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 defined(__arm__) || defined(__thumb__) | 603 #if V8_HOST_ARCH_X86 |
604 sample.pc = mcontext.gregs[REG_EIP]; | |
605 sample.sp = mcontext.gregs[REG_ESP]; | |
606 sample.fp = mcontext.gregs[REG_EBP]; | |
607 #elif V8_HOST_ARCH_X64 | |
608 sample.pc = mcontext.gregs[REG_RIP]; | |
Lasse Reichstein
2009/05/06 11:05:27
Does the assignment compile, and throw away the up
Dean McNamee
2009/05/06 11:07:15
It does compile, but I'll just do UNIMPLEMENTED :\
| |
609 sample.sp = mcontext.gregs[REG_RSP]; | |
610 sample.fp = mcontext.gregs[REG_RBP]; | |
611 #elif V8_HOST_ARCH_ARM | |
604 sample.pc = mcontext.gregs[R15]; | 612 sample.pc = mcontext.gregs[R15]; |
605 sample.sp = mcontext.gregs[R13]; | 613 sample.sp = mcontext.gregs[R13]; |
606 sample.fp = mcontext.gregs[R11]; | 614 sample.fp = mcontext.gregs[R11]; |
607 #else | |
608 sample.pc = mcontext.gregs[REG_EIP]; | |
609 sample.sp = mcontext.gregs[REG_ESP]; | |
610 sample.fp = mcontext.gregs[REG_EBP]; | |
611 #endif | 615 #endif |
612 } | 616 } |
613 | 617 |
614 // We always sample the VM state. | 618 // We always sample the VM state. |
615 sample.state = Logger::state(); | 619 sample.state = Logger::state(); |
616 | 620 |
617 active_sampler_->Tick(&sample); | 621 active_sampler_->Tick(&sample); |
618 } | 622 } |
619 | 623 |
620 | 624 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
677 } | 681 } |
678 | 682 |
679 // This sampler is no longer the active sampler. | 683 // This sampler is no longer the active sampler. |
680 active_sampler_ = NULL; | 684 active_sampler_ = NULL; |
681 active_ = false; | 685 active_ = false; |
682 } | 686 } |
683 | 687 |
684 #endif // ENABLE_LOGGING_AND_PROFILING | 688 #endif // ENABLE_LOGGING_AND_PROFILING |
685 | 689 |
686 } } // namespace v8::internal | 690 } } // namespace v8::internal |
OLD | NEW |