Bug 1461555 - Rename PseudoStack to ProfilingStack. r?njn draft
authorMarkus Stange <mstange@themasta.com>
Tue, 15 May 2018 01:03:11 -0400
changeset 795164 8bdf8fdfbe7903fd35e3ecf6f2523c5840995e02
parent 795163 fef873ca19b47fe52604c0330e0f6b920542a991
push id109880
push userbmo:mstange@themasta.com
push dateTue, 15 May 2018 05:14:38 +0000
reviewersnjn
bugs1461555
milestone62.0a1
Bug 1461555 - Rename PseudoStack to ProfilingStack. r?njn This also changes many references to the 'pseudo stack' to refer to the 'label stack' instead. The label stack is one of the two stacks that are managed by the profiling stack, the other stack being the JS interpreter stack. MozReview-Commit-ID: Ed0YMMeCBY8
devtools/client/performance/modules/categories.js
js/public/ProfilingStack.h
js/public/RootingAPI.h
js/src/gc/GC.cpp
js/src/gc/GCInternals.h
js/src/jsapi-tests/testProfileStrings.cpp
js/src/shell/js.cpp
js/src/shell/jsshell.h
js/src/vm/GeckoProfiler-inl.h
js/src/vm/GeckoProfiler.cpp
js/src/vm/ProfilingStack.cpp
js/src/vm/SavedStacks.cpp
mozglue/misc/AutoProfilerLabel.cpp
mozglue/misc/AutoProfilerLabel.h
toolkit/components/backgroundhangmonitor/ThreadStackHelper.cpp
toolkit/components/backgroundhangmonitor/ThreadStackHelper.h
toolkit/components/telemetry/docs/data/backgroundhangmonitor-ping.rst
toolkit/components/telemetry/docs/data/main-ping.rst
tools/profiler/core/ProfileBuffer.cpp
tools/profiler/core/ProfileBufferEntry.cpp
tools/profiler/core/RegisteredThread.h
tools/profiler/core/platform.cpp
tools/profiler/public/GeckoProfiler.h
tools/profiler/tests/gtest/GeckoProfiler.cpp
--- a/devtools/client/performance/modules/categories.js
+++ b/devtools/client/performance/modules/categories.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 
 const { L10N } = require("devtools/client/performance/modules/global");
 
 /**
- * Details about each profile pseudo-stack entry cateogry.
+ * Details about each label stack frame category.
  * @see CATEGORY_MAPPINGS.
  */
 const CATEGORIES = [{
   color: "#5e88b0",
   abbrev: "other",
   label: L10N.getStr("category.other")
 }, {
   color: "#46afe3",
--- a/js/public/ProfilingStack.h
+++ b/js/public/ProfilingStack.h
@@ -21,53 +21,56 @@
 #endif // JS_BROKEN_GCC_ATTRIBUTE_WARNING
 
 class JS_PUBLIC_API(JSTracer);
 
 #ifdef JS_BROKEN_GCC_ATTRIBUTE_WARNING
 #pragma GCC diagnostic pop
 #endif // JS_BROKEN_GCC_ATTRIBUTE_WARNING
 
-class PseudoStack;
+class ProfilingStack;
 
-// This file defines the classes PseudoStack and ProfilingStackFrame.
-// The PseudoStack manages an array of ProfilingStackFrames.
+// This file defines the classes ProfilingStack and ProfilingStackFrame.
+// The ProfilingStack manages an array of ProfilingStackFrames.
+// It keeps track of the "label stack" and the JS interpreter stack.
+// The two stack types are interleaved.
+//
 // Usage:
 //
-//  PseudoStack* pseudoStack = ...;
+//  ProfilingStack* profilingStack = ...;
 //
 //  // For label frames:
-//  pseudoStack->pushLabelFrame(...);
+//  profilingStack->pushLabelFrame(...);
 //  // Execute some code. When finished, pop the frame:
-//  pseudoStack->pop();
+//  profilingStack->pop();
 //
 //  // For JS stack frames:
-//  pseudoStack->pushJSFrame(...);
+//  profilingStack->pushJSFrame(...);
 //  // Execute some code. When finished, pop the frame:
-//  pseudoStack->pop();
+//  profilingStack->pop();
 //
 //
 // Concurrency considerations
 //
-// A thread's pseudo stack (and the frames inside it) is only modified by
-// that thread. However, the pseudo stack can be *read* by a different thread,
+// A thread's profiling stack (and the frames inside it) is only modified by
+// that thread. However, the profiling stack can be *read* by a different thread,
 // the sampler thread: Whenever the profiler wants to sample a given thread A,
 // the following happens:
 //  (1) Thread A is suspended.
-//  (2) The sampler thread (thread S) reads the PseudoStack of thread A,
+//  (2) The sampler thread (thread S) reads the ProfilingStack of thread A,
 //      including all ProfilingStackFrames that are currently in that stack
-//      (pseudoStack->frames[0..pseudoStack->stackSize()]).
+//      (profilingStack->frames[0..profilingStack->stackSize()]).
 //  (3) Thread A is resumed.
 //
 // Thread suspension is achieved using platform-specific APIs; refer to each
 // platform's Sampler::SuspendAndSampleAndResumeThread implementation in
 // platform-*.cpp for details.
 //
-// When the thread is suspended, the values in pseudoStack->stackPointer and in
-// the stack frame range pseudoStack->frames[0..pseudoStack->stackPointer] need
+// When the thread is suspended, the values in profilingStack->stackPointer and in
+// the stack frame range profilingStack->frames[0..profilingStack->stackPointer] need
 // to be in a consistent state, so that thread S does not read partially-
 // constructed stack frames. More specifically, we have two requirements:
 //  (1) When adding a new frame at the top of the stack, its ProfilingStackFrame
 //      data needs to be put in place *before* the stackPointer is incremented,
 //      and the compiler + CPU need to know that this order matters.
 //  (2) When popping an frame from the stack and then preparing the
 //      ProfilingStackFrame data for the next frame that is about to be pushed,
 //      the decrement of the stackPointer in pop() needs to happen *before* the
@@ -114,17 +117,17 @@ class ProfilingStackFrame
     // A ProfilingStackFrame represents either a label frame or a JS frame.
 
     // WARNING WARNING WARNING
     //
     // All the fields below are Atomic<...,ReleaseAcquire>. This is needed so
     // that writes to these fields are release-writes, which ensures that
     // earlier writes in this thread don't get reordered after the writes to
     // these fields. In particular, the decrement of the stack pointer in
-    // PseudoStack::pop() is a write that *must* happen before the values in
+    // ProfilingStack::pop() is a write that *must* happen before the values in
     // this ProfilingStackFrame are changed. Otherwise, the sampler thread might
     // see an inconsistent state where the stack pointer still points to a
     // ProfilingStackFrame which has already been popped off the stack and whose
     // fields have now been partially repopulated with new values.
     // See the "Concurrency considerations" paragraph at the top of this file
     // for more details.
 
     // Descriptive label for this stack frame. Must be a static string! Can be
@@ -298,55 +301,55 @@ class ProfilingStackFrame
 
     // The offset of a pc into a script's code can actually be 0, so to
     // signify a nullptr pc, use a -1 index. This is checked against in
     // pc() and setPC() to set/get the right pc.
     static const int32_t NullPCOffset = -1;
 };
 
 JS_FRIEND_API(void)
-SetContextProfilingStack(JSContext* cx, PseudoStack* pseudoStack);
+SetContextProfilingStack(JSContext* cx, ProfilingStack* profilingStack);
 
 // GetContextProfilingStack also exists, but it's defined in RootingAPI.h.
 
 JS_FRIEND_API(void)
 EnableContextProfilingStack(JSContext* cx, bool enabled);
 
 JS_FRIEND_API(void)
 RegisterContextProfilingEventMarker(JSContext* cx, void (*fn)(const char*));
 
 } // namespace js
 
-// Each thread has its own PseudoStack. That thread modifies the PseudoStack,
+// Each thread has its own ProfilingStack. That thread modifies the ProfilingStack,
 // pushing and popping elements as necessary.
 //
-// The PseudoStack is also read periodically by the profiler's sampler thread.
-// This happens only when the thread that owns the PseudoStack is suspended. So
-// there are no genuine parallel accesses.
+// The ProfilingStack is also read periodically by the profiler's sampler thread.
+// This happens only when the thread that owns the ProfilingStack is suspended.
+// So there are no genuine parallel accesses.
 //
 // However, it is possible for pushing/popping to be interrupted by a periodic
 // sample. Because of this, we need pushing/popping to be effectively atomic.
 //
 // - When pushing a new frame, we increment the stack pointer -- making the new
 //   frame visible to the sampler thread -- only after the new frame has been
 //   fully written. The stack pointer is Atomic<uint32_t,ReleaseAcquire>, so
 //   the increment is a release-store, which ensures that this store is not
 //   reordered before the writes of the frame.
 //
 // - When popping an old frame, the only operation is the decrementing of the
 //   stack pointer, which is obviously atomic.
 //
-class PseudoStack final
+class ProfilingStack final
 {
   public:
-    PseudoStack()
+    ProfilingStack()
       : stackPointer(0)
     {}
 
-    ~PseudoStack();
+    ~ProfilingStack();
 
     void pushLabelFrame(const char* label, const char* dynamicString, void* sp,
                         uint32_t line, js::ProfilingStackFrame::Category category) {
         uint32_t oldStackPointer = stackPointer;
 
         if (MOZ_LIKELY(capacity > oldStackPointer) || MOZ_LIKELY(ensureCapacitySlow()))
             frames[oldStackPointer].initLabelFrame(label, dynamicString, sp, line, category);
 
@@ -397,22 +400,22 @@ class PseudoStack final
     uint32_t stackCapacity() const { return capacity; }
 
   private:
     // Out of line path for expanding the buffer, since otherwise this would get inlined in every
     // DOM WebIDL call.
     MOZ_COLD MOZ_MUST_USE bool ensureCapacitySlow();
 
     // No copying.
-    PseudoStack(const PseudoStack&) = delete;
-    void operator=(const PseudoStack&) = delete;
+    ProfilingStack(const ProfilingStack&) = delete;
+    void operator=(const ProfilingStack&) = delete;
 
     // No moving either.
-    PseudoStack(PseudoStack&&) = delete;
-    void operator=(PseudoStack&&) = delete;
+    ProfilingStack(ProfilingStack&&) = delete;
+    void operator=(ProfilingStack&&) = delete;
 
     uint32_t capacity = 0;
 
   public:
 
     // The pointer to the stack frames, this is read from the profiler thread and written from the
     // current thread.
     //
@@ -440,29 +443,29 @@ class GeckoProfilerEntryMarker;
 class GeckoProfilerBaselineOSRMarker;
 
 class GeckoProfilerThread
 {
     friend class AutoGeckoProfilerEntry;
     friend class GeckoProfilerEntryMarker;
     friend class GeckoProfilerBaselineOSRMarker;
 
-    PseudoStack*         pseudoStack_;
+    ProfilingStack*         profilingStack_;
 
   public:
     GeckoProfilerThread();
 
-    uint32_t stackPointer() { MOZ_ASSERT(installed()); return pseudoStack_->stackPointer; }
-    ProfilingStackFrame* stack() { return pseudoStack_->frames; }
-    PseudoStack* getPseudoStack() { return pseudoStack_; }
+    uint32_t stackPointer() { MOZ_ASSERT(installed()); return profilingStack_->stackPointer; }
+    ProfilingStackFrame* stack() { return profilingStack_->frames; }
+    ProfilingStack* getProfilingStack() { return profilingStack_; }
 
     /* management of whether instrumentation is on or off */
-    bool installed() { return pseudoStack_ != nullptr; }
+    bool installed() { return profilingStack_ != nullptr; }
 
-    void setProfilingStack(PseudoStack* pseudoStack);
+    void setProfilingStack(ProfilingStack* profilingStack);
     void trace(JSTracer* trc);
 
     /*
      * Functions which are the actual instrumentation to track run information
      *
      *   - enter: a function has started to execute
      *   - updatePC: updates the pc information about where a function
      *               is currently executing
--- a/js/public/RootingAPI.h
+++ b/js/public/RootingAPI.h
@@ -1025,20 +1025,20 @@ GetContextCompartment(const JSContext* c
 }
 
 inline JS::Zone*
 GetContextZone(const JSContext* cx)
 {
     return JS::RootingContext::get(cx)->zone_;
 }
 
-inline PseudoStack*
+inline ProfilingStack*
 GetContextProfilingStack(JSContext* cx)
 {
-    return JS::RootingContext::get(cx)->geckoProfiler().getPseudoStack();
+    return JS::RootingContext::get(cx)->geckoProfiler().getProfilingStack();
 }
 
 /**
  * Augment the generic Rooted<T> interface when T = JSObject* with
  * class-querying and downcasting operations.
  *
  * Given a Rooted<JSObject*> obj, one can view
  *   Handle<StringObject*> h = obj.as<StringObject*>();
--- a/js/src/gc/GC.cpp
+++ b/js/src/gc/GC.cpp
@@ -6797,28 +6797,28 @@ HeapStateToLabel(JS::HeapState heapState
       case JS::HeapState::MinorCollecting:
         return "js::Nursery::collect";
       case JS::HeapState::MajorCollecting:
         return "js::GCRuntime::collect";
       case JS::HeapState::Tracing:
         return "JS_IterateCompartments";
       case JS::HeapState::Idle:
       case JS::HeapState::CycleCollecting:
-        MOZ_CRASH("Should never have an Idle or CC heap state when pushing GC pseudo frames!");
+        MOZ_CRASH("Should never have an Idle or CC heap state when pushing GC profiling stack frames!");
     }
     MOZ_ASSERT_UNREACHABLE("Should have exhausted every JS::HeapState variant!");
     return nullptr;
 }
 
 /* Start a new heap session. */
 AutoTraceSession::AutoTraceSession(JSRuntime* rt, JS::HeapState heapState)
   : runtime(rt),
     prevState(rt->mainContextFromOwnThread()->heapState),
-    pseudoFrame(rt->mainContextFromOwnThread(), HeapStateToLabel(heapState),
-                ProfilingStackFrame::Category::GC)
+    profilingStackFrame(rt->mainContextFromOwnThread(), HeapStateToLabel(heapState),
+                        ProfilingStackFrame::Category::GC)
 {
     MOZ_ASSERT(prevState == JS::HeapState::Idle);
     MOZ_ASSERT(heapState != JS::HeapState::Idle);
     MOZ_ASSERT_IF(heapState == JS::HeapState::MajorCollecting, rt->gc.nursery().isEmpty());
 
     // Session always begins with lock held, see comment in class definition.
     maybeLock.emplace(rt);
 
--- a/js/src/gc/GCInternals.h
+++ b/js/src/gc/GCInternals.h
@@ -45,17 +45,17 @@ class MOZ_RAII AutoTraceSession
   protected:
     JSRuntime* runtime;
 
   private:
     AutoTraceSession(const AutoTraceSession&) = delete;
     void operator=(const AutoTraceSession&) = delete;
 
     JS::HeapState prevState;
-    AutoGeckoProfilerEntry pseudoFrame;
+    AutoGeckoProfilerEntry profilingStackFrame;
 };
 
 class MOZ_RAII AutoPrepareForTracing
 {
     mozilla::Maybe<AutoTraceSession> session_;
 
   public:
     explicit AutoPrepareForTracing(JSContext* cx);
--- a/js/src/jsapi-tests/testProfileStrings.cpp
+++ b/js/src/jsapi-tests/testProfileStrings.cpp
@@ -7,36 +7,36 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/Atomics.h"
 
 #include "jsapi-tests/tests.h"
 #include "vm/JSContext.h"
 
-static PseudoStack pseudoStack;
+static ProfilingStack profilingStack;
 static uint32_t peakStackPointer = 0;
 
 static void
 reset(JSContext* cx)
 {
-    pseudoStack.stackPointer = 0;
+    profilingStack.stackPointer = 0;
     cx->runtime()->geckoProfiler().stringsReset();
     cx->runtime()->geckoProfiler().enableSlowAssertions(true);
     js::EnableContextProfilingStack(cx, true);
 }
 
 static const JSClass ptestClass = {
     "Prof", 0
 };
 
 static bool
 test_fn(JSContext* cx, unsigned argc, JS::Value* vp)
 {
-    peakStackPointer = pseudoStack.stackPointer;
+    peakStackPointer = profilingStack.stackPointer;
     return true;
 }
 
 static bool
 test_fn2(JSContext* cx, unsigned argc, JS::Value* vp)
 {
     JS::RootedValue r(cx);
     JS::RootedObject global(cx, JS::CurrentGlobalOrNull(cx));
@@ -74,17 +74,17 @@ static const JSFunctionSpec ptestFunctio
     JS_FN("enable", enable, 0, 0),
     JS_FN("disable", disable, 0, 0),
     JS_FS_END
 };
 
 static JSObject*
 initialize(JSContext* cx)
 {
-    js::SetContextProfilingStack(cx, &pseudoStack);
+    js::SetContextProfilingStack(cx, &profilingStack);
     JS::RootedObject global(cx, JS::CurrentGlobalOrNull(cx));
     return JS_InitClass(cx, global, nullptr, &ptestClass, Prof, 0,
                         nullptr, ptestFunctions, nullptr, nullptr);
 }
 
 BEGIN_TEST(testProfileStrings_isCalledWithInterpreter)
 {
     CHECK(initialize(cx));
@@ -100,35 +100,35 @@ BEGIN_TEST(testProfileStrings_isCalledWi
     EXEC("function check2() { var p = new Prof(); p.test_fn2(); }");
 
     reset(cx);
     {
         JS::RootedValue rval(cx);
         /* Make sure the stack resets and we have an entry for each stack */
         CHECK(JS_CallFunctionName(cx, global, "check", JS::HandleValueArray::empty(),
                                   &rval));
-        CHECK(pseudoStack.stackPointer == 0);
+        CHECK(profilingStack.stackPointer == 0);
         CHECK(peakStackPointer >= 8);
         CHECK(cx->runtime()->geckoProfiler().stringsCount() == 8);
         /* Make sure the stack resets and we added no new entries */
         peakStackPointer = 0;
         CHECK(JS_CallFunctionName(cx, global, "check", JS::HandleValueArray::empty(),
                                   &rval));
-        CHECK(pseudoStack.stackPointer == 0);
+        CHECK(profilingStack.stackPointer == 0);
         CHECK(peakStackPointer >= 8);
         CHECK(cx->runtime()->geckoProfiler().stringsCount() == 8);
     }
     reset(cx);
     {
         JS::RootedValue rval(cx);
         CHECK(JS_CallFunctionName(cx, global, "check2", JS::HandleValueArray::empty(),
                                   &rval));
         CHECK(cx->runtime()->geckoProfiler().stringsCount() == 5);
         CHECK(peakStackPointer >= 6);
-        CHECK(pseudoStack.stackPointer == 0);
+        CHECK(profilingStack.stackPointer == 0);
     }
     return true;
 }
 END_TEST(testProfileStrings_isCalledWithInterpreter)
 
 BEGIN_TEST(testProfileStrings_isCalledWithJIT)
 {
     CHECK(initialize(cx));
@@ -146,25 +146,25 @@ BEGIN_TEST(testProfileStrings_isCalledWi
     EXEC("function check2() { var p = new Prof(); p.test_fn2(); }");
 
     reset(cx);
     {
         JS::RootedValue rval(cx);
         /* Make sure the stack resets and we have an entry for each stack */
         CHECK(JS_CallFunctionName(cx, global, "check", JS::HandleValueArray::empty(),
                                   &rval));
-        CHECK(pseudoStack.stackPointer == 0);
+        CHECK(profilingStack.stackPointer == 0);
         CHECK(peakStackPointer >= 8);
 
         /* Make sure the stack resets and we added no new entries */
         uint32_t cnt = cx->runtime()->geckoProfiler().stringsCount();
         peakStackPointer = 0;
         CHECK(JS_CallFunctionName(cx, global, "check", JS::HandleValueArray::empty(),
                                   &rval));
-        CHECK(pseudoStack.stackPointer == 0);
+        CHECK(profilingStack.stackPointer == 0);
         CHECK(cx->runtime()->geckoProfiler().stringsCount() == cnt);
         CHECK(peakStackPointer >= 8);
     }
 
     return true;
 }
 END_TEST(testProfileStrings_isCalledWithJIT)
 
@@ -178,17 +178,17 @@ BEGIN_TEST(testProfileStrings_isCalledWh
 
     reset(cx);
     {
         JS::RootedValue rval(cx);
         /* Make sure the stack resets and we have an entry for each stack */
         bool ok = JS_CallFunctionName(cx, global, "check2", JS::HandleValueArray::empty(),
                                       &rval);
         CHECK(!ok);
-        CHECK(pseudoStack.stackPointer == 0);
+        CHECK(profilingStack.stackPointer == 0);
         CHECK(cx->runtime()->geckoProfiler().stringsCount() == 1);
 
         JS_ClearPendingException(cx);
     }
 
     return true;
 }
 END_TEST(testProfileStrings_isCalledWhenError)
@@ -202,48 +202,48 @@ BEGIN_TEST(testProfileStrings_worksWhenE
     EXEC("function b(p) { p.test_fn(); }");
     EXEC("function a() { var p = new Prof(); p.enable(); b(p); }");
     reset(cx);
     js::EnableContextProfilingStack(cx, false);
     {
         /* enable it in the middle of JS and make sure things check out */
         JS::RootedValue rval(cx);
         JS_CallFunctionName(cx, global, "a", JS::HandleValueArray::empty(), &rval);
-        CHECK(pseudoStack.stackPointer == 0);
+        CHECK(profilingStack.stackPointer == 0);
         CHECK(peakStackPointer >= 1);
         CHECK(cx->runtime()->geckoProfiler().stringsCount() == 1);
     }
 
     EXEC("function d(p) { p.disable(); }");
     EXEC("function c() { var p = new Prof(); d(p); }");
     reset(cx);
     {
         /* now disable in the middle of js */
         JS::RootedValue rval(cx);
         JS_CallFunctionName(cx, global, "c", JS::HandleValueArray::empty(), &rval);
-        CHECK(pseudoStack.stackPointer == 0);
+        CHECK(profilingStack.stackPointer == 0);
     }
 
     EXEC("function e() { var p = new Prof(); d(p); p.enable(); b(p); }");
     reset(cx);
     {
         /* now disable in the middle of js, but re-enable before final exit */
         JS::RootedValue rval(cx);
         JS_CallFunctionName(cx, global, "e", JS::HandleValueArray::empty(), &rval);
-        CHECK(pseudoStack.stackPointer == 0);
+        CHECK(profilingStack.stackPointer == 0);
         CHECK(peakStackPointer >= 3);
     }
 
     EXEC("function h() { }");
     EXEC("function g(p) { p.disable(); for (var i = 0; i < 100; i++) i++; }");
     EXEC("function f() { g(new Prof()); }");
     reset(cx);
     cx->runtime()->geckoProfiler().enableSlowAssertions(false);
     {
         JS::RootedValue rval(cx);
         /* disable, and make sure that if we try to re-enter the JIT the pop
          * will still happen */
         JS_CallFunctionName(cx, global, "f", JS::HandleValueArray::empty(), &rval);
-        CHECK(pseudoStack.stackPointer == 0);
+        CHECK(profilingStack.stackPointer == 0);
     }
     return true;
 }
 END_TEST(testProfileStrings_worksWhenEnabledOnTheFly)
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -3529,17 +3529,17 @@ static bool
 EnsureGeckoProfilingStackInstalled(JSContext* cx, ShellContext* sc)
 {
     if (cx->geckoProfiler().installed()) {
         MOZ_ASSERT(sc->geckoProfilingStack);
         return true;
     }
 
     MOZ_ASSERT(!sc->geckoProfilingStack);
-    sc->geckoProfilingStack = MakeUnique<PseudoStack>();
+    sc->geckoProfilingStack = MakeUnique<ProfilingStack>();
     if (!sc->geckoProfilingStack) {
         JS_ReportOutOfMemory(cx);
         return false;
     }
 
     SetContextProfilingStack(cx, sc->geckoProfilingStack.get());
     return true;
 }
--- a/js/src/shell/jsshell.h
+++ b/js/src/shell/jsshell.h
@@ -167,17 +167,17 @@ struct ShellContext
     bool quitting;
 
     JS::UniqueChars readLineBuf;
     size_t readLineBufPos;
 
     js::shell::RCFile** errFilePtr;
     js::shell::RCFile** outFilePtr;
 
-    UniquePtr<PseudoStack> geckoProfilingStack;
+    UniquePtr<ProfilingStack> geckoProfilingStack;
 
     JS::UniqueChars moduleLoadPath;
     UniquePtr<MarkBitObservers> markObservers;
 
     // Off-thread parse state.
     js::Monitor offThreadMonitor;
     Vector<OffThreadJob*, 0, SystemAllocPolicy> offThreadJobs;
 
--- a/js/src/vm/GeckoProfiler-inl.h
+++ b/js/src/vm/GeckoProfiler-inl.h
@@ -15,21 +15,21 @@
 namespace js {
 
 inline void
 GeckoProfilerThread::updatePC(JSContext* cx, JSScript* script, jsbytecode* pc)
 {
     if (!cx->runtime()->geckoProfiler().enabled())
         return;
 
-    uint32_t sp = pseudoStack_->stackPointer;
-    if (sp - 1 < pseudoStack_->stackCapacity()) {
+    uint32_t sp = profilingStack_->stackPointer;
+    if (sp - 1 < profilingStack_->stackCapacity()) {
         MOZ_ASSERT(sp > 0);
-        MOZ_ASSERT(pseudoStack_->frames[sp - 1].rawScript() == script);
-        pseudoStack_->frames[sp - 1].setPC(pc);
+        MOZ_ASSERT(profilingStack_->frames[sp - 1].rawScript() == script);
+        profilingStack_->frames[sp - 1].setPC(pc);
     }
 }
 
 /*
  * This class is used to suppress profiler sampling during
  * critical sections where stack state is not valid.
  */
 class MOZ_RAII AutoSuppressProfilerSampling
@@ -57,30 +57,30 @@ GeckoProfilerEntryMarker::GeckoProfilerE
         return;
     }
 #ifdef DEBUG
     spBefore_ = profiler_->stackPointer();
 #endif
 
     // Push an sp marker frame so the profiler can correctly order JS and native
     // stacks.
-    profiler_->pseudoStack_->pushSpMarkerFrame(this);
+    profiler_->profilingStack_->pushSpMarkerFrame(this);
 
-    profiler_->pseudoStack_->pushJsFrame(
+    profiler_->profilingStack_->pushJsFrame(
         "js::RunScript", /* dynamicString = */ nullptr, script, script->code());
 }
 
 MOZ_ALWAYS_INLINE
 GeckoProfilerEntryMarker::~GeckoProfilerEntryMarker()
 {
     if (MOZ_LIKELY(profiler_ == nullptr))
         return;
 
-    profiler_->pseudoStack_->pop();    // the JS frame
-    profiler_->pseudoStack_->pop();    // the BEGIN_PSEUDO_JS frame
+    profiler_->profilingStack_->pop();    // the JS frame
+    profiler_->profilingStack_->pop();    // the SP_MARKER frame
     MOZ_ASSERT(spBefore_ == profiler_->stackPointer());
 }
 
 MOZ_ALWAYS_INLINE
 AutoGeckoProfilerEntry::AutoGeckoProfilerEntry(JSContext* cx, const char* label,
                                                ProfilingStackFrame::Category category
                                                MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
   : profiler_(&cx->geckoProfiler())
@@ -88,28 +88,28 @@ AutoGeckoProfilerEntry::AutoGeckoProfile
     MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     if (MOZ_LIKELY(!profiler_->installed())) {
         profiler_ = nullptr;
         return;
     }
 #ifdef DEBUG
     spBefore_ = profiler_->stackPointer();
 #endif
-    profiler_->pseudoStack_->pushLabelFrame(label,
+    profiler_->profilingStack_->pushLabelFrame(label,
                                             /* dynamicString = */ nullptr,
                                             /* sp = */ this,
                                             /* line = */ 0,
                                             category);
 }
 
 MOZ_ALWAYS_INLINE
 AutoGeckoProfilerEntry::~AutoGeckoProfilerEntry()
 {
     if (MOZ_LIKELY(!profiler_))
         return;
 
-    profiler_->pseudoStack_->pop();
+    profiler_->profilingStack_->pop();
     MOZ_ASSERT(spBefore_ == profiler_->stackPointer());
 }
 
 } // namespace js
 
 #endif // vm_GeckoProfiler_inl_h
--- a/js/src/vm/GeckoProfiler.cpp
+++ b/js/src/vm/GeckoProfiler.cpp
@@ -21,17 +21,17 @@
 
 #include "gc/Marking-inl.h"
 
 using namespace js;
 
 using mozilla::DebugOnly;
 
 GeckoProfilerThread::GeckoProfilerThread()
-  : pseudoStack_(nullptr)
+  : profilingStack_(nullptr)
 {
 }
 
 GeckoProfilerRuntime::GeckoProfilerRuntime(JSRuntime* rt)
   : rt(rt),
     strings(mutexid::GeckoProfilerStrings),
     slowAssertions(false),
     enabled_(false),
@@ -46,19 +46,19 @@ GeckoProfilerRuntime::init()
     auto locked = strings.lock();
     if (!locked->init())
         return false;
 
     return true;
 }
 
 void
-GeckoProfilerThread::setProfilingStack(PseudoStack* pseudoStack)
+GeckoProfilerThread::setProfilingStack(ProfilingStack* profilingStack)
 {
-    pseudoStack_ = pseudoStack;
+    profilingStack_ = profilingStack;
 }
 
 void
 GeckoProfilerRuntime::setEventMarker(void (*fn)(const char*))
 {
     eventMarker_ = fn;
 }
 
@@ -206,62 +206,62 @@ GeckoProfilerThread::enter(JSContext* cx
 {
     const char* dynamicString = cx->runtime()->geckoProfiler().profileString(script, maybeFun);
     if (dynamicString == nullptr) {
         ReportOutOfMemory(cx);
         return false;
     }
 
 #ifdef DEBUG
-    // In debug builds, assert the JS pseudo frames already on the stack
-    // have a non-null pc. Only look at the top frames to avoid quadratic
+    // In debug builds, assert the JS profiling stack frames already on the
+    // stack have a non-null pc. Only look at the top frames to avoid quadratic
     // behavior.
-    uint32_t sp = pseudoStack_->stackPointer;
-    if (sp > 0 && sp - 1 < pseudoStack_->stackCapacity()) {
+    uint32_t sp = profilingStack_->stackPointer;
+    if (sp > 0 && sp - 1 < profilingStack_->stackCapacity()) {
         size_t start = (sp > 4) ? sp - 4 : 0;
         for (size_t i = start; i < sp - 1; i++)
-            MOZ_ASSERT_IF(pseudoStack_->frames[i].isJsFrame(), pseudoStack_->frames[i].pc());
+            MOZ_ASSERT_IF(profilingStack_->frames[i].isJsFrame(), profilingStack_->frames[i].pc());
     }
 #endif
 
-    pseudoStack_->pushJsFrame("", dynamicString, script, script->code());
+    profilingStack_->pushJsFrame("", dynamicString, script, script->code());
     return true;
 }
 
 void
 GeckoProfilerThread::exit(JSScript* script, JSFunction* maybeFun)
 {
-    pseudoStack_->pop();
+    profilingStack_->pop();
 
 #ifdef DEBUG
     /* Sanity check to make sure push/pop balanced */
-    uint32_t sp = pseudoStack_->stackPointer;
-    if (sp < pseudoStack_->stackCapacity()) {
+    uint32_t sp = profilingStack_->stackPointer;
+    if (sp < profilingStack_->stackCapacity()) {
         JSRuntime* rt = script->runtimeFromMainThread();
         const char* dynamicString = rt->geckoProfiler().profileString(script, maybeFun);
         /* Can't fail lookup because we should already be in the set */
         MOZ_ASSERT(dynamicString);
 
         // Bug 822041
-        if (!pseudoStack_->frames[sp].isJsFrame()) {
+        if (!profilingStack_->frames[sp].isJsFrame()) {
             fprintf(stderr, "--- ABOUT TO FAIL ASSERTION ---\n");
             fprintf(stderr, " frames=%p size=%u/%u\n",
-                            (void*) pseudoStack_->frames,
-                            uint32_t(pseudoStack_->stackPointer),
-                            pseudoStack_->stackCapacity());
+                            (void*) profilingStack_->frames,
+                            uint32_t(profilingStack_->stackPointer),
+                            profilingStack_->stackCapacity());
             for (int32_t i = sp; i >= 0; i--) {
-                ProfilingStackFrame& frame = pseudoStack_->frames[i];
+                ProfilingStackFrame& frame = profilingStack_->frames[i];
                 if (frame.isJsFrame())
                     fprintf(stderr, "  [%d] JS %s\n", i, frame.dynamicString());
                 else
                     fprintf(stderr, "  [%d] C line %d %s\n", i, frame.line(), frame.dynamicString());
             }
         }
 
-        ProfilingStackFrame& frame = pseudoStack_->frames[sp];
+        ProfilingStackFrame& frame = profilingStack_->frames[sp];
         MOZ_ASSERT(frame.isJsFrame());
         MOZ_ASSERT(frame.script() == script);
         MOZ_ASSERT(strcmp((const char*) frame.dynamicString(), dynamicString) == 0);
     }
 #endif
 }
 
 /*
@@ -316,20 +316,20 @@ GeckoProfilerRuntime::allocProfileString
     MOZ_ASSERT(ret == len, "Computed length should match actual length!");
 
     return cstr;
 }
 
 void
 GeckoProfilerThread::trace(JSTracer* trc)
 {
-    if (pseudoStack_) {
-        size_t size = pseudoStack_->stackSize();
+    if (profilingStack_) {
+        size_t size = profilingStack_->stackSize();
         for (size_t i = 0; i < size; i++)
-            pseudoStack_->frames[i].trace(trc);
+            profilingStack_->frames[i].trace(trc);
     }
 }
 
 void
 GeckoProfilerRuntime::fixupStringsMapAfterMovingGC()
 {
     auto locked = strings.lock();
     if (!locked->initialized())
@@ -376,27 +376,27 @@ GeckoProfilerBaselineOSRMarker::GeckoPro
     : profiler(&cx->geckoProfiler())
 {
     MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     if (!hasProfilerFrame || !cx->runtime()->geckoProfiler().enabled()) {
         profiler = nullptr;
         return;
     }
 
-    uint32_t sp = profiler->pseudoStack_->stackPointer;
-    if (sp >= profiler->pseudoStack_->stackCapacity()) {
+    uint32_t sp = profiler->profilingStack_->stackPointer;
+    if (sp >= profiler->profilingStack_->stackCapacity()) {
         profiler = nullptr;
         return;
     }
 
     spBefore_ = sp;
     if (sp == 0)
         return;
 
-    ProfilingStackFrame& frame = profiler->pseudoStack_->frames[sp - 1];
+    ProfilingStackFrame& frame = profiler->profilingStack_->frames[sp - 1];
     MOZ_ASSERT(frame.kind() == ProfilingStackFrame::Kind::JS_NORMAL);
     frame.setKind(ProfilingStackFrame::Kind::JS_OSR);
 }
 
 GeckoProfilerBaselineOSRMarker::~GeckoProfilerBaselineOSRMarker()
 {
     if (profiler == nullptr)
         return;
@@ -451,19 +451,19 @@ ProfilingStackFrame::setPC(jsbytecode* p
 {
     MOZ_ASSERT(isJsFrame());
     JSScript* script = this->script();
     MOZ_ASSERT(script); // This should not be called while profiling is suppressed.
     lineOrPcOffset = pcToOffset(script, pc);
 }
 
 JS_FRIEND_API(void)
-js::SetContextProfilingStack(JSContext* cx, PseudoStack* pseudoStack)
+js::SetContextProfilingStack(JSContext* cx, ProfilingStack* profilingStack)
 {
-    cx->geckoProfiler().setProfilingStack(pseudoStack);
+    cx->geckoProfiler().setProfilingStack(profilingStack);
 }
 
 JS_FRIEND_API(void)
 js::EnableContextProfilingStack(JSContext* cx, bool enabled)
 {
     cx->runtime()->geckoProfiler().enable(enabled);
 }
 
--- a/js/src/vm/ProfilingStack.cpp
+++ b/js/src/vm/ProfilingStack.cpp
@@ -9,28 +9,28 @@
 #include "mozilla/IntegerRange.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/UniquePtrExtensions.h"
 
 #include <algorithm>
 
 using namespace js;
 
-PseudoStack::~PseudoStack()
+ProfilingStack::~ProfilingStack()
 {
-    // The label macros keep a reference to the PseudoStack to avoid a TLS
+    // The label macros keep a reference to the ProfilingStack to avoid a TLS
     // access. If these are somehow not all cleared we will get a
     // use-after-free so better to crash now.
     MOZ_RELEASE_ASSERT(stackPointer == 0);
 
     delete[] frames;
 }
 
 bool
-PseudoStack::ensureCapacitySlow()
+ProfilingStack::ensureCapacitySlow()
 {
     MOZ_ASSERT(stackPointer >= capacity);
     const uint32_t kInitialCapacity = 128;
 
     uint32_t sp = stackPointer;
     auto newCapacity = std::max(sp + 1,  capacity ? capacity * 2 : kInitialCapacity);
 
     auto* newFrames =
--- a/js/src/vm/SavedStacks.cpp
+++ b/js/src/vm/SavedStacks.cpp
@@ -1286,17 +1286,17 @@ SavedStacks::saveCurrentStack(JSContext*
         cx->isExceptionPending() ||
         !cx->global() ||
         !cx->global()->isStandardClassResolved(JSProto_Object))
     {
         frame.set(nullptr);
         return true;
     }
 
-    AutoGeckoProfilerEntry pseudoFrame(cx, "js::SavedStacks::saveCurrentStack");
+    AutoGeckoProfilerEntry labelFrame(cx, "js::SavedStacks::saveCurrentStack");
     return insertFrames(cx, frame, mozilla::Move(capture));
 }
 
 bool
 SavedStacks::copyAsyncStack(JSContext* cx, HandleObject asyncStack, HandleString asyncCause,
                             MutableHandleSavedFrame adoptedStack,
                             const Maybe<size_t>& maxFrameCount)
 {
--- a/mozglue/misc/AutoProfilerLabel.cpp
+++ b/mozglue/misc/AutoProfilerLabel.cpp
@@ -21,20 +21,20 @@ RegisterProfilerLabelEnterExit(ProfilerL
 
 AutoProfilerLabel::AutoProfilerLabel(const char* aLabel,
                                      const char* aDynamicString,
                                      uint32_t aLine
                                      MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
 {
   MOZ_GUARD_OBJECT_NOTIFIER_INIT;
 
-  mPseudoStack = sEnter ? sEnter(aLabel, aDynamicString, this, aLine) : nullptr;
+  mProfilingStack = sEnter ? sEnter(aLabel, aDynamicString, this, aLine) : nullptr;
 }
 
 AutoProfilerLabel::~AutoProfilerLabel()
 {
-  if (sExit && mPseudoStack) {
-    sExit(mPseudoStack);
+  if (sExit && mProfilingStack) {
+    sExit(mProfilingStack);
   }
 }
 
 } // namespace mozilla
 
--- a/mozglue/misc/AutoProfilerLabel.h
+++ b/mozglue/misc/AutoProfilerLabel.h
@@ -7,38 +7,38 @@
 #ifndef mozilla_AutoProfilerLabel_h
 #define mozilla_AutoProfilerLabel_h
 
 #include "mozilla/Attributes.h"
 #include "mozilla/GuardObjects.h"
 #include "mozilla/Types.h"
 
 // The Gecko Profiler defines AutoProfilerLabel, an RAII class for
-// pushing/popping frames to/from the PseudoStack.
+// pushing/popping frames to/from the ProfilingStack.
 //
 // This file defines a class of the same name that does much the same thing,
 // but which can be used in (and only in) mozglue. A different class is
-// necessary because mozglue cannot directly access sPseudoStack.
+// necessary because mozglue cannot directly access sProfilingStack.
 //
 // Note that this class is slightly slower than the other AutoProfilerLabel,
 // and it lacks the macro wrappers. It also is effectively hardwired to use
 // js::ProfilingStackFrame::Category::OTHER as the category, because that's what
 // the callbacks provided by the profiler use. (Specifying the category in
 // this file would require #including ProfilingStack.h in mozglue, which we
 // don't want to do.)
 
-class PseudoStack;
+class ProfilingStack;
 
 namespace mozilla {
 
-typedef PseudoStack* (*ProfilerLabelEnter)(const char*, const char*, void*,
+typedef ProfilingStack* (*ProfilerLabelEnter)(const char*, const char*, void*,
                                            uint32_t);
-typedef void (*ProfilerLabelExit)(PseudoStack*);
+typedef void (*ProfilerLabelExit)(ProfilingStack*);
 
-// Register callbacks that do the entry/exit work involving sPseudoStack.
+// Register callbacks that do the entry/exit work involving sProfilingStack.
 MFBT_API void RegisterProfilerLabelEnterExit(ProfilerLabelEnter aEnter,
                                              ProfilerLabelExit aExit);
 
 // This #ifdef prevents this AutoProfilerLabel from being defined in libxul,
 // which would conflict with the one in the profiler.
 #ifdef IMPL_MFBT
 
 class MOZ_RAII AutoProfilerLabel
@@ -46,16 +46,16 @@ class MOZ_RAII AutoProfilerLabel
 public:
   AutoProfilerLabel(const char* aLabel, const char* aDynamicString,
                     uint32_t aLine
                     MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
   ~AutoProfilerLabel();
 
 private:
   MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
-  PseudoStack* mPseudoStack;
+  ProfilingStack* mProfilingStack;
 };
 
 #endif
 
 } // namespace mozilla
 
 #endif // mozilla_AutoProfilerLabel_h
--- a/toolkit/components/backgroundhangmonitor/ThreadStackHelper.cpp
+++ b/toolkit/components/backgroundhangmonitor/ThreadStackHelper.cpp
@@ -4,17 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ThreadStackHelper.h"
 #include "MainThreadUtils.h"
 #include "nsJSPrincipals.h"
 #include "nsScriptSecurityManager.h"
 #include "jsfriendapi.h"
-#ifdef MOZ_THREADSTACKHELPER_PSEUDO
+#ifdef MOZ_THREADSTACKHELPER_PROFILING_STACK
 #include "js/ProfilingStack.h"
 #endif
 
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/IntegerPrintfMacros.h"
 #include "mozilla/Move.h"
 #include "mozilla/Scoped.h"
@@ -90,17 +90,17 @@ ThreadStackHelper::PrepareStackBuffer(Ha
   mDesiredBufferSize = 0;
   mDesiredStackSize = 0;
 
   // Clear all of the stack entries.
   aStack.stack().ClearAndRetainStorage();
   aStack.strbuffer().ClearAndRetainStorage();
   aStack.modules().Clear();
 
-#ifdef MOZ_THREADSTACKHELPER_PSEUDO
+#ifdef MOZ_THREADSTACKHELPER_PROFILING_STACK
   // Ensure we have enough space in our stack and string buffers for the data we
   // want to collect.
   if (!aStack.stack().SetCapacity(mMaxStackSize, fallible) ||
       !aStack.strbuffer().SetCapacity(mMaxBufferSize, fallible)) {
     return false;
   }
   return true;
 #else
--- a/toolkit/components/backgroundhangmonitor/ThreadStackHelper.h
+++ b/toolkit/components/backgroundhangmonitor/ThreadStackHelper.h
@@ -20,48 +20,47 @@
 #include <semaphore.h>
 #include <sys/types.h>
 #elif defined(XP_WIN)
 #include <windows.h>
 #elif defined(XP_MACOSX)
 #include <mach/mach.h>
 #endif
 
-// Support pseudostack and native stack on these platforms.
+// Support profiling stack and native stack on these platforms.
 #if defined(XP_LINUX) || defined(XP_WIN) || defined(XP_MACOSX)
-#  define MOZ_THREADSTACKHELPER_PSEUDO
-#  define MOZ_THREADSTACKHELPER_NATIVE
+#  define MOZ_THREADSTACKHELPER_PROFILING_STACK
+#  define MOZ_THREADSTACKHELPER_NATIVE_STACK
 #endif
 
 
 // Android x86 builds consistently crash in the Background Hang Reporter. bug
 // 1368520.
 #if defined(__ANDROID__)
-#  undef MOZ_THREADSTACKHELPER_PSEUDO
-#  undef MOZ_THREADSTACKHELPER_NATIVE
+#  undef MOZ_THREADSTACKHELPER_PROFILING_STACK
+#  undef MOZ_THREADSTACKHELPER_NATIVE_STACK
 #endif
 
 namespace mozilla {
 
 /**
- * ThreadStackHelper is used to retrieve the profiler pseudo-stack of a
+ * ThreadStackHelper is used to retrieve the profiler's "profiling stack" of a
  * thread, as an alternative of using the profiler to take a profile.
  * The target thread first declares an ThreadStackHelper instance;
  * then another thread can call ThreadStackHelper::GetStack to retrieve
- * the pseudo-stack of the target thread at that instant.
+ * the profiling stack of the target thread at that instant.
  *
  * Only non-copying labels are included in the stack, which means labels
  * with custom text and markers are not included.
  */
 class ThreadStackHelper : public ProfilerStackCollector
 {
 private:
   HangStack* mStackToFill;
   Array<char, nsThread::kRunnableNameBufSize>* mRunnableNameBuffer;
-  // const PseudoStack* const mPseudoStack;
   size_t mMaxStackSize;
   size_t mMaxBufferSize;
   size_t mDesiredStackSize;
   size_t mDesiredBufferSize;
 
   bool PrepareStackBuffer(HangStack& aStack);
 
 public:
@@ -71,17 +70,17 @@ public:
   ThreadStackHelper();
 
   /**
    * Retrieve the current interleaved stack of the thread associated with this ThreadStackHelper.
    *
    * @param aStack        HangStack instance to be filled.
    * @param aRunnableName The name of the current runnable on the target thread.
    * @param aStackWalk    If true, native stack frames will be collected
-   *                      along with pseudostack frames.
+   *                      along with profiling stack frames.
    */
   void GetStack(HangStack& aStack, nsACString& aRunnableName, bool aStackWalk);
 
   /**
    * Retrieve the thread's profiler thread ID.
    */
   int GetThreadId() const { return mThreadId; }
 
--- a/toolkit/components/telemetry/docs/data/backgroundhangmonitor-ping.rst
+++ b/toolkit/components/telemetry/docs/data/backgroundhangmonitor-ping.rst
@@ -31,17 +31,17 @@ Structure:
           {
             "duration": <number>, // duration of the hang in milliseconds.
             "thread": <string>, // name of the hanging thread.
             "runnableName": <string>, // name of the runnable executing during the hang.
                                       // Runnable names are only collected for the XPCOM main thread.
             "process": <string>, // Type of process that hung, see below for a list of types.
             "remoteType": <string>, // Remote type of process which hung, see below.
             "annotations": { ... }, // A set of annotations on the hang, see below.
-            "pseudoStack": [ ... ], // List of pseudostack frame names.
+            "pseudoStack": [ ... ], // List of label stack frames and js frames.
             "stack": [ ... ], // interleaved hang stack, see below.
           },
           ...
         ]
       }
     }
 
 .. note: :
@@ -74,24 +74,27 @@ The supported ``remoteType`` values are 
 documentation: :ref:`remote-process-types`.
 
 Stack Traces
 ------------
 
 Each hang object contains a ``stack`` field which has been populated with an
 interleaved stack trace of the hung thread. An interleaved stack consists of a
 native backtrace with additional frames interleaved, representing chrome JS and
-pseudostack entries.
+label stack entries.
 
-Note that this field only contains native stack frames, pseudostack and chrome
+The structure that manages the label stack and the JS stack was called
+"PseudoStack" in the past and is now called "ProfilingStack".
+
+Note that this field only contains native stack frames, label stack and chrome
 JS script frames. If native stacks can not be collected on the target platform,
 or stackwalking was not initialized, there will be no native frames present, and
-the stack will consist only of pseudostack and chrome JS script frames.
+the stack will consist only of label stack and chrome JS script frames.
 
-A single frame in the stack is either a raw string, representing a pseudostack
+A single frame in the stack is either a raw string, representing a label stack
 or chrome JS script frame, or a native stack frame:
 
 .. code-block:: js
 
     [
       <number>, // Index in the payload.modules list of the module description.
                 // -1 if this frame was not in a valid module.
       <string> // Hex string (e.g. "FF0F") of the frame offset in the module.
--- a/toolkit/components/telemetry/docs/data/main-ping.rst
+++ b/toolkit/components/telemetry/docs/data/main-ping.rst
@@ -241,22 +241,22 @@ keyedHistograms
 This section contains the keyed histograms available for the current platform.
 
 As of Firefox 48, this section does not contain empty keyed histograms anymore.
 
 threadHangStats
 ---------------
 As of Firefox 57 this section is no longer present, and has been replaced with the :doc:`bhr ping <backgroundhangmonitor-ping>`.
 
-Contains the statistics about the hangs in main and background threads. Note that hangs in this section capture the `C++ pseudostack <https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Profiling_with_the_Built-in_Profiler#Native_stack_vs._Pseudo_stack>`_ and an incomplete JS stack, which is not 100% precise. For particularly egregious hangs, and on nightly, an unsymbolicated native stack is also captured. The amount of time that is considered "egregious" is different from thread to thread, and is set when the BackgroundHangMonitor is constructed for that thread. In general though, hangs from 5 - 10 seconds are generally considered egregious. Shorter hangs (1 - 2s) are considered egregious for other threads (the compositor thread, and the hang monitor that is only enabled during tab switch).
+Contains the statistics about the hangs in main and background threads. Note that hangs in this section capture the `label stack <https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Profiling_with_the_Built-in_Profiler#Native_stack_vs._label_stack>`_ and an incomplete JS stack, which is not 100% precise. For particularly egregious hangs, and on nightly, an unsymbolicated native stack is also captured. The amount of time that is considered "egregious" is different from thread to thread, and is set when the BackgroundHangMonitor is constructed for that thread. In general though, hangs from 5 - 10 seconds are generally considered egregious. Shorter hangs (1 - 2s) are considered egregious for other threads (the compositor thread, and the hang monitor that is only enabled during tab switch).
 
 To avoid submitting overly large payloads, some limits are applied:
 
 * Identical, adjacent "(chrome script)" or "(content script)" stack entries are collapsed together. If a stack is reduced, the "(reduced stack)" frame marker is added as the oldest frame.
-* The depth of the reported pseudostacks is limited to 11 entries. This value represents the 99.9th percentile of the thread hangs stack depths reported by Telemetry.
+* The depth of the reported label stacks is limited to 11 entries. This value represents the 99.9th percentile of the thread hangs stack depths reported by Telemetry.
 * The native stacks are limited to a depth of 25 stack frames.
 
 Structure:
 
 .. code-block:: js
 
     "threadHangStats" : [
       {
--- a/tools/profiler/core/ProfileBuffer.cpp
+++ b/tools/profiler/core/ProfileBuffer.cpp
@@ -161,17 +161,17 @@ ProfileBufferCollector::CollectProfiling
              aFrame.kind() == js::ProfilingStackFrame::Kind::JS_NORMAL);
 
   const char* label = aFrame.label();
   const char* dynamicString = aFrame.dynamicString();
   bool isChromeJSEntry = false;
   int lineno = -1;
 
   if (aFrame.isJsFrame()) {
-    // There are two kinds of JS frames that get pushed onto the PseudoStack.
+    // There are two kinds of JS frames that get pushed onto the ProfilingStack.
     //
     // - label = "", dynamic string = <something>
     // - label = "js::RunScript", dynamic string = nullptr
     //
     // The line number is only interesting in the first case.
 
     if (label[0] == '\0') {
       MOZ_ASSERT(dynamicString);
--- a/tools/profiler/core/ProfileBufferEntry.cpp
+++ b/tools/profiler/core/ProfileBufferEntry.cpp
@@ -801,30 +801,30 @@ private:
 //   | CollectionEnd
 //   | Pause
 //   | Resume
 // )*
 //
 // The most complicated part is the stack entry sequence that begins with
 // Label. Here are some examples.
 //
-// - PseudoStack frames without a dynamic string:
+// - ProfilingStack frames without a dynamic string:
 //
 //     Label("js::RunScript")
 //     Category(ProfilingStackFrame::Category::JS)
 //
 //     Label("XREMain::XRE_main")
 //     LineNumber(4660)
 //     Category(ProfilingStackFrame::Category::OTHER)
 //
 //     Label("ElementRestyler::ComputeStyleChangeFor")
 //     LineNumber(3003)
 //     Category(ProfilingStackFrame::Category::CSS)
 //
-// - PseudoStack frames with a dynamic string:
+// - ProfilingStack frames with a dynamic string:
 //
 //     Label("nsObserverService::NotifyObservers")
 //     DynamicStringFragment("domwindo")
 //     DynamicStringFragment("wopened")
 //     LineNumber(291)
 //     Category(ProfilingStackFrame::Category::OTHER)
 //
 //     Label("")
@@ -841,25 +841,25 @@ private:
 //
 //     Label("")
 //     DynamicStringFragment("bound (s")
 //     DynamicStringFragment("elf-host")
 //     DynamicStringFragment("ed:914)")
 //     LineNumber(945)
 //     Category(ProfilingStackFrame::Category::JS)
 //
-// - A pseudoStack frame with a dynamic string, but with privacy enabled:
+// - A profiling stack frame with a dynamic string, but with privacy enabled:
 //
 //     Label("nsObserverService::NotifyObservers")
 //     DynamicStringFragment("(private")
 //     DynamicStringFragment(")")
 //     LineNumber(291)
 //     Category(ProfilingStackFrame::Category::OTHER)
 //
-// - A pseudoStack frame with an overly long dynamic string:
+// - A profiling stack frame with an overly long dynamic string:
 //
 //     Label("")
 //     DynamicStringFragment("(too lon")
 //     DynamicStringFragment("g)")
 //     LineNumber(100)
 //     Category(ProfilingStackFrame::Category::NETWORK)
 //
 // - A wasm JIT frame:
--- a/tools/profiler/core/RegisteredThread.h
+++ b/tools/profiler/core/RegisteredThread.h
@@ -90,21 +90,21 @@ public:
     MOZ_ASSERT(mSleep != AWAKE);
     mSleep = AWAKE;
   }
 
   bool IsSleeping() { return mSleep != AWAKE; }
 
   int ThreadId() const { return mThreadId; }
 
-  class PseudoStack& PseudoStack() { return mPseudoStack; }
-  const class PseudoStack& PseudoStack() const { return mPseudoStack; }
+  class ProfilingStack& ProfilingStack() { return mProfilingStack; }
+  const class ProfilingStack& ProfilingStack() const { return mProfilingStack; }
 
 private:
-  class PseudoStack mPseudoStack;
+  class ProfilingStack mProfilingStack;
 
   // A list of pending markers that must be moved to the circular buffer.
   ProfilerSignalSafeLinkedList<ProfilerMarker> mPendingMarkers;
 
   // mThreadId contains the thread ID of the current thread. It is safe to read
   // this from multiple threads concurrently, as it will never be mutated.
   const int mThreadId;
 
@@ -171,19 +171,19 @@ public:
   void SetJSContext(JSContext* aContext)
   {
     // This function runs on-thread.
 
     MOZ_ASSERT(aContext && !mContext);
 
     mContext = aContext;
 
-    // We give the JS engine a non-owning reference to the PseudoStack. It's
+    // We give the JS engine a non-owning reference to the ProfilingStack. It's
     // important that the JS engine doesn't touch this once the thread dies.
-    js::SetContextProfilingStack(aContext, &RacyRegisteredThread().PseudoStack());
+    js::SetContextProfilingStack(aContext, &RacyRegisteredThread().ProfilingStack());
 
     PollJSSampling();
   }
 
   void ClearJSContext()
   {
     // This function runs on-thread.
     mContext = nullptr;
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -701,17 +701,17 @@ Atomic<uint32_t> RacyFeatures::sActiveAn
 // Each live thread has a RegisteredThread, and we store a reference to it in TLS.
 // This class encapsulates that TLS.
 class TLSRegisteredThread
 {
 public:
   static bool Init(PSLockRef)
   {
     bool ok1 = sRegisteredThread.init();
-    bool ok2 = AutoProfilerLabel::sPseudoStack.init();
+    bool ok2 = AutoProfilerLabel::sProfilingStack.init();
     return ok1 && ok2;
   }
 
   // Get the entire RegisteredThread. Accesses are guarded by gPSMutex.
   static class RegisteredThread* RegisteredThread(PSLockRef)
   {
     return sRegisteredThread.get();
   }
@@ -719,57 +719,57 @@ public:
   // Get only the RacyRegisteredThread. Accesses are not guarded by gPSMutex.
   static class RacyRegisteredThread* RacyRegisteredThread()
   {
     class RegisteredThread* registeredThread = sRegisteredThread.get();
     return registeredThread ? &registeredThread->RacyRegisteredThread()
                             : nullptr;
   }
 
-  // Get only the PseudoStack. Accesses are not guarded by gPSMutex.
-  // RacyRegisteredThread() can also be used to get the PseudoStack, but that
+  // Get only the ProfilingStack. Accesses are not guarded by gPSMutex.
+  // RacyRegisteredThread() can also be used to get the ProfilingStack, but that
   // is marginally slower because it requires an extra pointer indirection.
-  static PseudoStack* Stack() { return AutoProfilerLabel::sPseudoStack.get(); }
+  static ProfilingStack* Stack() { return AutoProfilerLabel::sProfilingStack.get(); }
 
   static void SetRegisteredThread(PSLockRef,
                                   class RegisteredThread* aRegisteredThread)
   {
     sRegisteredThread.set(aRegisteredThread);
-    AutoProfilerLabel::sPseudoStack.set(
+    AutoProfilerLabel::sProfilingStack.set(
       aRegisteredThread
-        ? &aRegisteredThread->RacyRegisteredThread().PseudoStack()
+        ? &aRegisteredThread->RacyRegisteredThread().ProfilingStack()
         : nullptr);
   }
 
 private:
   // This is a non-owning reference to the RegisteredThread;
   // CorePS::mRegisteredThreads is the owning reference. On thread
   // deregistration, this reference is cleared and the RegisteredThread is
   // destroyed.
   static MOZ_THREAD_LOCAL(class RegisteredThread*) sRegisteredThread;
 };
 
 MOZ_THREAD_LOCAL(RegisteredThread*) TLSRegisteredThread::sRegisteredThread;
 
-// Although you can access a thread's PseudoStack via
+// Although you can access a thread's ProfilingStack via
 // TLSRegisteredThread::sRegisteredThread, we also have a second TLS pointer
-// directly to the PseudoStack. Here's why.
+// directly to the ProfilingStack. Here's why.
 //
-// - We need to be able to push to and pop from the PseudoStack in
+// - We need to be able to push to and pop from the ProfilingStack in
 //   AutoProfilerLabel.
 //
 // - The class functions are hot and must be defined in GeckoProfiler.h so they
 //   can be inlined.
 //
 // - We don't want to expose TLSRegisteredThread (and RegisteredThread) in
 //   GeckoProfiler.h.
 //
 // This second pointer isn't ideal, but does provide a way to satisfy those
 // constraints. TLSRegisteredThread is responsible for updating it.
-MOZ_THREAD_LOCAL(PseudoStack*) AutoProfilerLabel::sPseudoStack;
+MOZ_THREAD_LOCAL(ProfilingStack*) AutoProfilerLabel::sProfilingStack;
 
 // The name of the main thread.
 static const char* const kMainThreadName = "GeckoMain";
 
 ////////////////////////////////////////////////////////////////////////
 // BEGIN sampling/unwinding code
 
 // The registers used for stack unwinding and a few other sampling purposes.
@@ -828,32 +828,32 @@ struct AutoWalkJSStack
 
   ~AutoWalkJSStack() {
     if (walkAllowed) {
       WALKING_JS_STACK = false;
     }
   }
 };
 
-// Merges the pseudo-stack, native stack, and JS stack, outputting the details
-// to aCollector.
+// Merges the profiling stack, native stack, and JS stack, outputting the
+// details to aCollector.
 static void
 MergeStacks(uint32_t aFeatures, bool aIsSynchronous,
             const RegisteredThread& aRegisteredThread, const Registers& aRegs,
             const NativeStack& aNativeStack,
             ProfilerStackCollector& aCollector)
 {
   // WARNING: this function runs within the profiler's "critical section".
   // WARNING: this function might be called while the profiler is inactive, and
   //          cannot rely on ActivePS.
 
-  const PseudoStack& pseudoStack =
-    aRegisteredThread.RacyRegisteredThread().PseudoStack();
-  const js::ProfilingStackFrame* pseudoEntries = pseudoStack.frames;
-  uint32_t pseudoCount = pseudoStack.stackSize();
+  const ProfilingStack& profilingStack =
+    aRegisteredThread.RacyRegisteredThread().ProfilingStack();
+  const js::ProfilingStackFrame* profilingStackFrames = profilingStack.frames;
+  uint32_t profilingStackFrameCount = profilingStack.stackSize();
   JSContext* context = aRegisteredThread.GetJSContext();
 
   // Make a copy of the JS stack into a JSFrame array. This is necessary since,
   // like the native stack, the JS stack is iterated youngest-to-oldest and we
   // need to iterate oldest-to-youngest when adding frames to aInfo.
 
   // Non-periodic sampling passes Nothing() as the buffer write position to
   // ProfilingFrameIterator to avoid incorrectly resetting the buffer position
@@ -895,101 +895,105 @@ MergeStacks(uint32_t aFeatures, bool aIs
           if (frame.isSome()) {
             jsFrames[jsCount++] = frame.value();
           }
         }
       }
     }
   }
 
-  // While the pseudo-stack array is ordered oldest-to-youngest, the JS and
+  // While the profiling stack array is ordered oldest-to-youngest, the JS and
   // native arrays are ordered youngest-to-oldest. We must add frames to aInfo
-  // oldest-to-youngest. Thus, iterate over the pseudo-stack forwards and JS
+  // oldest-to-youngest. Thus, iterate over the profiling stack forwards and JS
   // and native arrays backwards. Note: this means the terminating condition
   // jsIndex and nativeIndex is being < 0.
-  uint32_t pseudoIndex = 0;
+  uint32_t profilingStackIndex = 0;
   int32_t jsIndex = jsCount - 1;
   int32_t nativeIndex = aNativeStack.mCount - 1;
 
   uint8_t* lastLabelFrameStackAddr = nullptr;
   uint8_t* jitEndStackAddr = nullptr;
 
   // Iterate as long as there is at least one frame remaining.
-  while (pseudoIndex != pseudoCount || jsIndex >= 0 || nativeIndex >= 0) {
+  while (profilingStackIndex != profilingStackFrameCount || jsIndex >= 0 ||
+         nativeIndex >= 0) {
     // There are 1 to 3 frames available. Find and add the oldest.
-    uint8_t* pseudoStackAddr = nullptr;
+    uint8_t* profilingStackAddr = nullptr;
     uint8_t* jsStackAddr = nullptr;
     uint8_t* nativeStackAddr = nullptr;
     uint8_t* jsActivationAddr = nullptr;
 
-    if (pseudoIndex != pseudoCount) {
-      const js::ProfilingStackFrame& profilingStackFrame = pseudoEntries[pseudoIndex];
-
-      if (profilingStackFrame.isLabelFrame() || profilingStackFrame.isSpMarkerFrame()) {
+    if (profilingStackIndex != profilingStackFrameCount) {
+      const js::ProfilingStackFrame& profilingStackFrame =
+        profilingStackFrames[profilingStackIndex];
+
+      if (profilingStackFrame.isLabelFrame() ||
+          profilingStackFrame.isSpMarkerFrame()) {
         lastLabelFrameStackAddr = (uint8_t*) profilingStackFrame.stackAddress();
       }
 
       // Skip any JS_OSR frames. Such frames are used when the JS interpreter
       // enters a jit frame on a loop edge (via on-stack-replacement, or OSR).
-      // To avoid both the pseudoframe and jit frame being recorded (and
-      // showing up twice), the interpreter marks the interpreter pseudostack
-      // frame as JS_OSR to ensure that it doesn't get counted.
+      // To avoid both the profiling stack frame and jit frame being recorded
+      // (and showing up twice), the interpreter marks the interpreter
+      // profiling stack frame as JS_OSR to ensure that it doesn't get counted.
       if (profilingStackFrame.kind() == js::ProfilingStackFrame::Kind::JS_OSR) {
-          pseudoIndex++;
+          profilingStackIndex++;
           continue;
       }
 
       MOZ_ASSERT(lastLabelFrameStackAddr);
-      pseudoStackAddr = lastLabelFrameStackAddr;
+      profilingStackAddr = lastLabelFrameStackAddr;
     }
 
     if (jsIndex >= 0) {
       jsStackAddr = (uint8_t*) jsFrames[jsIndex].stackAddress;
       jsActivationAddr = (uint8_t*) jsFrames[jsIndex].activation;
     }
 
     if (nativeIndex >= 0) {
       nativeStackAddr = (uint8_t*) aNativeStack.mSPs[nativeIndex];
     }
 
     // If there's a native stack frame which has the same SP as a profiling
     // stack frame, pretend we didn't see the native stack frame.  Ditto for a
     // native stack frame which has the same SP as a JS stack frame.  In effect
     // this means profiling stack frames or JS frames trump conflicting native
     // frames.
-    if (nativeStackAddr && (pseudoStackAddr == nativeStackAddr ||
+    if (nativeStackAddr && (profilingStackAddr == nativeStackAddr ||
                             jsStackAddr == nativeStackAddr)) {
       nativeStackAddr = nullptr;
       nativeIndex--;
-      MOZ_ASSERT(pseudoStackAddr || jsStackAddr);
+      MOZ_ASSERT(profilingStackAddr || jsStackAddr);
     }
 
     // Sanity checks.
-    MOZ_ASSERT_IF(pseudoStackAddr, pseudoStackAddr != jsStackAddr &&
-                                   pseudoStackAddr != nativeStackAddr);
-    MOZ_ASSERT_IF(jsStackAddr, jsStackAddr != pseudoStackAddr &&
+    MOZ_ASSERT_IF(profilingStackAddr, profilingStackAddr != jsStackAddr &&
+                                      profilingStackAddr != nativeStackAddr);
+    MOZ_ASSERT_IF(jsStackAddr, jsStackAddr != profilingStackAddr &&
                                jsStackAddr != nativeStackAddr);
-    MOZ_ASSERT_IF(nativeStackAddr, nativeStackAddr != pseudoStackAddr &&
+    MOZ_ASSERT_IF(nativeStackAddr, nativeStackAddr != profilingStackAddr &&
                                    nativeStackAddr != jsStackAddr);
 
-    // Check to see if pseudoStack frame is top-most.
-    if (pseudoStackAddr > jsStackAddr && pseudoStackAddr > nativeStackAddr) {
-      MOZ_ASSERT(pseudoIndex < pseudoCount);
-      const js::ProfilingStackFrame& profilingStackFrame = pseudoEntries[pseudoIndex];
+    // Check to see if profiling stack frame is top-most.
+    if (profilingStackAddr > jsStackAddr && profilingStackAddr > nativeStackAddr) {
+      MOZ_ASSERT(profilingStackIndex < profilingStackFrameCount);
+      const js::ProfilingStackFrame& profilingStackFrame =
+        profilingStackFrames[profilingStackIndex];
 
       // Sp marker frames are just annotations and should not be recorded in
       // the profile.
       if (!profilingStackFrame.isSpMarkerFrame()) {
         // The JIT only allows the top-most frame to have a nullptr pc.
         MOZ_ASSERT_IF(profilingStackFrame.isJsFrame() &&
                       profilingStackFrame.script() && !profilingStackFrame.pc(),
-                      &profilingStackFrame == &pseudoStack.frames[pseudoStack.stackSize() - 1]);
+                      &profilingStackFrame == &profilingStack.frames[profilingStack.stackSize() - 1]);
         aCollector.CollectProfilingStackFrame(profilingStackFrame);
       }
-      pseudoIndex++;
+      profilingStackIndex++;
       continue;
     }
 
     // Check to see if JS jit stack frame is top-most
     if (jsStackAddr > nativeStackAddr) {
       MOZ_ASSERT(jsIndex >= 0);
       const JS::ProfilingFrameIterator::Frame& jsFrame = jsFrames[jsIndex];
       jitEndStackAddr = (uint8_t*) jsFrame.endStackAddress;
@@ -1124,27 +1128,27 @@ DoEHABIBacktrace(PSLockRef aLock, const 
                  const Registers& aRegs, NativeStack& aNativeStack)
 {
   // WARNING: this function runs within the profiler's "critical section".
   // WARNING: this function might be called while the profiler is inactive, and
   //          cannot rely on ActivePS.
 
   const mcontext_t* mcontext = &aRegs.mContext->uc_mcontext;
   mcontext_t savedContext;
-  const PseudoStack& pseudoStack =
-    aRegisteredThread.RacyRegisteredThread().PseudoStack();
-
-  // The pseudostack contains an "EnterJIT" frame whenever we enter
+  const ProfilingStack& profilingStack =
+    aRegisteredThread.RacyRegisteredThread().ProfilingStack();
+
+  // The profiling stack contains an "EnterJIT" frame whenever we enter
   // JIT code with profiling enabled; the stack pointer value points
   // the saved registers.  We use this to unwind resume unwinding
   // after encounting JIT code.
-  for (uint32_t i = pseudoStack.stackSize(); i > 0; --i) {
-    // The pseudostack grows towards higher indices, so we iterate
+  for (uint32_t i = profilingStack.stackSize(); i > 0; --i) {
+    // The profiling stack grows towards higher indices, so we iterate
     // backwards (from callee to caller).
-    const js::ProfilingStackFrame& frame = pseudoStack.frames[i - 1];
+    const js::ProfilingStackFrame& frame = profilingStack.frames[i - 1];
     if (!frame.isJsFrame() && strcmp(frame.label(), "EnterJIT") == 0) {
       // Found JIT entry frame.  Unwind up to that point (i.e., force
       // the stack walk to stop before the block of saved registers;
       // note that it yields nondecreasing stack pointers), then restore
       // the saved state.
       uint32_t* vSP = reinterpret_cast<uint32_t*>(frame.stackAddress());
 
       aNativeStack.mCount +=
@@ -2317,34 +2321,34 @@ NotifyProfilerStarted(const int aEntries
 }
 
 static void
 locked_profiler_start(PSLockRef aLock, uint32_t aEntries, double aInterval,
                       uint32_t aFeatures,
                       const char** aFilters, uint32_t aFilterCount);
 
 // This basically duplicates AutoProfilerLabel's constructor.
-PseudoStack*
+ProfilingStack*
 MozGlueLabelEnter(const char* aLabel, const char* aDynamicString, void* aSp,
                   uint32_t aLine)
 {
-  PseudoStack* pseudoStack = AutoProfilerLabel::sPseudoStack.get();
-  if (pseudoStack) {
-    pseudoStack->pushLabelFrame(aLabel, aDynamicString, aSp, aLine,
+  ProfilingStack* profilingStack = AutoProfilerLabel::sProfilingStack.get();
+  if (profilingStack) {
+    profilingStack->pushLabelFrame(aLabel, aDynamicString, aSp, aLine,
                                 js::ProfilingStackFrame::Category::OTHER);
   }
-  return pseudoStack;
+  return profilingStack;
 }
 
 // This basically duplicates AutoProfilerLabel's destructor.
 void
-MozGlueLabelExit(PseudoStack* aPseudoStack)
+MozGlueLabelExit(ProfilingStack* sProfilingStack)
 {
-  if (aPseudoStack) {
-    aPseudoStack->pop();
+  if (sProfilingStack) {
+    sProfilingStack->pop();
   }
 }
 
 static nsTArray<const char*>
 SplitAtCommas(const char* aString, UniquePtr<char[]>& aStorage)
 {
   size_t len = strlen(aString);
   aStorage = MakeUnique<char[]>(len + 1);
--- a/tools/profiler/public/GeckoProfiler.h
+++ b/tools/profiler/public/GeckoProfiler.h
@@ -6,17 +6,17 @@
 
 // The Gecko Profiler is an always-on profiler that takes fast and low overhead
 // samples of the program execution using only userspace functionality for
 // portability. The goal of this module is to provide performance data in a
 // generic cross-platform way without requiring custom tools or kernel support.
 //
 // Samples are collected to form a timeline with optional timeline event
 // (markers) used for filtering. The samples include both native stacks and
-// platform-independent "pseudostacks".
+// platform-independent "label stack" frames.
 
 #ifndef GeckoProfiler_h
 #define GeckoProfiler_h
 
 #ifndef MOZ_GECKO_PROFILER
 
 // This file can be #included unconditionally. However, everything within this
 // file must be guarded by a #ifdef MOZ_GECKO_PROFILER, *except* for the
@@ -101,17 +101,17 @@ class TimeStamp;
 // |macro| appropriately to extract the relevant parts. Note that the number
 // values are used internally only and so can be changed without consequence.
 // Any changes to this list should also be applied to the feature list in
 // browser/components/extensions/schemas/geckoProfiler.json.
 #define PROFILER_FOR_EACH_FEATURE(macro) \
   /* Profile Java code (Android only). */ \
   macro(0, "java", Java) \
   \
-  /* Get the JS engine to emit pseudostack entries in prologues/epilogues */ \
+  /* Get the JS engine to expose the JS stack to the profiler */ \
   macro(1, "js", JS) \
   \
   /* Include the C++ leaf node if not stackwalking. */ \
   /* The DevTools profiler doesn't want the native addresses. */ \
   macro(2, "leaf", Leaf) \
   \
   /* Add main thread I/O to the profile. */ \
   macro(3, "mainthreadio", MainThreadIO) \
@@ -228,17 +228,17 @@ private:
 // already run).
 void profiler_init(void* stackTop);
 
 #define AUTO_PROFILER_INIT \
   mozilla::AutoProfilerInit PROFILER_RAII
 
 // Clean up the profiler module, stopping it if required. This function may
 // also save a shutdown profile if requested. No profiler calls should happen
-// after this point and all pseudo labels should have been popped.
+// after this point and all profiling stack labels should have been popped.
 void profiler_shutdown();
 
 // Start the profiler -- initializing it first if necessary -- with the
 // selected options. Stops and restarts the profiler if it is already active.
 // After starting the profiler is "active". The samples will be recorded in a
 // circular buffer.
 //   "aEntries" is the number of entries in the profiler's circular buffer.
 //   "aInterval" the sampling interval, measured in millseconds.
@@ -395,17 +395,17 @@ public:
   virtual void CollectJitReturnAddr(void* aAddr) = 0;
 
   virtual void CollectWasmFrame(const char* aLabel) = 0;
 
   virtual void CollectProfilingStackFrame(const js::ProfilingStackFrame& aFrame) = 0;
 };
 
 // This method suspends the thread identified by aThreadId, samples its
-// pseudo-stack, JS stack, and (optionally) native stack, passing the collected
+// profiling stack, JS stack, and (optionally) native stack, passing the collected
 // frames into aCollector. aFeatures dictates which compiler features are used.
 // |Privacy| and |Leaf| are the only relevant ones.
 void profiler_suspend_and_sample_thread(int aThreadId, uint32_t aFeatures,
                                         ProfilerStackCollector& aCollector,
                                         bool aSampleNative = true);
 
 struct ProfilerBacktraceDestructor
 {
@@ -433,45 +433,45 @@ struct ProfilerBufferInfo
 // status of the profiler, allowing the user to get a sense for how fast the
 // buffer is being written to, and how much data is visible.
 mozilla::Maybe<ProfilerBufferInfo> profiler_get_buffer_info();
 
 //---------------------------------------------------------------------------
 // Put profiling data into the profiler (labels and markers)
 //---------------------------------------------------------------------------
 
-// Insert an RAII object in this scope to enter a pseudo stack frame. Any
-// samples collected in this scope will contain this label in their pseudo
-// stack. The label argument must be a static C string. It is usually of the
+// Insert an RAII object in this scope to enter a label stack frame. Any
+// samples collected in this scope will contain this label in their stack.
+// The label argument must be a static C string. It is usually of the
 // form "ClassName::FunctionName". (Ideally we'd use the compiler to provide
 // that for us, but __func__ gives us the function name without the class
 // name.) If the label applies to only part of a function, you can qualify it
 // like this: "ClassName::FunctionName:PartName".
 //
 // Use AUTO_PROFILER_LABEL_DYNAMIC_* if you want to add additional / dynamic
-// information to the pseudo stack frame.
+// information to the label stack frame.
 #define AUTO_PROFILER_LABEL(label, category) \
   mozilla::AutoProfilerLabel PROFILER_RAII(label, nullptr, __LINE__, \
                                            js::ProfilingStackFrame::Category::category)
 
 // Similar to AUTO_PROFILER_LABEL, but with an additional string. The inserted
 // RAII object stores the cStr pointer in a field; it does not copy the string.
 //
 // WARNING: This means that the string you pass to this macro needs to live at
 // least until the end of the current scope. Be careful using this macro with
 // ns[C]String; the other AUTO_PROFILER_LABEL_DYNAMIC_* macros below are
 // preferred because they avoid this problem.
 //
-// If the profiler samples the current thread and walks the pseudo stack while
+// If the profiler samples the current thread and walks the label stack while
 // this RAII object is on the stack, it will copy the supplied string into the
 // profile buffer. So there's one string copy operation, and it happens at
 // sample time.
 //
 // Compare this to the plain AUTO_PROFILER_LABEL macro, which only accepts
-// literal strings: When the pseudo stack frames generated by
+// literal strings: When the label stack frames generated by
 // AUTO_PROFILER_LABEL are sampled, no string copy needs to be made because the
 // profile buffer can just store the raw pointers to the literal strings.
 // Consequently, AUTO_PROFILER_LABEL frames take up considerably less space in
 // the profile buffer than AUTO_PROFILER_LABEL_DYNAMIC_* frames.
 #define AUTO_PROFILER_LABEL_DYNAMIC_CSTR(label, category, cStr) \
   mozilla::AutoProfilerLabel \
     PROFILER_RAII(label, cStr, __LINE__, js::ProfilingStackFrame::Category::category)
 
@@ -507,26 +507,26 @@ mozilla::Maybe<ProfilerBufferInfo> profi
     raiiObjectLossyNsString.emplace(label, asciiStr->get(), __LINE__, \
                                     js::ProfilingStackFrame::Category::category); \
   }
 
 // Similar to AUTO_PROFILER_LABEL, but accepting a JSContext* parameter, and a
 // no-op if the profiler is disabled.
 // Used to annotate functions for which overhead in the range of nanoseconds is
 // noticeable. It avoids overhead from the TLS lookup because it can get the
-// PseudoStack from the JS context, and avoids almost all overhead in the case
+// ProfilingStack from the JS context, and avoids almost all overhead in the case
 // where the profiler is disabled.
 #define AUTO_PROFILER_LABEL_FAST(label, category, ctx) \
   mozilla::AutoProfilerLabel PROFILER_RAII(ctx, label, nullptr, __LINE__, \
                                            js::ProfilingStackFrame::Category::category)
 
 // Insert a marker in the profile timeline. This is useful to delimit something
 // important happening such as the first paint. Unlike labels, which are only
 // recorded in the profile buffer if a sample is collected while the label is
-// on the pseudostack, markers will always be recorded in the profile buffer.
+// on the label stack, markers will always be recorded in the profile buffer.
 // aMarkerName is copied, so the caller does not need to ensure it lives for a
 // certain length of time. A no-op if the profiler is inactive or in privacy
 // mode.
 #define PROFILER_ADD_MARKER(markerName) \
   profiler_add_marker(markerName)
 void profiler_add_marker(const char* aMarkerName);
 void profiler_add_marker(const char* aMarkerName,
                          mozilla::UniquePtr<ProfilerMarkerPayload> aPayload);
@@ -681,82 +681,82 @@ public:
     }
   }
 
 private:
   MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
   bool mIssuedWake;
 };
 
-// This class creates a non-owning PseudoStack reference. Objects of this class
+// This class creates a non-owning ProfilingStack reference. Objects of this class
 // are stack-allocated, and so exist within a thread, and are thus bounded by
 // the lifetime of the thread, which ensures that the references held can't be
-// used after the PseudoStack is destroyed.
+// used after the ProfilingStack is destroyed.
 class MOZ_RAII AutoProfilerLabel
 {
 public:
   // This is the AUTO_PROFILER_LABEL and AUTO_PROFILER_LABEL_DYNAMIC variant.
   AutoProfilerLabel(const char* aLabel, const char* aDynamicString,
                     uint32_t aLine, js::ProfilingStackFrame::Category aCategory
                     MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
   {
     MOZ_GUARD_OBJECT_NOTIFIER_INIT;
 
-    // Get the PseudoStack from TLS.
-    Push(sPseudoStack.get(), aLabel, aDynamicString, aLine, aCategory);
+    // Get the ProfilingStack from TLS.
+    Push(sProfilingStack.get(), aLabel, aDynamicString, aLine, aCategory);
   }
 
   // This is the AUTO_PROFILER_LABEL_FAST variant. It's guarded on
-  // profiler_is_active() and retrieves the PseudoStack from the JSContext.
+  // profiler_is_active() and retrieves the ProfilingStack from the JSContext.
   AutoProfilerLabel(JSContext* aJSContext,
                     const char* aLabel, const char* aDynamicString,
                     uint32_t aLine, js::ProfilingStackFrame::Category aCategory
                     MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
   {
     MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     if (profiler_is_active()) {
       Push(js::GetContextProfilingStack(aJSContext),
            aLabel, aDynamicString, aLine, aCategory);
     } else {
-      mPseudoStack = nullptr;
+      mProfilingStack = nullptr;
     }
   }
 
-  void Push(PseudoStack* aPseudoStack,
+  void Push(ProfilingStack* aProfilingStack,
             const char* aLabel, const char* aDynamicString,
             uint32_t aLine, js::ProfilingStackFrame::Category aCategory)
   {
     // This function runs both on and off the main thread.
 
-    mPseudoStack = aPseudoStack;
-    if (mPseudoStack) {
-      mPseudoStack->pushLabelFrame(aLabel, aDynamicString, this, aLine,
+    mProfilingStack = aProfilingStack;
+    if (mProfilingStack) {
+      mProfilingStack->pushLabelFrame(aLabel, aDynamicString, this, aLine,
                                    aCategory);
     }
   }
 
   ~AutoProfilerLabel()
   {
     // This function runs both on and off the main thread.
 
-    if (mPseudoStack) {
-      mPseudoStack->pop();
+    if (mProfilingStack) {
+      mProfilingStack->pop();
     }
   }
 
 private:
   MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 
-  // We save a PseudoStack pointer in the ctor so we don't have to redo the TLS
+  // We save a ProfilingStack pointer in the ctor so we don't have to redo the TLS
   // lookup in the dtor.
-  PseudoStack* mPseudoStack;
+  ProfilingStack* mProfilingStack;
 
 public:
   // See the comment on the definition in platform.cpp for details about this.
-  static MOZ_THREAD_LOCAL(PseudoStack*) sPseudoStack;
+  static MOZ_THREAD_LOCAL(ProfilingStack*) sProfilingStack;
 };
 
 class MOZ_RAII AutoProfilerTracing
 {
 public:
   AutoProfilerTracing(const char* aCategory, const char* aMarkerName
                       MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
     : mCategory(aCategory)
--- a/tools/profiler/tests/gtest/GeckoProfiler.cpp
+++ b/tools/profiler/tests/gtest/GeckoProfiler.cpp
@@ -675,17 +675,17 @@ TEST(GeckoProfiler, StreamJSONForThisPro
       }),
     NS_DISPATCH_SYNC);
   thread->Shutdown();
 
   // Call profiler_stream_json_for_this_process on the main thread.
   ASSERT_TRUE(!profiler_stream_json_for_this_process(w));
 }
 
-TEST(GeckoProfiler, PseudoStack)
+TEST(GeckoProfiler, ProfilingStack)
 {
   uint32_t features = ProfilerFeature::StackWalk;
   const char* filters[] = { "GeckoMain" };
 
   AUTO_PROFILER_LABEL("A::B", OTHER);
 
   UniqueFreePtr<char> dynamic(strdup("dynamic"));
   {