| 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 CompareNilICStub& stub) { | 328 CompareNilICStub& stub) { |
| 329 Handle<String> name(isolate_->heap()->empty_string()); | 329 Handle<String> name(isolate_->heap()->empty_string()); |
| 330 if (!receiver_map->is_shared()) { | 330 if (!receiver_map->is_shared()) { |
| 331 Handle<Code> cached_ic = FindIC(name, receiver_map, Code::COMPARE_NIL_IC, | 331 Handle<Code> cached_ic = FindIC(name, receiver_map, Code::COMPARE_NIL_IC, |
| 332 stub.GetExtraICState()); | 332 stub.GetExtraICState()); |
| 333 if (!cached_ic.is_null()) return cached_ic; | 333 if (!cached_ic.is_null()) return cached_ic; |
| 334 } | 334 } |
| 335 | 335 |
| 336 Code::FindAndReplacePattern pattern; | 336 Code::FindAndReplacePattern pattern; |
| 337 pattern.Add(isolate_->factory()->meta_map(), receiver_map); | 337 pattern.Add(isolate_->factory()->meta_map(), receiver_map); |
| 338 Handle<Code> ic = stub.GetCodeCopy(isolate_, pattern); | 338 Handle<Code> ic = stub.GetCodeCopy(pattern); |
| 339 | 339 |
| 340 if (!receiver_map->is_shared()) { | 340 if (!receiver_map->is_shared()) { |
| 341 Map::UpdateCodeCache(receiver_map, name, ic); | 341 Map::UpdateCodeCache(receiver_map, name, ic); |
| 342 } | 342 } |
| 343 | 343 |
| 344 return ic; | 344 return ic; |
| 345 } | 345 } |
| 346 | 346 |
| 347 | 347 |
| 348 // TODO(verwaest): Change this method so it takes in a TypeHandleList. | 348 // TODO(verwaest): Change this method so it takes in a TypeHandleList. |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1183 | 1183 |
| 1184 Handle<Code> KeyedLoadStubCompiler::CompileLoadElement( | 1184 Handle<Code> KeyedLoadStubCompiler::CompileLoadElement( |
| 1185 Handle<Map> receiver_map) { | 1185 Handle<Map> receiver_map) { |
| 1186 ElementsKind elements_kind = receiver_map->elements_kind(); | 1186 ElementsKind elements_kind = receiver_map->elements_kind(); |
| 1187 if (receiver_map->has_fast_elements() || | 1187 if (receiver_map->has_fast_elements() || |
| 1188 receiver_map->has_external_array_elements() || | 1188 receiver_map->has_external_array_elements() || |
| 1189 receiver_map->has_fixed_typed_array_elements()) { | 1189 receiver_map->has_fixed_typed_array_elements()) { |
| 1190 Handle<Code> stub = KeyedLoadFastElementStub( | 1190 Handle<Code> stub = KeyedLoadFastElementStub( |
| 1191 isolate(), | 1191 isolate(), |
| 1192 receiver_map->instance_type() == JS_ARRAY_TYPE, | 1192 receiver_map->instance_type() == JS_ARRAY_TYPE, |
| 1193 elements_kind).GetCode(isolate()); | 1193 elements_kind).GetCode(); |
| 1194 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK); | 1194 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK); |
| 1195 } else { | 1195 } else { |
| 1196 Handle<Code> stub = FLAG_compiled_keyed_dictionary_loads | 1196 Handle<Code> stub = FLAG_compiled_keyed_dictionary_loads |
| 1197 ? KeyedLoadDictionaryElementStub(isolate()).GetCode(isolate()) | 1197 ? KeyedLoadDictionaryElementStub(isolate()).GetCode() |
| 1198 : KeyedLoadDictionaryElementPlatformStub(isolate()).GetCode(isolate()); | 1198 : KeyedLoadDictionaryElementPlatformStub(isolate()).GetCode(); |
| 1199 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK); | 1199 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK); |
| 1200 } | 1200 } |
| 1201 | 1201 |
| 1202 TailCallBuiltin(masm(), Builtins::kKeyedLoadIC_Miss); | 1202 TailCallBuiltin(masm(), Builtins::kKeyedLoadIC_Miss); |
| 1203 | 1203 |
| 1204 // Return the generated code. | 1204 // Return the generated code. |
| 1205 return GetICCode(kind(), Code::NORMAL, factory()->empty_string()); | 1205 return GetICCode(kind(), Code::NORMAL, factory()->empty_string()); |
| 1206 } | 1206 } |
| 1207 | 1207 |
| 1208 | 1208 |
| 1209 Handle<Code> KeyedStoreStubCompiler::CompileStoreElement( | 1209 Handle<Code> KeyedStoreStubCompiler::CompileStoreElement( |
| 1210 Handle<Map> receiver_map) { | 1210 Handle<Map> receiver_map) { |
| 1211 ElementsKind elements_kind = receiver_map->elements_kind(); | 1211 ElementsKind elements_kind = receiver_map->elements_kind(); |
| 1212 bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE; | 1212 bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 1213 Handle<Code> stub; | 1213 Handle<Code> stub; |
| 1214 if (receiver_map->has_fast_elements() || | 1214 if (receiver_map->has_fast_elements() || |
| 1215 receiver_map->has_external_array_elements() || | 1215 receiver_map->has_external_array_elements() || |
| 1216 receiver_map->has_fixed_typed_array_elements()) { | 1216 receiver_map->has_fixed_typed_array_elements()) { |
| 1217 stub = KeyedStoreFastElementStub( | 1217 stub = KeyedStoreFastElementStub( |
| 1218 isolate(), | 1218 isolate(), |
| 1219 is_jsarray, | 1219 is_jsarray, |
| 1220 elements_kind, | 1220 elements_kind, |
| 1221 store_mode()).GetCode(isolate()); | 1221 store_mode()).GetCode(); |
| 1222 } else { | 1222 } else { |
| 1223 stub = KeyedStoreElementStub(isolate(), | 1223 stub = KeyedStoreElementStub(isolate(), |
| 1224 is_jsarray, | 1224 is_jsarray, |
| 1225 elements_kind, | 1225 elements_kind, |
| 1226 store_mode()).GetCode(isolate()); | 1226 store_mode()).GetCode(); |
| 1227 } | 1227 } |
| 1228 | 1228 |
| 1229 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK); | 1229 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK); |
| 1230 | 1230 |
| 1231 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); | 1231 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); |
| 1232 | 1232 |
| 1233 // Return the generated code. | 1233 // Return the generated code. |
| 1234 return GetICCode(kind(), Code::NORMAL, factory()->empty_string()); | 1234 return GetICCode(kind(), Code::NORMAL, factory()->empty_string()); |
| 1235 } | 1235 } |
| 1236 | 1236 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 } else { | 1312 } else { |
| 1313 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 1313 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 1314 ElementsKind elements_kind = receiver_map->elements_kind(); | 1314 ElementsKind elements_kind = receiver_map->elements_kind(); |
| 1315 | 1315 |
| 1316 if (IsFastElementsKind(elements_kind) || | 1316 if (IsFastElementsKind(elements_kind) || |
| 1317 IsExternalArrayElementsKind(elements_kind) || | 1317 IsExternalArrayElementsKind(elements_kind) || |
| 1318 IsFixedTypedArrayElementsKind(elements_kind)) { | 1318 IsFixedTypedArrayElementsKind(elements_kind)) { |
| 1319 cached_stub = | 1319 cached_stub = |
| 1320 KeyedLoadFastElementStub(isolate(), | 1320 KeyedLoadFastElementStub(isolate(), |
| 1321 is_js_array, | 1321 is_js_array, |
| 1322 elements_kind).GetCode(isolate()); | 1322 elements_kind).GetCode(); |
| 1323 } else if (elements_kind == SLOPPY_ARGUMENTS_ELEMENTS) { | 1323 } else if (elements_kind == SLOPPY_ARGUMENTS_ELEMENTS) { |
| 1324 cached_stub = isolate()->builtins()->KeyedLoadIC_SloppyArguments(); | 1324 cached_stub = isolate()->builtins()->KeyedLoadIC_SloppyArguments(); |
| 1325 } else { | 1325 } else { |
| 1326 ASSERT(elements_kind == DICTIONARY_ELEMENTS); | 1326 ASSERT(elements_kind == DICTIONARY_ELEMENTS); |
| 1327 cached_stub = | 1327 cached_stub = |
| 1328 KeyedLoadDictionaryElementStub(isolate()).GetCode(isolate()); | 1328 KeyedLoadDictionaryElementStub(isolate()).GetCode(); |
| 1329 } | 1329 } |
| 1330 } | 1330 } |
| 1331 | 1331 |
| 1332 handlers->Add(cached_stub); | 1332 handlers->Add(cached_stub); |
| 1333 } | 1333 } |
| 1334 } | 1334 } |
| 1335 | 1335 |
| 1336 | 1336 |
| 1337 Handle<Code> KeyedStoreStubCompiler::CompileStoreElementPolymorphic( | 1337 Handle<Code> KeyedStoreStubCompiler::CompileStoreElementPolymorphic( |
| 1338 MapHandleList* receiver_maps) { | 1338 MapHandleList* receiver_maps) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1351 // to be. Not all the elements are in place yet, pessimistic elements | 1351 // to be. Not all the elements are in place yet, pessimistic elements |
| 1352 // transitions are still important for performance. | 1352 // transitions are still important for performance. |
| 1353 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 1353 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 1354 ElementsKind elements_kind = receiver_map->elements_kind(); | 1354 ElementsKind elements_kind = receiver_map->elements_kind(); |
| 1355 if (!transitioned_map.is_null()) { | 1355 if (!transitioned_map.is_null()) { |
| 1356 cached_stub = ElementsTransitionAndStoreStub( | 1356 cached_stub = ElementsTransitionAndStoreStub( |
| 1357 isolate(), | 1357 isolate(), |
| 1358 elements_kind, | 1358 elements_kind, |
| 1359 transitioned_map->elements_kind(), | 1359 transitioned_map->elements_kind(), |
| 1360 is_js_array, | 1360 is_js_array, |
| 1361 store_mode()).GetCode(isolate()); | 1361 store_mode()).GetCode(); |
| 1362 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) { | 1362 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) { |
| 1363 cached_stub = isolate()->builtins()->KeyedStoreIC_Slow(); | 1363 cached_stub = isolate()->builtins()->KeyedStoreIC_Slow(); |
| 1364 } else { | 1364 } else { |
| 1365 if (receiver_map->has_fast_elements() || | 1365 if (receiver_map->has_fast_elements() || |
| 1366 receiver_map->has_external_array_elements() || | 1366 receiver_map->has_external_array_elements() || |
| 1367 receiver_map->has_fixed_typed_array_elements()) { | 1367 receiver_map->has_fixed_typed_array_elements()) { |
| 1368 cached_stub = KeyedStoreFastElementStub( | 1368 cached_stub = KeyedStoreFastElementStub( |
| 1369 isolate(), | 1369 isolate(), |
| 1370 is_js_array, | 1370 is_js_array, |
| 1371 elements_kind, | 1371 elements_kind, |
| 1372 store_mode()).GetCode(isolate()); | 1372 store_mode()).GetCode(); |
| 1373 } else { | 1373 } else { |
| 1374 cached_stub = KeyedStoreElementStub( | 1374 cached_stub = KeyedStoreElementStub( |
| 1375 isolate(), | 1375 isolate(), |
| 1376 is_js_array, | 1376 is_js_array, |
| 1377 elements_kind, | 1377 elements_kind, |
| 1378 store_mode()).GetCode(isolate()); | 1378 store_mode()).GetCode(); |
| 1379 } | 1379 } |
| 1380 } | 1380 } |
| 1381 ASSERT(!cached_stub.is_null()); | 1381 ASSERT(!cached_stub.is_null()); |
| 1382 handlers.Add(cached_stub); | 1382 handlers.Add(cached_stub); |
| 1383 transitioned_maps.Add(transitioned_map); | 1383 transitioned_maps.Add(transitioned_map); |
| 1384 } | 1384 } |
| 1385 Handle<Code> code = | 1385 Handle<Code> code = |
| 1386 CompileStorePolymorphic(receiver_maps, &handlers, &transitioned_maps); | 1386 CompileStorePolymorphic(receiver_maps, &handlers, &transitioned_maps); |
| 1387 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment(); | 1387 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment(); |
| 1388 PROFILE(isolate(), | 1388 PROFILE(isolate(), |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 Handle<FunctionTemplateInfo>( | 1507 Handle<FunctionTemplateInfo>( |
| 1508 FunctionTemplateInfo::cast(signature->receiver())); | 1508 FunctionTemplateInfo::cast(signature->receiver())); |
| 1509 } | 1509 } |
| 1510 } | 1510 } |
| 1511 | 1511 |
| 1512 is_simple_api_call_ = true; | 1512 is_simple_api_call_ = true; |
| 1513 } | 1513 } |
| 1514 | 1514 |
| 1515 | 1515 |
| 1516 } } // namespace v8::internal | 1516 } } // namespace v8::internal |
| OLD | NEW |