Bug 1853720 - Inline-away AutoProfilerLabel::Push. r=aabh,profiler-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D188486
This commit is contained in:
Markus Stange 2023-09-25 19:36:41 +00:00
Родитель 0d02f04be0
Коммит abfc9f5199
1 изменённых файлов: 11 добавлений и 18 удалений

Просмотреть файл

@ -215,14 +215,16 @@ class MOZ_RAII AutoProfilerLabel {
JS::ProfilingCategoryPair aCategoryPair,
uint32_t aFlags = 0) {
// Get the ProfilingStack from TLS.
ProfilingStack* profilingStack =
profiler::ThreadRegistration::WithOnThreadRefOr(
mProfilingStack = profiler::ThreadRegistration::WithOnThreadRefOr(
[](profiler::ThreadRegistration::OnThreadRef aThread) {
return &aThread.UnlockedConstReaderAndAtomicRWRef()
.ProfilingStackRef();
},
nullptr);
Push(profilingStack, aLabel, aDynamicString, aCategoryPair, aFlags);
if (mProfilingStack) {
mProfilingStack->pushLabelFrame(aLabel, aDynamicString, this,
aCategoryPair, aFlags);
}
}
// This is the AUTO_PROFILER_LABEL_FAST variant. It retrieves the
@ -231,16 +233,7 @@ class MOZ_RAII AutoProfilerLabel {
AutoProfilerLabel(JSContext* aJSContext, const char* aLabel,
const char* aDynamicString,
JS::ProfilingCategoryPair aCategoryPair, uint32_t aFlags) {
Push(js::GetContextProfilingStackIfEnabled(aJSContext), aLabel,
aDynamicString, aCategoryPair, aFlags);
}
void Push(ProfilingStack* aProfilingStack, const char* aLabel,
const char* aDynamicString, JS::ProfilingCategoryPair aCategoryPair,
uint32_t aFlags = 0) {
// This function runs both on and off the main thread.
mProfilingStack = aProfilingStack;
mProfilingStack = js::GetContextProfilingStackIfEnabled(aJSContext);
if (mProfilingStack) {
mProfilingStack->pushLabelFrame(aLabel, aDynamicString, this,
aCategoryPair, aFlags);