summaryrefslogtreecommitdiffstats
path: root/js/src/wasm/AsmJS.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/wasm/AsmJS.cpp')
-rw-r--r--js/src/wasm/AsmJS.cpp17
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;