Changeset 38247 in webkit for trunk/JavaScriptCore/bytecompiler
- Timestamp:
- Nov 9, 2008, 5:04:30 PM (17 years ago)
- Location:
- trunk/JavaScriptCore/bytecompiler
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/bytecompiler/CodeGenerator.cpp
r38230 r38247 208 208 , m_globalData(&scopeChain.globalObject()->globalExec()->globalData()) 209 209 , m_lastOpcodeID(op_end) 210 , m_emitNodeDepth(0) 210 211 { 211 212 if (m_shouldEmitDebugHooks) … … 284 285 , m_globalData(&scopeChain.globalObject()->globalExec()->globalData()) 285 286 , m_lastOpcodeID(op_end) 287 , m_emitNodeDepth(0) 286 288 { 287 289 if (m_shouldEmitDebugHooks) … … 354 356 , m_globalData(&scopeChain.globalObject()->globalExec()->globalData()) 355 357 , m_lastOpcodeID(op_end) 358 , m_emitNodeDepth(0) 356 359 { 357 360 if (m_shouldEmitDebugHooks) … … 1677 1680 } 1678 1681 1682 RegisterID* CodeGenerator::emitThrowExpressionTooDeepException() 1683 { 1684 // It would be nice to do an even better job of identifying exactly where the expression is. 1685 // And we could make the caller pass the node pointer in, if there was some way of getting 1686 // that from an arbitrary node. However, calling emitExpressionInfo without any useful data 1687 // is still good enough to get us an accurate line number. 1688 emitExpressionInfo(0, 0, 0); 1689 RegisterID* exception = emitNewError(newTemporary(), SyntaxError, jsString(globalData(), "Expression too deep")); 1690 emitThrow(exception); 1691 return exception; 1692 } 1693 1679 1694 } // namespace JSC -
trunk/JavaScriptCore/bytecompiler/CodeGenerator.h
r38219 r38247 166 166 m_codeBlock->lineInfo.append(info); 167 167 } 168 return n->emitCode(*this, dst); 168 if (m_emitNodeDepth >= s_maxEmitNodeDepth) 169 return emitThrowExpressionTooDeepException(); 170 ++m_emitNodeDepth; 171 RegisterID* r = n->emitCode(*this, dst); 172 --m_emitNodeDepth; 173 return r; 169 174 } 170 175 … … 400 405 bool canOptimizeNonLocals() { return (m_codeType == FunctionCode) && !m_dynamicScopeDepth && !m_codeBlock->usesEval; } 401 406 407 RegisterID* emitThrowExpressionTooDeepException(); 408 402 409 bool m_shouldEmitDebugHooks; 403 410 bool m_shouldEmitProfileHooks; … … 445 452 static bool s_dumpsGeneratedCode; 446 453 #endif 454 455 unsigned m_emitNodeDepth; 456 457 static const unsigned s_maxEmitNodeDepth = 10000; 447 458 }; 448 459
Note:
See TracChangeset
for help on using the changeset viewer.