Changeset 194363 in webkit


Ignore:
Timestamp:
Dec 22, 2015 8:20:48 AM (8 years ago)
Author:
mark.lam@apple.com
Message:

Snippefy op_negate for the baseline JIT.
https://bugs.webkit.org/show_bug.cgi?id=152447

Reviewed by Benjamin Poulain.

(JSC::JIT::emit_op_unsigned):
(JSC::JIT::emit_op_negate):
(JSC::JIT::emitSlow_op_negate):
(JSC::JIT::emitBitBinaryOpFastPath):

  • jit/JITArithmetic32_64.cpp:

(JSC::JIT::emit_compareAndJump):
(JSC::JIT::emit_op_negate): Deleted.
(JSC::JIT::emitSlow_op_negate): Deleted.

  • jit/JITNegGenerator.cpp: Added.

(JSC::JITNegGenerator::generateFastPath):

  • jit/JITNegGenerator.h: Added.

(JSC::JITNegGenerator::JITNegGenerator):
(JSC::JITNegGenerator::didEmitFastPath):
(JSC::JITNegGenerator::endJumpList):
(JSC::JITNegGenerator::slowPathJumpList):

Location:
trunk/Source/JavaScriptCore
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r194332 r194363  
    474474    jit/JITLeftShiftGenerator.cpp
    475475    jit/JITMulGenerator.cpp
     476    jit/JITNegGenerator.cpp
    476477    jit/JITOpcodes.cpp
    477478    jit/JITOpcodes32_64.cpp
  • trunk/Source/JavaScriptCore/ChangeLog

    r194355 r194363  
     12015-12-21  Mark Lam  <mark.lam@apple.com>
     2
     3        Snippefy op_negate for the baseline JIT.
     4        https://bugs.webkit.org/show_bug.cgi?id=152447
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        * CMakeLists.txt:
     9        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
     10        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
     11        * JavaScriptCore.xcodeproj/project.pbxproj:
     12        * jit/JITArithmetic.cpp:
     13        (JSC::JIT::emit_op_unsigned):
     14        (JSC::JIT::emit_op_negate):
     15        (JSC::JIT::emitSlow_op_negate):
     16        (JSC::JIT::emitBitBinaryOpFastPath):
     17        * jit/JITArithmetic32_64.cpp:
     18        (JSC::JIT::emit_compareAndJump):
     19        (JSC::JIT::emit_op_negate): Deleted.
     20        (JSC::JIT::emitSlow_op_negate): Deleted.
     21        * jit/JITNegGenerator.cpp: Added.
     22        (JSC::JITNegGenerator::generateFastPath):
     23        * jit/JITNegGenerator.h: Added.
     24        (JSC::JITNegGenerator::JITNegGenerator):
     25        (JSC::JITNegGenerator::didEmitFastPath):
     26        (JSC::JITNegGenerator::endJumpList):
     27        (JSC::JITNegGenerator::slowPathJumpList):
     28
    1292015-12-21  Filip Pizlo  <fpizlo@apple.com>
    230
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj

    r194294 r194363  
    658658    <ClCompile Include="..\jit\JITLeftShiftGenerator.cpp" />
    659659    <ClCompile Include="..\jit\JITMulGenerator.cpp" />
     660    <ClCompile Include="..\jit\JITNegGenerator.cpp" />
    660661    <ClCompile Include="..\jit\JITOpcodes.cpp" />
    661662    <ClCompile Include="..\jit\JITOpcodes32_64.cpp" />
     
    14911492    <ClInclude Include="..\jit\JITLeftShiftGenerator.h" />
    14921493    <ClInclude Include="..\jit\JITMulGenerator.h" />
     1494    <ClInclude Include="..\jit\JITNegGenerator.h" />
    14931495    <ClInclude Include="..\jit\JITOperations.h" />
    14941496    <ClInclude Include="..\jit\JITRightShiftGenerator.h" />
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters

    r194294 r194363  
    463463      <Filter>jit</Filter>
    464464    </ClCompile>
     465    <ClCompile Include="..\jit\JITNegGenerator.cpp">
     466      <Filter>jit</Filter>
     467    </ClCompile>
    465468    <ClCompile Include="..\jit\JITOpcodes.cpp">
    466469      <Filter>jit</Filter>
     
    25812584    </ClInclude>
    25822585    <ClInclude Include="..\jit\JITMulGenerator.h">
     2586      <Filter>jit</Filter>
     2587    </ClInclude>
     2588    <ClInclude Include="..\jit\JITNegGenerator.h">
    25832589      <Filter>jit</Filter>
    25842590    </ClInclude>
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r194332 r194363  
    20552055                FE7BA6101A1A7CEC00F1F7B4 /* HeapVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = FE7BA60E1A1A7CEC00F1F7B4 /* HeapVerifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
    20562056                FE7C41961B97FC4B00F4D598 /* PingPongStackOverflowTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDA50D41B97F442009A3B4F /* PingPongStackOverflowTest.cpp */; };
     2057                FE99B2491C24C3D300C82159 /* JITNegGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FE99B2481C24B6D300C82159 /* JITNegGenerator.h */; settings = {ASSET_TAGS = (); }; };
     2058                FE99B24A1C24C3D700C82159 /* JITNegGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE99B2471C24B6D300C82159 /* JITNegGenerator.cpp */; settings = {ASSET_TAGS = (); }; };
    20572059                FEA08620182B7A0400F6D851 /* Breakpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FEA0861E182B7A0400F6D851 /* Breakpoint.h */; settings = {ATTRIBUTES = (Private, ); }; };
    20582060                FEA08621182B7A0400F6D851 /* DebuggerPrimitives.h in Headers */ = {isa = PBXBuildFile; fileRef = FEA0861F182B7A0400F6D851 /* DebuggerPrimitives.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    42624264                FE90BB3A1B7CF64E006B3F03 /* VMInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMInlines.h; sourceTree = "<group>"; };
    42634265                FE98B5B61BB9AE110073E7A6 /* JITSubGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITSubGenerator.h; sourceTree = "<group>"; };
     4266                FE99B2471C24B6D300C82159 /* JITNegGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITNegGenerator.cpp; sourceTree = "<group>"; };
     4267                FE99B2481C24B6D300C82159 /* JITNegGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITNegGenerator.h; sourceTree = "<group>"; };
    42644268                FEA0861E182B7A0400F6D851 /* Breakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Breakpoint.h; sourceTree = "<group>"; };
    42654269                FEA0861F182B7A0400F6D851 /* DebuggerPrimitives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebuggerPrimitives.h; sourceTree = "<group>"; };
     
    49714975                                FE1879FF1BFBC73C0038BBCA /* JITMulGenerator.cpp */,
    49724976                                FE187A001BFBC73C0038BBCA /* JITMulGenerator.h */,
     4977                                FE99B2471C24B6D300C82159 /* JITNegGenerator.cpp */,
     4978                                FE99B2481C24B6D300C82159 /* JITNegGenerator.h */,
    49734979                                BCDD51E90FB8DF74004A8BDC /* JITOpcodes.cpp */,
    49744980                                A71236E41195F33C00BD2174 /* JITOpcodes32_64.cpp */,
     
    72297235                                0F63947815DCE34B006A597C /* DFGStructureAbstractValue.h in Headers */,
    72307236                                0F50AF3C193E8B3900674EE8 /* DFGStructureClobberState.h in Headers */,
     7237                                FE99B2491C24C3D300C82159 /* JITNegGenerator.h in Headers */,
    72317238                                0F79085619A290B200F6310C /* DFGStructureRegistrationPhase.h in Headers */,
    72327239                                0F2FCCFF18A60070001A27F8 /* DFGThreadData.h in Headers */,
     
    89658972                                A71236E51195F33C00BD2174 /* JITOpcodes32_64.cpp in Sources */,
    89668973                                0F24E54C17EE274900ABB217 /* JITOperations.cpp in Sources */,
     8974                                FE99B24A1C24C3D700C82159 /* JITNegGenerator.cpp in Sources */,
    89678975                                86CC85C40EE7A89400288682 /* JITPropertyAccess.cpp in Sources */,
    89688976                                A7C1E8E4112E72EF00A37F98 /* JITPropertyAccess32_64.cpp in Sources */,
  • trunk/Source/JavaScriptCore/jit/JITArithmetic.cpp

    r194294 r194363  
    3838#include "JITLeftShiftGenerator.h"
    3939#include "JITMulGenerator.h"
     40#include "JITNegGenerator.h"
    4041#include "JITOperations.h"
    4142#include "JITRightShiftGenerator.h"
     
    197198
    198199#if USE(JSVALUE64)
    199 
    200 void JIT::emit_op_negate(Instruction* currentInstruction)
    201 {
    202     int dst = currentInstruction[1].u.operand;
    203     int src = currentInstruction[2].u.operand;
    204 
    205     emitGetVirtualRegister(src, regT0);
    206 
    207     Jump srcNotInt = emitJumpIfNotInt(regT0);
    208     addSlowCase(branchTest32(Zero, regT0, TrustedImm32(0x7fffffff)));
    209     neg32(regT0);
    210     emitTagInt(regT0, regT0);
    211 
    212     Jump end = jump();
    213 
    214     srcNotInt.link(this);
    215     emitJumpSlowCaseIfNotNumber(regT0);
    216 
    217     move(TrustedImm64((int64_t)0x8000000000000000ull), regT1);
    218     xor64(regT1, regT0);
    219 
    220     end.link(this);
    221     emitPutVirtualRegister(dst);
    222 }
    223 
    224 void JIT::emitSlow_op_negate(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
    225 {
    226     linkSlowCase(iter); // 0x7fffffff check
    227     linkSlowCase(iter); // double check
    228 
    229     JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_negate);
    230     slowPathCall.call();
    231 }
    232200
    233201void JIT::emit_op_unsigned(Instruction* currentInstruction)
     
    499467#endif // USE(JSVALUE64)
    500468
     469void JIT::emit_op_negate(Instruction* currentInstruction)
     470{
     471    int result = currentInstruction[1].u.operand;
     472    int src = currentInstruction[2].u.operand;
     473
     474#if USE(JSVALUE64)
     475    JSValueRegs srcRegs = JSValueRegs(regT0);
     476    JSValueRegs resultRegs = srcRegs;
     477    GPRReg scratchGPR = regT2;
     478#else
     479    JSValueRegs srcRegs = JSValueRegs(regT1, regT0);
     480    JSValueRegs resultRegs = srcRegs;
     481    GPRReg scratchGPR = regT4;
     482#endif
     483
     484    emitGetVirtualRegister(src, srcRegs);
     485
     486    JITNegGenerator gen(resultRegs, srcRegs, scratchGPR);
     487    gen.generateFastPath(*this);
     488
     489    ASSERT(gen.didEmitFastPath());
     490    gen.endJumpList().link(this);
     491    emitPutVirtualRegister(result, resultRegs);
     492
     493    addSlowCase(gen.slowPathJumpList());
     494}
     495
     496void JIT::emitSlow_op_negate(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
     497{
     498    linkAllSlowCasesForBytecodeOffset(m_slowCases, iter, m_bytecodeOffset);
     499
     500    JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_negate);
     501    slowPathCall.call();
     502}
     503
    501504template<typename SnippetGenerator>
    502505void JIT::emitBitBinaryOpFastPath(Instruction* currentInstruction)
  • trunk/Source/JavaScriptCore/jit/JITArithmetic32_64.cpp

    r193788 r194363  
    4343namespace JSC {
    4444
    45 void JIT::emit_op_negate(Instruction* currentInstruction)
    46 {
    47     int dst = currentInstruction[1].u.operand;
    48     int src = currentInstruction[2].u.operand;
    49 
    50     emitLoad(src, regT1, regT0);
    51 
    52     Jump srcNotInt = branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag));
    53     addSlowCase(branchTest32(Zero, regT0, TrustedImm32(0x7fffffff)));
    54     neg32(regT0);
    55     emitStoreInt32(dst, regT0, (dst == src));
    56 
    57     Jump end = jump();
    58 
    59     srcNotInt.link(this);
    60     addSlowCase(branch32(Above, regT1, TrustedImm32(JSValue::LowestTag)));
    61 
    62     xor32(TrustedImm32(1 << 31), regT1);
    63     store32(regT1, tagFor(dst));
    64     if (dst != src)
    65         store32(regT0, payloadFor(dst));
    66 
    67     end.link(this);
    68 }
    69 
    70 void JIT::emitSlow_op_negate(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
    71 {
    72     linkSlowCase(iter); // 0x7fffffff check
    73     linkSlowCase(iter); // double check
    74 
    75     JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_negate);
    76     slowPathCall.call();
    77 }
    78 
    7945void JIT::emit_compareAndJump(OpcodeID opcode, int op1, int op2, unsigned target, RelationalCondition condition)
    8046{
Note: See TracChangeset for help on using the changeset viewer.