From 6485ea0dfeb0bbe4af3e388e8f01685bb2e32acf Mon Sep 17 00:00:00 2001 From: Paul Bone Date: Fri, 5 Oct 2018 10:52:43 +1000 Subject: [PATCH] Bug 1496623 - Rename and comment GeckoProfilerThread::installed() r=njn --HG-- extra : rebase_source : 2478d8e26f702c9bdbd933a18e36df5232353dc8 extra : histedit_source : 95df9357a34d2c3b1a96856d2df0f63de407e4cc --- js/public/ProfilingStack.h | 10 +++++++--- js/src/shell/js.cpp | 2 +- js/src/vm/GeckoProfiler-inl.h | 4 ++-- js/src/vm/GeckoProfiler.cpp | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/js/public/ProfilingStack.h b/js/public/ProfilingStack.h index 66b770eb990d..fde10ad148de 100644 --- a/js/public/ProfilingStack.h +++ b/js/public/ProfilingStack.h @@ -474,12 +474,16 @@ class GeckoProfilerThread public: GeckoProfilerThread(); - uint32_t stackPointer() { MOZ_ASSERT(installed()); return profilingStack_->stackPointer; } + uint32_t stackPointer() { MOZ_ASSERT(infraInstalled()); return profilingStack_->stackPointer; } ProfilingStackFrame* stack() { return profilingStack_->frames; } ProfilingStack* getProfilingStack() { return profilingStack_; } - /* management of whether instrumentation is on or off */ - bool installed() { return profilingStack_ != nullptr; } + /* + * True if the profiler infrastructure is setup. Should be true in builds + * that include profiler support except during early startup or late + * shutdown. Unrelated to the presence of the Gecko Profiler addon. + */ + bool infraInstalled() { return profilingStack_ != nullptr; } void setProfilingStack(ProfilingStack* profilingStack); void trace(JSTracer* trc); diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 5b794edd3e8a..18c0b0476226 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -3820,7 +3820,7 @@ EvalInContext(JSContext* cx, unsigned argc, Value* vp) static bool EnsureGeckoProfilingStackInstalled(JSContext* cx, ShellContext* sc) { - if (cx->geckoProfiler().installed()) { + if (cx->geckoProfiler().infraInstalled()) { MOZ_ASSERT(sc->geckoProfilingStack); return true; } diff --git a/js/src/vm/GeckoProfiler-inl.h b/js/src/vm/GeckoProfiler-inl.h index 99cd8fe58ea2..47d9d25807f8 100644 --- a/js/src/vm/GeckoProfiler-inl.h +++ b/js/src/vm/GeckoProfiler-inl.h @@ -53,7 +53,7 @@ GeckoProfilerEntryMarker::GeckoProfilerEntryMarker(JSContext* cx, : profiler_(&cx->geckoProfiler()) { MOZ_GUARD_OBJECT_NOTIFIER_INIT; - if (MOZ_LIKELY(!profiler_->installed())) { + if (MOZ_LIKELY(!profiler_->infraInstalled())) { profiler_ = nullptr; return; } @@ -88,7 +88,7 @@ AutoGeckoProfilerEntry::AutoGeckoProfilerEntry(JSContext* cx, const char* label, : profiler_(&cx->geckoProfiler()) { MOZ_GUARD_OBJECT_NOTIFIER_INIT; - if (MOZ_LIKELY(!profiler_->installed())) { + if (MOZ_LIKELY(!profiler_->infraInstalled())) { profiler_ = nullptr; return; } diff --git a/js/src/vm/GeckoProfiler.cpp b/js/src/vm/GeckoProfiler.cpp index 110162d12193..e113e860965b 100644 --- a/js/src/vm/GeckoProfiler.cpp +++ b/js/src/vm/GeckoProfiler.cpp @@ -85,7 +85,7 @@ void GeckoProfilerRuntime::enable(bool enabled) { JSContext* cx = rt->mainContextFromAnyThread(); - MOZ_ASSERT(cx->geckoProfiler().installed()); + MOZ_ASSERT(cx->geckoProfiler().infraInstalled()); if (enabled_ == enabled) { return;