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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
593 if (signal != SIGPROF) return; | 593 if (signal != SIGPROF) return; |
594 if (active_sampler_ == NULL) return; | 594 if (active_sampler_ == NULL) return; |
595 | 595 |
596 TickSample sample; | 596 TickSample sample; |
597 | 597 |
598 // If profiling, we extract the current pc and sp. | 598 // If profiling, we extract the current pc and sp. |
599 if (active_sampler_->IsProfiling()) { | 599 if (active_sampler_->IsProfiling()) { |
600 // Extracting the sample from the context is extremely machine dependent. | 600 // Extracting the sample from the context is extremely machine dependent. |
601 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); | 601 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); |
602 mcontext_t& mcontext = ucontext->uc_mcontext; | 602 mcontext_t& mcontext = ucontext->uc_mcontext; |
603 #if V8_HOST_ARCH_X86 | 603 #if V8_HOST_ARCH_IA32 |
604 sample.pc = mcontext.gregs[REG_EIP]; | 604 sample.pc = mcontext.gregs[REG_EIP]; |
605 sample.sp = mcontext.gregs[REG_ESP]; | 605 sample.sp = mcontext.gregs[REG_ESP]; |
606 sample.fp = mcontext.gregs[REG_EBP]; | 606 sample.fp = mcontext.gregs[REG_EBP]; |
607 #elif V8_HOST_ARCH_X64 | 607 #elif V8_HOST_ARCH_X64 |
608 UNIMPLEMENTED(); | 608 UNIMPLEMENTED(); |
609 sample.pc = mcontext.gregs[REG_RIP]; | 609 sample.pc = mcontext.gregs[REG_RIP]; |
610 sample.sp = mcontext.gregs[REG_RSP]; | 610 sample.sp = mcontext.gregs[REG_RSP]; |
611 sample.fp = mcontext.gregs[REG_RBP]; | 611 sample.fp = mcontext.gregs[REG_RBP]; |
612 #elif V8_HOST_ARCH_ARM | 612 #elif V8_HOST_ARCH_ARM |
613 sample.pc = mcontext.gregs[R15]; | 613 sample.pc = mcontext.gregs[R15]; |
614 sample.sp = mcontext.gregs[R13]; | 614 sample.sp = mcontext.gregs[R13]; |
615 sample.fp = mcontext.gregs[R11]; | 615 sample.fp = mcontext.gregs[R11]; |
616 #endif | 616 #endif |
iposva
2009/05/08 18:12:35
As I suggested before this would have been found e
| |
617 } | 617 } |
618 | 618 |
619 // We always sample the VM state. | 619 // We always sample the VM state. |
620 sample.state = Logger::state(); | 620 sample.state = Logger::state(); |
621 | 621 |
622 active_sampler_->Tick(&sample); | 622 active_sampler_->Tick(&sample); |
623 } | 623 } |
624 | 624 |
625 | 625 |
626 class Sampler::PlatformData : public Malloced { | 626 class Sampler::PlatformData : public Malloced { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
682 } | 682 } |
683 | 683 |
684 // This sampler is no longer the active sampler. | 684 // This sampler is no longer the active sampler. |
685 active_sampler_ = NULL; | 685 active_sampler_ = NULL; |
686 active_ = false; | 686 active_ = false; |
687 } | 687 } |
688 | 688 |
689 #endif // ENABLE_LOGGING_AND_PROFILING | 689 #endif // ENABLE_LOGGING_AND_PROFILING |
690 | 690 |
691 } } // namespace v8::internal | 691 } } // namespace v8::internal |
OLD | NEW |