Bug 818958: Tell SPSProfiler when the JS runtime shuts down r=luke

This commit is contained in:
Irving Reid 2013-01-18 12:04:35 -05:00
parent 009043843c
commit 7deeb3fb59
2 changed files with 10 additions and 0 deletions

View File

@ -1308,6 +1308,11 @@ XPCJSRuntime::~XPCJSRuntime()
fprintf(stderr, "nJRSI: destroyed runtime %p\n", (void *)mJSRuntime);
#endif
}
#ifdef MOZ_ENABLE_PROFILER_SPS
// Tell the profiler that the runtime is gone
if (ProfileStack *stack = mozilla_profile_stack())
stack->sampleRuntime(nullptr);
#endif
#ifdef DEBUG
for (uint32_t i = 0; i < XPCCCX_STRING_CACHE_SIZE; ++i) {

View File

@ -368,6 +368,11 @@ public:
void sampleRuntime(JSRuntime *runtime) {
mRuntime = runtime;
if (!runtime) {
// JS shut down
return;
}
JS_STATIC_ASSERT(sizeof(mStack[0]) == sizeof(js::ProfileEntry));
js::SetRuntimeProfilingStack(runtime,
(js::ProfileEntry*) mStack,