Chromium Code Reviews| 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 HValue* opt_count_and_bailout_reason = Add<HLoadNamedField>( | |
| 1200 shared_info, HObjectAccess::ForOptCountAndBailoutReason()); | |
| 1201 int32_t opt_count_mask = | |
|
Jakob Kummerow
2013/11/05 14:35:05
BitField has a kMask which you can use. Note that
| |
| 1202 (1 << SharedFunctionInfo::OptCountBits::kSize - 1) | |
| 1203 << SharedFunctionInfo::OptCountBits::kShift; | |
| 1204 HValue* mask = Add<HConstant>(opt_count_mask); | |
| 1205 HValue* result = Add<HBitwise>( | |
| 1206 Token::BIT_AND, opt_count_and_bailout_reason, mask); | |
| 1207 Add<HStoreNamedField>(shared_info, | |
| 1208 HObjectAccess::ForOptCountAndBailoutReason(), | |
| 1209 result); | |
| 1210 } | |
| 1194 done_check.End(); | 1211 done_check.End(); |
| 1195 } | 1212 } |
| 1196 restore_check.End(); | 1213 restore_check.End(); |
| 1197 } | 1214 } |
| 1198 loop_builder.EndBody(); | 1215 loop_builder.EndBody(); |
| 1199 } | 1216 } |
| 1200 already_in.End(); | 1217 already_in.End(); |
| 1201 } | 1218 } |
| 1202 is_optimized.End(); | 1219 is_optimized.End(); |
| 1203 } | 1220 } |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 1234 Add<HStoreNamedField>(js_function, HObjectAccess::ForElementsPointer(), | 1251 Add<HStoreNamedField>(js_function, HObjectAccess::ForElementsPointer(), |
| 1235 empty_fixed_array); | 1252 empty_fixed_array); |
| 1236 Add<HStoreNamedField>(js_function, HObjectAccess::ForLiteralsPointer(), | 1253 Add<HStoreNamedField>(js_function, HObjectAccess::ForLiteralsPointer(), |
| 1237 empty_fixed_array); | 1254 empty_fixed_array); |
| 1238 Add<HStoreNamedField>(js_function, HObjectAccess::ForPrototypeOrInitialMap(), | 1255 Add<HStoreNamedField>(js_function, HObjectAccess::ForPrototypeOrInitialMap(), |
| 1239 graph()->GetConstantHole()); | 1256 graph()->GetConstantHole()); |
| 1240 Add<HStoreNamedField>(js_function, | 1257 Add<HStoreNamedField>(js_function, |
| 1241 HObjectAccess::ForSharedFunctionInfoPointer(), | 1258 HObjectAccess::ForSharedFunctionInfoPointer(), |
| 1242 shared_info); | 1259 shared_info); |
| 1243 Add<HStoreNamedField>(js_function, HObjectAccess::ForFunctionContextPointer(), | 1260 Add<HStoreNamedField>(js_function, HObjectAccess::ForFunctionContextPointer(), |
| 1244 shared_info); | |
| 1245 Add<HStoreNamedField>(js_function, HObjectAccess::ForFunctionContextPointer(), | |
| 1246 context()); | 1261 context()); |
| 1247 | 1262 |
| 1248 // Initialize the code pointer in the function to be the one | 1263 // Initialize the code pointer in the function to be the one |
| 1249 // found in the shared function info object. | 1264 // found in the shared function info object. |
| 1250 // But first check if there is an optimized version for our context. | 1265 // But first check if there is an optimized version for our context. |
| 1251 if (FLAG_cache_optimized_code) { | 1266 if (FLAG_cache_optimized_code) { |
| 1252 BuildInstallFromOptimizedCodeMap(js_function, shared_info, native_context); | 1267 BuildInstallFromOptimizedCodeMap(js_function, shared_info, native_context); |
| 1253 } else { | 1268 } else { |
| 1254 BuildInstallCode(js_function, shared_info); | 1269 BuildInstallCode(js_function, shared_info); |
| 1255 } | 1270 } |
| 1256 | 1271 |
| 1257 return js_function; | 1272 return js_function; |
| 1258 } | 1273 } |
| 1259 | 1274 |
| 1260 | 1275 |
| 1261 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { | 1276 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { |
| 1262 return DoGenerateCode(isolate, this); | 1277 return DoGenerateCode(isolate, this); |
| 1263 } | 1278 } |
| 1264 | 1279 |
| 1265 | 1280 |
| 1266 } } // namespace v8::internal | 1281 } } // namespace v8::internal |
| OLD | NEW |