| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 return simulator_ != NULL; | 238 return simulator_ != NULL; |
| 239 } | 239 } |
| 240 | 240 |
| 241 inline void FillRegisters(RegisterState* state) { | 241 inline void FillRegisters(RegisterState* state) { |
| 242 #if V8_TARGET_ARCH_ARM | 242 #if V8_TARGET_ARCH_ARM |
| 243 state->pc = reinterpret_cast<Address>(simulator_->get_pc()); | 243 state->pc = reinterpret_cast<Address>(simulator_->get_pc()); |
| 244 state->sp = reinterpret_cast<Address>(simulator_->get_register( | 244 state->sp = reinterpret_cast<Address>(simulator_->get_register( |
| 245 Simulator::sp)); | 245 Simulator::sp)); |
| 246 state->fp = reinterpret_cast<Address>(simulator_->get_register( | 246 state->fp = reinterpret_cast<Address>(simulator_->get_register( |
| 247 Simulator::r11)); | 247 Simulator::r11)); |
| 248 #elif V8_TARGET_ARCH_A64 | 248 #elif V8_TARGET_ARCH_ARM64 |
| 249 if (simulator_->sp() == 0 || simulator_->fp() == 0) { | 249 if (simulator_->sp() == 0 || simulator_->fp() == 0) { |
| 250 // It possible that the simulator is interrupted while it is updating | 250 // It possible that the simulator is interrupted while it is updating |
| 251 // the sp or fp register. A64 simulator does this in two steps: | 251 // the sp or fp register. ARM64 simulator does this in two steps: |
| 252 // first setting it to zero and then setting it to the new value. | 252 // first setting it to zero and then setting it to the new value. |
| 253 // Bailout if sp/fp doesn't contain the new value. | 253 // Bailout if sp/fp doesn't contain the new value. |
| 254 return; | 254 return; |
| 255 } | 255 } |
| 256 state->pc = reinterpret_cast<Address>(simulator_->pc()); | 256 state->pc = reinterpret_cast<Address>(simulator_->pc()); |
| 257 state->sp = reinterpret_cast<Address>(simulator_->sp()); | 257 state->sp = reinterpret_cast<Address>(simulator_->sp()); |
| 258 state->fp = reinterpret_cast<Address>(simulator_->fp()); | 258 state->fp = reinterpret_cast<Address>(simulator_->fp()); |
| 259 #elif V8_TARGET_ARCH_MIPS | 259 #elif V8_TARGET_ARCH_MIPS |
| 260 state->pc = reinterpret_cast<Address>(simulator_->get_pc()); | 260 state->pc = reinterpret_cast<Address>(simulator_->get_pc()); |
| 261 state->sp = reinterpret_cast<Address>(simulator_->get_register( | 261 state->sp = reinterpret_cast<Address>(simulator_->get_register( |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 Sampler* sampler = isolate->logger()->sampler(); | 350 Sampler* sampler = isolate->logger()->sampler(); |
| 351 if (sampler == NULL) return; | 351 if (sampler == NULL) return; |
| 352 | 352 |
| 353 RegisterState state; | 353 RegisterState state; |
| 354 | 354 |
| 355 #if defined(USE_SIMULATOR) | 355 #if defined(USE_SIMULATOR) |
| 356 SimulatorHelper helper; | 356 SimulatorHelper helper; |
| 357 if (!helper.Init(sampler, isolate)) return; | 357 if (!helper.Init(sampler, isolate)) return; |
| 358 helper.FillRegisters(&state); | 358 helper.FillRegisters(&state); |
| 359 // It possible that the simulator is interrupted while it is updating | 359 // It possible that the simulator is interrupted while it is updating |
| 360 // the sp or fp register. A64 simulator does this in two steps: | 360 // the sp or fp register. ARM64 simulator does this in two steps: |
| 361 // first setting it to zero and then setting it to the new value. | 361 // first setting it to zero and then setting it to the new value. |
| 362 // Bailout if sp/fp doesn't contain the new value. | 362 // Bailout if sp/fp doesn't contain the new value. |
| 363 if (state.sp == 0 || state.fp == 0) return; | 363 if (state.sp == 0 || state.fp == 0) return; |
| 364 #else | 364 #else |
| 365 // Extracting the sample from the context is extremely machine dependent. | 365 // Extracting the sample from the context is extremely machine dependent. |
| 366 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); | 366 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); |
| 367 #if !V8_OS_OPENBSD | 367 #if !V8_OS_OPENBSD |
| 368 mcontext_t& mcontext = ucontext->uc_mcontext; | 368 mcontext_t& mcontext = ucontext->uc_mcontext; |
| 369 #endif | 369 #endif |
| 370 #if V8_OS_LINUX | 370 #if V8_OS_LINUX |
| (...skipping 12 matching lines...) Expand all Loading... |
| 383 // values from mcontext_t. | 383 // values from mcontext_t. |
| 384 state.pc = reinterpret_cast<Address>(mcontext.gregs[R15]); | 384 state.pc = reinterpret_cast<Address>(mcontext.gregs[R15]); |
| 385 state.sp = reinterpret_cast<Address>(mcontext.gregs[R13]); | 385 state.sp = reinterpret_cast<Address>(mcontext.gregs[R13]); |
| 386 state.fp = reinterpret_cast<Address>(mcontext.gregs[R11]); | 386 state.fp = reinterpret_cast<Address>(mcontext.gregs[R11]); |
| 387 #else | 387 #else |
| 388 state.pc = reinterpret_cast<Address>(mcontext.arm_pc); | 388 state.pc = reinterpret_cast<Address>(mcontext.arm_pc); |
| 389 state.sp = reinterpret_cast<Address>(mcontext.arm_sp); | 389 state.sp = reinterpret_cast<Address>(mcontext.arm_sp); |
| 390 state.fp = reinterpret_cast<Address>(mcontext.arm_fp); | 390 state.fp = reinterpret_cast<Address>(mcontext.arm_fp); |
| 391 #endif // defined(__GLIBC__) && !defined(__UCLIBC__) && | 391 #endif // defined(__GLIBC__) && !defined(__UCLIBC__) && |
| 392 // (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) | 392 // (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) |
| 393 #elif V8_HOST_ARCH_A64 | 393 #elif V8_HOST_ARCH_ARM64 |
| 394 state.pc = reinterpret_cast<Address>(mcontext.pc); | 394 state.pc = reinterpret_cast<Address>(mcontext.pc); |
| 395 state.sp = reinterpret_cast<Address>(mcontext.sp); | 395 state.sp = reinterpret_cast<Address>(mcontext.sp); |
| 396 // FP is an alias for x29. | 396 // FP is an alias for x29. |
| 397 state.fp = reinterpret_cast<Address>(mcontext.regs[29]); | 397 state.fp = reinterpret_cast<Address>(mcontext.regs[29]); |
| 398 #elif V8_HOST_ARCH_MIPS | 398 #elif V8_HOST_ARCH_MIPS |
| 399 state.pc = reinterpret_cast<Address>(mcontext.pc); | 399 state.pc = reinterpret_cast<Address>(mcontext.pc); |
| 400 state.sp = reinterpret_cast<Address>(mcontext.gregs[29]); | 400 state.sp = reinterpret_cast<Address>(mcontext.gregs[29]); |
| 401 state.fp = reinterpret_cast<Address>(mcontext.gregs[30]); | 401 state.fp = reinterpret_cast<Address>(mcontext.gregs[30]); |
| 402 #endif // V8_HOST_ARCH_* | 402 #endif // V8_HOST_ARCH_* |
| 403 #elif V8_OS_MACOSX | 403 #elif V8_OS_MACOSX |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 #endif // USE_SIMULATOR | 733 #endif // USE_SIMULATOR |
| 734 SampleStack(state); | 734 SampleStack(state); |
| 735 } | 735 } |
| 736 ResumeThread(profiled_thread); | 736 ResumeThread(profiled_thread); |
| 737 } | 737 } |
| 738 | 738 |
| 739 #endif // USE_SIGNALS | 739 #endif // USE_SIGNALS |
| 740 | 740 |
| 741 | 741 |
| 742 } } // namespace v8::internal | 742 } } // namespace v8::internal |
| OLD | NEW |