From aa7429333ca733eacc2e0e93b205be219add7720 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Wed, 30 Dec 2015 13:28:13 +0100 Subject: [PATCH] Bug 1233152 - Use PersistentRooted for ParseTask script and sourceObject. r=terrence --- js/src/vm/HelperThreads.cpp | 5 +++-- js/src/vm/HelperThreads.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/js/src/vm/HelperThreads.cpp b/js/src/vm/HelperThreads.cpp index e1b063085094..a31a8e90b36c 100644 --- a/js/src/vm/HelperThreads.cpp +++ b/js/src/vm/HelperThreads.cpp @@ -202,7 +202,8 @@ ParseTask::ParseTask(ExclusiveContext* cx, JSObject* exclusiveContextGlobal, JSC alloc(JSRuntime::TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE), exclusiveContextGlobal(initCx->runtime(), exclusiveContextGlobal), callback(callback), callbackData(callbackData), - script(nullptr), sourceObject(nullptr), errors(cx), overRecursed(false) + script(initCx->runtime()), sourceObject(initCx->runtime()), + errors(cx), overRecursed(false) { } @@ -1384,7 +1385,7 @@ HelperThread::handleParseWorkload() task->options, srcBuf, /* source_ = */ nullptr, /* extraSct = */ nullptr, - /* sourceObjectOut = */ &(task->sourceObject)); + /* sourceObjectOut = */ task->sourceObject.address()); } // The callback is invoked while we are still off the main thread. diff --git a/js/src/vm/HelperThreads.h b/js/src/vm/HelperThreads.h index 10f1471fad48..aae3c152ddfa 100644 --- a/js/src/vm/HelperThreads.h +++ b/js/src/vm/HelperThreads.h @@ -479,10 +479,10 @@ struct ParseTask // Holds the final script between the invocation of the callback and the // point where FinishOffThreadScript is called, which will destroy the // ParseTask. - JSScript* script; + PersistentRootedScript script; // Holds the ScriptSourceObject generated for the script compilation. - ScriptSourceObject* sourceObject; + PersistentRooted sourceObject; // Any errors or warnings produced during compilation. These are reported // when finishing the script.