<rdar://problem/6150322> In Gmail, a crash occurs at KJS::Machine::privateExecute...
[WebKit-https.git] / JavaScriptCore / VM / Machine.cpp
index 915fca8..5ae33c6 100644 (file)
@@ -82,8 +82,10 @@ static void* op_call_indirect;
 #endif
 
 // Returns the depth of the scope chain within a given call frame.
-static int depth(ScopeChain& sc)
+static int depth(CodeBlock* codeBlock, ScopeChain& sc)
 {
+    if (!codeBlock->needsFullScopeChain)
+        return 0;
     int scopeDepth = 0;
     ScopeChainIterator iter = sc.begin();
     ScopeChainIterator end = sc.end();
@@ -740,7 +742,7 @@ NEVER_INLINE Instruction* Machine::throwException(ExecState* exec, JSValue*& exc
     // Now unwind the scope chain within the exception handler's call frame.
 
     ScopeChain sc(scopeChain);
-    int scopeDelta = depth(sc) - scopeDepth;
+    int scopeDelta = depth(codeBlock, sc) - scopeDepth;
     ASSERT(scopeDelta >= 0);
     while (scopeDelta--)
         sc.pop();