Changeset 146396 in webkit
- Timestamp:
- Mar 20, 2013 3:07:23 PM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r146392 r146396 1 2013-03-20 Zoltan Herczeg <zherczeg@webkit.org> 2 3 ARMv7 replaceWithJump ASSERT failure after r135330. 4 https://bugs.webkit.org/show_bug.cgi?id=103146 5 6 Reviewed by Filip Pizlo. 7 8 On Linux, the 24 bit distance range of jumps sometimes does not 9 enough to cover all targets addresses. This patch supports jumps 10 outside of this range using a mov/movt/bx 10 byte long sequence. 11 12 * assembler/ARMv7Assembler.h: 13 (ARMv7Assembler): 14 (JSC::ARMv7Assembler::revertJumpTo_movT3movtcmpT2): 15 (JSC::ARMv7Assembler::nopw): 16 (JSC::ARMv7Assembler::label): 17 (JSC::ARMv7Assembler::replaceWithJump): 18 (JSC::ARMv7Assembler::maxJumpReplacementSize): 19 * assembler/MacroAssemblerARMv7.h: 20 (JSC::MacroAssemblerARMv7::revertJumpReplacementToBranchPtrWithPatch): 21 1 22 2013-03-20 Mark Hahnenberg <mhahnenberg@apple.com> 2 23 -
trunk/Source/JavaScriptCore/assembler/ARMv7Assembler.h
r145505 r146396 1267 1267 } 1268 1268 1269 #if OS(LINUX) 1270 static void revertJumpTo_movT3movtcmpT2(void* instructionStart, RegisterID left, RegisterID right, uintptr_t imm) 1271 { 1272 uint16_t* address = static_cast<uint16_t*>(instructionStart); 1273 ARMThumbImmediate lo16 = ARMThumbImmediate::makeUInt16(static_cast<uint16_t>(imm)); 1274 ARMThumbImmediate hi16 = ARMThumbImmediate::makeUInt16(static_cast<uint16_t>(imm >> 16)); 1275 address[0] = twoWordOp5i6Imm4Reg4EncodedImmFirst(OP_MOV_imm_T3, lo16); 1276 address[1] = twoWordOp5i6Imm4Reg4EncodedImmSecond(right, lo16); 1277 address[2] = twoWordOp5i6Imm4Reg4EncodedImmFirst(OP_MOVT, hi16); 1278 address[3] = twoWordOp5i6Imm4Reg4EncodedImmSecond(right, hi16); 1279 address[4] = OP_CMP_reg_T2 | left; 1280 cacheFlush(address, sizeof(uint16_t) * 5); 1281 } 1282 #else 1269 1283 static void revertJumpTo_movT3(void* instructionStart, RegisterID rd, ARMThumbImmediate imm) 1270 1284 { … … 1278 1292 cacheFlush(address, sizeof(uint16_t) * 2); 1279 1293 } 1294 #endif 1280 1295 1281 1296 ALWAYS_INLINE void mov(RegisterID rd, ARMThumbImmediate imm) … … 1883 1898 m_formatter.oneWordOp8Imm8(OP_NOP_T1, 0); 1884 1899 } 1885 1900 1901 void nopw() 1902 { 1903 m_formatter.twoWordOp16Op16(OP_NOP_T2a, OP_NOP_T2b); 1904 } 1905 1886 1906 AssemblerLabel labelIgnoringWatchpoints() 1887 1907 { … … 1903 1923 AssemblerLabel result = m_formatter.label(); 1904 1924 while (UNLIKELY(static_cast<int>(result.m_offset) < m_indexOfTailOfLastWatchpoint)) { 1905 nop(); 1925 if (UNLIKELY(static_cast<int>(result.m_offset) + 4 <= m_indexOfTailOfLastWatchpoint)) 1926 nopw(); 1927 else 1928 nop(); 1906 1929 result = m_formatter.label(); 1907 1930 } … … 2161 2184 ASSERT(!(bitwise_cast<uintptr_t>(instructionStart) & 1)); 2162 2185 ASSERT(!(bitwise_cast<uintptr_t>(to) & 1)); 2186 2187 #if OS(LINUX) 2188 if (canBeJumpT4(reinterpret_cast<uint16_t*>(instructionStart), to)) { 2189 uint16_t* ptr = reinterpret_cast<uint16_t*>(instructionStart) + 2; 2190 linkJumpT4(ptr, to); 2191 cacheFlush(ptr - 2, sizeof(uint16_t) * 2); 2192 } else { 2193 uint16_t* ptr = reinterpret_cast<uint16_t*>(instructionStart) + 5; 2194 linkBX(ptr, to); 2195 cacheFlush(ptr - 5, sizeof(uint16_t) * 5); 2196 } 2197 #else 2163 2198 uint16_t* ptr = reinterpret_cast<uint16_t*>(instructionStart) + 2; 2164 2165 2199 linkJumpT4(ptr, to); 2166 2200 cacheFlush(ptr - 2, sizeof(uint16_t) * 2); 2201 #endif 2167 2202 } 2168 2203 2169 2204 static ptrdiff_t maxJumpReplacementSize() 2170 2205 { 2206 #if OS(LINUX) 2207 return 10; 2208 #else 2171 2209 return 4; 2210 #endif 2172 2211 } 2173 2212 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h
r146195 r146396 1774 1774 } 1775 1775 1776 static void revertJumpReplacementToBranchPtrWithPatch(CodeLocationLabel instructionStart, RegisterID, void* initialValue) 1777 { 1776 static void revertJumpReplacementToBranchPtrWithPatch(CodeLocationLabel instructionStart, RegisterID rd, void* initialValue) 1777 { 1778 #if OS(LINUX) 1779 ARMv7Assembler::revertJumpTo_movT3movtcmpT2(instructionStart.dataLocation(), rd, dataTempRegister, reinterpret_cast<uintptr_t>(initialValue)); 1780 #else 1781 UNUSED_PARAM(rd); 1778 1782 ARMv7Assembler::revertJumpTo_movT3(instructionStart.dataLocation(), dataTempRegister, ARMThumbImmediate::makeUInt16(reinterpret_cast<uintptr_t>(initialValue) & 0xffff)); 1783 #endif 1779 1784 } 1780 1785
Note: See TracChangeset
for help on using the changeset viewer.