| 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 | 635 |
| 636 | 636 |
| 637 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { | 637 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { |
| 638 USE(info); | 638 USE(info); |
| 639 if (signal != SIGPROF) return; | 639 if (signal != SIGPROF) return; |
| 640 Isolate* isolate = Isolate::UncheckedCurrent(); | 640 Isolate* isolate = Isolate::UncheckedCurrent(); |
| 641 if (isolate == NULL || !isolate->IsInitialized() || !isolate->IsInUse()) { | 641 if (isolate == NULL || !isolate->IsInitialized() || !isolate->IsInUse()) { |
| 642 // We require a fully initialized and entered isolate. | 642 // We require a fully initialized and entered isolate. |
| 643 return; | 643 return; |
| 644 } | 644 } |
| 645 if (v8::Locker::IsActive() && |
| 646 !isolate->thread_manager()->IsLockedByCurrentThread()) { |
| 647 return; |
| 648 } |
| 649 |
| 645 Sampler* sampler = isolate->logger()->sampler(); | 650 Sampler* sampler = isolate->logger()->sampler(); |
| 646 if (sampler == NULL || !sampler->IsActive()) return; | 651 if (sampler == NULL || !sampler->IsActive()) return; |
| 647 | 652 |
| 648 TickSample sample_obj; | 653 TickSample sample_obj; |
| 649 TickSample* sample = CpuProfiler::TickSampleEvent(isolate); | 654 TickSample* sample = CpuProfiler::TickSampleEvent(isolate); |
| 650 if (sample == NULL) sample = &sample_obj; | 655 if (sample == NULL) sample = &sample_obj; |
| 651 | 656 |
| 652 // Extracting the sample from the context is extremely machine dependent. | 657 // Extracting the sample from the context is extremely machine dependent. |
| 653 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); | 658 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); |
| 654 mcontext_t& mcontext = ucontext->uc_mcontext; | 659 mcontext_t& mcontext = ucontext->uc_mcontext; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 | 841 |
| 837 void Sampler::Stop() { | 842 void Sampler::Stop() { |
| 838 ASSERT(IsActive()); | 843 ASSERT(IsActive()); |
| 839 SignalSender::RemoveActiveSampler(this); | 844 SignalSender::RemoveActiveSampler(this); |
| 840 SetActive(false); | 845 SetActive(false); |
| 841 } | 846 } |
| 842 | 847 |
| 843 #endif // ENABLE_LOGGING_AND_PROFILING | 848 #endif // ENABLE_LOGGING_AND_PROFILING |
| 844 | 849 |
| 845 } } // namespace v8::internal | 850 } } // namespace v8::internal |
| OLD | NEW |