Bug 819797: Create script for lazy functions before using the script, r=dvander
authorHannes Verschore <hv1989@gmail.com>
Tue, 11 Dec 2012 12:22:06 +0100
changeset 115633 1181c5df586637733d0bb6781f9f2ed5ef841a95
parent 115632 a4a0aa79803867bc2457ffe27ae0ef8f3024655d
child 115634 8288c4940d1e3cd09291fa2bfce8bf9bfe98d528
push idunknown
push userunknown
push dateunknown
reviewersdvander
bugs819797
milestone20.0a1
Bug 819797: Create script for lazy functions before using the script, r=dvander
js/src/ion/CodeGenerator.cpp
--- a/js/src/ion/CodeGenerator.cpp
+++ b/js/src/ion/CodeGenerator.cpp
@@ -929,16 +929,20 @@ CodeGenerator::visitCallKnown(LCallKnown
 
     // Native single targets are handled by LCallNative.
     JS_ASSERT(!target->isNative());
     // Missing arguments must have been explicitly appended by the IonBuilder.
     JS_ASSERT(target->nargs <= call->numStackArgs());
 
     masm.checkStackAlignment();
 
+    // Make sure the function has a JSScript
+    if (target->isInterpretedLazy() && !target->getOrCreateScript(cx))
+        return false;
+
     // If the function is known to be uncompilable, only emit the call to InvokeFunction.
     ExecutionMode executionMode = gen->info().executionMode();
     RootedScript targetScript(cx, target->nonLazyScript());
     if (GetIonScript(targetScript, executionMode) == ION_DISABLED_SCRIPT) {
         if (!emitCallInvokeFunction(call, calleereg, call->numActualArgs(), unusedStack))
             return false;
 
         if (call->mir()->isConstructing()) {