зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1130367 - Ensure profiler stack sampling is disabled when spsProfiler is disabled. r=shu
This commit is contained in:
Родитель
9ab946434d
Коммит
834ee9ffd2
|
@ -123,6 +123,9 @@ class JS_PUBLIC_API(ProfilingFrameIterator)
|
|||
bool isJit() const;
|
||||
};
|
||||
|
||||
JS_FRIEND_API(bool)
|
||||
IsProfilingEnabledForRuntime(JSRuntime *runtime);
|
||||
|
||||
/**
|
||||
* After each sample run, this method should be called with the latest sample
|
||||
* buffer generation, and the lapCount. It will update corresponding fields on
|
||||
|
|
|
@ -1254,8 +1254,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));
|
||||
|
|
|
@ -848,3 +848,9 @@ JS::UpdateJSRuntimeProfilerSampleBufferGen(JSRuntime *runtime, uint32_t generati
|
|||
runtime->setProfilerSampleBufferGen(generation);
|
||||
runtime->updateProfilerSampleBufferLapCount(lapCount);
|
||||
}
|
||||
|
||||
JS_FRIEND_API(bool)
|
||||
JS::IsProfilingEnabledForRuntime(JSRuntime *runtime)
|
||||
{
|
||||
return runtime->spsProfiler.enabled();
|
||||
}
|
||||
|
|
|
@ -87,6 +87,12 @@ SPSProfiler::enable(bool enabled)
|
|||
*/
|
||||
ReleaseAllJITCode(rt->defaultFreeOp());
|
||||
|
||||
// Ensure that lastProfilingFrame is null before 'enabled' becomes true.
|
||||
if (rt->jitActivation) {
|
||||
rt->jitActivation->setLastProfilingFrame(nullptr);
|
||||
rt->jitActivation->setLastProfilingCallSite(nullptr);
|
||||
}
|
||||
|
||||
enabled_ = enabled;
|
||||
|
||||
/* Toggle SPS-related jumps on baseline jitcode.
|
||||
|
|
|
@ -1718,17 +1718,20 @@ JS::ProfilingFrameIterator::ProfilingFrameIterator(JSRuntime *rt, const Register
|
|||
uint32_t sampleBufferGen)
|
||||
: rt_(rt),
|
||||
sampleBufferGen_(sampleBufferGen),
|
||||
activation_(rt->profilingActivation()),
|
||||
activation_(nullptr),
|
||||
savedPrevJitTop_(nullptr)
|
||||
{
|
||||
if (!activation_)
|
||||
if (!rt->spsProfiler.enabled())
|
||||
MOZ_CRASH("ProfilingFrameIterator called when spsProfiler not enabled for runtime.");
|
||||
|
||||
if (!rt->profilingActivation())
|
||||
return;
|
||||
|
||||
// If profiler sampling is not enabled, skip.
|
||||
if (!rt_->isProfilerSamplingEnabled()) {
|
||||
activation_ = nullptr;
|
||||
if (!rt_->isProfilerSamplingEnabled())
|
||||
return;
|
||||
}
|
||||
|
||||
activation_ = rt->profilingActivation();
|
||||
|
||||
MOZ_ASSERT(activation_->isProfiling());
|
||||
|
||||
|
|
|
@ -489,7 +489,8 @@ void mergeStacksIntoProfile(ThreadProfile& aProfile, TickSample* aSample, Native
|
|||
uint32_t startBufferGen = aProfile.bufferGeneration();
|
||||
uint32_t jsCount = 0;
|
||||
JS::ProfilingFrameIterator::Frame jsFrames[1000];
|
||||
{
|
||||
// Only walk jit stack if profiling frame iterator is turned on.
|
||||
if (JS::IsProfilingEnabledForRuntime(pseudoStack->mRuntime)) {
|
||||
AutoWalkJSStack autoWalkJSStack;
|
||||
const uint32_t maxFrames = mozilla::ArrayLength(jsFrames);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче