diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-06-08 17:19:11 -0400 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-07-18 22:38:20 -0400 |
commit | cefee262b7059d035667b148d56ebc7af5120d37 (patch) | |
tree | bb2feca588ba2555b2559fdada273934335ae31b /js/src/wasm | |
parent | d074844a4e758209dcfd8ce12720680edd957b42 (diff) | |
download | UXP-cefee262b7059d035667b148d56ebc7af5120d37.tar UXP-cefee262b7059d035667b148d56ebc7af5120d37.tar.gz UXP-cefee262b7059d035667b148d56ebc7af5120d37.tar.lz UXP-cefee262b7059d035667b148d56ebc7af5120d37.tar.xz UXP-cefee262b7059d035667b148d56ebc7af5120d37.zip |
1333143 - Self-host Object.prototype.valueOf.
Diffstat (limited to 'js/src/wasm')
-rw-r--r-- | js/src/wasm/AsmJS.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/js/src/wasm/AsmJS.cpp b/js/src/wasm/AsmJS.cpp index f906d4bf1..81795b47d 100644 --- a/js/src/wasm/AsmJS.cpp +++ b/js/src/wasm/AsmJS.cpp @@ -34,6 +34,7 @@ #include "frontend/Parser.h" #include "gc/Policy.h" #include "js/MemoryMetrics.h" +#include "vm/SelfHosting.h" #include "vm/StringBuffer.h" #include "vm/Time.h" #include "vm/TypedArrayObject.h" @@ -7465,6 +7466,20 @@ GetDataProperty(JSContext* cx, HandleValue objVal, ImmutablePropertyNamePtr fiel } static bool +HasObjectValueOfMethodPure(JSObject* obj, JSContext* cx) +{ + Value v; + if (!GetPropertyPure(cx, obj, NameToId(cx->names().valueOf), &v)) + return false; + + JSFunction* fun; + if (!IsFunctionObject(v, &fun)) + return false; + + return IsSelfHostedFunctionWithName(fun, cx->names().Object_valueOf); +} + +static bool HasPureCoercion(JSContext* cx, HandleValue v) { // Unsigned SIMD types are not allowed in function signatures. @@ -7480,7 +7495,7 @@ HasPureCoercion(JSContext* cx, HandleValue v) // most apps have been built with newer Emscripten. if (v.toObject().is<JSFunction>() && HasNoToPrimitiveMethodPure(&v.toObject(), cx) && - HasNativeMethodPure(&v.toObject(), cx->names().valueOf, obj_valueOf, cx) && + HasObjectValueOfMethodPure(&v.toObject(), cx) && HasNativeMethodPure(&v.toObject(), cx->names().toString, fun_toString, cx)) { return true; |