Changeset 33293
- Timestamp:
- 05/12/08 23:01:54 (6 months ago)
- Location:
- branches/squirrelfish/JavaScriptCore
- Files:
-
- 3 modified
-
ChangeLog (modified) (1 diff)
-
VM/Machine.cpp (modified) (7 diffs)
-
VM/Machine.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/squirrelfish/JavaScriptCore/ChangeLog
r33292 r33293 1 2008-04-25 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Geoff. 4 5 Bug 18736: SQUIRRELFISH: switch statements with no default have incorrect codegen 6 <https://bugs.webkit.org/show_bug.cgi?id=18736> 7 8 Put a limit on the level of reentry recursion. 128 levels of re-entrant recursion 9 seems reasonable as it is greater than the old eval limit, and a long way short of 10 the reentry depth needed to overflow the stack. 11 12 * VM/Machine.cpp: 13 (KJS::Machine::execute): 14 * VM/Machine.h: 15 1 16 2008-04-25 Geoffrey Garen <ggaren@apple.com> 2 17 -
branches/squirrelfish/JavaScriptCore/VM/Machine.cpp
r33292 r33293 240 240 241 241 Machine::Machine() 242 : m_reentryDepth(0) 242 243 { 243 244 privateExecute(InitializeAndReturn); … … 549 550 JSValue* Machine::execute(ProgramNode* programNode, ExecState* exec, JSObject* thisObj, RegisterFileStack* registerFileStack, ScopeChainNode* scopeChain, JSValue** exception) 550 551 { 552 if (m_reentryDepth >= MaxReentryDepth) { 553 *exception = createStackOverflowError(exec); 554 return 0; 555 } 556 551 557 RegisterFile* registerFile = registerFileStack->pushRegisterFile(); 552 558 CodeBlock* codeBlock = &programNode->code(scopeChain); … … 561 567 if (codeBlock->needsFullScopeChain) 562 568 scopeChain = scopeChain->copy(); 563 569 m_reentryDepth++; 564 570 JSValue* result = privateExecute(Normal, exec, registerFile, r, scopeChain, codeBlock, exception); 565 571 m_reentryDepth--; 566 572 registerFileStack->popRegisterFile(); 567 573 return result; … … 570 576 JSValue* Machine::execute(FunctionBodyNode* functionBodyNode, ExecState* exec, FunctionImp* function, JSObject* thisObj, const List& args, RegisterFileStack* registerFileStack, ScopeChainNode* scopeChain, JSValue** exception) 571 577 { 578 if (m_reentryDepth >= MaxReentryDepth) { 579 *exception = createStackOverflowError(exec); 580 return 0; 581 } 582 572 583 RegisterFile* registerFile = registerFileStack->current(); 573 584 … … 606 617 callFrame = (*registerBase) + callFrameOffset; // registerBase may have moved, recompute callFrame 607 618 scopeChain = scopeChainForCall(newCodeBlock, scopeChain, function, callFrame, registerBase, r); 608 619 m_reentryDepth++; 609 620 JSValue* result = privateExecute(Normal, exec, registerFile, r, scopeChain, newCodeBlock, exception); 621 m_reentryDepth--; 610 622 registerFile->shrink(oldSize); 611 623 return result; … … 615 627 JSValue* Machine::execute(EvalNode* evalNode, ExecState* exec, JSObject* thisObj, RegisterFile* registerFile, int registerOffset, ScopeChainNode* scopeChain, JSValue** exception, JSObject* variableObject) 616 628 { 629 if (m_reentryDepth >= MaxReentryDepth) { 630 *exception = createStackOverflowError(exec); 631 return 0; 632 } 617 633 EvalCodeBlock* codeBlock = &evalNode->code(scopeChain); 618 634 … … 648 664 if (codeBlock->needsFullScopeChain) 649 665 scopeChain = scopeChain->copy(); 650 666 m_reentryDepth++; 651 667 JSValue* result = privateExecute(Normal, exec, registerFile, r, scopeChain, codeBlock, exception); 652 668 m_reentryDepth--; 653 669 registerFile->shrink(oldSize); 654 670 -
branches/squirrelfish/JavaScriptCore/VM/Machine.h
r33277 r33293 89 89 90 90 private: 91 enum { MaxReentryDepth = 128 }; 91 92 typedef enum { Normal, InitializeAndReturn } ExecutionFlag; 92 93 … … 101 102 bool isGlobalCallFrame(Register** registerBase, const Register* r) { return (*registerBase) == r; } 102 103 104 int m_reentryDepth; 103 105 #if HAVE(COMPUTED_GOTO) 104 106 Opcode m_opcodeTable[numOpcodeIDs]; // Maps OpcodeID => Opcode for compiling