| 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 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 HValue* keyed_plus = AddUncasted<HAdd>( | 1184 HValue* keyed_plus = AddUncasted<HAdd>( |
| 1185 keyed_minus, graph()->GetConstant1()); | 1185 keyed_minus, graph()->GetConstant1()); |
| 1186 HValue* code_object = Add<HLoadKeyed>(optimized_map, | 1186 HValue* code_object = Add<HLoadKeyed>(optimized_map, |
| 1187 keyed_plus, static_cast<HValue*>(NULL), FAST_ELEMENTS); | 1187 keyed_plus, static_cast<HValue*>(NULL), FAST_ELEMENTS); |
| 1188 BuildInstallOptimizedCode(js_function, native_context, code_object); | 1188 BuildInstallOptimizedCode(js_function, native_context, code_object); |
| 1189 | 1189 |
| 1190 // Fall out of the loop | 1190 // Fall out of the loop |
| 1191 loop_builder.Break(); | 1191 loop_builder.Break(); |
| 1192 } | 1192 } |
| 1193 done_check.Else(); | 1193 done_check.Else(); |
| 1194 { |
| 1195 // The optimization count should be tied to the context, e.g. as |
| 1196 // entry in optimized code map. But for simplicity's sake we just |
| 1197 // reset the opt count if the optimized code map lookup fails, |
| 1198 // because no optimized code exists for the current context. |
| 1199 HObjectAccess field = HObjectAccess::ForOptCountAndBailoutReason(). |
| 1200 WithRepresentation(Representation::Integer32()); |
| 1201 HValue* opt_count_and_bailout_reason = |
| 1202 Add<HLoadNamedField>(shared_info, field); |
| 1203 static const int pseudo_smi_shift = 1; |
| 1204 int32_t opt_count_mask = |
| 1205 static_cast<int32_t>(~SharedFunctionInfo::OptCountBits::kMask) |
| 1206 << pseudo_smi_shift; |
| 1207 HValue* mask = Add<HConstant>(opt_count_mask); |
| 1208 HValue* result = Add<HBitwise>( |
| 1209 Token::BIT_AND, opt_count_and_bailout_reason, mask); |
| 1210 Add<HStoreNamedField>(shared_info, field, result); |
| 1211 } |
| 1194 done_check.End(); | 1212 done_check.End(); |
| 1195 } | 1213 } |
| 1196 restore_check.End(); | 1214 restore_check.End(); |
| 1197 } | 1215 } |
| 1198 loop_builder.EndBody(); | 1216 loop_builder.EndBody(); |
| 1199 } | 1217 } |
| 1200 already_in.End(); | 1218 already_in.End(); |
| 1201 } | 1219 } |
| 1202 is_optimized.End(); | 1220 is_optimized.End(); |
| 1203 } | 1221 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1234 Add<HStoreNamedField>(js_function, HObjectAccess::ForElementsPointer(), | 1252 Add<HStoreNamedField>(js_function, HObjectAccess::ForElementsPointer(), |
| 1235 empty_fixed_array); | 1253 empty_fixed_array); |
| 1236 Add<HStoreNamedField>(js_function, HObjectAccess::ForLiteralsPointer(), | 1254 Add<HStoreNamedField>(js_function, HObjectAccess::ForLiteralsPointer(), |
| 1237 empty_fixed_array); | 1255 empty_fixed_array); |
| 1238 Add<HStoreNamedField>(js_function, HObjectAccess::ForPrototypeOrInitialMap(), | 1256 Add<HStoreNamedField>(js_function, HObjectAccess::ForPrototypeOrInitialMap(), |
| 1239 graph()->GetConstantHole()); | 1257 graph()->GetConstantHole()); |
| 1240 Add<HStoreNamedField>(js_function, | 1258 Add<HStoreNamedField>(js_function, |
| 1241 HObjectAccess::ForSharedFunctionInfoPointer(), | 1259 HObjectAccess::ForSharedFunctionInfoPointer(), |
| 1242 shared_info); | 1260 shared_info); |
| 1243 Add<HStoreNamedField>(js_function, HObjectAccess::ForFunctionContextPointer(), | 1261 Add<HStoreNamedField>(js_function, HObjectAccess::ForFunctionContextPointer(), |
| 1244 shared_info); | |
| 1245 Add<HStoreNamedField>(js_function, HObjectAccess::ForFunctionContextPointer(), | |
| 1246 context()); | 1262 context()); |
| 1247 | 1263 |
| 1248 // Initialize the code pointer in the function to be the one | 1264 // Initialize the code pointer in the function to be the one |
| 1249 // found in the shared function info object. | 1265 // found in the shared function info object. |
| 1250 // But first check if there is an optimized version for our context. | 1266 // But first check if there is an optimized version for our context. |
| 1251 if (FLAG_cache_optimized_code) { | 1267 if (FLAG_cache_optimized_code) { |
| 1252 BuildInstallFromOptimizedCodeMap(js_function, shared_info, native_context); | 1268 BuildInstallFromOptimizedCodeMap(js_function, shared_info, native_context); |
| 1253 } else { | 1269 } else { |
| 1254 BuildInstallCode(js_function, shared_info); | 1270 BuildInstallCode(js_function, shared_info); |
| 1255 } | 1271 } |
| 1256 | 1272 |
| 1257 return js_function; | 1273 return js_function; |
| 1258 } | 1274 } |
| 1259 | 1275 |
| 1260 | 1276 |
| 1261 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { | 1277 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { |
| 1262 return DoGenerateCode(isolate, this); | 1278 return DoGenerateCode(isolate, this); |
| 1263 } | 1279 } |
| 1264 | 1280 |
| 1265 | 1281 |
| 1266 } } // namespace v8::internal | 1282 } } // namespace v8::internal |
| OLD | NEW |