Changeset 277902 in webkit


Ignore:
Timestamp:
May 21, 2021, 5:46:03 PM (4 years ago)
Author:
mark.lam@apple.com
Message:

Remove the unnecessary use of CompileOpStrictEqType.
https://bugs.webkit.org/show_bug.cgi?id=226121

Reviewed by Saam Barati and Robin Morisset.

We're already emitting template code. Might as well make the relevant condition
checks a build time check on the opcode type the template is specializing on
instead of a runtime check on a passed in CompileOpStrictEqType.

  • jit/JIT.h:
  • jit/JITOpcodes.cpp:

(JSC::JIT::compileOpStrictEq):
(JSC::JIT::emit_op_stricteq):
(JSC::JIT::emit_op_nstricteq):
(JSC::JIT::compileOpStrictEqJump):
(JSC::JIT::emit_op_jstricteq):
(JSC::JIT::emit_op_jnstricteq):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::compileOpStrictEq):
(JSC::JIT::emit_op_stricteq):
(JSC::JIT::emit_op_nstricteq):
(JSC::JIT::compileOpStrictEqJump):
(JSC::JIT::emit_op_jstricteq):
(JSC::JIT::emit_op_jnstricteq):

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r277882 r277902  
     12021-05-21  Mark Lam  <mark.lam@apple.com>
     2
     3        Remove the unnecessary use of CompileOpStrictEqType.
     4        https://bugs.webkit.org/show_bug.cgi?id=226121
     5
     6        Reviewed by Saam Barati and Robin Morisset.
     7
     8        We're already emitting template code.  Might as well make the relevant condition
     9        checks a build time check on the opcode type the template is specializing on
     10        instead of a runtime check on a passed in CompileOpStrictEqType.
     11
     12        * jit/JIT.h:
     13        * jit/JITOpcodes.cpp:
     14        (JSC::JIT::compileOpStrictEq):
     15        (JSC::JIT::emit_op_stricteq):
     16        (JSC::JIT::emit_op_nstricteq):
     17        (JSC::JIT::compileOpStrictEqJump):
     18        (JSC::JIT::emit_op_jstricteq):
     19        (JSC::JIT::emit_op_jnstricteq):
     20        * jit/JITOpcodes32_64.cpp:
     21        (JSC::JIT::compileOpStrictEq):
     22        (JSC::JIT::emit_op_stricteq):
     23        (JSC::JIT::emit_op_nstricteq):
     24        (JSC::JIT::compileOpStrictEqJump):
     25        (JSC::JIT::emit_op_jstricteq):
     26        (JSC::JIT::emit_op_jnstricteq):
     27
    1282021-05-21  Mark Lam  <mark.lam@apple.com>
    229
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r277850 r277902  
    354354        void emitPutCallResult(const Op&);
    355355
    356         enum class CompileOpStrictEqType { StrictEq, NStrictEq };
    357         template<typename Op>
    358         void compileOpStrictEq(const Instruction*, CompileOpStrictEqType);
    359         template<typename Op>
    360         void compileOpStrictEqJump(const Instruction*, CompileOpStrictEqType);
     356        template<typename Op> void compileOpStrictEq(const Instruction*);
     357        template<typename Op> void compileOpStrictEqJump(const Instruction*);
    361358        enum class CompileOpEqType { Eq, NEq };
    362359        void compileOpEqJumpSlow(Vector<SlowCaseEntry>::iterator&, CompileOpEqType, int jumpTarget);
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r277757 r277902  
    649649
    650650template<typename Op>
    651 void JIT::compileOpStrictEq(const Instruction* currentInstruction, CompileOpStrictEqType type)
     651void JIT::compileOpStrictEq(const Instruction* currentInstruction)
    652652{
    653653    auto bytecode = currentInstruction->as<Op>();
     
    694694
    695695    done.link(this);
    696     if (type == CompileOpStrictEqType::NStrictEq)
     696    if constexpr (std::is_same<Op, OpNstricteq>::value)
    697697        xor64(TrustedImm64(1), regT5);
    698698    boxBoolean(regT5, JSValueRegs { regT5 });
     
    713713    rightOK.link(this);
    714714
    715     if (type == CompileOpStrictEqType::StrictEq)
     715    if constexpr (std::is_same<Op, OpStricteq>::value)
    716716        compare64(Equal, regT1, regT0, regT0);
    717717    else
     
    725725void JIT::emit_op_stricteq(const Instruction* currentInstruction)
    726726{
    727     compileOpStrictEq<OpStricteq>(currentInstruction, CompileOpStrictEqType::StrictEq);
     727    compileOpStrictEq<OpStricteq>(currentInstruction);
    728728}
    729729
    730730void JIT::emit_op_nstricteq(const Instruction* currentInstruction)
    731731{
    732     compileOpStrictEq<OpNstricteq>(currentInstruction, CompileOpStrictEqType::NStrictEq);
     732    compileOpStrictEq<OpNstricteq>(currentInstruction);
    733733}
    734734
    735735template<typename Op>
    736 void JIT::compileOpStrictEqJump(const Instruction* currentInstruction, CompileOpStrictEqType type)
     736void JIT::compileOpStrictEqJump(const Instruction* currentInstruction)
    737737{
    738738    auto bytecode = currentInstruction->as<Op>();
     
    768768
    769769    Jump areEqual = branch64(Equal, regT0, regT1);
    770     if (type == CompileOpStrictEqType::StrictEq)
     770    if constexpr (std::is_same<Op, OpJstricteq>::value)
    771771        addJump(areEqual, target);
    772772
     
    777777    addSlowCase(branchIfCell(regT2));
    778778
    779     if (type == CompileOpStrictEqType::NStrictEq) {
     779    if constexpr (std::is_same<Op, OpJnstricteq>::value) {
    780780        addJump(jump(), target);
    781781        areEqual.link(this);
     
    795795    addSlowCase(branchIfNumber(regT1));
    796796    rightOK.link(this);
    797     if (type == CompileOpStrictEqType::StrictEq)
     797    if constexpr (std::is_same<Op, OpJstricteq>::value)
    798798        addJump(branch64(Equal, regT1, regT0), target);
    799799    else
     
    804804void JIT::emit_op_jstricteq(const Instruction* currentInstruction)
    805805{
    806     compileOpStrictEqJump<OpJstricteq>(currentInstruction, CompileOpStrictEqType::StrictEq);
     806    compileOpStrictEqJump<OpJstricteq>(currentInstruction);
    807807}
    808808
    809809void JIT::emit_op_jnstricteq(const Instruction* currentInstruction)
    810810{
    811     compileOpStrictEqJump<OpJnstricteq>(currentInstruction, CompileOpStrictEqType::NStrictEq);
     811    compileOpStrictEqJump<OpJnstricteq>(currentInstruction);
    812812}
    813813
  • trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp

    r277757 r277902  
    678678
    679679template <typename Op>
    680 void JIT::compileOpStrictEq(const Instruction* currentInstruction, CompileOpStrictEqType type)
     680void JIT::compileOpStrictEq(const Instruction* currentInstruction)
    681681{
    682682    auto bytecode = currentInstruction->as<Op>();
     
    699699
    700700    // Simply compare the payloads.
    701     if (type == CompileOpStrictEqType::StrictEq)
     701    if constexpr (std::is_same<Op, OpStricteq>::value)
    702702        compare32(Equal, regT0, regT2, regT0);
    703703    else
     
    709709void JIT::emit_op_stricteq(const Instruction* currentInstruction)
    710710{
    711     compileOpStrictEq<OpStricteq>(currentInstruction, CompileOpStrictEqType::StrictEq);
     711    compileOpStrictEq<OpStricteq>(currentInstruction);
    712712}
    713713
    714714void JIT::emit_op_nstricteq(const Instruction* currentInstruction)
    715715{
    716     compileOpStrictEq<OpNstricteq>(currentInstruction, CompileOpStrictEqType::NStrictEq);
     716    compileOpStrictEq<OpNstricteq>(currentInstruction);
    717717}
    718718
    719719template<typename Op>
    720 void JIT::compileOpStrictEqJump(const Instruction* currentInstruction, CompileOpStrictEqType type)
     720void JIT::compileOpStrictEqJump(const Instruction* currentInstruction)
    721721{
    722722    auto bytecode = currentInstruction->as<Op>();
     
    739739
    740740    // Simply compare the payloads.
    741     if (type == CompileOpStrictEqType::StrictEq)
     741    if constexpr (std::is_same<Op, OpJstricteq>::value)
    742742        addJump(branch32(Equal, regT0, regT2), target);
    743743    else
     
    747747void JIT::emit_op_jstricteq(const Instruction* currentInstruction)
    748748{
    749     compileOpStrictEqJump<OpJstricteq>(currentInstruction, CompileOpStrictEqType::StrictEq);
     749    compileOpStrictEqJump<OpJstricteq>(currentInstruction);
    750750}
    751751
    752752void JIT::emit_op_jnstricteq(const Instruction* currentInstruction)
    753753{
    754     compileOpStrictEqJump<OpJnstricteq>(currentInstruction, CompileOpStrictEqType::NStrictEq);
     754    compileOpStrictEqJump<OpJnstricteq>(currentInstruction);
    755755}
    756756
Note: See TracChangeset for help on using the changeset viewer.