Bug 1406888 - Inline GeckoProfilerEntryMarker ctor/dtor. r=anba

This commit is contained in:
Jan de Mooij 2017-10-11 10:30:00 +02:00
Родитель cc66552944
Коммит 763bc6ef8d
3 изменённых файлов: 45 добавлений и 38 удалений

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

@ -47,6 +47,42 @@ class MOZ_RAII AutoSuppressProfilerSampling
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
MOZ_ALWAYS_INLINE
GeckoProfilerEntryMarker::GeckoProfilerEntryMarker(JSContext* cx,
JSScript* script
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: profiler_(&cx->geckoProfiler())
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (MOZ_LIKELY(!profiler_->installed())) {
profiler_ = nullptr;
return;
}
#ifdef DEBUG
spBefore_ = profiler_->stackPointer();
#endif
// We want to push a CPP frame so the profiler can correctly order JS and native stacks.
// Only the sp value is important.
profiler_->pseudoStack_->pushCppFrame(
/* label = */ "", /* dynamicString = */ nullptr, /* sp = */ this, /* line = */ 0,
ProfileEntry::Kind::CPP_MARKER_FOR_JS, ProfileEntry::Category::OTHER);
profiler_->pseudoStack_->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
MOZ_ASSERT(spBefore_ == profiler_->stackPointer());
}
MOZ_ALWAYS_INLINE
AutoGeckoProfilerEntry::AutoGeckoProfilerEntry(JSContext* cx, const char* label,
ProfileEntry::Category category

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

@ -376,38 +376,6 @@ ProfileEntry::trace(JSTracer* trc)
}
}
GeckoProfilerEntryMarker::GeckoProfilerEntryMarker(JSContext* cx,
JSScript* script
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: profiler(&cx->geckoProfiler())
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (!profiler->installed()) {
profiler = nullptr;
return;
}
spBefore_ = profiler->stackPointer();
// We want to push a CPP frame so the profiler can correctly order JS and native stacks.
// Only the sp value is important.
profiler->pseudoStack_->pushCppFrame(
/* label = */ "", /* dynamicString = */ nullptr, /* sp = */ this, /* line = */ 0,
ProfileEntry::Kind::CPP_MARKER_FOR_JS, ProfileEntry::Category::OTHER);
profiler->pseudoStack_->pushJsFrame(
"js::RunScript", /* dynamicString = */ nullptr, script, script->code());
}
GeckoProfilerEntryMarker::~GeckoProfilerEntryMarker()
{
if (profiler == nullptr)
return;
profiler->pseudoStack_->pop(); // the JS frame
profiler->pseudoStack_->pop(); // the BEGIN_PSEUDO_JS frame
MOZ_ASSERT(spBefore_ == profiler->stackPointer());
}
GeckoProfilerBaselineOSRMarker::GeckoProfilerBaselineOSRMarker(JSContext* cx, bool hasProfilerFrame
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: profiler(&cx->geckoProfiler())

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

@ -209,14 +209,17 @@ GeckoProfilerRuntime::stringsReset()
class MOZ_RAII GeckoProfilerEntryMarker
{
public:
explicit GeckoProfilerEntryMarker(JSContext* cx,
JSScript* script
MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~GeckoProfilerEntryMarker();
explicit MOZ_ALWAYS_INLINE
GeckoProfilerEntryMarker(JSContext* cx,
JSScript* script
MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
MOZ_ALWAYS_INLINE ~GeckoProfilerEntryMarker();
private:
GeckoProfilerThread* profiler;
mozilla::DebugOnly<uint32_t> spBefore_;
GeckoProfilerThread* profiler_;
#ifdef DEBUG
uint32_t spBefore_;
#endif
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};