| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7dd68ac commit c5fe3a2
16 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,7 +36,7 @@ | |||
| 36 | 36 | ||
| 37 | 37 | # Reset this number to 0 on major V8 upgrades. | |
| 38 | 38 | # Increment by one for each non-official patch applied to deps/v8. | |
| 39 | - 'v8_embedder_string': '-node.52', | ||
| 39 | + 'v8_embedder_string': '-node.53', | ||
| 40 | 40 | ||
| 41 | 41 | ##### V8 defaults for Node.js ##### | |
| 42 | 42 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1801,12 +1801,13 @@ TNode<IntPtrT> CodeStubAssembler::LoadJSReceiverIdentityHash( | |||
| 1801 | 1801 | return var_hash.value(); | |
| 1802 | 1802 | } | |
| 1803 | 1803 | ||
| 1804 | - TNode<Uint32T> CodeStubAssembler::LoadNameHashField(SloppyTNode<Name> name) { | ||
| 1805 | - CSA_ASSERT(this, IsName(name)); | ||
| 1806 | - return LoadObjectField<Uint32T>(name, Name::kHashFieldOffset); | ||
| 1804 | + TNode<Uint32T> CodeStubAssembler::LoadNameHashAssumeComputed(TNode<Name> name) { | ||
| 1805 | + TNode<Uint32T> hash_field = LoadNameHashField(name); | ||
| 1806 | + CSA_ASSERT(this, IsClearWord32(hash_field, Name::kHashNotComputedMask)); | ||
| 1807 | + return Unsigned(Word32Shr(hash_field, Int32Constant(Name::kHashShift))); | ||
| 1807 | 1808 | } | |
| 1808 | 1809 | ||
| 1809 | - TNode<Uint32T> CodeStubAssembler::LoadNameHash(SloppyTNode<Name> name, | ||
| 1810 | + TNode<Uint32T> CodeStubAssembler::LoadNameHash(TNode<Name> name, | ||
| 1810 | 1811 | Label* if_hash_not_computed) { | |
| 1811 | 1812 | TNode<Uint32T> hash_field = LoadNameHashField(name); | |
| 1812 | 1813 | if (if_hash_not_computed != nullptr) { | |
@@ -1994,13 +1995,13 @@ TNode<T> CodeStubAssembler::LoadArrayElement(TNode<Array> array, | |||
| 1994 | 1995 | } | |
| 1995 | 1996 | } | |
| 1996 | 1997 | ||
| 1997 | - template TNode<MaybeObject> | ||
| 1998 | + template V8_EXPORT_PRIVATE TNode<MaybeObject> | ||
| 1998 | 1999 | CodeStubAssembler::LoadArrayElement<TransitionArray>(TNode<TransitionArray>, | |
| 1999 | 2000 | int, Node*, int, | |
| 2000 | 2001 | ParameterMode, | |
| 2001 | 2002 | LoadSensitivity); | |
| 2002 | 2003 | ||
| 2003 | - template TNode<MaybeObject> | ||
| 2004 | + template V8_EXPORT_PRIVATE TNode<MaybeObject> | ||
| 2004 | 2005 | CodeStubAssembler::LoadArrayElement<DescriptorArray>(TNode<DescriptorArray>, | |
| 2005 | 2006 | int, Node*, int, | |
| 2006 | 2007 | ParameterMode, | |
@@ -8063,7 +8064,7 @@ void CodeStubAssembler::LookupBinary(TNode<Name> unique_name, | |||
| 8063 | 8064 | TNode<Uint32T> limit = | |
| 8064 | 8065 | Unsigned(Int32Sub(NumberOfEntries<Array>(array), Int32Constant(1))); | |
| 8065 | 8066 | TVARIABLE(Uint32T, var_high, limit); | |
| 8066 | - TNode<Uint32T> hash = LoadNameHashField(unique_name); | ||
| 8067 | + TNode<Uint32T> hash = LoadNameHashAssumeComputed(unique_name); | ||
| 8067 | 8068 | CSA_ASSERT(this, Word32NotEqual(hash, Int32Constant(0))); | |
| 8068 | 8069 | ||
| 8069 | 8070 | // Assume non-empty array. | |
@@ -8081,7 +8082,7 @@ void CodeStubAssembler::LookupBinary(TNode<Name> unique_name, | |||
| 8081 | 8082 | TNode<Uint32T> sorted_key_index = GetSortedKeyIndex<Array>(array, mid); | |
| 8082 | 8083 | TNode<Name> mid_name = GetKey<Array>(array, sorted_key_index); | |
| 8083 | 8084 | ||
| 8084 | - TNode<Uint32T> mid_hash = LoadNameHashField(mid_name); | ||
| 8085 | + TNode<Uint32T> mid_hash = LoadNameHashAssumeComputed(mid_name); | ||
| 8085 | 8086 | ||
| 8086 | 8087 | Label mid_greater(this), mid_less(this), merge(this); | |
| 8087 | 8088 | Branch(Uint32GreaterThanOrEqual(mid_hash, hash), &mid_greater, &mid_less); | |
@@ -8108,7 +8109,7 @@ void CodeStubAssembler::LookupBinary(TNode<Name> unique_name, | |||
| 8108 | 8109 | TNode<Uint32T> sort_index = | |
| 8109 | 8110 | GetSortedKeyIndex<Array>(array, var_low.value()); | |
| 8110 | 8111 | TNode<Name> current_name = GetKey<Array>(array, sort_index); | |
| 8111 | - TNode<Uint32T> current_hash = LoadNameHashField(current_name); | ||
| 8112 | + TNode<Uint32T> current_hash = LoadNameHashAssumeComputed(current_name); | ||
| 8112 | 8113 | GotoIf(Word32NotEqual(current_hash, hash), if_not_found); | |
| 8113 | 8114 | Label next(this); | |
| 8114 | 8115 | GotoIf(TaggedNotEqual(current_name, unique_name), &next); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1353,13 +1353,12 @@ class V8_EXPORT_PRIVATE CodeStubAssembler | |||
| 1353 | 1353 | // Check if the map is set for slow properties. | |
| 1354 | 1354 | TNode<BoolT> IsDictionaryMap(SloppyTNode<Map> map); | |
| 1355 | 1355 | ||
| 1356 | - // Load the hash field of a name as an uint32 value. | ||
| 1357 | - TNode<Uint32T> LoadNameHashField(SloppyTNode<Name> name); | ||
| 1358 | - // Load the hash value of a name as an uint32 value. | ||
| 1356 | + // Load the Name::hash() value of a name as an uint32 value. | ||
| 1359 | 1357 | // If {if_hash_not_computed} label is specified then it also checks if | |
| 1360 | 1358 | // hash is actually computed. | |
| 1361 | - TNode<Uint32T> LoadNameHash(SloppyTNode<Name> name, | ||
| 1359 | + TNode<Uint32T> LoadNameHash(TNode<Name> name, | ||
| 1362 | 1360 | Label* if_hash_not_computed = nullptr); | |
| 1361 | + TNode<Uint32T> LoadNameHashAssumeComputed(TNode<Name> name); | ||
| 1363 | 1362 | ||
| 1364 | 1363 | // Load length field of a String object as Smi value. | |
| 1365 | 1364 | TNode<Smi> LoadStringLengthAsSmi(TNode<String> string); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1667,12 +1667,13 @@ bool DescriptorArray::IsSortedNoDuplicates(int valid_entries) { | |||
| 1667 | 1667 | uint32_t current = 0; | |
| 1668 | 1668 | for (int i = 0; i < number_of_descriptors(); i++) { | |
| 1669 | 1669 | Name key = GetSortedKey(i); | |
| 1670 | + CHECK(key.HasHashCode()); | ||
| 1670 | 1671 | if (key == current_key) { | |
| 1671 | 1672 | Print(); | |
| 1672 | 1673 | return false; | |
| 1673 | 1674 | } | |
| 1674 | 1675 | current_key = key; | |
| 1675 | - uint32_t hash = GetSortedKey(i).Hash(); | ||
| 1676 | + uint32_t hash = key.hash(); | ||
| 1676 | 1677 | if (hash < current) { | |
| 1677 | 1678 | Print(); | |
| 1678 | 1679 | return false; | |
@@ -1691,7 +1692,8 @@ bool TransitionArray::IsSortedNoDuplicates(int valid_entries) { | |||
| 1691 | 1692 | ||
| 1692 | 1693 | for (int i = 0; i < number_of_transitions(); i++) { | |
| 1693 | 1694 | Name key = GetSortedKey(i); | |
| 1694 | - uint32_t hash = key.Hash(); | ||
| 1695 | + CHECK(key.HasHashCode()); | ||
| 1696 | + uint32_t hash = key.hash(); | ||
| 1695 | 1697 | PropertyKind kind = kData; | |
| 1696 | 1698 | PropertyAttributes attributes = NONE; | |
| 1697 | 1699 | if (!TransitionsAccessor::IsSpecialTransition(key.GetReadOnlyRoots(), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -226,7 +226,7 @@ void DescriptorArray::Append(Descriptor* desc) { | |||
| 226 | 226 | ||
| 227 | 227 | for (insertion = descriptor_number; insertion > 0; --insertion) { | |
| 228 | 228 | Name key = GetSortedKey(insertion - 1); | |
| 229 | - if (key.Hash() <= hash) break; | ||
| 229 | + if (key.hash() <= hash) break; | ||
| 230 | 230 | SetSortedKey(insertion, GetSortedKeyIndex(insertion - 1)); | |
| 231 | 231 | } | |
| 232 | 232 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -113,7 +113,7 @@ class DescriptorArray | |||
| 113 | 113 | int slack = 0); | |
| 114 | 114 | ||
| 115 | 115 | // Sort the instance descriptors by the hash codes of their keys. | |
| 116 | - void Sort(); | ||
| 116 | + V8_EXPORT_PRIVATE void Sort(); | ||
| 117 | 117 | ||
| 118 | 118 | // Search the instance descriptors for given name. | |
| 119 | 119 | V8_INLINE InternalIndex Search(Name name, int number_of_own_descriptors); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -212,15 +212,15 @@ int BinarySearch(T* array, Name name, int valid_entries, | |||
| 212 | 212 | DCHECK(search_mode == ALL_ENTRIES || out_insertion_index == nullptr); | |
| 213 | 213 | int low = 0; | |
| 214 | 214 | int high = array->number_of_entries() - 1; | |
| 215 | - uint32_t hash = name.hash_field(); | ||
| 215 | + uint32_t hash = name.hash(); | ||
| 216 | 216 | int limit = high; | |
| 217 | 217 | ||
| 218 | 218 | DCHECK(low <= high); | |
| 219 | 219 | ||
| 220 | 220 | while (low != high) { | |
| 221 | 221 | int mid = low + (high - low) / 2; | |
| 222 | 222 | Name mid_name = array->GetSortedKey(mid); | |
| 223 | - uint32_t mid_hash = mid_name.hash_field(); | ||
| 223 | + uint32_t mid_hash = mid_name.hash(); | ||
| 224 | 224 | ||
| 225 | 225 | if (mid_hash >= hash) { | |
| 226 | 226 | high = mid; | |
@@ -232,7 +232,7 @@ int BinarySearch(T* array, Name name, int valid_entries, | |||
| 232 | 232 | for (; low <= limit; ++low) { | |
| 233 | 233 | int sort_index = array->GetSortedKeyIndex(low); | |
| 234 | 234 | Name entry = array->GetKey(InternalIndex(sort_index)); | |
| 235 | - uint32_t current_hash = entry.hash_field(); | ||
| 235 | + uint32_t current_hash = entry.hash(); | ||
| 236 | 236 | if (current_hash != hash) { | |
| 237 | 237 | if (search_mode == ALL_ENTRIES && out_insertion_index != nullptr) { | |
| 238 | 238 | *out_insertion_index = sort_index + (current_hash > hash ? 0 : 1); | |
@@ -259,12 +259,12 @@ template <SearchMode search_mode, typename T> | |||
| 259 | 259 | int LinearSearch(T* array, Name name, int valid_entries, | |
| 260 | 260 | int* out_insertion_index) { | |
| 261 | 261 | if (search_mode == ALL_ENTRIES && out_insertion_index != nullptr) { | |
| 262 | - uint32_t hash = name.hash_field(); | ||
| 262 | + uint32_t hash = name.hash(); | ||
| 263 | 263 | int len = array->number_of_entries(); | |
| 264 | 264 | for (int number = 0; number < len; number++) { | |
| 265 | 265 | int sorted_index = array->GetSortedKeyIndex(number); | |
| 266 | 266 | Name entry = array->GetKey(InternalIndex(sorted_index)); | |
| 267 | - uint32_t current_hash = entry.hash_field(); | ||
| 267 | + uint32_t current_hash = entry.hash(); | ||
| 268 | 268 | if (current_hash > hash) { | |
| 269 | 269 | *out_insertion_index = sorted_index; | |
| 270 | 270 | return T::kNotFound; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -94,6 +94,12 @@ uint32_t Name::Hash() { | |||
| 94 | 94 | return String::cast(*this).ComputeAndSetHash(); | |
| 95 | 95 | } | |
| 96 | 96 | ||
| 97 | + uint32_t Name::hash() const { | ||
| 98 | + uint32_t field = hash_field(); | ||
| 99 | + DCHECK(IsHashFieldComputed(field)); | ||
| 100 | + return field >> kHashShift; | ||
| 101 | + } | ||
| 102 | + | ||
| 97 | 103 | DEF_GETTER(Name, IsInterestingSymbol, bool) { | |
| 98 | 104 | return IsSymbol(isolate) && Symbol::cast(*this).is_interesting_symbol(); | |
| 99 | 105 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,9 +23,15 @@ class Name : public TorqueGeneratedName<Name, PrimitiveHeapObject> { | |||
| 23 | 23 | // Tells whether the hash code has been computed. | |
| 24 | 24 | inline bool HasHashCode(); | |
| 25 | 25 | ||
| 26 | - // Returns a hash value used for the property table | ||
| 26 | + // Returns a hash value used for the property table. Ensures that the hash | ||
| 27 | + // value is computed. | ||
| 28 | + // TODO(ishell): rename to EnsureHash(). | ||
| 27 | 29 | inline uint32_t Hash(); | |
| 28 | 30 | ||
| 31 | + // Returns a hash value used for the property table (same as Hash()), assumes | ||
| 32 | + // the hash is already computed. | ||
| 33 | + inline uint32_t hash() const; | ||
| 34 | + | ||
| 29 | 35 | // Equality operations. | |
| 30 | 36 | inline bool Equals(Name other); | |
| 31 | 37 | inline static bool Equals(Isolate* isolate, Handle<Name> one, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4355,16 +4355,16 @@ void DescriptorArray::Sort() { | |||
| 4355 | 4355 | // Reset sorting since the descriptor array might contain invalid pointers. | |
| 4356 | 4356 | for (int i = 0; i < len; ++i) SetSortedKey(i, i); | |
| 4357 | 4357 | // Bottom-up max-heap construction. | |
| 4358 | - // Index of the last node with children | ||
| 4358 | + // Index of the last node with children. | ||
| 4359 | 4359 | const int max_parent_index = (len / 2) - 1; | |
| 4360 | 4360 | for (int i = max_parent_index; i >= 0; --i) { | |
| 4361 | 4361 | int parent_index = i; | |
| 4362 | - const uint32_t parent_hash = GetSortedKey(i).Hash(); | ||
| 4362 | + const uint32_t parent_hash = GetSortedKey(i).hash(); | ||
| 4363 | 4363 | while (parent_index <= max_parent_index) { | |
| 4364 | 4364 | int child_index = 2 * parent_index + 1; | |
| 4365 | - uint32_t child_hash = GetSortedKey(child_index).Hash(); | ||
| 4365 | + uint32_t child_hash = GetSortedKey(child_index).hash(); | ||
| 4366 | 4366 | if (child_index + 1 < len) { | |
| 4367 | - uint32_t right_child_hash = GetSortedKey(child_index + 1).Hash(); | ||
| 4367 | + uint32_t right_child_hash = GetSortedKey(child_index + 1).hash(); | ||
| 4368 | 4368 | if (right_child_hash > child_hash) { | |
| 4369 | 4369 | child_index++; | |
| 4370 | 4370 | child_hash = right_child_hash; | |
@@ -4383,13 +4383,13 @@ void DescriptorArray::Sort() { | |||
| 4383 | 4383 | SwapSortedKeys(0, i); | |
| 4384 | 4384 | // Shift down the new top element. | |
| 4385 | 4385 | int parent_index = 0; | |
| 4386 | - const uint32_t parent_hash = GetSortedKey(parent_index).Hash(); | ||
| 4386 | + const uint32_t parent_hash = GetSortedKey(parent_index).hash(); | ||
| 4387 | 4387 | const int max_parent_index = (i / 2) - 1; | |
| 4388 | 4388 | while (parent_index <= max_parent_index) { | |
| 4389 | 4389 | int child_index = parent_index * 2 + 1; | |
| 4390 | - uint32_t child_hash = GetSortedKey(child_index).Hash(); | ||
| 4390 | + uint32_t child_hash = GetSortedKey(child_index).hash(); | ||
| 4391 | 4391 | if (child_index + 1 < i) { | |
| 4392 | - uint32_t right_child_hash = GetSortedKey(child_index + 1).Hash(); | ||
| 4392 | + uint32_t right_child_hash = GetSortedKey(child_index + 1).hash(); | ||
| 4393 | 4393 | if (right_child_hash > child_hash) { | |
| 4394 | 4394 | child_index++; | |
| 4395 | 4395 | child_hash = right_child_hash; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments