Changeset 277902 in webkit
- Timestamp:
- May 21, 2021, 5:46:03 PM (4 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r277882 r277902 1 2021-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 1 28 2021-05-21 Mark Lam <mark.lam@apple.com> 2 29 -
trunk/Source/JavaScriptCore/jit/JIT.h
r277850 r277902 354 354 void emitPutCallResult(const Op&); 355 355 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*); 361 358 enum class CompileOpEqType { Eq, NEq }; 362 359 void compileOpEqJumpSlow(Vector<SlowCaseEntry>::iterator&, CompileOpEqType, int jumpTarget); -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r277757 r277902 649 649 650 650 template<typename Op> 651 void JIT::compileOpStrictEq(const Instruction* currentInstruction , CompileOpStrictEqType type)651 void JIT::compileOpStrictEq(const Instruction* currentInstruction) 652 652 { 653 653 auto bytecode = currentInstruction->as<Op>(); … … 694 694 695 695 done.link(this); 696 if (type == CompileOpStrictEqType::NStrictEq)696 if constexpr (std::is_same<Op, OpNstricteq>::value) 697 697 xor64(TrustedImm64(1), regT5); 698 698 boxBoolean(regT5, JSValueRegs { regT5 }); … … 713 713 rightOK.link(this); 714 714 715 if (type == CompileOpStrictEqType::StrictEq)715 if constexpr (std::is_same<Op, OpStricteq>::value) 716 716 compare64(Equal, regT1, regT0, regT0); 717 717 else … … 725 725 void JIT::emit_op_stricteq(const Instruction* currentInstruction) 726 726 { 727 compileOpStrictEq<OpStricteq>(currentInstruction , CompileOpStrictEqType::StrictEq);727 compileOpStrictEq<OpStricteq>(currentInstruction); 728 728 } 729 729 730 730 void JIT::emit_op_nstricteq(const Instruction* currentInstruction) 731 731 { 732 compileOpStrictEq<OpNstricteq>(currentInstruction , CompileOpStrictEqType::NStrictEq);732 compileOpStrictEq<OpNstricteq>(currentInstruction); 733 733 } 734 734 735 735 template<typename Op> 736 void JIT::compileOpStrictEqJump(const Instruction* currentInstruction , CompileOpStrictEqType type)736 void JIT::compileOpStrictEqJump(const Instruction* currentInstruction) 737 737 { 738 738 auto bytecode = currentInstruction->as<Op>(); … … 768 768 769 769 Jump areEqual = branch64(Equal, regT0, regT1); 770 if (type == CompileOpStrictEqType::StrictEq)770 if constexpr (std::is_same<Op, OpJstricteq>::value) 771 771 addJump(areEqual, target); 772 772 … … 777 777 addSlowCase(branchIfCell(regT2)); 778 778 779 if (type == CompileOpStrictEqType::NStrictEq) {779 if constexpr (std::is_same<Op, OpJnstricteq>::value) { 780 780 addJump(jump(), target); 781 781 areEqual.link(this); … … 795 795 addSlowCase(branchIfNumber(regT1)); 796 796 rightOK.link(this); 797 if (type == CompileOpStrictEqType::StrictEq)797 if constexpr (std::is_same<Op, OpJstricteq>::value) 798 798 addJump(branch64(Equal, regT1, regT0), target); 799 799 else … … 804 804 void JIT::emit_op_jstricteq(const Instruction* currentInstruction) 805 805 { 806 compileOpStrictEqJump<OpJstricteq>(currentInstruction , CompileOpStrictEqType::StrictEq);806 compileOpStrictEqJump<OpJstricteq>(currentInstruction); 807 807 } 808 808 809 809 void JIT::emit_op_jnstricteq(const Instruction* currentInstruction) 810 810 { 811 compileOpStrictEqJump<OpJnstricteq>(currentInstruction , CompileOpStrictEqType::NStrictEq);811 compileOpStrictEqJump<OpJnstricteq>(currentInstruction); 812 812 } 813 813 -
trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
r277757 r277902 678 678 679 679 template <typename Op> 680 void JIT::compileOpStrictEq(const Instruction* currentInstruction , CompileOpStrictEqType type)680 void JIT::compileOpStrictEq(const Instruction* currentInstruction) 681 681 { 682 682 auto bytecode = currentInstruction->as<Op>(); … … 699 699 700 700 // Simply compare the payloads. 701 if (type == CompileOpStrictEqType::StrictEq)701 if constexpr (std::is_same<Op, OpStricteq>::value) 702 702 compare32(Equal, regT0, regT2, regT0); 703 703 else … … 709 709 void JIT::emit_op_stricteq(const Instruction* currentInstruction) 710 710 { 711 compileOpStrictEq<OpStricteq>(currentInstruction , CompileOpStrictEqType::StrictEq);711 compileOpStrictEq<OpStricteq>(currentInstruction); 712 712 } 713 713 714 714 void JIT::emit_op_nstricteq(const Instruction* currentInstruction) 715 715 { 716 compileOpStrictEq<OpNstricteq>(currentInstruction , CompileOpStrictEqType::NStrictEq);716 compileOpStrictEq<OpNstricteq>(currentInstruction); 717 717 } 718 718 719 719 template<typename Op> 720 void JIT::compileOpStrictEqJump(const Instruction* currentInstruction , CompileOpStrictEqType type)720 void JIT::compileOpStrictEqJump(const Instruction* currentInstruction) 721 721 { 722 722 auto bytecode = currentInstruction->as<Op>(); … … 739 739 740 740 // Simply compare the payloads. 741 if (type == CompileOpStrictEqType::StrictEq)741 if constexpr (std::is_same<Op, OpJstricteq>::value) 742 742 addJump(branch32(Equal, regT0, regT2), target); 743 743 else … … 747 747 void JIT::emit_op_jstricteq(const Instruction* currentInstruction) 748 748 { 749 compileOpStrictEqJump<OpJstricteq>(currentInstruction , CompileOpStrictEqType::StrictEq);749 compileOpStrictEqJump<OpJstricteq>(currentInstruction); 750 750 } 751 751 752 752 void JIT::emit_op_jnstricteq(const Instruction* currentInstruction) 753 753 { 754 compileOpStrictEqJump<OpJnstricteq>(currentInstruction , CompileOpStrictEqType::NStrictEq);754 compileOpStrictEqJump<OpJnstricteq>(currentInstruction); 755 755 } 756 756
Note:
See TracChangeset
for help on using the changeset viewer.