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 #ifndef V8_CODE_STUB_ASSEMBLER_H_ | 5 #ifndef V8_CODE_STUB_ASSEMBLER_H_ |
6 #define V8_CODE_STUB_ASSEMBLER_H_ | 6 #define V8_CODE_STUB_ASSEMBLER_H_ |
7 | 7 |
8 #include <functional> | 8 #include <functional> |
9 | 9 |
10 #include "src/compiler/code-assembler.h" | 10 #include "src/compiler/code-assembler.h" |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 void StoreDetailsByKeyIndex(Node* container, Node* key_index, Node* details) { | 981 void StoreDetailsByKeyIndex(Node* container, Node* key_index, Node* details) { |
982 const int kKeyToDetailsOffset = | 982 const int kKeyToDetailsOffset = |
983 (ContainerType::kEntryDetailsIndex - ContainerType::kEntryKeyIndex) * | 983 (ContainerType::kEntryDetailsIndex - ContainerType::kEntryKeyIndex) * |
984 kPointerSize; | 984 kPointerSize; |
985 StoreFixedArrayElement(container, key_index, details, SKIP_WRITE_BARRIER, | 985 StoreFixedArrayElement(container, key_index, details, SKIP_WRITE_BARRIER, |
986 kKeyToDetailsOffset); | 986 kKeyToDetailsOffset); |
987 } | 987 } |
988 | 988 |
989 // Stores the value for the entry with the given key_index. | 989 // Stores the value for the entry with the given key_index. |
990 template <class ContainerType> | 990 template <class ContainerType> |
991 void StoreValueByKeyIndex(Node* container, Node* key_index, Node* value) { | 991 void StoreValueByKeyIndex( |
| 992 Node* container, Node* key_index, Node* value, |
| 993 WriteBarrierMode write_barrier = UPDATE_WRITE_BARRIER) { |
992 const int kKeyToValueOffset = | 994 const int kKeyToValueOffset = |
993 (ContainerType::kEntryValueIndex - ContainerType::kEntryKeyIndex) * | 995 (ContainerType::kEntryValueIndex - ContainerType::kEntryKeyIndex) * |
994 kPointerSize; | 996 kPointerSize; |
995 StoreFixedArrayElement(container, key_index, value, UPDATE_WRITE_BARRIER, | 997 StoreFixedArrayElement(container, key_index, value, write_barrier, |
996 kKeyToValueOffset); | 998 kKeyToValueOffset); |
997 } | 999 } |
998 | 1000 |
999 // Calculate a valid size for the a hash table. | 1001 // Calculate a valid size for the a hash table. |
1000 Node* HashTableComputeCapacity(Node* at_least_space_for); | 1002 Node* HashTableComputeCapacity(Node* at_least_space_for); |
1001 | 1003 |
1002 template <class Dictionary> | 1004 template <class Dictionary> |
1003 Node* GetNumberOfElements(Node* dictionary); | 1005 Node* GetNumberOfElements(Node* dictionary) { |
| 1006 return LoadFixedArrayElement(dictionary, |
| 1007 Dictionary::kNumberOfElementsIndex); |
| 1008 } |
1004 | 1009 |
1005 template <class Dictionary> | 1010 template <class Dictionary> |
1006 void SetNumberOfElements(Node* dictionary, Node* num_elements_smi); | 1011 void SetNumberOfElements(Node* dictionary, Node* num_elements_smi) { |
| 1012 StoreFixedArrayElement(dictionary, Dictionary::kNumberOfElementsIndex, |
| 1013 num_elements_smi, SKIP_WRITE_BARRIER); |
| 1014 } |
1007 | 1015 |
1008 template <class Dictionary> | 1016 template <class Dictionary> |
1009 Node* GetNumberOfDeletedElements(Node* dictionary); | 1017 Node* GetNumberOfDeletedElements(Node* dictionary) { |
| 1018 return LoadFixedArrayElement(dictionary, |
| 1019 Dictionary::kNumberOfDeletedElementsIndex); |
| 1020 } |
1010 | 1021 |
1011 template <class Dictionary> | 1022 template <class Dictionary> |
1012 Node* GetCapacity(Node* dictionary); | 1023 void SetNumberOfDeletedElements(Node* dictionary, Node* num_deleted_smi) { |
| 1024 StoreFixedArrayElement(dictionary, |
| 1025 Dictionary::kNumberOfDeletedElementsIndex, |
| 1026 num_deleted_smi, SKIP_WRITE_BARRIER); |
| 1027 } |
| 1028 |
| 1029 template <class Dictionary> |
| 1030 Node* GetCapacity(Node* dictionary) { |
| 1031 return LoadFixedArrayElement(dictionary, Dictionary::kCapacityIndex); |
| 1032 } |
1013 | 1033 |
1014 template <class Dictionary> | 1034 template <class Dictionary> |
1015 Node* GetNextEnumerationIndex(Node* dictionary); | 1035 Node* GetNextEnumerationIndex(Node* dictionary); |
1016 | 1036 |
1017 template <class Dictionary> | 1037 template <class Dictionary> |
1018 void SetNextEnumerationIndex(Node* dictionary, Node* next_enum_index_smi); | 1038 void SetNextEnumerationIndex(Node* dictionary, Node* next_enum_index_smi); |
1019 | 1039 |
1020 // Looks up an entry in a NameDictionaryBase successor. If the entry is found | 1040 // Looks up an entry in a NameDictionaryBase successor. If the entry is found |
1021 // control goes to {if_found} and {var_name_index} contains an index of the | 1041 // control goes to {if_found} and {var_name_index} contains an index of the |
1022 // key field of the entry found. If the key is not found control goes to | 1042 // key field of the entry found. If the key is not found control goes to |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 protected: | 1358 protected: |
1339 void DescriptorLookup(Node* unique_name, Node* descriptors, Node* bitfield3, | 1359 void DescriptorLookup(Node* unique_name, Node* descriptors, Node* bitfield3, |
1340 Label* if_found, Variable* var_name_index, | 1360 Label* if_found, Variable* var_name_index, |
1341 Label* if_not_found); | 1361 Label* if_not_found); |
1342 void DescriptorLookupLinear(Node* unique_name, Node* descriptors, Node* nof, | 1362 void DescriptorLookupLinear(Node* unique_name, Node* descriptors, Node* nof, |
1343 Label* if_found, Variable* var_name_index, | 1363 Label* if_found, Variable* var_name_index, |
1344 Label* if_not_found); | 1364 Label* if_not_found); |
1345 void DescriptorLookupBinary(Node* unique_name, Node* descriptors, Node* nof, | 1365 void DescriptorLookupBinary(Node* unique_name, Node* descriptors, Node* nof, |
1346 Label* if_found, Variable* var_name_index, | 1366 Label* if_found, Variable* var_name_index, |
1347 Label* if_not_found); | 1367 Label* if_not_found); |
| 1368 // Implements DescriptorArray::ToKeyIndex. |
| 1369 // Returns an untagged IntPtr. |
| 1370 Node* DescriptorArrayToKeyIndex(Node* descriptor_number); |
1348 | 1371 |
1349 Node* CallGetterIfAccessor(Node* value, Node* details, Node* context, | 1372 Node* CallGetterIfAccessor(Node* value, Node* details, Node* context, |
1350 Node* receiver, Label* if_bailout); | 1373 Node* receiver, Label* if_bailout); |
1351 | 1374 |
1352 Node* TryToIntptr(Node* key, Label* miss); | 1375 Node* TryToIntptr(Node* key, Label* miss); |
1353 | 1376 |
1354 void BranchIfPrototypesHaveNoElements(Node* receiver_map, | 1377 void BranchIfPrototypesHaveNoElements(Node* receiver_map, |
1355 Label* definitely_no_elements, | 1378 Label* definitely_no_elements, |
1356 Label* possibly_elements); | 1379 Label* possibly_elements); |
1357 | 1380 |
(...skipping 23 matching lines...) Expand all Loading... |
1381 | 1404 |
1382 Node* AllocateSlicedString(Heap::RootListIndex map_root_index, Node* length, | 1405 Node* AllocateSlicedString(Heap::RootListIndex map_root_index, Node* length, |
1383 Node* parent, Node* offset); | 1406 Node* parent, Node* offset); |
1384 | 1407 |
1385 Node* AllocateConsString(Heap::RootListIndex map_root_index, Node* length, | 1408 Node* AllocateConsString(Heap::RootListIndex map_root_index, Node* length, |
1386 Node* first, Node* second, AllocationFlags flags); | 1409 Node* first, Node* second, AllocationFlags flags); |
1387 | 1410 |
1388 // Implements DescriptorArray::number_of_entries. | 1411 // Implements DescriptorArray::number_of_entries. |
1389 // Returns an untagged int32. | 1412 // Returns an untagged int32. |
1390 Node* DescriptorArrayNumberOfEntries(Node* descriptors); | 1413 Node* DescriptorArrayNumberOfEntries(Node* descriptors); |
1391 // Implements DescriptorArray::ToKeyIndex. | |
1392 // Returns an untagged IntPtr. | |
1393 Node* DescriptorArrayToKeyIndex(Node* descriptor_number); | |
1394 // Implements DescriptorArray::GetSortedKeyIndex. | 1414 // Implements DescriptorArray::GetSortedKeyIndex. |
1395 // Returns an untagged int32. | 1415 // Returns an untagged int32. |
1396 Node* DescriptorArrayGetSortedKeyIndex(Node* descriptors, | 1416 Node* DescriptorArrayGetSortedKeyIndex(Node* descriptors, |
1397 Node* descriptor_number); | 1417 Node* descriptor_number); |
1398 // Implements DescriptorArray::GetKey. | 1418 // Implements DescriptorArray::GetKey. |
1399 Node* DescriptorArrayGetKey(Node* descriptors, Node* descriptor_number); | 1419 Node* DescriptorArrayGetKey(Node* descriptors, Node* descriptor_number); |
1400 | 1420 |
1401 static const int kElementLoopUnrollThreshold = 8; | 1421 static const int kElementLoopUnrollThreshold = 8; |
1402 }; | 1422 }; |
1403 | 1423 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 } | 1543 } |
1524 #else | 1544 #else |
1525 #define CSA_SLOW_ASSERT(csa, x) ((void)0) | 1545 #define CSA_SLOW_ASSERT(csa, x) ((void)0) |
1526 #endif | 1546 #endif |
1527 | 1547 |
1528 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1548 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
1529 | 1549 |
1530 } // namespace internal | 1550 } // namespace internal |
1531 } // namespace v8 | 1551 } // namespace v8 |
1532 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1552 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |