| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 } | 1185 } |
| 1186 is_optimized.Else(); | 1186 is_optimized.Else(); |
| 1187 { | 1187 { |
| 1188 AddIncrementCounter(counters->fast_new_closure_try_optimized()); | 1188 AddIncrementCounter(counters->fast_new_closure_try_optimized()); |
| 1189 // optimized_map points to fixed array of 3-element entries | 1189 // optimized_map points to fixed array of 3-element entries |
| 1190 // (native context, optimized code, literals). | 1190 // (native context, optimized code, literals). |
| 1191 // Map must never be empty, so check the first elements. | 1191 // Map must never be empty, so check the first elements. |
| 1192 Label install_optimized; | 1192 Label install_optimized; |
| 1193 HValue* first_context_slot = Add<HLoadNamedField>(optimized_map, | 1193 HValue* first_context_slot = Add<HLoadNamedField>(optimized_map, |
| 1194 HObjectAccess::ForFirstContextSlot()); | 1194 HObjectAccess::ForFirstContextSlot()); |
| 1195 HValue* first_osr_ast_slot = Add<HLoadNamedField>(optimized_map, |
| 1196 HObjectAccess::ForFirstOsrAstIdSlot()); |
| 1197 HValue* not_osr_ast_id = Add<HConstant>(BailoutId::None().ToInt(), |
| 1198 Representation::Smi()); |
| 1195 IfBuilder already_in(this); | 1199 IfBuilder already_in(this); |
| 1196 already_in.If<HCompareObjectEqAndBranch>(native_context, | 1200 already_in.If<HCompareObjectEqAndBranch>(native_context, |
| 1197 first_context_slot); | 1201 first_context_slot); |
| 1202 already_in.AndIf<HCompareObjectEqAndBranch>(first_osr_ast_slot, |
| 1203 not_osr_ast_id); |
| 1198 already_in.Then(); | 1204 already_in.Then(); |
| 1199 { | 1205 { |
| 1200 HValue* code_object = Add<HLoadNamedField>(optimized_map, | 1206 HValue* code_object = Add<HLoadNamedField>(optimized_map, |
| 1201 HObjectAccess::ForFirstCodeSlot()); | 1207 HObjectAccess::ForFirstCodeSlot()); |
| 1202 BuildInstallOptimizedCode(js_function, native_context, code_object); | 1208 BuildInstallOptimizedCode(js_function, native_context, code_object); |
| 1203 } | 1209 } |
| 1204 already_in.Else(); | 1210 already_in.Else(); |
| 1205 { | 1211 { |
| 1206 HValue* shared_function_entry_length = | 1212 HValue* shared_function_entry_length = |
| 1207 Add<HConstant>(SharedFunctionInfo::kEntryLength); | 1213 Add<HConstant>(SharedFunctionInfo::kEntryLength); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1225 restore_check.Then(); | 1231 restore_check.Then(); |
| 1226 { | 1232 { |
| 1227 // Store the unoptimized code | 1233 // Store the unoptimized code |
| 1228 BuildInstallCode(js_function, shared_info); | 1234 BuildInstallCode(js_function, shared_info); |
| 1229 loop_builder.Break(); | 1235 loop_builder.Break(); |
| 1230 } | 1236 } |
| 1231 restore_check.Else(); | 1237 restore_check.Else(); |
| 1232 { | 1238 { |
| 1233 HValue* keyed_minus = AddUncasted<HSub>( | 1239 HValue* keyed_minus = AddUncasted<HSub>( |
| 1234 key, shared_function_entry_length); | 1240 key, shared_function_entry_length); |
| 1241 HValue* key_for_osr_ast_id = AddUncasted<HSub>( |
| 1242 key, graph()->GetConstant1()); |
| 1235 HInstruction* keyed_lookup = Add<HLoadKeyed>(optimized_map, | 1243 HInstruction* keyed_lookup = Add<HLoadKeyed>(optimized_map, |
| 1236 keyed_minus, static_cast<HValue*>(NULL), FAST_ELEMENTS); | 1244 keyed_minus, static_cast<HValue*>(NULL), FAST_ELEMENTS); |
| 1245 HInstruction* osr_ast_id = Add<HLoadKeyed>(optimized_map, |
| 1246 key_for_osr_ast_id, static_cast<HValue*>(NULL), FAST_ELEMENTS); |
| 1237 IfBuilder done_check(this); | 1247 IfBuilder done_check(this); |
| 1238 done_check.If<HCompareObjectEqAndBranch>(native_context, | 1248 done_check.If<HCompareObjectEqAndBranch>(native_context, |
| 1239 keyed_lookup); | 1249 keyed_lookup); |
| 1250 done_check.AndIf<HCompareObjectEqAndBranch>(osr_ast_id, |
| 1251 not_osr_ast_id); |
| 1240 done_check.Then(); | 1252 done_check.Then(); |
| 1241 { | 1253 { |
| 1242 // Hit: fetch the optimized code. | 1254 // Hit: fetch the optimized code. |
| 1243 HValue* keyed_plus = AddUncasted<HAdd>( | 1255 HValue* keyed_plus = AddUncasted<HAdd>( |
| 1244 keyed_minus, graph()->GetConstant1()); | 1256 keyed_minus, graph()->GetConstant1()); |
| 1245 HValue* code_object = Add<HLoadKeyed>(optimized_map, | 1257 HValue* code_object = Add<HLoadKeyed>(optimized_map, |
| 1246 keyed_plus, static_cast<HValue*>(NULL), FAST_ELEMENTS); | 1258 keyed_plus, static_cast<HValue*>(NULL), FAST_ELEMENTS); |
| 1247 BuildInstallOptimizedCode(js_function, native_context, code_object); | 1259 BuildInstallOptimizedCode(js_function, native_context, code_object); |
| 1248 | 1260 |
| 1249 // Fall out of the loop | 1261 // Fall out of the loop |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 return BuildUncheckedDictionaryElementLoad(receiver, key); | 1342 return BuildUncheckedDictionaryElementLoad(receiver, key); |
| 1331 } | 1343 } |
| 1332 | 1344 |
| 1333 | 1345 |
| 1334 Handle<Code> KeyedLoadDictionaryElementStub::GenerateCode(Isolate* isolate) { | 1346 Handle<Code> KeyedLoadDictionaryElementStub::GenerateCode(Isolate* isolate) { |
| 1335 return DoGenerateCode(isolate, this); | 1347 return DoGenerateCode(isolate, this); |
| 1336 } | 1348 } |
| 1337 | 1349 |
| 1338 | 1350 |
| 1339 } } // namespace v8::internal | 1351 } } // namespace v8::internal |
| OLD | NEW |