Changeset 39752 in webkit for trunk/JavaScriptCore/bytecompiler
- Timestamp:
- Jan 9, 2009, 10:47:37 AM (16 years ago)
- Location:
- trunk/JavaScriptCore/bytecompiler
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r39737 r39752 116 116 117 117 #ifndef NDEBUG 118 bool BytecodeGenerator::s_dumpsGeneratedCode = false;118 static bool s_dumpsGeneratedCode = false; 119 119 #endif 120 120 … … 212 212 : m_shouldEmitDebugHooks(!!debugger) 213 213 , m_shouldEmitProfileHooks(scopeChain.globalObject()->supportsProfiling()) 214 , m_regeneratingForExceptionInfo(false)215 214 , m_scopeChain(&scopeChain) 216 215 , m_symbolTable(symbolTable) … … 226 225 , m_lastOpcodeID(op_end) 227 226 , m_emitNodeDepth(0) 227 , m_regeneratingForExceptionInfo(false) 228 , m_codeBlockBeingRegeneratedFrom(0) 228 229 { 229 230 if (m_shouldEmitDebugHooks) … … 295 296 : m_shouldEmitDebugHooks(!!debugger) 296 297 , m_shouldEmitProfileHooks(scopeChain.globalObject()->supportsProfiling()) 297 , m_regeneratingForExceptionInfo(false)298 298 , m_scopeChain(&scopeChain) 299 299 , m_symbolTable(symbolTable) … … 307 307 , m_lastOpcodeID(op_end) 308 308 , m_emitNodeDepth(0) 309 , m_regeneratingForExceptionInfo(false) 310 , m_codeBlockBeingRegeneratedFrom(0) 309 311 { 310 312 if (m_shouldEmitDebugHooks) … … 367 369 : m_shouldEmitDebugHooks(!!debugger) 368 370 , m_shouldEmitProfileHooks(scopeChain.globalObject()->supportsProfiling()) 369 , m_regeneratingForExceptionInfo(false)370 371 , m_scopeChain(&scopeChain) 371 372 , m_symbolTable(symbolTable) … … 375 376 , m_finallyDepth(0) 376 377 , m_dynamicScopeDepth(0) 377 , m_baseScopeDepth( scopeChain.localDepth())378 , m_baseScopeDepth(codeBlock->baseScopeDepth()) 378 379 , m_codeType(EvalCode) 379 380 , m_globalData(&scopeChain.globalObject()->globalExec()->globalData()) 380 381 , m_lastOpcodeID(op_end) 381 382 , m_emitNodeDepth(0) 383 , m_regeneratingForExceptionInfo(false) 384 , m_codeBlockBeingRegeneratedFrom(0) 382 385 { 383 386 if (m_shouldEmitDebugHooks || m_baseScopeDepth) … … 992 995 } 993 996 994 if (index != missingSymbolMarker()) {995 // Directly index the property lookup across multiple scopes. Yay!996 return emitGetScopedVar(dst, depth, index, globalObject);997 }998 999 997 if (globalObject) { 998 bool forceGlobalResolve = false; 999 if (m_regeneratingForExceptionInfo) { 1000 1000 #if ENABLE(JIT) 1001 m_codeBlock->addGlobalResolveInfo(); 1001 forceGlobalResolve = m_codeBlockBeingRegeneratedFrom->hasGlobalResolveInfoAtBytecodeOffset(instructions().size()); 1002 #else 1003 forceGlobalResolve = m_codeBlockBeingRegeneratedFrom->hasGlobalResolveInstructionAtBytecodeOffset(instructions().size()); 1004 #endif 1005 } 1006 1007 if (index != missingSymbolMarker() && !forceGlobalResolve) { 1008 // Directly index the property lookup across multiple scopes. 1009 return emitGetScopedVar(dst, depth, index, globalObject); 1010 } 1011 1012 #if ENABLE(JIT) 1013 m_codeBlock->addGlobalResolveInfo(instructions().size()); 1002 1014 #else 1003 1015 m_codeBlock->addGlobalResolveInstruction(instructions().size()); … … 1012 1024 } 1013 1025 1026 if (index != missingSymbolMarker()) { 1027 // Directly index the property lookup across multiple scopes. 1028 return emitGetScopedVar(dst, depth, index, globalObject); 1029 } 1030 1014 1031 // In this case we are at least able to drop a few scope chains from the 1015 1032 // lookup chain, although we still need to hash from then on. … … 1024 1041 { 1025 1042 if (globalObject) { 1026 // op_get_global_var must be the same length as op_resolve_global.1027 1043 emitOpcode(op_get_global_var); 1028 1044 instructions().append(dst->index()); 1029 1045 instructions().append(asCell(globalObject)); 1030 1046 instructions().append(index); 1031 instructions().append(0);1032 instructions().append(0);1033 1047 return dst; 1034 1048 } -
trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r39737 r39752 330 330 CodeType codeType() const { return m_codeType; } 331 331 332 void setRegeneratingForExceptionInfo() { m_regeneratingForExceptionInfo = true; } 332 void setRegeneratingForExceptionInfo(CodeBlock* originalCodeBlock) 333 { 334 m_regeneratingForExceptionInfo = true; 335 m_codeBlockBeingRegeneratedFrom = originalCodeBlock; 336 } 333 337 334 338 private: … … 422 426 bool m_shouldEmitDebugHooks; 423 427 bool m_shouldEmitProfileHooks; 424 425 bool m_regeneratingForExceptionInfo;426 428 427 429 const ScopeChain* m_scopeChain; … … 466 468 OpcodeID m_lastOpcodeID; 467 469 468 #ifndef NDEBUG469 static bool s_dumpsGeneratedCode;470 #endif471 472 470 unsigned m_emitNodeDepth; 471 472 bool m_regeneratingForExceptionInfo; 473 CodeBlock* m_codeBlockBeingRegeneratedFrom; 473 474 474 475 static const unsigned s_maxEmitNodeDepth = 10000;
Note:
See TracChangeset
for help on using the changeset viewer.