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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 if (active_sampler_ == NULL) return; | 700 if (active_sampler_ == NULL) return; |
701 | 701 |
702 TickSample sample; | 702 TickSample sample; |
703 | 703 |
704 // If profiling, we extract the current pc and sp. | 704 // If profiling, we extract the current pc and sp. |
705 if (active_sampler_->IsProfiling()) { | 705 if (active_sampler_->IsProfiling()) { |
706 // Extracting the sample from the context is extremely machine dependent. | 706 // Extracting the sample from the context is extremely machine dependent. |
707 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); | 707 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); |
708 mcontext_t& mcontext = ucontext->uc_mcontext; | 708 mcontext_t& mcontext = ucontext->uc_mcontext; |
709 #if V8_HOST_ARCH_IA32 | 709 #if V8_HOST_ARCH_IA32 |
710 sample.pc = mcontext.gregs[REG_EIP]; | 710 sample.pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]); |
711 sample.sp = mcontext.gregs[REG_ESP]; | 711 sample.sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]); |
712 sample.fp = mcontext.gregs[REG_EBP]; | 712 sample.fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]); |
713 #elif V8_HOST_ARCH_X64 | 713 #elif V8_HOST_ARCH_X64 |
714 sample.pc = mcontext.gregs[REG_RIP]; | 714 sample.pc = reinterpret_cast<Address>(mcontext.gregs[REG_RIP]); |
715 sample.sp = mcontext.gregs[REG_RSP]; | 715 sample.sp = reinterpret_cast<Address>(mcontext.gregs[REG_RSP]); |
716 sample.fp = mcontext.gregs[REG_RBP]; | 716 sample.fp = reinterpret_cast<Address>(mcontext.gregs[REG_RBP]); |
717 #elif V8_HOST_ARCH_ARM | 717 #elif V8_HOST_ARCH_ARM |
718 // An undefined macro evaluates to 0, so this applies to Android's Bionic also. | 718 // An undefined macro evaluates to 0, so this applies to Android's Bionic also. |
719 #if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) | 719 #if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) |
720 sample.pc = mcontext.gregs[R15]; | 720 sample.pc = reinterpret_cast<Address>(mcontext.gregs[R15]); |
721 sample.sp = mcontext.gregs[R13]; | 721 sample.sp = reinterpret_cast<Address>(mcontext.gregs[R13]); |
722 sample.fp = mcontext.gregs[R11]; | 722 sample.fp = reinterpret_cast<Address>(mcontext.gregs[R11]); |
723 #else | 723 #else |
724 sample.pc = mcontext.arm_pc; | 724 sample.pc = reinterpret_cast<Address>(mcontext.arm_pc); |
725 sample.sp = mcontext.arm_sp; | 725 sample.sp = reinterpret_cast<Address>(mcontext.arm_sp); |
726 sample.fp = mcontext.arm_fp; | 726 sample.fp = reinterpret_cast<Address>(mcontext.arm_fp); |
727 #endif | 727 #endif |
728 #endif | 728 #endif |
729 if (IsVmThread()) | 729 if (IsVmThread()) |
730 active_sampler_->SampleStack(&sample); | 730 active_sampler_->SampleStack(&sample); |
731 } | 731 } |
732 | 732 |
733 // We always sample the VM state. | 733 // We always sample the VM state. |
734 sample.state = Logger::state(); | 734 sample.state = Logger::state(); |
735 | 735 |
736 active_sampler_->Tick(&sample); | 736 active_sampler_->Tick(&sample); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 | 799 |
800 // This sampler is no longer the active sampler. | 800 // This sampler is no longer the active sampler. |
801 active_sampler_ = NULL; | 801 active_sampler_ = NULL; |
802 active_ = false; | 802 active_ = false; |
803 } | 803 } |
804 | 804 |
805 | 805 |
806 #endif // ENABLE_LOGGING_AND_PROFILING | 806 #endif // ENABLE_LOGGING_AND_PROFILING |
807 | 807 |
808 } } // namespace v8::internal | 808 } } // namespace v8::internal |
OLD | NEW |