Bug 1437842: [Part 11] Convert IsSetObject to GuardToSetObject r=jandem
authorMatthew Gaudet <mgaudet@mozilla.com>
Mon, 23 Apr 2018 15:18:17 -0400
changeset 415829 c49e30fa8764f8f72fc81e8c24be376a6e1c2ac3
parent 415828 7b62cd702024bca4eede031d9849a300babc4d75
child 415830 4e618d287d8165ce6e0507d3560474d475d105ed
push id33910
push usershindli@mozilla.com
push dateThu, 26 Apr 2018 21:39:52 +0000
treeherdermozilla-central@63a0e2f626fe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1437842
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1437842: [Part 11] Convert IsSetObject to GuardToSetObject r=jandem
js/src/builtin/Set.js
js/src/jit/InlinableNatives.h
js/src/jit/MCallOptimize.cpp
js/src/vm/SelfHosting.cpp
--- a/js/src/builtin/Set.js
+++ b/js/src/builtin/Set.js
@@ -21,18 +21,18 @@ function SetConstructorInit(iterable) {
 
 // ES2018 draft rev f83aa38282c2a60c6916ebc410bfdf105a0f6a54
 // 23.2.3.6 Set.prototype.forEach ( callbackfn [ , thisArg ] )
 function SetForEach(callbackfn, thisArg = undefined) {
     // Step 1.
     var S = this;
 
     // Steps 2-3.
-    if (!IsObject(S) || !IsSetObject(S))
-        return callFunction(CallSetMethodIfWrapped, S, callbackfn, thisArg, "SetForEach");
+    if (!IsObject(S) || (S = GuardToSetObject(S)) === null)
+        return callFunction(CallSetMethodIfWrapped, this, callbackfn, thisArg, "SetForEach");
 
     // Step 4.
     if (!IsCallable(callbackfn))
         ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
 
     // Steps 5-8.
     var values = callFunction(std_Set_iterator, S);
 
--- a/js/src/jit/InlinableNatives.h
+++ b/js/src/jit/InlinableNatives.h
@@ -135,17 +135,17 @@
     _(IntrinsicGuardToArrayIterator) \
     _(IntrinsicGuardToMapIterator)  \
     _(IntrinsicGuardToSetIterator)  \
     _(IntrinsicGuardToStringIterator) \
                                     \
     _(IntrinsicGuardToMapObject)    \
     _(IntrinsicGetNextMapEntryForIterator) \
                                     \
-    _(IntrinsicIsSetObject)         \
+    _(IntrinsicGuardToSetObject)    \
     _(IntrinsicGetNextSetEntryForIterator) \
                                     \
     _(IntrinsicNewArrayIterator)    \
     _(IntrinsicNewStringIterator)   \
                                     \
     _(IntrinsicIsArrayBuffer)       \
     _(IntrinsicArrayBufferByteLength) \
     _(IntrinsicPossiblyWrappedArrayBufferByteLength) \
--- a/js/src/jit/MCallOptimize.cpp
+++ b/js/src/jit/MCallOptimize.cpp
@@ -336,18 +336,18 @@ IonBuilder::inlineNativeCall(CallInfo& c
 
       // Map intrinsics.
       case InlinableNative::IntrinsicGuardToMapObject:
         return inlineGuardToClass(callInfo, &MapObject::class_);
       case InlinableNative::IntrinsicGetNextMapEntryForIterator:
         return inlineGetNextEntryForIterator(callInfo, MGetNextEntryForIterator::Map);
 
       // Set intrinsics.
-      case InlinableNative::IntrinsicIsSetObject:
-        return inlineHasClass(callInfo, &SetObject::class_);
+      case InlinableNative::IntrinsicGuardToSetObject:
+        return inlineGuardToClass(callInfo, &SetObject::class_);
       case InlinableNative::IntrinsicGetNextSetEntryForIterator:
         return inlineGetNextEntryForIterator(callInfo, MGetNextEntryForIterator::Set);
 
       // ArrayBuffer intrinsics.
       case InlinableNative::IntrinsicIsArrayBuffer:
         return inlineHasClass(callInfo, &ArrayBufferObject::class_);
       case InlinableNative::IntrinsicArrayBufferByteLength:
         return inlineArrayBufferByteLength(callInfo);
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -2482,18 +2482,18 @@ static const JSFunctionSpec intrinsic_fu
 
     JS_FN("CallGeneratorMethodIfWrapped",
           CallNonGenericSelfhostedMethod<Is<GeneratorObject>>, 2, 0),
 
     JS_INLINABLE_FN("GuardToMapObject", intrinsic_GuardToBuiltin<MapObject>, 1, 0,
                     IntrinsicGuardToMapObject),
     JS_FN("CallMapMethodIfWrapped", CallNonGenericSelfhostedMethod<Is<MapObject>>, 2, 0),
 
-    JS_INLINABLE_FN("IsSetObject", intrinsic_IsInstanceOfBuiltin<SetObject>, 1, 0,
-                    IntrinsicIsSetObject),
+    JS_INLINABLE_FN("GuardToSetObject", intrinsic_GuardToBuiltin<SetObject>, 1, 0,
+                    IntrinsicGuardToSetObject),
     JS_FN("CallSetMethodIfWrapped", CallNonGenericSelfhostedMethod<Is<SetObject>>, 2, 0),
 
     // See builtin/TypedObject.h for descriptors of the typedobj functions.
     JS_FN("NewOpaqueTypedObject",           js::NewOpaqueTypedObject, 1, 0),
     JS_FN("NewDerivedTypedObject",          js::NewDerivedTypedObject, 3, 0),
     JS_FN("TypedObjectBuffer",              TypedObject::GetBuffer, 1, 0),
     JS_FN("TypedObjectByteOffset",          TypedObject::GetByteOffset, 1, 0),
     JS_FN("AttachTypedObject",              js::AttachTypedObject, 3, 0),