Title: [287058] trunk/Source/_javascript_Core
Revision
287058
Author
[email protected]
Date
2021-12-14 17:23:39 -0800 (Tue, 14 Dec 2021)

Log Message

[JSC] OpInstanceofCustom should be in CommonSlowPaths
https://bugs.webkit.org/show_bug.cgi?id=234316

Reviewed by Alexey Shvayka.

No tier has a fast path for OpInstanceofCustom and this is unlikely to change anytime soon.
As such, we should not be having LLInt and Baseline implement *separate* slow paths for this operation;
this patch straightforwardly makes use of CommonSlowPaths instead.

* jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):
* jit/JIT.h:
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_instanceof_custom): Deleted.
(JSC::JIT::emitSlow_op_instanceof_custom): Deleted.
* llint/LLIntSlowPaths.cpp:
* llint/LLIntSlowPaths.h:
* llint/LowLevelInterpreter.asm:
* runtime/CommonSlowPaths.cpp:
(JSC::JSC_DEFINE_COMMON_SLOW_PATH):
* runtime/CommonSlowPaths.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (287057 => 287058)


--- trunk/Source/_javascript_Core/ChangeLog	2021-12-15 00:46:45 UTC (rev 287057)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-12-15 01:23:39 UTC (rev 287058)
@@ -1,3 +1,28 @@
+2021-12-14  Ross Kirsling  <[email protected]>
+
+        [JSC] OpInstanceofCustom should be in CommonSlowPaths
+        https://bugs.webkit.org/show_bug.cgi?id=234316
+
+        Reviewed by Alexey Shvayka.
+
+        No tier has a fast path for OpInstanceofCustom and this is unlikely to change anytime soon.
+        As such, we should not be having LLInt and Baseline implement *separate* slow paths for this operation;
+        this patch straightforwardly makes use of CommonSlowPaths instead.
+
+        * jit/JIT.cpp:
+        (JSC::JIT::privateCompileMainPass):
+        (JSC::JIT::privateCompileSlowCases):
+        * jit/JIT.h:
+        * jit/JITOpcodes.cpp:
+        (JSC::JIT::emit_op_instanceof_custom): Deleted.
+        (JSC::JIT::emitSlow_op_instanceof_custom): Deleted.
+        * llint/LLIntSlowPaths.cpp:
+        * llint/LLIntSlowPaths.h:
+        * llint/LowLevelInterpreter.asm:
+        * runtime/CommonSlowPaths.cpp:
+        (JSC::JSC_DEFINE_COMMON_SLOW_PATH):
+        * runtime/CommonSlowPaths.h:
+
 2021-12-14  Jean-Yves Avenard  <[email protected]>
 
         Rename SharedBuffer classes.

Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (287057 => 287058)


--- trunk/Source/_javascript_Core/jit/JIT.cpp	2021-12-15 00:46:45 UTC (rev 287057)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp	2021-12-15 01:23:39 UTC (rev 287058)
@@ -313,6 +313,7 @@
         DEFINE_SLOW_OP(lesseq)
         DEFINE_SLOW_OP(greater)
         DEFINE_SLOW_OP(greatereq)
+        DEFINE_SLOW_OP(instanceof_custom)
         DEFINE_SLOW_OP(is_callable)
         DEFINE_SLOW_OP(is_constructor)
         DEFINE_SLOW_OP(typeof)
@@ -396,7 +397,6 @@
         DEFINE_OP(op_get_prototype_of)
         DEFINE_OP(op_overrides_has_instance)
         DEFINE_OP(op_instanceof)
-        DEFINE_OP(op_instanceof_custom)
         DEFINE_OP(op_is_empty)
         DEFINE_OP(op_typeof_is_undefined)
         DEFINE_OP(op_is_undefined_or_null)
@@ -601,7 +601,6 @@
         DEFINE_SLOWCASE_OP(op_set_private_brand)
         DEFINE_SLOWCASE_OP(op_check_private_brand)
         DEFINE_SLOWCASE_OP(op_instanceof)
-        DEFINE_SLOWCASE_OP(op_instanceof_custom)
         DEFINE_SLOWCASE_OP(op_jless)
         DEFINE_SLOWCASE_OP(op_jlesseq)
         DEFINE_SLOWCASE_OP(op_jgreater)

Modified: trunk/Source/_javascript_Core/jit/JIT.h (287057 => 287058)


--- trunk/Source/_javascript_Core/jit/JIT.h	2021-12-15 00:46:45 UTC (rev 287057)
+++ trunk/Source/_javascript_Core/jit/JIT.h	2021-12-15 01:23:39 UTC (rev 287058)
@@ -443,7 +443,6 @@
         void emit_op_init_lazy_reg(const Instruction*);
         void emit_op_overrides_has_instance(const Instruction*);
         void emit_op_instanceof(const Instruction*);
-        void emit_op_instanceof_custom(const Instruction*);
         void emit_op_is_empty(const Instruction*);
         void emit_op_typeof_is_undefined(const Instruction*);
         void emit_op_is_undefined_or_null(const Instruction*);
@@ -582,7 +581,6 @@
         void emitSlow_op_has_private_name(const Instruction*, Vector<SlowCaseEntry>::iterator&);
         void emitSlow_op_has_private_brand(const Instruction*, Vector<SlowCaseEntry>::iterator&);
         void emitSlow_op_instanceof(const Instruction*, Vector<SlowCaseEntry>::iterator&);
-        void emitSlow_op_instanceof_custom(const Instruction*, Vector<SlowCaseEntry>::iterator&);
         void emitSlow_op_jless(const Instruction*, Vector<SlowCaseEntry>::iterator&);
         void emitSlow_op_jlesseq(const Instruction*, Vector<SlowCaseEntry>::iterator&);
         void emitSlow_op_jgreater(const Instruction*, Vector<SlowCaseEntry>::iterator&);

Modified: trunk/Source/_javascript_Core/jit/JITOpcodes.cpp (287057 => 287058)


--- trunk/Source/_javascript_Core/jit/JITOpcodes.cpp	2021-12-15 00:46:45 UTC (rev 287057)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes.cpp	2021-12-15 01:23:39 UTC (rev 287058)
@@ -1486,39 +1486,6 @@
 
 #endif // USE(JSVALUE64)
 
-void JIT::emit_op_instanceof_custom(const Instruction*)
-{
-    // This always goes to slow path since we expect it to be rare.
-    addSlowCase(jump());
-}
-
-void JIT::emitSlow_op_instanceof_custom(const Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
-{
-    linkAllSlowCases(iter);
-
-    auto bytecode = currentInstruction->as<OpInstanceofCustom>();
-    VirtualRegister dst = bytecode.m_dst;
-    VirtualRegister value = bytecode.m_value;
-    VirtualRegister constructor = bytecode.m_constructor;
-    VirtualRegister hasInstanceValue = bytecode.m_hasInstanceValue;
-
-    using SlowOperation = decltype(operationInstanceOfCustom);
-    constexpr GPRReg globalObjectGPR = preferredArgumentGPR<SlowOperation, 0>();
-    constexpr JSValueRegs valueJSR = preferredArgumentJSR<SlowOperation, 1>();
-    constexpr GPRReg constructorGPR = preferredArgumentGPR<SlowOperation, 2>();
-    constexpr JSValueRegs hasInstanceValueJSR = preferredArgumentJSR<SlowOperation, 3>();
-
-    emitGetVirtualRegister(value, valueJSR);
-    emitGetVirtualRegisterPayload(constructor, constructorGPR);
-    emitGetVirtualRegister(hasInstanceValue, hasInstanceValueJSR);
-    loadGlobalObject(globalObjectGPR);
-    callOperation(
-        operationInstanceOfCustom,
-        globalObjectGPR, valueJSR, constructorGPR, hasInstanceValueJSR);
-    boxBoolean(returnValueGPR, returnValueJSR);
-    emitPutVirtualRegister(dst, returnValueJSR);
-}
-
 void JIT::emit_op_debug(const Instruction* currentInstruction)
 {
     auto bytecode = currentInstruction->as<OpDebug>();

Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (287057 => 287058)


--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2021-12-15 00:46:45 UTC (rev 287057)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2021-12-15 01:23:39 UTC (rev 287058)
@@ -637,22 +637,6 @@
     LLINT_RETURN(jsBoolean(JSObject::defaultHasInstance(globalObject, value, proto)));
 }
 
-LLINT_SLOW_PATH_DECL(slow_path_instanceof_custom)
-{
-    LLINT_BEGIN();
-
-    auto bytecode = pc->as<OpInstanceofCustom>();
-    JSValue value = getOperand(callFrame, bytecode.m_value);
-    JSValue constructor = getOperand(callFrame, bytecode.m_constructor);
-    JSValue hasInstanceValue = getOperand(callFrame, bytecode.m_hasInstanceValue);
-
-    ASSERT(constructor.isObject());
-    ASSERT(hasInstanceValue != globalObject->functionProtoHasInstanceSymbolFunction() || !constructor.getObject()->structure(vm)->typeInfo().implementsDefaultHasInstance());
-
-    JSValue result = jsBoolean(constructor.getObject()->hasInstance(globalObject, value, hasInstanceValue));
-    LLINT_RETURN(result);
-}
-
 LLINT_SLOW_PATH_DECL(slow_path_try_get_by_id)
 {
     LLINT_BEGIN();

Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.h (287057 => 287058)


--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.h	2021-12-15 00:46:45 UTC (rev 287057)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.h	2021-12-15 01:23:39 UTC (rev 287058)
@@ -67,7 +67,6 @@
 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_array_with_size);
 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_regexp);
 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_instanceof);
-LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_instanceof_custom);
 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_try_get_by_id);
 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_get_by_id_direct);
 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_get_by_id);

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm (287057 => 287058)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2021-12-15 00:46:45 UTC (rev 287057)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2021-12-15 01:23:39 UTC (rev 287058)
@@ -2130,6 +2130,7 @@
     slowPathOp(get_prototype_of)
 end
 
+slowPathOp(instanceof_custom)
 slowPathOp(is_callable)
 slowPathOp(is_constructor)
 slowPathOp(new_array_buffer)
@@ -2163,7 +2164,6 @@
 llintSlowPathOp(del_by_id)
 llintSlowPathOp(del_by_val)
 llintSlowPathOp(instanceof)
-llintSlowPathOp(instanceof_custom)
 llintSlowPathOp(new_array)
 llintSlowPathOp(new_array_with_size)
 llintSlowPathOp(new_async_func)

Modified: trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp (287057 => 287058)


--- trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp	2021-12-15 00:46:45 UTC (rev 287057)
+++ trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp	2021-12-15 01:23:39 UTC (rev 287058)
@@ -816,6 +816,21 @@
     RETURN(jsBoolean(jsTypeofIsFunction(globalObject, GET_C(bytecode.m_operand).jsValue())));
 }
 
+JSC_DEFINE_COMMON_SLOW_PATH(slow_path_instanceof_custom)
+{
+    BEGIN();
+
+    auto bytecode = pc->as<OpInstanceofCustom>();
+    auto value = GET_C(bytecode.m_value).jsValue();
+    auto constructor = GET_C(bytecode.m_constructor).jsValue();
+    auto hasInstanceValue = GET_C(bytecode.m_hasInstanceValue).jsValue();
+
+    ASSERT(constructor.isObject());
+    ASSERT(hasInstanceValue != globalObject->functionProtoHasInstanceSymbolFunction() || !constructor.getObject()->structure(vm)->typeInfo().implementsDefaultHasInstance());
+
+    RETURN(jsBoolean(constructor.getObject()->hasInstance(globalObject, value, hasInstanceValue)));
+}
+
 JSC_DEFINE_COMMON_SLOW_PATH(slow_path_is_callable)
 {
     BEGIN();

Modified: trunk/Source/_javascript_Core/runtime/CommonSlowPaths.h (287057 => 287058)


--- trunk/Source/_javascript_Core/runtime/CommonSlowPaths.h	2021-12-15 00:46:45 UTC (rev 287057)
+++ trunk/Source/_javascript_Core/runtime/CommonSlowPaths.h	2021-12-15 01:23:39 UTC (rev 287058)
@@ -300,6 +300,7 @@
 JSC_DECLARE_COMMON_SLOW_PATH(slow_path_typeof);
 JSC_DECLARE_COMMON_SLOW_PATH(slow_path_typeof_is_object);
 JSC_DECLARE_COMMON_SLOW_PATH(slow_path_typeof_is_function);
+JSC_DECLARE_COMMON_SLOW_PATH(slow_path_instanceof_custom);
 JSC_DECLARE_COMMON_SLOW_PATH(slow_path_is_callable);
 JSC_DECLARE_COMMON_SLOW_PATH(slow_path_is_constructor);
 JSC_DECLARE_COMMON_SLOW_PATH(slow_path_strcat);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to