Changeset 153197 in webkit for trunk/Source/JavaScriptCore/assembler
- Timestamp:
- Jul 24, 2013, 9:01:38 PM (12 years ago)
- Location:
- trunk/Source/JavaScriptCore/assembler
- Files:
-
- 9 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/assembler/ARMAssembler.h
r149601 r153197 51 51 r10, 52 52 r11, 53 r12, S1 = r12,53 r12, ip = r12, S1 = r12, 54 54 r13, sp = r13, 55 55 r14, lr = r14, … … 92 92 } FPRegisterID; 93 93 94 #if USE(MASM_PROBE) 95 #define FOR_EACH_CPU_REGISTER(V) \ 96 FOR_EACH_CPU_GPREGISTER(V) \ 97 FOR_EACH_CPU_SPECIAL_REGISTER(V) \ 98 FOR_EACH_CPU_FPREGISTER(V) 99 100 #define FOR_EACH_CPU_GPREGISTER(V) \ 101 V(void*, r0) \ 102 V(void*, r1) \ 103 V(void*, r2) \ 104 V(void*, r3) \ 105 V(void*, r4) \ 106 V(void*, r5) \ 107 V(void*, r6) \ 108 V(void*, r7) \ 109 V(void*, r8) \ 110 V(void*, r9) \ 111 V(void*, r10) \ 112 V(void*, r11) \ 113 V(void*, ip) \ 114 V(void*, sp) \ 115 V(void*, lr) \ 116 V(void*, pc) 117 118 #define FOR_EACH_CPU_SPECIAL_REGISTER(V) \ 119 V(void*, apsr) \ 120 V(void*, fpscr) \ 121 122 #define FOR_EACH_CPU_FPREGISTER(V) \ 123 V(double, d0) \ 124 V(double, d1) \ 125 V(double, d2) \ 126 V(double, d3) \ 127 V(double, d4) \ 128 V(double, d5) \ 129 V(double, d6) \ 130 V(double, d7) \ 131 V(double, d8) \ 132 V(double, d9) \ 133 V(double, d10) \ 134 V(double, d11) \ 135 V(double, d12) \ 136 V(double, d13) \ 137 V(double, d14) \ 138 V(double, d15) 139 #endif // USE(MASM_PROBE) 94 140 } // namespace ARMRegisters 95 141 -
trunk/Source/JavaScriptCore/assembler/ARMv7Assembler.h
r149395 r153197 173 173 return (FPDoubleRegisterID)(reg >> 1); 174 174 } 175 176 #if USE(MASM_PROBE) 177 #define FOR_EACH_CPU_REGISTER(V) \ 178 FOR_EACH_CPU_GPREGISTER(V) \ 179 FOR_EACH_CPU_SPECIAL_REGISTER(V) \ 180 FOR_EACH_CPU_FPREGISTER(V) 181 182 #define FOR_EACH_CPU_GPREGISTER(V) \ 183 V(void*, r0) \ 184 V(void*, r1) \ 185 V(void*, r2) \ 186 V(void*, r3) \ 187 V(void*, r4) \ 188 V(void*, r5) \ 189 V(void*, r6) \ 190 V(void*, r7) \ 191 V(void*, r8) \ 192 V(void*, r9) \ 193 V(void*, r10) \ 194 V(void*, r11) \ 195 V(void*, ip) \ 196 V(void*, sp) \ 197 V(void*, lr) \ 198 V(void*, pc) 199 200 #define FOR_EACH_CPU_SPECIAL_REGISTER(V) \ 201 V(void*, apsr) \ 202 V(void*, fpscr) \ 203 204 #define FOR_EACH_CPU_FPREGISTER(V) \ 205 V(double, d0) \ 206 V(double, d1) \ 207 V(double, d2) \ 208 V(double, d3) \ 209 V(double, d4) \ 210 V(double, d5) \ 211 V(double, d6) \ 212 V(double, d7) \ 213 V(double, d8) \ 214 V(double, d9) \ 215 V(double, d10) \ 216 V(double, d11) \ 217 V(double, d12) \ 218 V(double, d13) \ 219 V(double, d14) \ 220 V(double, d15) \ 221 FOR_EACH_CPU_FPREGISTER_EXTENSION(V) 222 223 #if CPU(APPLE_ARMV7S) 224 #define FOR_EACH_CPU_FPREGISTER_EXTENSION(V) \ 225 V(double, d16) \ 226 V(double, d17) \ 227 V(double, d18) \ 228 V(double, d19) \ 229 V(double, d20) \ 230 V(double, d21) \ 231 V(double, d22) \ 232 V(double, d23) \ 233 V(double, d24) \ 234 V(double, d25) \ 235 V(double, d26) \ 236 V(double, d27) \ 237 V(double, d28) \ 238 V(double, d29) \ 239 V(double, d30) \ 240 V(double, d31) 241 #else 242 #define FOR_EACH_CPU_FPREGISTER_EXTENSION(V) // Nothing to add. 243 #endif // CPU(APPLE_ARMV7S) 244 245 #endif // USE(MASM_PROBE) 175 246 } 176 247 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp
r125541 r153197 1 1 /* 2 * Copyright (C) 2013 Apple Inc. 2 3 * Copyright (C) 2009 University of Szeged 3 4 * All rights reserved. … … 31 32 #include "MacroAssemblerARM.h" 32 33 34 #if USE(MASM_PROBE) 35 #include <wtf/StdLibExtras.h> 36 #endif 37 33 38 #if OS(LINUX) 34 39 #include <sys/types.h> … … 56 61 close(fd); 57 62 } 58 #endif 63 #endif // OS(LINUX) 59 64 60 65 #if (COMPILER(RVCT) && defined(__TARGET_FPU_VFP)) || (COMPILER(GCC) && defined(__VFP_FP__)) … … 93 98 m_assembler.orr(dest, dest, m_assembler.lsl(ARMRegisters::S0, 16)); 94 99 } 95 #endif 100 #endif // CPU(ARMV5_OR_LOWER) 101 102 #if USE(MASM_PROBE) 103 104 void MacroAssemblerARM::ProbeContext::dumpCPURegisters(const char* indentation) 105 { 106 #define DUMP_GPREGISTER(_type, _regName) { \ 107 int32_t value = reinterpret_cast<int32_t>(cpu._regName); \ 108 dataLogF("%s %5s: 0x%08x %d\n", indentation, #_regName, value, value) ; \ 109 } 110 FOR_EACH_CPU_GPREGISTER(DUMP_GPREGISTER) 111 FOR_EACH_CPU_SPECIAL_REGISTER(DUMP_GPREGISTER) 112 #undef DUMP_GPREGISTER 113 114 #define DUMP_FPREGISTER(_type, _regName) { \ 115 uint32_t* u = reinterpret_cast<uint32_t*>(&cpu._regName); \ 116 double* d = reinterpret_cast<double*>(&cpu._regName); \ 117 dataLogF("%s %5s: 0x %08x %08x %12g\n", \ 118 indentation, #_regName, u[1], u[0], d[0]); \ 119 } 120 FOR_EACH_CPU_FPREGISTER(DUMP_FPREGISTER) 121 #undef DUMP_FPREGISTER 122 } 123 124 void MacroAssemblerARM::ProbeContext::dump(const char* indentation) 125 { 126 if (!indentation) 127 indentation = ""; 128 129 dataLogF("%sProbeContext %p {\n", indentation, this); 130 dataLogF("%s probeFunction: %p\n", indentation, probeFunction); 131 dataLogF("%s arg1: %p %llu\n", indentation, arg1, reinterpret_cast<int64_t>(arg1)); 132 dataLogF("%s arg2: %p %llu\n", indentation, arg2, reinterpret_cast<int64_t>(arg2)); 133 dataLogF("%s jitStackFrame: %p\n", indentation, jitStackFrame); 134 dataLogF("%s cpu: {\n", indentation); 135 136 dumpCPURegisters(indentation); 137 138 dataLogF("%s }\n", indentation); 139 dataLogF("%s}\n", indentation); 140 } 141 142 143 extern "C" void ctiMasmProbeTrampoline(); 144 145 // For details on "What code is emitted for the probe?" and "What values are in 146 // the saved registers?", see comment for MacroAssemblerX86::probe() in 147 // MacroAssemblerX86_64.h. 148 149 void MacroAssemblerARM::probe(MacroAssemblerARM::ProbeFunction function, void* arg1, void* arg2) 150 { 151 push(RegisterID::sp); 152 push(RegisterID::lr); 153 push(RegisterID::ip); 154 push(RegisterID::S0); 155 // The following uses RegisterID::S0. So, they must come after we push S0 above. 156 push(trustedImm32FromPtr(arg2)); 157 push(trustedImm32FromPtr(arg1)); 158 push(trustedImm32FromPtr(function)); 159 160 move(trustedImm32FromPtr(ctiMasmProbeTrampoline), RegisterID::S0); 161 m_assembler.blx(RegisterID::S0); 96 162 97 163 } 164 #endif // USE(MASM_PROBE) 165 166 } // namespace JSC 98 167 99 168 #endif // ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL) -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.h
r150748 r153197 1 1 /* 2 * Copyright (C) 2008 Apple Inc.2 * Copyright (C) 2008, 2013 Apple Inc. 3 3 * Copyright (C) 2009, 2010 University of Szeged 4 4 * All rights reserved. … … 36 36 namespace JSC { 37 37 38 struct JITStackFrame; 39 38 40 class MacroAssemblerARM : public AbstractMacroAssembler<ARMAssembler> { 39 41 static const int DoubleConditionMask = 0x0f; … … 1329 1331 } 1330 1332 1333 #if USE(MASM_PROBE) 1334 struct CPUState { 1335 #define DECLARE_REGISTER(_type, _regName) \ 1336 _type _regName; 1337 FOR_EACH_CPU_REGISTER(DECLARE_REGISTER) 1338 #undef DECLARE_REGISTER 1339 }; 1340 1341 struct ProbeContext; 1342 typedef void (*ProbeFunction)(struct ProbeContext*); 1343 1344 struct ProbeContext { 1345 ProbeFunction probeFunction; 1346 void* arg1; 1347 void* arg2; 1348 JITStackFrame* jitStackFrame; 1349 CPUState cpu; 1350 1351 void dump(const char* indentation = 0); 1352 private: 1353 void dumpCPURegisters(const char* indentation); 1354 }; 1355 1356 // For details about probe(), see comment in MacroAssemblerX86_64.h. 1357 void probe(ProbeFunction, void* arg1 = 0, void* arg2 = 0); 1358 #endif // USE(MASM_PROBE) 1359 1331 1360 protected: 1332 1361 ARMAssembler::Condition ARMCondition(RelationalCondition cond) … … 1384 1413 } 1385 1414 1415 #if USE(MASM_PROBE) 1416 inline TrustedImm32 trustedImm32FromPtr(void* ptr) 1417 { 1418 return TrustedImm32(TrustedImmPtr(ptr)); 1419 } 1420 1421 inline TrustedImm32 trustedImm32FromPtr(ProbeFunction function) 1422 { 1423 return TrustedImm32(TrustedImmPtr(reinterpret_cast<void*>(function))); 1424 } 1425 1426 inline TrustedImm32 trustedImm32FromPtr(void (*function)()) 1427 { 1428 return TrustedImm32(TrustedImmPtr(reinterpret_cast<void*>(function))); 1429 } 1430 #endif 1431 1386 1432 static const bool s_isVFPPresent; 1387 1433 }; -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.cpp
r153196 r153197 25 25 26 26 #include "config.h" 27 #include "MacroAssemblerX86Common.h" 27 28 #if ENABLE(ASSEMBLER) && CPU(ARM_THUMB2) 29 #include "MacroAssemblerARMv7.h" 30 31 #if USE(MASM_PROBE) 32 #include <wtf/StdLibExtras.h> 33 #endif 28 34 29 35 namespace JSC { … … 31 37 #if USE(MASM_PROBE) 32 38 33 void MacroAssembler X86Common::ProbeContext::dumpCPURegisters(const char* indentation)39 void MacroAssemblerARMv7::ProbeContext::dumpCPURegisters(const char* indentation) 34 40 { 35 #if CPU(X86)36 41 #define DUMP_GPREGISTER(_type, _regName) { \ 37 42 int32_t value = reinterpret_cast<int32_t>(cpu._regName); \ 38 dataLogF("%s % 4s: 0x%08x %d\n", indentation, #_regName, value, value) ; \43 dataLogF("%s %5s: 0x%08x %d\n", indentation, #_regName, value, value) ; \ 39 44 } 40 #elif CPU(X86_64)41 #define DUMP_GPREGISTER(_type, _regName) { \42 int64_t value = reinterpret_cast<int64_t>(cpu._regName); \43 dataLogF("%s %4s: 0x%016llx %lld\n", indentation, #_regName, value, value) ; \44 }45 #endif46 45 FOR_EACH_CPU_GPREGISTER(DUMP_GPREGISTER) 46 FOR_EACH_CPU_SPECIAL_REGISTER(DUMP_GPREGISTER) 47 47 #undef DUMP_GPREGISTER 48 48 … … 50 50 uint32_t* u = reinterpret_cast<uint32_t*>(&cpu._regName); \ 51 51 double* d = reinterpret_cast<double*>(&cpu._regName); \ 52 dataLogF("%s % s: 0x%08x%08x 0x%08x%08x %12g%12g\n", \53 indentation, #_regName, u[ 3], u[2], u[1], u[0], d[1], d[0]); \52 dataLogF("%s %5s: 0x %08x %08x %12g\n", \ 53 indentation, #_regName, u[1], u[0], d[0]); \ 54 54 } 55 55 FOR_EACH_CPU_FPREGISTER(DUMP_FPREGISTER) … … 57 57 } 58 58 59 void MacroAssembler X86Common::ProbeContext::dump(const char* indentation)59 void MacroAssemblerARMv7::ProbeContext::dump(const char* indentation) 60 60 { 61 61 if (!indentation) … … 75 75 } 76 76 77 78 extern "C" void ctiMasmProbeTrampoline(); 79 80 // For details on "What code is emitted for the probe?" and "What values are in 81 // the saved registers?", see comment for MacroAssemblerX86::probe() in 82 // MacroAssemblerX86_64.h. 83 84 void MacroAssemblerARMv7::probe(MacroAssemblerARMv7::ProbeFunction function, void* arg1, void* arg2) 85 { 86 push(RegisterID::sp); 87 push(RegisterID::lr); 88 push(RegisterID::ip); 89 push(RegisterID::r0); 90 // The following uses RegisterID::ip. So, they must come after we push ip above. 91 push(trustedImm32FromPtr(arg2)); 92 push(trustedImm32FromPtr(arg1)); 93 push(trustedImm32FromPtr(function)); 94 95 move(trustedImm32FromPtr(ctiMasmProbeTrampoline), RegisterID::ip); 96 m_assembler.blx(RegisterID::ip); 97 } 77 98 #endif // USE(MASM_PROBE) 78 99 79 100 } // namespace JSC 101 102 #endif // ENABLE(ASSEMBLER) 103 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h
r149395 r153197 35 35 namespace JSC { 36 36 37 struct JITStackFrame; 38 37 39 class MacroAssemblerARMv7 : public AbstractMacroAssembler<ARMv7Assembler> { 38 40 // FIXME: switch dataTempRegister & addressTempRegister, or possibly use r7? … … 1797 1799 } 1798 1800 1801 #if USE(MASM_PROBE) 1802 struct CPUState { 1803 #define DECLARE_REGISTER(_type, _regName) \ 1804 _type _regName; 1805 FOR_EACH_CPU_REGISTER(DECLARE_REGISTER) 1806 #undef DECLARE_REGISTER 1807 }; 1808 1809 struct ProbeContext; 1810 typedef void (*ProbeFunction)(struct ProbeContext*); 1811 1812 struct ProbeContext { 1813 ProbeFunction probeFunction; 1814 void* arg1; 1815 void* arg2; 1816 JITStackFrame* jitStackFrame; 1817 CPUState cpu; 1818 1819 void dump(const char* indentation = 0); 1820 private: 1821 void dumpCPURegisters(const char* indentation); 1822 }; 1823 1824 // For details about probe(), see comment in MacroAssemblerX86_64.h. 1825 void probe(ProbeFunction, void* arg1 = 0, void* arg2 = 0); 1826 #endif // USE(MASM_PROBE) 1827 1799 1828 protected: 1800 1829 ALWAYS_INLINE Jump jump() … … 1907 1936 } 1908 1937 1938 #if USE(MASM_PROBE) 1939 inline TrustedImm32 trustedImm32FromPtr(void* ptr) 1940 { 1941 return TrustedImm32(TrustedImmPtr(ptr)); 1942 } 1943 1944 inline TrustedImm32 trustedImm32FromPtr(ProbeFunction function) 1945 { 1946 return TrustedImm32(TrustedImmPtr(reinterpret_cast<void*>(function))); 1947 } 1948 1949 inline TrustedImm32 trustedImm32FromPtr(void (*function)()) 1950 { 1951 return TrustedImm32(TrustedImmPtr(reinterpret_cast<void*>(function))); 1952 } 1953 #endif 1954 1909 1955 bool m_makeJumpPatchable; 1910 1956 }; -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86.h
r153162 r153197 293 293 294 294 #if USE(MASM_PROBE) 295 // This function emits code to preserve the CPUState (e.g. registers), 296 // call a user supplied probe function, and restore the CPUState before 297 // continuing with other JIT generated code. 298 // 299 // The user supplied probe function will be called with a single pointer to 300 // a ProbeContext struct (defined above) which contains, among other things, 301 // the preserved CPUState. This allows the user probe function to inspect 302 // the CPUState at that point in the JIT generated code. 303 // 304 // If the user probe function alters the register values in the ProbeContext, 305 // the altered values will be loaded into the CPU registers when the probe 306 // returns. 307 // 308 // The ProbeContext is stack allocated and is only valid for the duration 309 // of the call to the user probe function. 310 295 // For details about probe(), see comment in MacroAssemblerX86_64.h. 311 296 void probe(ProbeFunction, void* arg1 = 0, void* arg2 = 0); 312 297 #endif // USE(MASM_PROBE) … … 353 338 extern "C" void ctiMasmProbeTrampoline(); 354 339 355 // What code is emitted for the probe? 356 // ================================== 357 // We want to keep the size of the emitted probe invocation code as compact as 358 // possible to minimize the perturbation to the JIT generated code. However, 359 // we also need to preserve the CPU registers and set up the ProbeContext to be 360 // passed to the user probe function. 361 // 362 // Hence, we do only the minimum here to preserve the eax (to be used as a 363 // scratch register) and esp registers, and pass the probe arguments. We'll let 364 // the ctiMasmProbeTrampoline handle the rest of the probe invocation work 365 // i.e. saving the CPUState (and setting up the ProbeContext), calling the user 366 // probe function, and restoring the CPUState before returning to JIT generated 367 // code. 368 // 369 // What values are in the saved registers? 370 // ====================================== 371 // Conceptually, the saved registers should contain values as if the probe 372 // is not present in the JIT generated code. Hence, they should contain values 373 // that are expected at the start of the instruction immediately following the 374 // probe. 375 // 376 // Specifcally, the saved esp will point to the stack position before we 377 // push the ProbeContext frame. The saved eip will point to the address of 378 // the instruction immediately following the probe. 340 // For details on "What code is emitted for the probe?" and "What values are in 341 // the saved registers?", see comment for MacroAssemblerX86::probe() in 342 // MacroAssemblerX86_64.h. 379 343 380 344 inline void MacroAssemblerX86::probe(MacroAssemblerX86::ProbeFunction function, void* arg1, void* arg2) 381 345 { 382 RegisterID esp = RegisterID::esp; 383 #define probeContextField(field) Address(esp, offsetof(ProbeContext, field)) 384 385 // The X86_64 ABI specifies that the worse case stack alignment requirement 386 // is 32 bytes. 387 const int probeFrameSize = WTF::roundUpToMultipleOf(32, sizeof(ProbeContext)); 388 sub32(TrustedImm32(probeFrameSize), esp); 389 390 store32(RegisterID::eax, probeContextField(cpu.eax)); 391 392 move(TrustedImm32(probeFrameSize), RegisterID::eax); 393 add32(esp, RegisterID::eax); 394 store32(RegisterID::eax, probeContextField(cpu.esp)); 395 396 store32(trustedImm32FromPtr(function), probeContextField(probeFunction)); 397 store32(trustedImm32FromPtr(arg1), probeContextField(arg1)); 398 store32(trustedImm32FromPtr(arg2), probeContextField(arg2)); 346 push(RegisterID::esp); 347 push(RegisterID::eax); 348 push(trustedImm32FromPtr(arg2)); 349 push(trustedImm32FromPtr(arg1)); 350 push(trustedImm32FromPtr(function)); 399 351 400 352 move(trustedImm32FromPtr(ctiMasmProbeTrampoline), RegisterID::eax); 401 353 call(RegisterID::eax); 402 403 #undef probeContextField404 354 } 405 355 #endif // USE(MASM_PROBE) -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp
r153162 r153197 25 25 26 26 #include "config.h" 27 28 #if ENABLE(ASSEMBLER) && (CPU(X86) || CPU(X86_64)) 27 29 #include "MacroAssemblerX86Common.h" 28 30 … … 36 38 #define DUMP_GPREGISTER(_type, _regName) { \ 37 39 int32_t value = reinterpret_cast<int32_t>(cpu._regName); \ 38 dataLogF("%s % 4s: 0x%08x %d\n", indentation, #_regName, value, value) ; \40 dataLogF("%s %6s: 0x%08x %d\n", indentation, #_regName, value, value) ; \ 39 41 } 40 42 #elif CPU(X86_64) 41 43 #define DUMP_GPREGISTER(_type, _regName) { \ 42 44 int64_t value = reinterpret_cast<int64_t>(cpu._regName); \ 43 dataLogF("%s % 4s: 0x%016llx %lld\n", indentation, #_regName, value, value) ; \45 dataLogF("%s %6s: 0x%016llx %lld\n", indentation, #_regName, value, value) ; \ 44 46 } 45 47 #endif 46 48 FOR_EACH_CPU_GPREGISTER(DUMP_GPREGISTER) 49 FOR_EACH_CPU_SPECIAL_REGISTER(DUMP_GPREGISTER) 47 50 #undef DUMP_GPREGISTER 48 51 … … 50 53 uint32_t* u = reinterpret_cast<uint32_t*>(&cpu._regName); \ 51 54 double* d = reinterpret_cast<double*>(&cpu._regName); \ 52 dataLogF("%s % s: 0x%08x%08x 0x%08x%08x %12g %12g\n", \55 dataLogF("%s %6s: 0x%08x%08x 0x%08x%08x %12g %12g\n", \ 53 56 indentation, #_regName, u[3], u[2], u[1], u[0], d[1], d[0]); \ 54 57 } … … 78 81 79 82 } // namespace JSC 83 84 #endif // ENABLE(ASSEMBLER) && (CPU(X86) || CPU(X86_64)) -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h
r153162 r153197 688 688 // passed to the user probe function. 689 689 // 690 // Hence, we do only the minimum here to preserve the rax (to be used as a691 // scratch register) and rsp registers, and pass the probe arguments. We'll let692 // the ctiMasmProbeTrampoline handle the rest of the probe invocation work693 // i.e. saving the CPUState (and setting up the ProbeContext), calling the user694 // probe function, and restoring the CPUState before returning to JIT generated695 // code.690 // Hence, we do only the minimum here to preserve a scratch register (i.e. rax 691 // in this case) and the stack pointer (i.e. rsp), and pass the probe arguments. 692 // We'll let the ctiMasmProbeTrampoline handle the rest of the probe invocation 693 // work i.e. saving the CPUState (and setting up the ProbeContext), calling the 694 // user probe function, and restoring the CPUState before returning to JIT 695 // generated code. 696 696 // 697 697 // What values are in the saved registers? … … 702 702 // probe. 703 703 // 704 // Specifcally, the saved rsp will point to the stack position before we705 // p ush the ProbeContext frame. The saved rip will point to the address of706 // the instruction immediately following the probe.704 // Specifcally, the saved stack pointer register will point to the stack 705 // position before we push the ProbeContext frame. The saved rip will point to 706 // the address of the instruction immediately following the probe. 707 707 708 708 inline void MacroAssemblerX86_64::probe(MacroAssemblerX86_64::ProbeFunction function, void* arg1, void* arg2) 709 709 { 710 RegisterID esp = RegisterID::esp; 711 #define probeContextField(field) Address(esp, offsetof(ProbeContext, field)) 712 713 // The X86_64 ABI specifies that the worse case stack alignment requirement 714 // is 32 bytes. 715 const int probeFrameSize = WTF::roundUpToMultipleOf(32, sizeof(ProbeContext)); 716 sub64(TrustedImm32(probeFrameSize), esp); 717 718 store64(RegisterID::eax, probeContextField(cpu.eax)); 719 720 move(TrustedImm32(probeFrameSize), RegisterID::eax); 721 add64(esp, RegisterID::eax); 722 store64(RegisterID::eax, probeContextField(cpu.esp)); 723 724 store64(trustedImm64FromPtr(function), probeContextField(probeFunction)); 725 store64(trustedImm64FromPtr(arg1), probeContextField(arg1)); 726 store64(trustedImm64FromPtr(arg2), probeContextField(arg2)); 727 710 push(RegisterID::esp); 711 push(RegisterID::eax); 712 move(trustedImm64FromPtr(arg2), RegisterID::eax); 713 push(RegisterID::eax); 714 move(trustedImm64FromPtr(arg1), RegisterID::eax); 715 push(RegisterID::eax); 716 move(trustedImm64FromPtr(function), RegisterID::eax); 717 push(RegisterID::eax); 728 718 move(trustedImm64FromPtr(ctiMasmProbeTrampoline), RegisterID::eax); 729 719 call(RegisterID::eax); 730 731 #undef probeContextField732 720 } 733 721 #endif // USE(MASM_PROBE) -
trunk/Source/JavaScriptCore/assembler/X86Assembler.h
r153162 r153197 80 80 #define FOR_EACH_CPU_REGISTER(V) \ 81 81 FOR_EACH_CPU_GPREGISTER(V) \ 82 FOR_EACH_CPU_SPECIAL_REGISTER(V) \ 82 83 FOR_EACH_CPU_FPREGISTER(V) 83 84 84 85 #define FOR_EACH_CPU_GPREGISTER(V) \ 85 86 V(void*, eax) \ 87 V(void*, ebx) \ 86 88 V(void*, ecx) \ 87 89 V(void*, edx) \ 88 V(void*, ebx) \89 V(void*, esp) \90 V(void*, ebp) \91 90 V(void*, esi) \ 92 91 V(void*, edi) \ 93 FOR_EACH_X86_64_CPU_GPREGISTER(V) \ 94 V(void*, eip) 92 V(void*, ebp) \ 93 V(void*, esp) \ 94 FOR_EACH_X86_64_CPU_GPREGISTER(V) 95 96 #define FOR_EACH_CPU_SPECIAL_REGISTER(V) \ 97 V(void*, eip) \ 98 V(void*, eflags) \ 95 99 96 100 #define FOR_EACH_CPU_FPREGISTER(V) \
Note:
See TracChangeset
for help on using the changeset viewer.