⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 287058 in webkit


Ignore:
Timestamp:
Dec 14, 2021, 5:23:39 PM (5 years ago)
Author:
Ross Kirsling
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:
Location:
trunk/Source/JavaScriptCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r287021 r287058  
     12021-12-14  Ross Kirsling  <ross.kirsling@sony.com>
     2
     3        [JSC] OpInstanceofCustom should be in CommonSlowPaths
     4        https://bugs.webkit.org/show_bug.cgi?id=234316
     5
     6        Reviewed by Alexey Shvayka.
     7
     8        No tier has a fast path for OpInstanceofCustom and this is unlikely to change anytime soon.
     9        As such, we should not be having LLInt and Baseline implement *separate* slow paths for this operation;
     10        this patch straightforwardly makes use of CommonSlowPaths instead.
     11
     12        * jit/JIT.cpp:
     13        (JSC::JIT::privateCompileMainPass):
     14        (JSC::JIT::privateCompileSlowCases):
     15        * jit/JIT.h:
     16        * jit/JITOpcodes.cpp:
     17        (JSC::JIT::emit_op_instanceof_custom): Deleted.
     18        (JSC::JIT::emitSlow_op_instanceof_custom): Deleted.
     19        * llint/LLIntSlowPaths.cpp:
     20        * llint/LLIntSlowPaths.h:
     21        * llint/LowLevelInterpreter.asm:
     22        * runtime/CommonSlowPaths.cpp:
     23        (JSC::JSC_DEFINE_COMMON_SLOW_PATH):
     24        * runtime/CommonSlowPaths.h:
     25
    1262021-12-14  Jean-Yves Avenard  <jya@apple.com>
    227
  • trunk/Source/JavaScriptCore/jit/JIT.cpp

    r286424 r287058  
    314314        DEFINE_SLOW_OP(greater)
    315315        DEFINE_SLOW_OP(greatereq)
     316        DEFINE_SLOW_OP(instanceof_custom)
    316317        DEFINE_SLOW_OP(is_callable)
    317318        DEFINE_SLOW_OP(is_constructor)
     
    397398        DEFINE_OP(op_overrides_has_instance)
    398399        DEFINE_OP(op_instanceof)
    399         DEFINE_OP(op_instanceof_custom)
    400400        DEFINE_OP(op_is_empty)
    401401        DEFINE_OP(op_typeof_is_undefined)
     
    602602        DEFINE_SLOWCASE_OP(op_check_private_brand)
    603603        DEFINE_SLOWCASE_OP(op_instanceof)
    604         DEFINE_SLOWCASE_OP(op_instanceof_custom)
    605604        DEFINE_SLOWCASE_OP(op_jless)
    606605        DEFINE_SLOWCASE_OP(op_jlesseq)
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r286424 r287058  
    444444        void emit_op_overrides_has_instance(const Instruction*);
    445445        void emit_op_instanceof(const Instruction*);
    446         void emit_op_instanceof_custom(const Instruction*);
    447446        void emit_op_is_empty(const Instruction*);
    448447        void emit_op_typeof_is_undefined(const Instruction*);
     
    583582        void emitSlow_op_has_private_brand(const Instruction*, Vector<SlowCaseEntry>::iterator&);
    584583        void emitSlow_op_instanceof(const Instruction*, Vector<SlowCaseEntry>::iterator&);
    585         void emitSlow_op_instanceof_custom(const Instruction*, Vector<SlowCaseEntry>::iterator&);
    586584        void emitSlow_op_jless(const Instruction*, Vector<SlowCaseEntry>::iterator&);
    587585        void emitSlow_op_jlesseq(const Instruction*, Vector<SlowCaseEntry>::iterator&);
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r286994 r287058  
    14871487#endif // USE(JSVALUE64)
    14881488
    1489 void JIT::emit_op_instanceof_custom(const Instruction*)
    1490 {
    1491     // This always goes to slow path since we expect it to be rare.
    1492     addSlowCase(jump());
    1493 }
    1494 
    1495 void JIT::emitSlow_op_instanceof_custom(const Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
    1496 {
    1497     linkAllSlowCases(iter);
    1498 
    1499     auto bytecode = currentInstruction->as<OpInstanceofCustom>();
    1500     VirtualRegister dst = bytecode.m_dst;
    1501     VirtualRegister value = bytecode.m_value;
    1502     VirtualRegister constructor = bytecode.m_constructor;
    1503     VirtualRegister hasInstanceValue = bytecode.m_hasInstanceValue;
    1504 
    1505     using SlowOperation = decltype(operationInstanceOfCustom);
    1506     constexpr GPRReg globalObjectGPR = preferredArgumentGPR<SlowOperation, 0>();
    1507     constexpr JSValueRegs valueJSR = preferredArgumentJSR<SlowOperation, 1>();
    1508     constexpr GPRReg constructorGPR = preferredArgumentGPR<SlowOperation, 2>();
    1509     constexpr JSValueRegs hasInstanceValueJSR = preferredArgumentJSR<SlowOperation, 3>();
    1510 
    1511     emitGetVirtualRegister(value, valueJSR);
    1512     emitGetVirtualRegisterPayload(constructor, constructorGPR);
    1513     emitGetVirtualRegister(hasInstanceValue, hasInstanceValueJSR);
    1514     loadGlobalObject(globalObjectGPR);
    1515     callOperation(
    1516         operationInstanceOfCustom,
    1517         globalObjectGPR, valueJSR, constructorGPR, hasInstanceValueJSR);
    1518     boxBoolean(returnValueGPR, returnValueJSR);
    1519     emitPutVirtualRegister(dst, returnValueJSR);
    1520 }
    1521 
    15221489void JIT::emit_op_debug(const Instruction* currentInstruction)
    15231490{
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r286994 r287058  
    638638}
    639639
    640 LLINT_SLOW_PATH_DECL(slow_path_instanceof_custom)
    641 {
    642     LLINT_BEGIN();
    643 
    644     auto bytecode = pc->as<OpInstanceofCustom>();
    645     JSValue value = getOperand(callFrame, bytecode.m_value);
    646     JSValue constructor = getOperand(callFrame, bytecode.m_constructor);
    647     JSValue hasInstanceValue = getOperand(callFrame, bytecode.m_hasInstanceValue);
    648 
    649     ASSERT(constructor.isObject());
    650     ASSERT(hasInstanceValue != globalObject->functionProtoHasInstanceSymbolFunction() || !constructor.getObject()->structure(vm)->typeInfo().implementsDefaultHasInstance());
    651 
    652     JSValue result = jsBoolean(constructor.getObject()->hasInstance(globalObject, value, hasInstanceValue));
    653     LLINT_RETURN(result);
    654 }
    655 
    656640LLINT_SLOW_PATH_DECL(slow_path_try_get_by_id)
    657641{
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.h

    r286253 r287058  
    6868LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_regexp);
    6969LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_instanceof);
    70 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_instanceof_custom);
    7170LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_try_get_by_id);
    7271LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_get_by_id_direct);
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r286994 r287058  
    21312131end
    21322132
     2133slowPathOp(instanceof_custom)
    21332134slowPathOp(is_callable)
    21342135slowPathOp(is_constructor)
     
    21642165llintSlowPathOp(del_by_val)
    21652166llintSlowPathOp(instanceof)
    2166 llintSlowPathOp(instanceof_custom)
    21672167llintSlowPathOp(new_array)
    21682168llintSlowPathOp(new_array_with_size)
  • trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp

    r286994 r287058  
    817817}
    818818
     819JSC_DEFINE_COMMON_SLOW_PATH(slow_path_instanceof_custom)
     820{
     821    BEGIN();
     822
     823    auto bytecode = pc->as<OpInstanceofCustom>();
     824    auto value = GET_C(bytecode.m_value).jsValue();
     825    auto constructor = GET_C(bytecode.m_constructor).jsValue();
     826    auto hasInstanceValue = GET_C(bytecode.m_hasInstanceValue).jsValue();
     827
     828    ASSERT(constructor.isObject());
     829    ASSERT(hasInstanceValue != globalObject->functionProtoHasInstanceSymbolFunction() || !constructor.getObject()->structure(vm)->typeInfo().implementsDefaultHasInstance());
     830
     831    RETURN(jsBoolean(constructor.getObject()->hasInstance(globalObject, value, hasInstanceValue)));
     832}
     833
    819834JSC_DEFINE_COMMON_SLOW_PATH(slow_path_is_callable)
    820835{
  • trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.h

    r286251 r287058  
    301301JSC_DECLARE_COMMON_SLOW_PATH(slow_path_typeof_is_object);
    302302JSC_DECLARE_COMMON_SLOW_PATH(slow_path_typeof_is_function);
     303JSC_DECLARE_COMMON_SLOW_PATH(slow_path_instanceof_custom);
    303304JSC_DECLARE_COMMON_SLOW_PATH(slow_path_is_callable);
    304305JSC_DECLARE_COMMON_SLOW_PATH(slow_path_is_constructor);
Note: See TracChangeset for help on using the changeset viewer.