Changeset 86919 in webkit
- Timestamp:
- May 19, 2011 6:33:46 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r86908 r86919 1 2011-05-19 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Gavin Barraclough. 4 5 Randomise code starting location a little 6 https://bugs.webkit.org/show_bug.cgi?id=61161 7 8 Add a nop() function to the Assemblers so that we 9 can randomise code offsets slightly at no real cost. 10 11 * assembler/ARMAssembler.h: 12 (JSC::ARMAssembler::nop): 13 * assembler/ARMv7Assembler.h: 14 (JSC::ARMv7Assembler::nop): 15 * assembler/MacroAssemblerARM.h: 16 (JSC::MacroAssemblerARM::nop): 17 * assembler/MacroAssemblerARMv7.h: 18 (JSC::MacroAssemblerARMv7::nop): 19 * assembler/MacroAssemblerMIPS.h: 20 (JSC::MacroAssemblerMIPS::nop): 21 * assembler/MacroAssemblerSH4.h: 22 (JSC::MacroAssemblerSH4::nop): 23 * assembler/MacroAssemblerX86Common.h: 24 (JSC::MacroAssemblerX86Common::nop): 25 * assembler/X86Assembler.h: 26 (JSC::X86Assembler::nop): 27 * jit/JIT.cpp: 28 (JSC::JIT::JIT): 29 (JSC::JIT::privateCompile): 30 * jit/JIT.h: 31 * runtime/WeakRandom.h: 32 (JSC::WeakRandom::getUint32): 33 1 34 2011-05-19 Oliver Hunt <oliver@apple.com> 2 35 -
trunk/Source/JavaScriptCore/assembler/ARMAssembler.h
r86699 r86919 168 168 BKPT = 0xe1200070, 169 169 BLX = 0x012fff30, 170 NOP_T2 = 0xf3af8000, 170 171 #endif 171 172 #if WTF_ARM_ARCH_AT_LEAST(7) … … 572 573 #endif 573 574 } 575 576 void nop() 577 { 578 m_buffer.putInt(OP_NOP_T2); 579 } 574 580 575 581 void bx(int rm, Condition cc = AL) -
trunk/Source/JavaScriptCore/assembler/ARMv7Assembler.h
r86699 r86919 1527 1527 } 1528 1528 1529 void nop() 1530 { 1531 m_formatter.oneWordOp8Imm8(OP_NOP_T1, 0); 1532 } 1533 1529 1534 AssemblerLabel label() 1530 1535 { -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.h
r86699 r86919 934 934 convertInt32ToDouble(ARMRegisters::S0, scratch); 935 935 return branchDouble(DoubleEqualOrUnordered, reg, scratch); 936 } 937 938 void nop() 939 { 940 m_assembler.nop(); 936 941 } 937 942 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h
r86699 r86919 820 820 } 821 821 822 void nop() 823 { 824 m_assembler.nop(); 825 } 822 826 823 827 // Forwards / external control flow operations: -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h
r86699 r86919 1772 1772 } 1773 1773 1774 void nop() 1775 { 1776 m_assembler.nop(); 1777 } 1774 1778 1775 1779 private: -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h
r86699 r86919 1735 1735 return tailRecursiveCall(); 1736 1736 } 1737 1738 void nop() 1739 { 1740 m_assembler.nop(); 1741 } 1742 1737 1743 protected: 1738 1744 SH4Assembler::Condition SH4Condition(RelationalCondition cond) -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
r86699 r86919 1214 1214 ASSERT(cond == Below || cond == BelowOrEqual || cond == Above || cond == AboveOrEqual); 1215 1215 return static_cast<RelationalCondition>(X86Assembler::ConditionB + X86Assembler::ConditionA - cond); 1216 } 1217 1218 void nop() 1219 { 1220 m_assembler.nop(); 1216 1221 } 1217 1222 -
trunk/Source/JavaScriptCore/assembler/X86Assembler.h
r86699 r86919 139 139 OP_LEA = 0x8D, 140 140 OP_GROUP1A_Ev = 0x8F, 141 OP_NOP = 0x90, 141 142 OP_CDQ = 0x99, 142 143 OP_MOV_EAXOv = 0xA1, … … 1593 1594 unsigned debugOffset() { return m_formatter.debugOffset(); } 1594 1595 #endif 1596 1597 void nop() 1598 { 1599 m_formatter.oneByteOp(OP_NOP); 1600 } 1595 1601 1596 1602 private: -
trunk/Source/JavaScriptCore/jit/JIT.cpp
r85432 r86919 36 36 37 37 #include "CodeBlock.h" 38 #include "CryptographicallyRandomNumber.h" 38 39 #include "Interpreter.h" 39 40 #include "JITInlineMethods.h" … … 86 87 , m_lastResultBytecodeRegister(std::numeric_limits<int>::max()) 87 88 , m_jumpTargetsPosition(0) 89 #endif 90 #if USE(OS_RANDOMNESS) 91 , m_randomGenerator(cryptographicallyRandomNumber()) 92 #else 93 , m_randomGenerator(static_cast<unsigned>(randomNumber() * 0xFFFFFFF)) 88 94 #endif 89 95 { … … 459 465 JITCode JIT::privateCompile(CodePtr* functionEntryArityCheck) 460 466 { 467 // Just add a little bit of randomness to the codegen 468 if (m_randomGenerator.getUint32() & 1) 469 nop(); 470 461 471 // Could use a pop_m, but would need to offset the following instruction if so. 462 472 preserveReturnAddressAfterCall(regT2); -
trunk/Source/JavaScriptCore/jit/JIT.h
r86699 r86919 998 998 #endif 999 999 #endif 1000 WeakRandom m_randomGenerator; 1000 1001 static CodePtr stringGetByValStubGenerator(JSGlobalData* globalData, ExecutablePool* pool); 1001 1002 } JIT_CLASS_ALIGNMENT; -
trunk/Source/JavaScriptCore/runtime/WeakRandom.h
r50791 r86919 69 69 } 70 70 71 unsigned getUint32() 72 { 73 return advance(); 74 } 75 71 76 private: 72 77 unsigned advance()
Note: See TracChangeset
for help on using the changeset viewer.