tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit bb661aeb498c6809b82c7b90d7ddad47ffc33577
parent 1ae86c8f91d84cbe6a84fa47626bb991d2974d95
Author: Nazım Can Altınova <canaltinova@gmail.com>
Date:   Fri, 28 Nov 2025 09:42:32 +0000

Bug 2002825 - Rename CollectWasmFrame to CollectWasmOrSyncJITFrame r=mstange,profiler-reviewers

This was a source of confusion because even though the name said wasm
frames, it was also collecting the JIT frames that were from sync
samples (marker stacks). This should at least make it clearer for the
future readers when they need to touch these areas.

Differential Revision: https://phabricator.services.mozilla.com/D274328

Diffstat:
Mtoolkit/components/backgroundhangmonitor/ThreadStackHelper.cpp | 7+++++--
Mtoolkit/components/backgroundhangmonitor/ThreadStackHelper.h | 4++--
Mtools/profiler/core/ProfileBuffer.cpp | 2+-
Mtools/profiler/core/ProfileBuffer.h | 4++--
Mtools/profiler/core/platform.cpp | 3++-
Mtools/profiler/public/GeckoProfiler.h | 4++--
Mtools/profiler/tests/gtest/GeckoProfiler.cpp | 4++--
7 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/toolkit/components/backgroundhangmonitor/ThreadStackHelper.cpp b/toolkit/components/backgroundhangmonitor/ThreadStackHelper.cpp @@ -201,9 +201,12 @@ void ThreadStackHelper::CollectJitReturnAddr(void* aAddr) { TryAppendFrame(HangEntryJit()); } -void ThreadStackHelper::CollectWasmFrame(JS::ProfilingCategoryPair aCategory, - const char* aLabel) { +void ThreadStackHelper::CollectWasmOrSyncJITFrame( + JS::ProfilingCategoryPair aCategory, const char* aLabel) { MOZ_RELEASE_ASSERT(mStackToFill); + // BHR performs asynchronous sampling as the stack collection happens on the + // "BHMgr Monitor" thread. That's why, this method only receives WASM frames, + // never sync JIT frames. // We don't want to collect WASM frames, as they are probably for content, so // we just add a "(content wasm)" frame. TryAppendFrame(HangEntryWasm()); diff --git a/toolkit/components/backgroundhangmonitor/ThreadStackHelper.h b/toolkit/components/backgroundhangmonitor/ThreadStackHelper.h @@ -92,8 +92,8 @@ class ThreadStackHelper : public ProfilerStackCollector { virtual void SetIsMainThread() override; virtual void CollectNativeLeafAddr(void* aAddr) override; virtual void CollectJitReturnAddr(void* aAddr) override; - virtual void CollectWasmFrame(JS::ProfilingCategoryPair aCategory, - const char* aLabel) override; + virtual void CollectWasmOrSyncJITFrame(JS::ProfilingCategoryPair aCategory, + const char* aLabel) override; virtual void CollectProfilingStackFrame( const js::ProfilingStackFrame& aEntry) override; diff --git a/tools/profiler/core/ProfileBuffer.cpp b/tools/profiler/core/ProfileBuffer.cpp @@ -196,7 +196,7 @@ void ProfileBufferCollector::CollectJitReturnAddr(void* aAddr) { mBuf.AddEntry(ProfileBufferEntry::JitReturnAddr(aAddr)); } -void ProfileBufferCollector::CollectWasmFrame( +void ProfileBufferCollector::CollectWasmOrSyncJITFrame( JS::ProfilingCategoryPair aCategory, const char* aLabel) { mBuf.CollectCodeLocation("", aLabel, 0, 0, 0, Nothing(), Nothing(), Some(aCategory)); diff --git a/tools/profiler/core/ProfileBuffer.h b/tools/profiler/core/ProfileBuffer.h @@ -267,8 +267,8 @@ class ProfileBufferCollector final : public ProfilerStackCollector { virtual void CollectNativeLeafAddr(void* aAddr) override; virtual void CollectJitReturnAddr(void* aAddr) override; - virtual void CollectWasmFrame(JS::ProfilingCategoryPair aCategory, - const char* aLabel) override; + virtual void CollectWasmOrSyncJITFrame(JS::ProfilingCategoryPair aCategory, + const char* aLabel) override; virtual void CollectProfilingStackFrame( const js::ProfilingStackFrame& aFrame) override; diff --git a/tools/profiler/core/platform.cpp b/tools/profiler/core/platform.cpp @@ -2475,7 +2475,8 @@ static void MergeStacks( jsFrame.kind == JS::ProfilingFrameIterator::Frame_WasmIon || jsFrame.kind == JS::ProfilingFrameIterator::Frame_WasmBaseline || jsFrame.kind == JS::ProfilingFrameIterator::Frame_WasmOther) { - aCollector.CollectWasmFrame(jsFrame.profilingCategory(), jsFrame.label); + aCollector.CollectWasmOrSyncJITFrame(jsFrame.profilingCategory(), + jsFrame.label); } else if (jsFrame.kind == JS::ProfilingFrameIterator::Frame_BaselineInterpreter) { // Materialize a ProfilingStackFrame similar to the C++ Interpreter. We diff --git a/tools/profiler/public/GeckoProfiler.h b/tools/profiler/public/GeckoProfiler.h @@ -261,8 +261,8 @@ class ProfilerStackCollector { virtual void CollectJitReturnAddr(void* aAddr) = 0; - virtual void CollectWasmFrame(JS::ProfilingCategoryPair aCategory, - const char* aLabel) = 0; + virtual void CollectWasmOrSyncJITFrame(JS::ProfilingCategoryPair aCategory, + const char* aLabel) = 0; virtual void CollectProfilingStackFrame( const js::ProfilingStackFrame& aFrame) = 0; diff --git a/tools/profiler/tests/gtest/GeckoProfiler.cpp b/tools/profiler/tests/gtest/GeckoProfiler.cpp @@ -4094,8 +4094,8 @@ class GTestStackCollector final : public ProfilerStackCollector { virtual void CollectNativeLeafAddr(void* aAddr) { mFrames++; } virtual void CollectJitReturnAddr(void* aAddr) { mFrames++; } - virtual void CollectWasmFrame(JS::ProfilingCategoryPair aCategory, - const char* aLabel) { + virtual void CollectWasmOrSyncJITFrame(JS::ProfilingCategoryPair aCategory, + const char* aLabel) { mFrames++; } virtual void CollectProfilingStackFrame(