Bug 1047495 - Push RunScript JS frame in addition to CPP frame; r=djvj
authorJim Chen <nchen@mozilla.com>
Tue, 05 Aug 2014 12:41:10 -0400
changeset 198004 e2dc50b68014db43c4d7d837a829f69fc3ba47f4
parent 198003 9688c8b7fdc10b19650c245879ec8d1cc801b271
child 198005 392cc38c7981f6b1fd553e308bf33e17ed9e87e5
push id1036
push userrnewman@mozilla.com
push dateWed, 06 Aug 2014 02:14:58 +0000
treeherderservices-central@3fd543e150c8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdjvj
bugs1047495
milestone34.0a1
Bug 1047495 - Push RunScript JS frame in addition to CPP frame; r=djvj
js/src/vm/SPSProfiler.cpp
--- 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());