| 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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 TickSample* sample = CpuProfiler::TickSampleEvent(); | 731 TickSample* sample = CpuProfiler::TickSampleEvent(); |
| 732 if (sample == NULL) return; | 732 if (sample == NULL) return; |
| 733 sample->pc = NULL; // Impossible value if sampling succeeds. | 733 sample->pc = NULL; // Impossible value if sampling succeeds. |
| 734 sample->frames_count = 0; | 734 sample->frames_count = 0; |
| 735 #else | 735 #else |
| 736 TickSample sample_obj; | 736 TickSample sample_obj; |
| 737 TickSample* sample = &sample_obj; | 737 TickSample* sample = &sample_obj; |
| 738 #endif | 738 #endif |
| 739 | 739 |
| 740 // We always sample the VM state. | 740 // We always sample the VM state. |
| 741 sample->state = Logger::state(); | 741 sample->state = VMState::current_state(); |
| 742 // If profiling, we extract the current pc and sp. | 742 // If profiling, we extract the current pc and sp. |
| 743 if (active_sampler_->IsProfiling()) { | 743 if (active_sampler_->IsProfiling()) { |
| 744 // Extracting the sample from the context is extremely machine dependent. | 744 // Extracting the sample from the context is extremely machine dependent. |
| 745 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); | 745 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); |
| 746 mcontext_t& mcontext = ucontext->uc_mcontext; | 746 mcontext_t& mcontext = ucontext->uc_mcontext; |
| 747 #if V8_HOST_ARCH_IA32 | 747 #if V8_HOST_ARCH_IA32 |
| 748 sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]); | 748 sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]); |
| 749 sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]); | 749 sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]); |
| 750 sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]); | 750 sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]); |
| 751 #elif V8_HOST_ARCH_X64 | 751 #elif V8_HOST_ARCH_X64 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 | 840 |
| 841 // This sampler is no longer the active sampler. | 841 // This sampler is no longer the active sampler. |
| 842 active_sampler_ = NULL; | 842 active_sampler_ = NULL; |
| 843 active_ = false; | 843 active_ = false; |
| 844 } | 844 } |
| 845 | 845 |
| 846 | 846 |
| 847 #endif // ENABLE_LOGGING_AND_PROFILING | 847 #endif // ENABLE_LOGGING_AND_PROFILING |
| 848 | 848 |
| 849 } } // namespace v8::internal | 849 } } // namespace v8::internal |
| OLD | NEW |