From a2c515239b0fc01045426923ebbd94ce96eac97c Mon Sep 17 00:00:00 2001 From: Brian Hackett Date: Wed, 25 Sep 2013 13:14:21 -0600 Subject: [PATCH] Bug 919140 - Watch for lazy scripts in AddPossibleCallees, r=jandem. --- js/src/jit/CodeGenerator.cpp | 2 +- js/src/jit/ParallelSafetyAnalysis.cpp | 8 +++----- js/src/jit/ParallelSafetyAnalysis.h | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/js/src/jit/CodeGenerator.cpp b/js/src/jit/CodeGenerator.cpp index 533f07dc9867..c37ce363f477 100644 --- a/js/src/jit/CodeGenerator.cpp +++ b/js/src/jit/CodeGenerator.cpp @@ -5680,7 +5680,7 @@ CodeGenerator::link() // only tracked when compiling for parallel execution. CallTargetVector callTargets; if (executionMode == ParallelExecution) - AddPossibleCallees(graph.mir(), callTargets); + AddPossibleCallees(cx, graph.mir(), callTargets); IonScript *ionScript = IonScript::New(cx, graph.totalSlotCount(), scriptFrameSize, snapshots_.size(), diff --git a/js/src/jit/ParallelSafetyAnalysis.cpp b/js/src/jit/ParallelSafetyAnalysis.cpp index 26e5f549608d..23a8eda47f2f 100644 --- a/js/src/jit/ParallelSafetyAnalysis.cpp +++ b/js/src/jit/ParallelSafetyAnalysis.cpp @@ -780,10 +780,8 @@ static bool AddCallTarget(HandleScript script, CallTargetVector &targets); bool -jit::AddPossibleCallees(MIRGraph &graph, CallTargetVector &targets) +jit::AddPossibleCallees(JSContext *cx, MIRGraph &graph, CallTargetVector &targets) { - JSContext *cx = GetIonContext()->cx; - for (ReversePostorderIterator block(graph.rpoBegin()); block != graph.rpoEnd(); block++) { for (MInstructionIterator ins(block->begin()); ins != block->end(); ins++) { @@ -797,8 +795,8 @@ jit::AddPossibleCallees(MIRGraph &graph, CallTargetVector &targets) JS_ASSERT_IF(!target->isInterpreted(), target->hasParallelNative()); if (target->isInterpreted()) { - RootedScript script(cx, target->nonLazyScript()); - if (!AddCallTarget(script, targets)) + RootedScript script(cx, target->getOrCreateScript(cx)); + if (!script || !AddCallTarget(script, targets)) return false; } diff --git a/js/src/jit/ParallelSafetyAnalysis.h b/js/src/jit/ParallelSafetyAnalysis.h index 5a9acd71b86c..3e68d6faacc2 100644 --- a/js/src/jit/ParallelSafetyAnalysis.h +++ b/js/src/jit/ParallelSafetyAnalysis.h @@ -47,7 +47,7 @@ class ParallelSafetyAnalysis // This code may clone scripts and thus may invoke the GC. Hence only // run from the link phase, which executes on the main thread. typedef Vector CallTargetVector; -bool AddPossibleCallees(MIRGraph &graph, CallTargetVector &targets); +bool AddPossibleCallees(JSContext *cx, MIRGraph &graph, CallTargetVector &targets); } // namespace jit } // namespace js