OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/ic/accessor-assembler.h" | 5 #include "src/ic/accessor-assembler.h" |
6 #include "src/ic/accessor-assembler-impl.h" | 6 #include "src/ic/accessor-assembler-impl.h" |
7 | 7 |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/ic/handler-configuration.h" | 10 #include "src/ic/handler-configuration.h" |
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 Bind(&miss); | 1294 Bind(&miss); |
1295 { | 1295 { |
1296 Comment("KeyedLoadIC_miss"); | 1296 Comment("KeyedLoadIC_miss"); |
1297 TailCallRuntime(Runtime::kKeyedLoadIC_Miss, p->context, p->receiver, | 1297 TailCallRuntime(Runtime::kKeyedLoadIC_Miss, p->context, p->receiver, |
1298 p->name, p->slot, p->vector); | 1298 p->name, p->slot, p->vector); |
1299 } | 1299 } |
1300 } | 1300 } |
1301 | 1301 |
1302 void AccessorAssemblerImpl::KeyedLoadICGeneric(const LoadICParameters* p) { | 1302 void AccessorAssemblerImpl::KeyedLoadICGeneric(const LoadICParameters* p) { |
1303 Variable var_index(this, MachineType::PointerRepresentation()); | 1303 Variable var_index(this, MachineType::PointerRepresentation()); |
| 1304 Variable var_unique(this, MachineRepresentation::kTagged); |
| 1305 var_unique.Bind(p->name); // Dummy initialization. |
1304 Variable var_details(this, MachineRepresentation::kWord32); | 1306 Variable var_details(this, MachineRepresentation::kWord32); |
1305 Variable var_value(this, MachineRepresentation::kTagged); | 1307 Variable var_value(this, MachineRepresentation::kTagged); |
1306 Label if_index(this), if_unique_name(this), if_element_hole(this), | 1308 Label if_index(this), if_unique_name(this), if_element_hole(this), |
1307 if_oob(this), slow(this), stub_cache_miss(this), | 1309 if_oob(this), slow(this), stub_cache_miss(this), |
1308 if_property_dictionary(this), if_found_on_receiver(this); | 1310 if_property_dictionary(this), if_found_on_receiver(this); |
1309 | 1311 |
1310 Node* receiver = p->receiver; | 1312 Node* receiver = p->receiver; |
1311 GotoIf(TaggedIsSmi(receiver), &slow); | 1313 GotoIf(TaggedIsSmi(receiver), &slow); |
1312 Node* receiver_map = LoadMap(receiver); | 1314 Node* receiver_map = LoadMap(receiver); |
1313 Node* instance_type = LoadMapInstanceType(receiver_map); | 1315 Node* instance_type = LoadMapInstanceType(receiver_map); |
1314 // Receivers requiring non-standard element accesses (interceptors, access | 1316 // Receivers requiring non-standard element accesses (interceptors, access |
1315 // checks, strings and string wrappers, proxies) are handled in the runtime. | 1317 // checks, strings and string wrappers, proxies) are handled in the runtime. |
1316 GotoIf(Int32LessThanOrEqual(instance_type, | 1318 GotoIf(Int32LessThanOrEqual(instance_type, |
1317 Int32Constant(LAST_CUSTOM_ELEMENTS_RECEIVER)), | 1319 Int32Constant(LAST_CUSTOM_ELEMENTS_RECEIVER)), |
1318 &slow); | 1320 &slow); |
1319 | 1321 |
1320 Node* key = p->name; | 1322 TryToName(p->name, &if_index, &var_index, &if_unique_name, &var_unique, |
1321 TryToName(key, &if_index, &var_index, &if_unique_name, &slow); | 1323 &slow); |
1322 | 1324 |
1323 Bind(&if_index); | 1325 Bind(&if_index); |
1324 { | 1326 { |
1325 Comment("integer index"); | 1327 Comment("integer index"); |
1326 Node* index = var_index.value(); | 1328 Node* index = var_index.value(); |
1327 Node* elements = LoadElements(receiver); | 1329 Node* elements = LoadElements(receiver); |
1328 Node* elements_kind = LoadMapElementsKind(receiver_map); | 1330 Node* elements_kind = LoadMapElementsKind(receiver_map); |
1329 Node* is_jsarray_condition = | 1331 Node* is_jsarray_condition = |
1330 Word32Equal(instance_type, Int32Constant(JS_ARRAY_TYPE)); | 1332 Word32Equal(instance_type, Int32Constant(JS_ARRAY_TYPE)); |
1331 Variable var_double_value(this, MachineRepresentation::kFloat64); | 1333 Variable var_double_value(this, MachineRepresentation::kFloat64); |
(...skipping 28 matching lines...) Expand all Loading... |
1360 BranchIfPrototypesHaveNoElements(receiver_map, &return_undefined, &slow); | 1362 BranchIfPrototypesHaveNoElements(receiver_map, &return_undefined, &slow); |
1361 | 1363 |
1362 Bind(&return_undefined); | 1364 Bind(&return_undefined); |
1363 Return(UndefinedConstant()); | 1365 Return(UndefinedConstant()); |
1364 } | 1366 } |
1365 | 1367 |
1366 Node* properties = nullptr; | 1368 Node* properties = nullptr; |
1367 Bind(&if_unique_name); | 1369 Bind(&if_unique_name); |
1368 { | 1370 { |
1369 Comment("key is unique name"); | 1371 Comment("key is unique name"); |
| 1372 Node* key = var_unique.value(); |
1370 // Check if the receiver has fast or slow properties. | 1373 // Check if the receiver has fast or slow properties. |
1371 properties = LoadProperties(receiver); | 1374 properties = LoadProperties(receiver); |
1372 Node* properties_map = LoadMap(properties); | 1375 Node* properties_map = LoadMap(properties); |
1373 GotoIf(WordEqual(properties_map, LoadRoot(Heap::kHashTableMapRootIndex)), | 1376 GotoIf(WordEqual(properties_map, LoadRoot(Heap::kHashTableMapRootIndex)), |
1374 &if_property_dictionary); | 1377 &if_property_dictionary); |
1375 | 1378 |
1376 // Try looking up the property on the receiver; if unsuccessful, look | 1379 // Try looking up the property on the receiver; if unsuccessful, look |
1377 // for a handler in the stub cache. | 1380 // for a handler in the stub cache. |
1378 Comment("DescriptorArray lookup"); | 1381 Comment("DescriptorArray lookup"); |
1379 | 1382 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1418 } | 1421 } |
1419 } | 1422 } |
1420 } | 1423 } |
1421 | 1424 |
1422 Bind(&if_property_dictionary); | 1425 Bind(&if_property_dictionary); |
1423 { | 1426 { |
1424 Comment("dictionary property load"); | 1427 Comment("dictionary property load"); |
1425 // We checked for LAST_CUSTOM_ELEMENTS_RECEIVER before, which rules out | 1428 // We checked for LAST_CUSTOM_ELEMENTS_RECEIVER before, which rules out |
1426 // seeing global objects here (which would need special handling). | 1429 // seeing global objects here (which would need special handling). |
1427 | 1430 |
| 1431 Node* key = var_unique.value(); |
1428 Variable var_name_index(this, MachineType::PointerRepresentation()); | 1432 Variable var_name_index(this, MachineType::PointerRepresentation()); |
1429 Label dictionary_found(this, &var_name_index); | 1433 Label dictionary_found(this, &var_name_index); |
1430 NameDictionaryLookup<NameDictionary>(properties, key, &dictionary_found, | 1434 NameDictionaryLookup<NameDictionary>(properties, key, &dictionary_found, |
1431 &var_name_index, &slow); | 1435 &var_name_index, &slow); |
1432 Bind(&dictionary_found); | 1436 Bind(&dictionary_found); |
1433 { | 1437 { |
1434 LoadPropertyFromNameDictionary(properties, var_name_index.value(), | 1438 LoadPropertyFromNameDictionary(properties, var_name_index.value(), |
1435 &var_details, &var_value); | 1439 &var_details, &var_value); |
1436 Goto(&if_found_on_receiver); | 1440 Goto(&if_found_on_receiver); |
1437 } | 1441 } |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1813 void AccessorAssembler::GenerateKeyedStoreICTrampolineTF( | 1817 void AccessorAssembler::GenerateKeyedStoreICTrampolineTF( |
1814 CodeAssemblerState* state, LanguageMode language_mode) { | 1818 CodeAssemblerState* state, LanguageMode language_mode) { |
1815 AccessorAssemblerImpl assembler(state); | 1819 AccessorAssemblerImpl assembler(state); |
1816 assembler.GenerateKeyedStoreICTrampolineTF(language_mode); | 1820 assembler.GenerateKeyedStoreICTrampolineTF(language_mode); |
1817 } | 1821 } |
1818 | 1822 |
1819 #undef ACCESSOR_ASSEMBLER_PUBLIC_INTERFACE | 1823 #undef ACCESSOR_ASSEMBLER_PUBLIC_INTERFACE |
1820 | 1824 |
1821 } // namespace internal | 1825 } // namespace internal |
1822 } // namespace v8 | 1826 } // namespace v8 |
OLD | NEW |