Bug 1047495 - Push RunScript JS frame in addition to CPP frame; r=djvj
--- a/js/src/vm/SPSProfiler.cpp
+++ b/js/src/vm/SPSProfiler.cpp
@@ -316,23 +316,27 @@ SPSEntryMarker::SPSEntryMarker(JSRuntime
: profiler(&rt->spsProfiler)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (!profiler->installed()) {
profiler = nullptr;
return;
}
size_before = *profiler->size_;
+ // We want to push a CPP frame so the profiler can correctly order JS and native stacks.
profiler->push("js::RunScript", this, nullptr, nullptr, /* copy = */ false);
+ // We also want to push a JS frame so the hang monitor can catch script hangs.
+ profiler->push("js::RunScript", nullptr, script, script->code(), /* copy = */ false);
}
SPSEntryMarker::~SPSEntryMarker()
{
if (profiler != nullptr) {
profiler->pop();
+ profiler->pop();
JS_ASSERT(size_before == *profiler->size_);
}
}
JS_FRIEND_API(jsbytecode*)
ProfileEntry::pc() const volatile
{
MOZ_ASSERT(isJs());