Changeset 42574 in webkit for trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
- Timestamp:
- Apr 16, 2009, 4:36:07 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r42337 r42574 223 223 , m_codeType(GlobalCode) 224 224 , m_nextGlobalIndex(-1) 225 , m_globalConstantIndex(0) 225 226 , m_globalData(&scopeChain.globalObject()->globalExec()->globalData()) 226 227 , m_lastOpcodeID(op_end) … … 305 306 , m_baseScopeDepth(0) 306 307 , m_codeType(FunctionCode) 308 , m_globalConstantIndex(0) 307 309 , m_globalData(&scopeChain.globalObject()->globalExec()->globalData()) 308 310 , m_lastOpcodeID(op_end) … … 379 381 , m_baseScopeDepth(codeBlock->baseScopeDepth()) 380 382 , m_codeType(EvalCode) 383 , m_globalConstantIndex(0) 381 384 , m_globalData(&scopeChain.globalObject()->globalExec()->globalData()) 382 385 , m_lastOpcodeID(op_end) … … 755 758 { 756 759 return m_codeBlock->addUnexpectedConstant(v); 760 } 761 762 RegisterID* BytecodeGenerator::emitLoadGlobalObject(RegisterID* dst, JSObject* globalObject) 763 { 764 if (!m_globalConstantIndex) 765 m_globalConstantIndex = m_codeBlock->addUnexpectedConstant(globalObject); 766 emitOpcode(op_unexpected_load); 767 instructions().append(dst->index()); 768 instructions().append(m_globalConstantIndex); 769 return dst; 757 770 } 758 771 … … 1100 1113 RegisterID* BytecodeGenerator::emitResolveWithBase(RegisterID* baseDst, RegisterID* propDst, const Identifier& property) 1101 1114 { 1102 emitOpcode(op_resolve_with_base); 1103 instructions().append(baseDst->index()); 1115 size_t depth = 0; 1116 int index = 0; 1117 JSObject* globalObject = 0; 1118 if (!findScopedProperty(property, index, depth, false, globalObject) || !globalObject) { 1119 // We can't optimise at all :-( 1120 emitOpcode(op_resolve_with_base); 1121 instructions().append(baseDst->index()); 1122 instructions().append(propDst->index()); 1123 instructions().append(addConstant(property)); 1124 return baseDst; 1125 } 1126 1127 bool forceGlobalResolve = false; 1128 if (m_regeneratingForExceptionInfo) { 1129 #if ENABLE(JIT) 1130 forceGlobalResolve = m_codeBlockBeingRegeneratedFrom->hasGlobalResolveInfoAtBytecodeOffset(instructions().size()); 1131 #else 1132 forceGlobalResolve = m_codeBlockBeingRegeneratedFrom->hasGlobalResolveInstructionAtBytecodeOffset(instructions().size()); 1133 #endif 1134 } 1135 1136 // Global object is the base 1137 emitLoadGlobalObject(baseDst, globalObject); 1138 1139 if (index != missingSymbolMarker() && !forceGlobalResolve) { 1140 // Directly index the property lookup across multiple scopes. 1141 emitGetScopedVar(propDst, depth, index, globalObject); 1142 return baseDst; 1143 } 1144 1145 #if ENABLE(JIT) 1146 m_codeBlock->addGlobalResolveInfo(instructions().size()); 1147 #else 1148 m_codeBlock->addGlobalResolveInstruction(instructions().size()); 1149 #endif 1150 emitOpcode(op_resolve_global); 1104 1151 instructions().append(propDst->index()); 1152 instructions().append(globalObject); 1105 1153 instructions().append(addConstant(property)); 1154 instructions().append(0); 1155 instructions().append(0); 1106 1156 return baseDst; 1107 1157 }
Note:
See TracChangeset
for help on using the changeset viewer.