Changeset 215269 in webkit for trunk/Source/JavaScriptCore/runtime/MachineContext.h
- Timestamp:
- Apr 12, 2017, 9:59:26 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/MachineContext.h
r213904 r215269 28 28 #include "GPRInfo.h" 29 29 #include "LLIntPCRanges.h" 30 #include <wtf/PlatformRegisters.h> 30 31 #include <wtf/StdLibExtras.h> 31 32 #if OS(DARWIN) || OS(FREEBSD) || defined(__GLIBC__)33 #include <signal.h>34 // Using signal.h didn't make mcontext_t and ucontext_t available on FreeBSD.35 // This bug has been fixed in FreeBSD 11.0-CURRENT, so this workaround can be36 // removed after FreeBSD 10.x goes EOL.37 // https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=20707938 #if OS(FREEBSD)39 #include <ucontext.h>40 #endif41 #endif42 43 #if OS(DARWIN)44 #include <mach/thread_act.h>45 #endif46 32 47 33 namespace JSC { 48 34 namespace MachineContext { 49 35 50 #if OS(DARWIN) 51 52 #if CPU(X86) 53 typedef i386_thread_state_t PlatformRegisters; 54 #elif CPU(X86_64) 55 typedef x86_thread_state64_t PlatformRegisters; 56 #elif CPU(PPC) 57 typedef ppc_thread_state_t PlatformRegisters; 58 #elif CPU(PPC64) 59 typedef ppc_thread_state64_t PlatformRegisters; 60 #elif CPU(ARM) 61 typedef arm_thread_state_t PlatformRegisters; 62 #elif CPU(ARM64) 63 typedef arm_thread_state64_t PlatformRegisters; 64 #else 65 #error Unknown Architecture 66 #endif 67 68 #elif OS(WINDOWS) 69 70 typedef CONTEXT PlatformRegisters; 71 72 #endif 73 74 75 #if OS(DARWIN) || OS(WINDOWS) 36 37 void*& stackPointer(PlatformRegisters&); 38 void* stackPointer(const PlatformRegisters&); 39 40 #if OS(WINDOWS) || USE(MACHINE_CONTEXT) 41 void*& framePointer(PlatformRegisters&); 42 void* framePointer(const PlatformRegisters&); 43 void*& instructionPointer(PlatformRegisters&); 44 void* instructionPointer(const PlatformRegisters&); 45 template<size_t N> void*& argumentPointer(PlatformRegisters&); 46 template<size_t N> void* argumentPointer(const PlatformRegisters&); 47 #if ENABLE(JIT) 48 void*& llintInstructionPointer(PlatformRegisters&); 49 void* llintInstructionPointer(const PlatformRegisters&); 50 #endif // ENABLE(JIT) 51 #if USE(MACHINE_CONTEXT) 52 void*& stackPointer(mcontext_t&); 53 void* stackPointer(const mcontext_t&); 54 void*& framePointer(mcontext_t&); 55 void* framePointer(const mcontext_t&); 56 void*& instructionPointer(mcontext_t&); 57 void* instructionPointer(const mcontext_t&); 58 template<size_t N> void*& argumentPointer(mcontext_t&); 59 template<size_t N> void* argumentPointer(const mcontext_t&); 60 #if ENABLE(JIT) 61 void*& llintInstructionPointer(mcontext_t&); 62 void* llintInstructionPointer(const mcontext_t&); 63 #endif // ENABLE(JIT) 64 #endif // USE(MACHINE_CONTEXT) 65 #endif // OS(WINDOWS) || USE(MACHINE_CONTEXT) 66 76 67 inline void*& stackPointer(PlatformRegisters& regs) 77 68 { … … 119 110 #endif 120 111 121 #endif // OS(DARWIN) 112 #elif USE(MACHINE_CONTEXT) 113 return stackPointer(regs.machineContext); 114 #else 115 return regs.stackPointer; 116 #endif 122 117 } 123 118 … … 126 121 return stackPointer(const_cast<PlatformRegisters&>(regs)); 127 122 } 128 #endif // OS(DARWIN) || OS(WINDOWS) 129 130 131 #if OS(DARWIN) || ((OS(FREEBSD) || defined(__GLIBC__)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS))) 123 124 125 #if USE(MACHINE_CONTEXT) 132 126 inline void*& stackPointer(mcontext_t& machineContext) 133 127 { … … 172 166 return stackPointer(const_cast<mcontext_t&>(machineContext)); 173 167 } 174 #endif // OS(DARWIN) || ((OS(FREEBSD) || defined(__GLIBC__)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS)))175 176 177 #if OS( DARWIN) || OS(WINDOWS)168 #endif // USE(MACHINE_CONTEXT) 169 170 171 #if OS(WINDOWS) || USE(MACHINE_CONTEXT) 178 172 inline void*& framePointer(PlatformRegisters& regs) 179 173 { … … 222 216 #endif 223 217 224 #endif // OS(DARWIN) 218 #elif USE(MACHINE_CONTEXT) 219 return framePointer(regs.machineContext); 220 #endif 225 221 } 226 222 … … 229 225 return framePointer(const_cast<PlatformRegisters&>(regs)); 230 226 } 231 #endif // OS( DARWIN) || OS(WINDOWS)232 233 234 #if OS(DARWIN) || ((OS(FREEBSD) || defined(__GLIBC__)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS)))227 #endif // OS(WINDOWS) || USE(MACHINE_CONTEXT) 228 229 230 #if USE(MACHINE_CONTEXT) 235 231 inline void*& framePointer(mcontext_t& machineContext) 236 232 { … … 279 275 return framePointer(const_cast<mcontext_t&>(machineContext)); 280 276 } 281 #endif // OS(DARWIN) || ((OS(FREEBSD) || defined(__GLIBC__)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS)))282 283 284 #if OS( DARWIN) || OS(WINDOWS)277 #endif // USE(MACHINE_CONTEXT) 278 279 280 #if OS(WINDOWS) || USE(MACHINE_CONTEXT) 285 281 inline void*& instructionPointer(PlatformRegisters& regs) 286 282 { … … 323 319 #endif 324 320 325 #endif // OS(DARWIN) 321 #elif USE(MACHINE_CONTEXT) 322 return instructionPointer(regs.machineContext); 323 #endif 326 324 } 327 325 … … 330 328 return instructionPointer(const_cast<PlatformRegisters&>(regs)); 331 329 } 332 #endif // OS(DARWIN) || OS(WINDOWS) 333 334 335 #if OS(DARWIN) || ((OS(FREEBSD) || defined(__GLIBC__)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS))) 336 330 #endif // OS(WINDOWS) || USE(MACHINE_CONTEXT) 331 332 333 #if USE(MACHINE_CONTEXT) 337 334 inline void*& instructionPointer(mcontext_t& machineContext) 338 335 { … … 381 378 return instructionPointer(const_cast<mcontext_t&>(machineContext)); 382 379 } 383 #endif // OS(DARWIN) || ((OS(FREEBSD) || defined(__GLIBC__)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS))) 384 385 386 #if OS(DARWIN) || OS(WINDOWS) 387 template<size_t N> 388 void*& argumentPointer(PlatformRegisters&); 380 #endif // USE(MACHINE_CONTEXT) 381 382 383 #if OS(WINDOWS) || USE(MACHINE_CONTEXT) 384 #if USE(MACHINE_CONTEXT) 385 template<> void*& argumentPointer<1>(mcontext_t&); 386 #endif 389 387 390 388 template<> … … 432 430 #endif 433 431 434 #endif // OS(DARWIN) 432 #elif USE(MACHINE_CONTEXT) 433 return argumentPointer<1>(regs.machineContext); 434 #endif 435 435 } 436 436 … … 440 440 return argumentPointer<N>(const_cast<PlatformRegisters&>(regs)); 441 441 } 442 #endif // OS(DARWIN) || OS(WINDOWS) 443 444 445 #if OS(DARWIN) || ((OS(FREEBSD) || defined(__GLIBC__)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS))) 446 template<unsigned N> 447 void*& argumentPointer(mcontext_t&); 448 442 #endif // OS(WINDOWS) || USE(MACHINE_CONTEXT) 443 444 #if USE(MACHINE_CONTEXT) 449 445 template<> 450 446 inline void*& argumentPointer<1>(mcontext_t& machineContext) … … 495 491 return argumentPointer<N>(const_cast<mcontext_t&>(machineContext)); 496 492 } 497 #endif // OS(DARWIN) || ((OS(FREEBSD) || defined(__GLIBC__)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS)))493 #endif // USE(MACHINE_CONTEXT) 498 494 499 495 #if ENABLE(JIT) 500 #if OS( DARWIN) || OS(WINDOWS)496 #if OS(WINDOWS) || USE(MACHINE_CONTEXT) 501 497 inline void*& llintInstructionPointer(PlatformRegisters& regs) 502 498 { … … 551 547 #endif 552 548 553 #endif // OS(DARWIN) 549 #elif USE(MACHINE_CONTEXT) 550 return llintInstructionPointer(regs.machineContext); 551 #endif 554 552 } 555 553 … … 558 556 return llintInstructionPointer(const_cast<PlatformRegisters&>(regs)); 559 557 } 560 #endif // OS( DARWIN) || OS(WINDOWS)561 562 563 #if OS(DARWIN) || ((OS(FREEBSD) || defined(__GLIBC__)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS)))558 #endif // OS(WINDOWS) || USE(MACHINE_CONTEXT) 559 560 561 #if USE(MACHINE_CONTEXT) 564 562 inline void*& llintInstructionPointer(mcontext_t& machineContext) 565 563 { … … 609 607 return llintInstructionPointer(const_cast<mcontext_t&>(machineContext)); 610 608 } 611 #endif // OS(DARWIN) || ((OS(FREEBSD) || defined(__GLIBC__)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS)))609 #endif // USE(MACHINE_CONTEXT) 612 610 #endif // ENABLE(JIT) 613 611
Note:
See TracChangeset
for help on using the changeset viewer.