Bug 1246680 - Make ReadSPSProfilingStack check that profiling is not suppressed before proceeding. r=shu
authorKannan Vijayan <kvijayan@mozilla.com>
Mon, 18 Jul 2016 12:26:30 -0400
changeset 330668 514f963dfefd24b04ef05cd2889c3ea4b8836bc3
parent 330667 b6d9207f225715ada12aee6aed640f1708f46804
child 330669 048a09249037efad7c9cdb8a985c760c83bd0f71
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshu
bugs1246680
milestone50.0a1
Bug 1246680 - Make ReadSPSProfilingStack check that profiling is not suppressed before proceeding. r=shu
js/src/builtin/TestingFunctions.cpp
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -1596,16 +1596,23 @@ ReadSPSProfilingStack(JSContext* cx, uns
         return true;
     }
 
     // Array holding physical jit stack frames.
     RootedObject stack(cx, NewDenseEmptyArray(cx));
     if (!stack)
         return false;
 
+    // If profiler sampling has been suppressed, return an empty
+    // stack.
+    if (!cx->runtime()->isProfilerSamplingEnabled()) {
+      args.rval().setObject(*stack);
+      return true;
+    }
+
     RootedObject inlineStack(cx);
     RootedObject inlineFrameInfo(cx);
     RootedString frameKind(cx);
     RootedString frameLabel(cx);
     RootedId idx(cx);
 
     JS::ProfilingFrameIterator::RegisterState state;
     uint32_t physicalFrameNo = 0;