Bug 1130367 - Fix readSPSProfilingStack testing function to work right when profiler is disabled. r=shu

This commit is contained in:
Kannan Vijayan 2015-02-23 18:45:43 -05:00
parent cb76881e78
commit b715de9b7e
2 changed files with 7 additions and 1 deletions

View File

@ -1245,8 +1245,11 @@ ReadSPSProfilingStack(JSContext *cx, unsigned argc, jsval *vp)
CallArgs args = CallArgsFromVp(argc, vp);
args.rval().setUndefined();
if (!cx->runtime()->spsProfiler.enabled())
// Return boolean 'false' if profiler is not enabled.
if (!cx->runtime()->spsProfiler.enabled()) {
args.rval().setBoolean(false);
return true;
}
// Array holding physical jit stack frames.
RootedObject stack(cx, NewDenseEmptyArray(cx));

View File

@ -1719,6 +1719,9 @@ JS::ProfilingFrameIterator::ProfilingFrameIterator(JSRuntime *rt, const Register
activation_(rt->profilingActivation()),
savedPrevJitTop_(nullptr)
{
// Should only be instantiated when profiling is enabled.
MOZ_ASSERT(rt_->spsProfiler.enabled());
if (!activation_)
return;