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 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 | 846 |
847 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { | 847 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { |
848 #ifndef V8_HOST_ARCH_MIPS | 848 #ifndef V8_HOST_ARCH_MIPS |
849 USE(info); | 849 USE(info); |
850 if (signal != SIGPROF) return; | 850 if (signal != SIGPROF) return; |
851 Isolate* isolate = Isolate::UncheckedCurrent(); | 851 Isolate* isolate = Isolate::UncheckedCurrent(); |
852 if (isolate == NULL || !isolate->IsInitialized() || !isolate->IsInUse()) { | 852 if (isolate == NULL || !isolate->IsInitialized() || !isolate->IsInUse()) { |
853 // We require a fully initialized and entered isolate. | 853 // We require a fully initialized and entered isolate. |
854 return; | 854 return; |
855 } | 855 } |
| 856 if (v8::Locker::IsActive() && |
| 857 !isolate->thread_manager()->IsLockedByCurrentThread()) { |
| 858 return; |
| 859 } |
| 860 |
856 Sampler* sampler = isolate->logger()->sampler(); | 861 Sampler* sampler = isolate->logger()->sampler(); |
857 if (sampler == NULL || !sampler->IsActive()) return; | 862 if (sampler == NULL || !sampler->IsActive()) return; |
858 | 863 |
859 TickSample sample_obj; | 864 TickSample sample_obj; |
860 TickSample* sample = CpuProfiler::TickSampleEvent(isolate); | 865 TickSample* sample = CpuProfiler::TickSampleEvent(isolate); |
861 if (sample == NULL) sample = &sample_obj; | 866 if (sample == NULL) sample = &sample_obj; |
862 | 867 |
863 // Extracting the sample from the context is extremely machine dependent. | 868 // Extracting the sample from the context is extremely machine dependent. |
864 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); | 869 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); |
865 mcontext_t& mcontext = ucontext->uc_mcontext; | 870 mcontext_t& mcontext = ucontext->uc_mcontext; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 | 1083 |
1079 void Sampler::Stop() { | 1084 void Sampler::Stop() { |
1080 ASSERT(IsActive()); | 1085 ASSERT(IsActive()); |
1081 SignalSender::RemoveActiveSampler(this); | 1086 SignalSender::RemoveActiveSampler(this); |
1082 SetActive(false); | 1087 SetActive(false); |
1083 } | 1088 } |
1084 | 1089 |
1085 #endif // ENABLE_LOGGING_AND_PROFILING | 1090 #endif // ENABLE_LOGGING_AND_PROFILING |
1086 | 1091 |
1087 } } // namespace v8::internal | 1092 } } // namespace v8::internal |
OLD | NEW |