Changeset 58986 in webkit for trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
- Timestamp:
- May 7, 2010, 5:05:00 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r58907 r58986 994 994 } 995 995 996 bool BytecodeGenerator::findScopedProperty(const Identifier& property, int& index, size_t& stackDepth, bool forWriting, JSObject*& globalObject)996 bool BytecodeGenerator::findScopedProperty(const Identifier& property, int& index, size_t& stackDepth, bool forWriting, bool& requiresDynamicChecks, JSObject*& globalObject) 997 997 { 998 998 // Cases where we cannot statically optimize the lookup. … … 1010 1010 1011 1011 size_t depth = 0; 1012 1012 requiresDynamicChecks = false; 1013 1013 ScopeChainIterator iter = m_scopeChain->begin(); 1014 1014 ScopeChainIterator end = m_scopeChain->end(); … … 1035 1035 return true; 1036 1036 } 1037 if (currentVariableObject->isDynamicScope()) 1037 bool scopeRequiresDynamicChecks = false; 1038 if (currentVariableObject->isDynamicScope(scopeRequiresDynamicChecks)) 1038 1039 break; 1039 }1040 1040 requiresDynamicChecks |= scopeRequiresDynamicChecks; 1041 } 1041 1042 // Can't locate the property but we're able to avoid a few lookups. 1042 1043 stackDepth = depth; … … 1063 1064 int index = 0; 1064 1065 JSObject* globalObject = 0; 1065 if (!findScopedProperty(property, index, depth, false, globalObject) && !globalObject) { 1066 bool requiresDynamicChecks = false; 1067 if (!findScopedProperty(property, index, depth, false, requiresDynamicChecks, globalObject) && !globalObject) { 1066 1068 // We can't optimise at all :-( 1067 1069 emitOpcode(op_resolve); … … 1091 1093 m_codeBlock->addGlobalResolveInstruction(instructions().size()); 1092 1094 #endif 1093 emitOpcode( op_resolve_global);1095 emitOpcode(requiresDynamicChecks ? op_resolve_global_dynamic : op_resolve_global); 1094 1096 instructions().append(dst->index()); 1095 1097 instructions().append(globalObject); … … 1097 1099 instructions().append(0); 1098 1100 instructions().append(0); 1101 if (requiresDynamicChecks) 1102 instructions().append(depth); 1103 return dst; 1104 } 1105 1106 if (requiresDynamicChecks) { 1107 // If we get here we have eval nested inside a |with| just give up 1108 emitOpcode(op_resolve); 1109 instructions().append(dst->index()); 1110 instructions().append(addConstant(property)); 1099 1111 return dst; 1100 1112 } … … 1152 1164 int index = 0; 1153 1165 JSObject* globalObject = 0; 1154 findScopedProperty(property, index, depth, false, globalObject); 1155 if (!globalObject) { 1166 bool requiresDynamicChecks = false; 1167 findScopedProperty(property, index, depth, false, requiresDynamicChecks, globalObject); 1168 if (!globalObject || requiresDynamicChecks) { 1156 1169 // We can't optimise at all :-( 1157 1170 emitOpcode(op_resolve_base); … … 1170 1183 int index = 0; 1171 1184 JSObject* globalObject = 0; 1172 if (!findScopedProperty(property, index, depth, false, globalObject) || !globalObject) { 1185 bool requiresDynamicChecks = false; 1186 if (!findScopedProperty(property, index, depth, false, requiresDynamicChecks, globalObject) || !globalObject || requiresDynamicChecks) { 1173 1187 // We can't optimise at all :-( 1174 1188 emitOpcode(op_resolve_with_base); … … 1202 1216 m_codeBlock->addGlobalResolveInstruction(instructions().size()); 1203 1217 #endif 1204 emitOpcode( op_resolve_global);1218 emitOpcode(requiresDynamicChecks ? op_resolve_global_dynamic : op_resolve_global); 1205 1219 instructions().append(propDst->index()); 1206 1220 instructions().append(globalObject); … … 1208 1222 instructions().append(0); 1209 1223 instructions().append(0); 1224 if (requiresDynamicChecks) 1225 instructions().append(depth); 1210 1226 return baseDst; 1211 1227 }
Note:
See TracChangeset
for help on using the changeset viewer.