Index: src/runtime-profiler.cc |
diff --git a/src/runtime-profiler.cc b/src/runtime-profiler.cc |
index 5b0aa8f72868f9ca8a7bfadf631db9afd6ba299d..97f034169e5677a1b38751a78328760714b4ecdd 100644 |
--- a/src/runtime-profiler.cc |
+++ b/src/runtime-profiler.cc |
@@ -114,6 +114,11 @@ Atomic32 RuntimeProfiler::state_ = 0; |
Semaphore* RuntimeProfiler::semaphore_ = OS::CreateSemaphore(0); |
#endif |
+#ifdef DEBUG |
+bool RuntimeProfiler::has_been_globally_setup_ = false; |
+#endif |
+bool RuntimeProfiler::enabled_ = false; |
+ |
RuntimeProfiler::RuntimeProfiler(Isolate* isolate) |
: isolate_(isolate), |
@@ -134,8 +139,12 @@ RuntimeProfiler::RuntimeProfiler(Isolate* isolate) |
} |
-bool RuntimeProfiler::IsEnabled() { |
- return V8::UseCrankshaft() && FLAG_opt; |
+void RuntimeProfiler::GlobalSetup() { |
+ ASSERT(!has_been_globally_setup_); |
+ enabled_ = V8::UseCrankshaft() && FLAG_opt; |
+#ifdef DEBUG |
+ has_been_globally_setup_ = true; |
+#endif |
} |
@@ -363,6 +372,7 @@ void RuntimeProfiler::NotifyTick() { |
void RuntimeProfiler::Setup() { |
+ ASSERT(has_been_globally_setup_); |
ClearSampleBuffer(); |
// If the ticker hasn't already started, make sure to do so to get |
// the ticks for the runtime profiler. |