Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Unified Diff: src/runtime-profiler.cc

Issue 6825054: Add global setup for runtime profiler. (Closed)
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime-profiler.h ('k') | src/v8.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « src/runtime-profiler.h ('k') | src/v8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698