| 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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 static Sampler* active_sampler_ = NULL; | 562 static Sampler* active_sampler_ = NULL; |
| 563 | 563 |
| 564 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { | 564 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { |
| 565 USE(info); | 565 USE(info); |
| 566 if (signal != SIGPROF) return; | 566 if (signal != SIGPROF) return; |
| 567 if (active_sampler_ == NULL) return; | 567 if (active_sampler_ == NULL) return; |
| 568 | 568 |
| 569 TickSample sample; | 569 TickSample sample; |
| 570 | 570 |
| 571 // We always sample the VM state. | 571 // We always sample the VM state. |
| 572 sample.state = Logger::state(); | 572 sample.state = VMState::current_state(); |
| 573 | 573 |
| 574 // If profiling, we extract the current pc and sp. | 574 // If profiling, we extract the current pc and sp. |
| 575 if (active_sampler_->IsProfiling()) { | 575 if (active_sampler_->IsProfiling()) { |
| 576 // Extracting the sample from the context is extremely machine dependent. | 576 // Extracting the sample from the context is extremely machine dependent. |
| 577 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); | 577 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); |
| 578 mcontext_t& mcontext = ucontext->uc_mcontext; | 578 mcontext_t& mcontext = ucontext->uc_mcontext; |
| 579 #if V8_HOST_ARCH_IA32 | 579 #if V8_HOST_ARCH_IA32 |
| 580 sample.pc = reinterpret_cast<Address>(mcontext.mc_eip); | 580 sample.pc = reinterpret_cast<Address>(mcontext.mc_eip); |
| 581 sample.sp = reinterpret_cast<Address>(mcontext.mc_esp); | 581 sample.sp = reinterpret_cast<Address>(mcontext.mc_esp); |
| 582 sample.fp = reinterpret_cast<Address>(mcontext.mc_ebp); | 582 sample.fp = reinterpret_cast<Address>(mcontext.mc_ebp); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 } | 655 } |
| 656 | 656 |
| 657 // This sampler is no longer the active sampler. | 657 // This sampler is no longer the active sampler. |
| 658 active_sampler_ = NULL; | 658 active_sampler_ = NULL; |
| 659 active_ = false; | 659 active_ = false; |
| 660 } | 660 } |
| 661 | 661 |
| 662 #endif // ENABLE_LOGGING_AND_PROFILING | 662 #endif // ENABLE_LOGGING_AND_PROFILING |
| 663 | 663 |
| 664 } } // namespace v8::internal | 664 } } // namespace v8::internal |
| OLD | NEW |