Changeset 148893 in webkit
- Timestamp:
- Apr 22, 2013 10:37:29 AM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r148891 r148893 1 2013-04-22 Mark Lam <mark.lam@apple.com> 2 3 Change baseline JIT watchdog timer check to use the proper fast slow path 4 infrastructure. 5 https://bugs.webkit.org/show_bug.cgi?id=114963. 6 7 Reviewed by Oliver Hunt. 8 9 SH4 parts contributed by Julien Brianceau. 10 11 * assembler/ARMAssembler.h: 12 * assembler/MacroAssemblerARM.h: 13 * assembler/MacroAssemblerARMv7.h: 14 * assembler/MacroAssemblerMIPS.h: 15 (JSC::MacroAssemblerMIPS::branchAdd32): 16 * assembler/MacroAssemblerSH4.h: 17 (JSC::MacroAssemblerSH4::branchAdd32): 18 * assembler/MacroAssemblerX86Common.h: 19 * assembler/SH4Assembler.h: 20 * jit/JIT.cpp: 21 (JSC::JIT::emitEnterOptimizationCheck): 22 (JSC::JIT::privateCompileSlowCases): 23 * jit/JIT.h: 24 (JSC::JIT::emitEnterOptimizationCheck): 25 * jit/JITOpcodes.cpp: 26 (JSC::JIT::emit_op_loop_hint): 27 (JSC::JIT::emitSlow_op_loop_hint): 28 (JSC::JIT::emit_op_enter): 29 * jit/JITOpcodes32_64.cpp: 30 (JSC::JIT::emit_op_enter): 31 1 32 2013-04-22 Andreas Kling <akling@apple.com> 2 33 -
trunk/Source/JavaScriptCore/assembler/ARMAssembler.h
r148696 r148893 108 108 // ARM conditional constants 109 109 typedef enum { 110 EQ = 0x00000000, // Zero 111 NE = 0x10000000, // Non-zero 112 CS = 0x20000000, 113 CC = 0x30000000, 114 MI = 0x40000000, 115 PL = 0x50000000, 116 VS = 0x60000000, 117 VC = 0x70000000, 118 HI = 0x80000000, 119 LS = 0x90000000, 120 GE = 0xa0000000, 121 LT = 0xb0000000, 122 GT = 0xc0000000, 123 LE = 0xd0000000, 124 AL = 0xe0000000 110 EQ = 0x00000000, // Zero / Equal. 111 NE = 0x10000000, // Non-zero / Not equal. 112 CS = 0x20000000, // Unsigned higher or same. 113 CC = 0x30000000, // Unsigned lower. 114 MI = 0x40000000, // Negative. 115 PL = 0x50000000, // Positive or zero. 116 VS = 0x60000000, // Overflowed. 117 VC = 0x70000000, // Not overflowed. 118 HI = 0x80000000, // Unsigned higher. 119 LS = 0x90000000, // Unsigned lower or same. 120 GE = 0xa0000000, // Signed greater than or equal. 121 LT = 0xb0000000, // Signed less than. 122 GT = 0xc0000000, // Signed greater than. 123 LE = 0xd0000000, // Signed less than or euqal. 124 AL = 0xe0000000 // Unconditional / Always execute. 125 125 } Condition; 126 126 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.h
r148134 r148893 59 59 Overflow = ARMAssembler::VS, 60 60 Signed = ARMAssembler::MI, 61 PositiveOrZero = ARMAssembler::PL, 61 62 Zero = ARMAssembler::EQ, 62 63 NonZero = ARMAssembler::NE -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h
r147892 r148893 120 120 Overflow = ARMv7Assembler::ConditionVS, 121 121 Signed = ARMv7Assembler::ConditionMI, 122 PositiveOrZero = ARMAssembler::PL, 122 123 Zero = ARMv7Assembler::ConditionEQ, 123 124 NonZero = ARMv7Assembler::ConditionNE -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h
r146339 r148893 81 81 Overflow, 82 82 Signed, 83 PositiveOrZero, 83 84 Zero, 84 85 NonZero … … 1510 1511 Jump branchAdd32(ResultCondition cond, RegisterID src, RegisterID dest) 1511 1512 { 1512 ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero));1513 ASSERT((cond == Overflow) || (cond == Signed) || (cond == PositiveOrZero) || (cond == Zero) || (cond == NonZero)); 1513 1514 if (cond == Overflow) { 1514 1515 /* … … 1541 1542 // Check if dest is negative. 1542 1543 m_assembler.slt(cmpTempRegister, dest, MIPSRegisters::zero); 1544 return branchNotEqual(cmpTempRegister, MIPSRegisters::zero); 1545 } 1546 if (cond == PositiveOrZero) { 1547 add32(src, dest); 1548 // Check if dest is negative. 1549 m_assembler.slt(cmpTempRegister, MIPSRegisters::zero, dest); 1543 1550 return branchNotEqual(cmpTempRegister, MIPSRegisters::zero); 1544 1551 } -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h
r140594 r148893 69 69 Overflow = SH4Assembler::OF, 70 70 Signed = SH4Assembler::SI, 71 PositiveOrZero = SH4Assembler::NS, 71 72 Zero = SH4Assembler::EQ, 72 73 NonZero = SH4Assembler::NE … … 1921 1922 } 1922 1923 1924 if (cond == PositiveOrZero) { 1925 m_assembler.addlRegReg(src, dest); 1926 m_assembler.cmppz(dest); 1927 return branchTrue(); 1928 } 1929 1923 1930 m_assembler.addlRegReg(src, dest); 1924 1931 compare32(0, dest, Equal); … … 1955 1962 m_assembler.cmppz(dest); 1956 1963 return branchFalse(); 1964 } 1965 1966 if (cond == PositiveOrZero) { 1967 m_assembler.cmppz(dest); 1968 return branchTrue(); 1957 1969 } 1958 1970 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
r133953 r148893 69 69 Overflow = X86Assembler::ConditionO, 70 70 Signed = X86Assembler::ConditionS, 71 PositiveOrZero = X86Assembler::ConditionNS, 71 72 Zero = X86Assembler::ConditionE, 72 73 NonZero = X86Assembler::ConditionNE -
trunk/Source/JavaScriptCore/assembler/SH4Assembler.h
r148696 r148893 342 342 EQ = 0x0, // Equal 343 343 NE = 0x1, // Not Equal 344 HS = 0x2, // Unsig end Greater Than equal345 HI = 0x3, // Unsig end Greater Than346 LS = 0x4, // Unsig end Lower or Same347 LI = 0x5, // Unsig end Lower344 HS = 0x2, // Unsigned Greater Than equal 345 HI = 0x3, // Unsigned Greater Than 346 LS = 0x4, // Unsigned Lower or Same 347 LI = 0x5, // Unsigned Lower 348 348 GE = 0x6, // Greater or Equal 349 349 LT = 0x7, // Less Than … … 352 352 OF = 0xa, // OverFlow 353 353 SI = 0xb, // Signed 354 EQU= 0xc, // Equal or unordered(NaN) 355 NEU= 0xd, 356 GTU= 0xe, 357 GEU= 0xf, 358 LTU= 0x10, 359 LEU= 0x11, 354 NS = 0xc, // Not Signed 355 EQU= 0xd, // Equal or unordered(NaN) 356 NEU= 0xe, 357 GTU= 0xf, 358 GEU= 0x10, 359 LTU= 0x11, 360 LEU= 0x12, 360 361 } Condition; 361 362 -
trunk/Source/JavaScriptCore/jit/JIT.cpp
r148696 r148893 104 104 105 105 #if ENABLE(DFG_JIT) 106 void JIT::emit OptimizationCheck(OptimizationCheckKind kind)106 void JIT::emitEnterOptimizationCheck() 107 107 { 108 108 if (!canBeOptimized()) 109 109 return; 110 111 Jump skipOptimize = branchAdd32(Signed, TrustedImm32( kind == LoopOptimizationCheck ? Options::executionCounterIncrementForLoop() :Options::executionCounterIncrementForReturn()), AbsoluteAddress(m_codeBlock->addressOfJITExecuteCounter()));110 111 Jump skipOptimize = branchAdd32(Signed, TrustedImm32(Options::executionCounterIncrementForReturn()), AbsoluteAddress(m_codeBlock->addressOfJITExecuteCounter())); 112 112 JITStubCall stubCall(this, cti_optimize); 113 113 stubCall.addArgument(TrustedImm32(m_bytecodeOffset)); 114 if (kind == EnterOptimizationCheck) 115 ASSERT(!m_bytecodeOffset); 114 ASSERT(!m_bytecodeOffset); 116 115 stubCall.call(); 117 116 skipOptimize.link(this); 118 117 } 119 118 #endif 120 121 void JIT::emitWatchdogTimerCheck()122 {123 if (!m_vm->watchdog.isEnabled())124 return;125 126 Jump skipCheck = branchTest8(Zero, AbsoluteAddress(m_vm->watchdog.timerDidFireAddress()));127 JITStubCall stubCall(this, cti_handle_watchdog_timer);128 stubCall.call();129 skipCheck.link(this);130 }131 119 132 120 #define NEXT_OPCODE(name) \ … … 474 462 DEFINE_SLOWCASE_OP(op_jngreatereq) 475 463 DEFINE_SLOWCASE_OP(op_jtrue) 464 DEFINE_SLOWCASE_OP(op_loop_hint) 476 465 DEFINE_SLOWCASE_OP(op_lshift) 477 466 DEFINE_SLOWCASE_OP(op_mod) -
trunk/Source/JavaScriptCore/jit/JIT.h
r148696 r148893 781 781 void emitSlow_op_jngreatereq(Instruction*, Vector<SlowCaseEntry>::iterator&); 782 782 void emitSlow_op_jtrue(Instruction*, Vector<SlowCaseEntry>::iterator&); 783 void emitSlow_op_loop_hint(Instruction*, Vector<SlowCaseEntry>::iterator&); 783 784 void emitSlow_op_lshift(Instruction*, Vector<SlowCaseEntry>::iterator&); 784 785 void emitSlow_op_mod(Instruction*, Vector<SlowCaseEntry>::iterator&); … … 853 854 void emitLoadCharacterString(RegisterID src, RegisterID dst, JumpList& failures); 854 855 855 enum OptimizationCheckKind { LoopOptimizationCheck, EnterOptimizationCheck };856 856 #if ENABLE(DFG_JIT) 857 void emitOptimizationCheck(OptimizationCheckKind); 858 #else 859 void emitOptimizationCheck(OptimizationCheckKind) { } 860 #endif 861 void emitWatchdogTimerCheck(); 857 void emitEnterOptimizationCheck(); 858 #else 859 void emitEnterOptimizationCheck() { } 860 #endif 862 861 863 862 #ifndef NDEBUG … … 945 944 } JIT_CLASS_ALIGNMENT; 946 945 947 inline void JIT::emit_op_loop_hint(Instruction*)948 {949 emitWatchdogTimerCheck();950 emitOptimizationCheck(LoopOptimizationCheck);951 }952 953 946 } // namespace JSC 954 947 -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r148711 r148893 482 482 } 483 483 484 void JIT::emit_op_loop_hint(Instruction*) 485 { 486 // Emit the watchdog timer check: 487 if (m_vm->watchdog.isEnabled()) 488 addSlowCase(branchTest8(NonZero, AbsoluteAddress(m_vm->watchdog.timerDidFireAddress()))); 489 490 // Emit the JIT optimization check: 491 if (canBeOptimized()) 492 addSlowCase(branchAdd32(PositiveOrZero, TrustedImm32(Options::executionCounterIncrementForLoop()), 493 AbsoluteAddress(m_codeBlock->addressOfJITExecuteCounter()))); 494 } 495 496 void JIT::emitSlow_op_loop_hint(Instruction*, Vector<SlowCaseEntry>::iterator& iter) 497 { 498 // Emit the slow path of the watchdog timer check: 499 if (m_vm->watchdog.isEnabled()) { 500 linkSlowCase(iter); 501 502 JITStubCall stubCall(this, cti_handle_watchdog_timer); 503 stubCall.call(); 504 505 #if ENABLE(DFG_JIT) 506 if (canBeOptimized()) { 507 Jump doOptimize = branchAdd32(PositiveOrZero, TrustedImm32(Options::executionCounterIncrementForLoop()), 508 AbsoluteAddress(m_codeBlock->addressOfJITExecuteCounter())); 509 emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_loop_hint)); 510 doOptimize.link(this); 511 } else 512 #endif 513 emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_loop_hint)); 514 } 515 516 #if ENABLE(DFG_JIT) 517 // Emit the slow path for the JIT optimization check: 518 if (canBeOptimized()) { 519 linkSlowCase(iter); 520 521 JITStubCall stubCall(this, cti_optimize); 522 stubCall.addArgument(TrustedImm32(m_bytecodeOffset)); 523 stubCall.call(); 524 525 emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_loop_hint)); 526 } 527 #endif 528 } 529 484 530 void JIT::emit_op_neq(Instruction* currentInstruction) 485 531 { … … 864 910 void JIT::emit_op_enter(Instruction*) 865 911 { 866 emit OptimizationCheck(EnterOptimizationCheck);912 emitEnterOptimizationCheck(); 867 913 868 914 // Even though CTI doesn't use them, we initialize our constant -
trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
r148696 r148893 1114 1114 void JIT::emit_op_enter(Instruction*) 1115 1115 { 1116 emit OptimizationCheck(EnterOptimizationCheck);1116 emitEnterOptimizationCheck(); 1117 1117 1118 1118 // Even though JIT code doesn't use them, we initialize our constant
Note: See TracChangeset
for help on using the changeset viewer.