| 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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 Label* if_bailout); | 878 Label* if_bailout); |
| 879 | 879 |
| 880 // Calculates array index for given dictionary entry and entry field. | 880 // Calculates array index for given dictionary entry and entry field. |
| 881 // See Dictionary::EntryToIndex(). | 881 // See Dictionary::EntryToIndex(). |
| 882 template <typename Dictionary> | 882 template <typename Dictionary> |
| 883 Node* EntryToIndex(Node* entry, int field_index); | 883 Node* EntryToIndex(Node* entry, int field_index); |
| 884 template <typename Dictionary> | 884 template <typename Dictionary> |
| 885 Node* EntryToIndex(Node* entry) { | 885 Node* EntryToIndex(Node* entry) { |
| 886 return EntryToIndex<Dictionary>(entry, Dictionary::kEntryKeyIndex); | 886 return EntryToIndex<Dictionary>(entry, Dictionary::kEntryKeyIndex); |
| 887 } | 887 } |
| 888 |
| 889 // Loads the details for the entry with the given key_index. |
| 890 // Returns an untagged int32. |
| 891 template <class ContainerType> |
| 892 Node* LoadDetailsByKeyIndex(Node* container, Node* key_index) { |
| 893 const int kKeyToDetailsOffset = |
| 894 (ContainerType::kEntryDetailsIndex - ContainerType::kEntryKeyIndex) * |
| 895 kPointerSize; |
| 896 return LoadAndUntagToWord32FixedArrayElement(container, key_index, |
| 897 kKeyToDetailsOffset); |
| 898 } |
| 899 |
| 900 // Loads the value for the entry with the given key_index. |
| 901 // Returns a tagged value. |
| 902 template <class ContainerType> |
| 903 Node* LoadValueByKeyIndex(Node* container, Node* key_index) { |
| 904 const int kKeyToValueOffset = |
| 905 (ContainerType::kEntryValueIndex - ContainerType::kEntryKeyIndex) * |
| 906 kPointerSize; |
| 907 return LoadFixedArrayElement(container, key_index, kKeyToValueOffset); |
| 908 } |
| 909 |
| 910 // Stores the details for the entry with the given key_index. |
| 911 // |details| must be a Smi. |
| 912 template <class ContainerType> |
| 913 void StoreDetailsByKeyIndex(Node* container, Node* key_index, Node* details) { |
| 914 const int kKeyToDetailsOffset = |
| 915 (ContainerType::kEntryDetailsIndex - ContainerType::kEntryKeyIndex) * |
| 916 kPointerSize; |
| 917 StoreFixedArrayElement(container, key_index, details, SKIP_WRITE_BARRIER, |
| 918 kKeyToDetailsOffset); |
| 919 } |
| 920 |
| 921 // Stores the value for the entry with the given key_index. |
| 922 template <class ContainerType> |
| 923 void StoreValueByKeyIndex(Node* container, Node* key_index, Node* value) { |
| 924 const int kKeyToValueOffset = |
| 925 (ContainerType::kEntryValueIndex - ContainerType::kEntryKeyIndex) * |
| 926 kPointerSize; |
| 927 StoreFixedArrayElement(container, key_index, value, UPDATE_WRITE_BARRIER, |
| 928 kKeyToValueOffset); |
| 929 } |
| 930 |
| 888 // Calculate a valid size for the a hash table. | 931 // Calculate a valid size for the a hash table. |
| 889 Node* HashTableComputeCapacity(Node* at_least_space_for); | 932 Node* HashTableComputeCapacity(Node* at_least_space_for); |
| 890 | 933 |
| 891 template <class Dictionary> | 934 template <class Dictionary> |
| 892 Node* GetNumberOfElements(Node* dictionary); | 935 Node* GetNumberOfElements(Node* dictionary); |
| 893 | 936 |
| 894 template <class Dictionary> | 937 template <class Dictionary> |
| 895 void SetNumberOfElements(Node* dictionary, Node* num_elements_smi); | 938 void SetNumberOfElements(Node* dictionary, Node* num_elements_smi); |
| 896 | 939 |
| 897 template <class Dictionary> | 940 template <class Dictionary> |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 } | 1368 } |
| 1326 #else | 1369 #else |
| 1327 #define CSA_SLOW_ASSERT(csa, x) ((void)0) | 1370 #define CSA_SLOW_ASSERT(csa, x) ((void)0) |
| 1328 #endif | 1371 #endif |
| 1329 | 1372 |
| 1330 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1373 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
| 1331 | 1374 |
| 1332 } // namespace internal | 1375 } // namespace internal |
| 1333 } // namespace v8 | 1376 } // namespace v8 |
| 1334 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1377 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
| OLD | NEW |