| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 if (signal != SIGPROF) return; | 474 if (signal != SIGPROF) return; |
| 475 if (active_sampler_ == NULL) return; | 475 if (active_sampler_ == NULL) return; |
| 476 | 476 |
| 477 TickSample sample; | 477 TickSample sample; |
| 478 | 478 |
| 479 // If profiling, we extract the current pc and sp. | 479 // If profiling, we extract the current pc and sp. |
| 480 if (active_sampler_->IsProfiling()) { | 480 if (active_sampler_->IsProfiling()) { |
| 481 // Extracting the sample from the context is extremely machine dependent. | 481 // Extracting the sample from the context is extremely machine dependent. |
| 482 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); | 482 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); |
| 483 mcontext_t& mcontext = ucontext->uc_mcontext; | 483 mcontext_t& mcontext = ucontext->uc_mcontext; |
| 484 #if V8_HOST_ARCH_X64 |
| 485 UNIMPLEMENTED(); |
| 486 USE(mcontext); |
| 487 sample.pc = 0; |
| 488 sample.sp = 0; |
| 489 sample.fp = 0; |
| 490 #elif V8_HOST_ARCH_IA32 |
| 484 #if __DARWIN_UNIX03 | 491 #if __DARWIN_UNIX03 |
| 485 sample.pc = mcontext->__ss.__eip; | 492 sample.pc = mcontext->__ss.__eip; |
| 486 sample.sp = mcontext->__ss.__esp; | 493 sample.sp = mcontext->__ss.__esp; |
| 487 sample.fp = mcontext->__ss.__ebp; | 494 sample.fp = mcontext->__ss.__ebp; |
| 488 #else // !__DARWIN_UNIX03 | 495 #else // !__DARWIN_UNIX03 |
| 489 sample.pc = mcontext->ss.eip; | 496 sample.pc = mcontext->ss.eip; |
| 490 sample.sp = mcontext->ss.esp; | 497 sample.sp = mcontext->ss.esp; |
| 491 sample.fp = mcontext->ss.ebp; | 498 sample.fp = mcontext->ss.ebp; |
| 492 #endif // __DARWIN_UNIX03 | 499 #endif // __DARWIN_UNIX03 |
| 500 #else |
| 501 #error Unsupported Mac OS X host architecture. |
| 502 #endif // V8_TARGET_ARCH_IA32 |
| 493 } | 503 } |
| 494 | 504 |
| 495 // We always sample the VM state. | 505 // We always sample the VM state. |
| 496 sample.state = Logger::state(); | 506 sample.state = Logger::state(); |
| 497 | 507 |
| 498 active_sampler_->Tick(&sample); | 508 active_sampler_->Tick(&sample); |
| 499 } | 509 } |
| 500 | 510 |
| 501 | 511 |
| 502 class Sampler::PlatformData : public Malloced { | 512 class Sampler::PlatformData : public Malloced { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 } | 568 } |
| 559 | 569 |
| 560 // This sampler is no longer the active sampler. | 570 // This sampler is no longer the active sampler. |
| 561 active_sampler_ = NULL; | 571 active_sampler_ = NULL; |
| 562 active_ = false; | 572 active_ = false; |
| 563 } | 573 } |
| 564 | 574 |
| 565 #endif // ENABLE_LOGGING_AND_PROFILING | 575 #endif // ENABLE_LOGGING_AND_PROFILING |
| 566 | 576 |
| 567 } } // namespace v8::internal | 577 } } // namespace v8::internal |
| OLD | NEW |