| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 09f5e25 commit f12db24
9 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ | |||
| 11 | 11 | #define V8_MAJOR_VERSION 6 | |
| 12 | 12 | #define V8_MINOR_VERSION 2 | |
| 13 | 13 | #define V8_BUILD_NUMBER 414 | |
| 14 | - #define V8_PATCH_LEVEL 52 | ||
| 14 | + #define V8_PATCH_LEVEL 53 | ||
| 15 | 15 | ||
| 16 | 16 | // Use 1 for candidates and 0 otherwise. | |
| 17 | 17 | // (Boolean macro values are not supported by all preprocessors.) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1187,8 +1187,8 @@ TNode<Int32T> CodeStubAssembler::LoadHashForJSObject( | |||
| 1187 | 1187 | { | |
| 1188 | 1188 | Node* length_and_hash_int32 = LoadAndUntagToWord32ObjectField( | |
| 1189 | 1189 | properties_or_hash, PropertyArray::kLengthAndHashOffset); | |
| 1190 | - var_hash.Bind(Word32And(length_and_hash_int32, | ||
| 1191 | - Int32Constant(PropertyArray::kHashMask))); | ||
| 1190 | + var_hash.Bind( | ||
| 1191 | + DecodeWord32<PropertyArray::HashField>(length_and_hash_int32)); | ||
| 1192 | 1192 | Goto(&done); | |
| 1193 | 1193 | } | |
| 1194 | 1194 | ||
@@ -2508,7 +2508,8 @@ void CodeStubAssembler::InitializePropertyArrayLength(Node* property_array, | |||
| 2508 | 2508 | CSA_ASSERT( | |
| 2509 | 2509 | this, | |
| 2510 | 2510 | IntPtrOrSmiLessThanOrEqual( | |
| 2511 | - length, IntPtrOrSmiConstant(PropertyArray::kMaxLength, mode), mode)); | ||
| 2511 | + length, IntPtrOrSmiConstant(PropertyArray::LengthField::kMax, mode), | ||
| 2512 | + mode)); | ||
| 2512 | 2513 | StoreObjectFieldNoWriteBarrier( | |
| 2513 | 2514 | property_array, PropertyArray::kLengthAndHashOffset, | |
| 2514 | 2515 | ParameterToTagged(length, mode), MachineRepresentation::kTaggedSigned); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2255,14 +2255,18 @@ Node* JSNativeContextSpecialization::BuildExtendPropertiesBackingStore( | |||
| 2255 | 2255 | jsgraph()->SmiConstant(PropertyArray::kNoHashSentinel)); | |
| 2256 | 2256 | hash = graph()->NewNode(common()->TypeGuard(Type::SignedSmall()), hash, | |
| 2257 | 2257 | control); | |
| 2258 | + hash = | ||
| 2259 | + graph()->NewNode(simplified()->NumberShiftLeft(), hash, | ||
| 2260 | + jsgraph()->Constant(PropertyArray::HashField::kShift)); | ||
| 2258 | 2261 | } else { | |
| 2259 | 2262 | hash = effect = graph()->NewNode( | |
| 2260 | 2263 | simplified()->LoadField(AccessBuilder::ForPropertyArrayLengthAndHash()), | |
| 2261 | 2264 | properties, effect, control); | |
| 2262 | 2265 | effect = graph()->NewNode( | |
| 2263 | 2266 | common()->BeginRegion(RegionObservability::kNotObservable), effect); | |
| 2264 | - hash = graph()->NewNode(simplified()->NumberBitwiseAnd(), hash, | ||
| 2265 | - jsgraph()->Constant(JSReceiver::kHashMask)); | ||
| 2267 | + hash = | ||
| 2268 | + graph()->NewNode(simplified()->NumberBitwiseAnd(), hash, | ||
| 2269 | + jsgraph()->Constant(PropertyArray::HashField::kMask)); | ||
| 2266 | 2270 | } | |
| 2267 | 2271 | ||
| 2268 | 2272 | Node* new_length_and_hash = graph()->NewNode( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1091,7 +1091,7 @@ void AccessorAssembler::ExtendPropertiesBackingStore(Node* object, | |||
| 1091 | 1091 | // TODO(gsathya): Clean up the type conversions by creating smarter | |
| 1092 | 1092 | // helpers that do the correct op based on the mode. | |
| 1093 | 1093 | VARIABLE(var_properties, MachineRepresentation::kTaggedPointer); | |
| 1094 | - VARIABLE(var_hash, MachineRepresentation::kWord32); | ||
| 1094 | + VARIABLE(var_encoded_hash, MachineRepresentation::kWord32); | ||
| 1095 | 1095 | VARIABLE(var_length, ParameterRepresentation(mode)); | |
| 1096 | 1096 | ||
| 1097 | 1097 | Node* properties = LoadObjectField(object, JSObject::kPropertiesOrHashOffset); | |
@@ -1102,7 +1102,10 @@ void AccessorAssembler::ExtendPropertiesBackingStore(Node* object, | |||
| 1102 | 1102 | ||
| 1103 | 1103 | BIND(&if_smi_hash); | |
| 1104 | 1104 | { | |
| 1105 | - var_hash.Bind(SmiToWord32(properties)); | ||
| 1105 | + Node* hash = SmiToWord32(properties); | ||
| 1106 | + Node* encoded_hash = | ||
| 1107 | + Word32Shl(hash, Int32Constant(PropertyArray::HashField::kShift)); | ||
| 1108 | + var_encoded_hash.Bind(encoded_hash); | ||
| 1106 | 1109 | var_length.Bind(IntPtrOrSmiConstant(0, mode)); | |
| 1107 | 1110 | var_properties.Bind(EmptyFixedArrayConstant()); | |
| 1108 | 1111 | Goto(&extend_store); | |
@@ -1112,10 +1115,11 @@ void AccessorAssembler::ExtendPropertiesBackingStore(Node* object, | |||
| 1112 | 1115 | { | |
| 1113 | 1116 | Node* length_and_hash_int32 = LoadAndUntagToWord32ObjectField( | |
| 1114 | 1117 | var_properties.value(), PropertyArray::kLengthAndHashOffset); | |
| 1115 | - var_hash.Bind(Word32And(length_and_hash_int32, | ||
| 1116 | - Int32Constant(PropertyArray::kHashMask))); | ||
| 1117 | - Node* length_intptr = ChangeInt32ToIntPtr(Word32And( | ||
| 1118 | - length_and_hash_int32, Int32Constant(PropertyArray::kLengthMask))); | ||
| 1118 | + var_encoded_hash.Bind(Word32And( | ||
| 1119 | + length_and_hash_int32, Int32Constant(PropertyArray::HashField::kMask))); | ||
| 1120 | + Node* length_intptr = ChangeInt32ToIntPtr( | ||
| 1121 | + Word32And(length_and_hash_int32, | ||
| 1122 | + Int32Constant(PropertyArray::LengthField::kMask))); | ||
| 1119 | 1123 | Node* length = WordToParameter(length_intptr, mode); | |
| 1120 | 1124 | var_length.Bind(length); | |
| 1121 | 1125 | Goto(&extend_store); | |
@@ -1161,7 +1165,7 @@ void AccessorAssembler::ExtendPropertiesBackingStore(Node* object, | |||
| 1161 | 1165 | Node* new_capacity_int32 = | |
| 1162 | 1166 | TruncateWordToWord32(ParameterToWord(new_capacity, mode)); | |
| 1163 | 1167 | Node* new_length_and_hash_int32 = | |
| 1164 | - Word32Or(var_hash.value(), new_capacity_int32); | ||
| 1168 | + Word32Or(var_encoded_hash.value(), new_capacity_int32); | ||
| 1165 | 1169 | StoreObjectField(new_properties, PropertyArray::kLengthAndHashOffset, | |
| 1166 | 1170 | SmiFromWord32(new_length_and_hash_int32)); | |
| 1167 | 1171 | StoreObjectField(object, JSObject::kPropertiesOrHashOffset, new_properties); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2679,33 +2679,31 @@ SYNCHRONIZED_SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset) | |||
| 2679 | 2679 | int PropertyArray::length() const { | |
| 2680 | 2680 | Object* value_obj = READ_FIELD(this, kLengthAndHashOffset); | |
| 2681 | 2681 | int value = Smi::ToInt(value_obj); | |
| 2682 | - return value & kLengthMask; | ||
| 2682 | + return LengthField::decode(value); | ||
| 2683 | 2683 | } | |
| 2684 | 2684 | ||
| 2685 | 2685 | void PropertyArray::initialize_length(int len) { | |
| 2686 | 2686 | SLOW_DCHECK(len >= 0); | |
| 2687 | - SLOW_DCHECK(len < kMaxLength); | ||
| 2687 | + SLOW_DCHECK(len < LengthField::kMax); | ||
| 2688 | 2688 | WRITE_FIELD(this, kLengthAndHashOffset, Smi::FromInt(len)); | |
| 2689 | 2689 | } | |
| 2690 | 2690 | ||
| 2691 | 2691 | int PropertyArray::synchronized_length() const { | |
| 2692 | 2692 | Object* value_obj = ACQUIRE_READ_FIELD(this, kLengthAndHashOffset); | |
| 2693 | 2693 | int value = Smi::ToInt(value_obj); | |
| 2694 | - return value & kLengthMask; | ||
| 2694 | + return LengthField::decode(value); | ||
| 2695 | 2695 | } | |
| 2696 | 2696 | ||
| 2697 | 2697 | int PropertyArray::Hash() const { | |
| 2698 | 2698 | Object* value_obj = READ_FIELD(this, kLengthAndHashOffset); | |
| 2699 | 2699 | int value = Smi::ToInt(value_obj); | |
| 2700 | - int hash = value & kHashMask; | ||
| 2701 | - return hash; | ||
| 2700 | + return HashField::decode(value); | ||
| 2702 | 2701 | } | |
| 2703 | 2702 | ||
| 2704 | - void PropertyArray::SetHash(int masked_hash) { | ||
| 2705 | - DCHECK_EQ(masked_hash & JSReceiver::kHashMask, masked_hash); | ||
| 2703 | + void PropertyArray::SetHash(int hash) { | ||
| 2706 | 2704 | Object* value_obj = READ_FIELD(this, kLengthAndHashOffset); | |
| 2707 | 2705 | int value = Smi::ToInt(value_obj); | |
| 2708 | - value = (value & kLengthMask) | masked_hash; | ||
| 2706 | + value = HashField::update(value, hash); | ||
| 2709 | 2707 | WRITE_FIELD(this, kLengthAndHashOffset, Smi::FromInt(value)); | |
| 2710 | 2708 | } | |
| 2711 | 2709 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6269,22 +6269,22 @@ Handle<SeededNumberDictionary> JSObject::NormalizeElements( | |||
| 6269 | 6269 | ||
| 6270 | 6270 | namespace { | |
| 6271 | 6271 | ||
| 6272 | - Object* SetHashAndUpdateProperties(HeapObject* properties, int masked_hash) { | ||
| 6273 | - DCHECK_NE(PropertyArray::kNoHashSentinel, masked_hash); | ||
| 6274 | - DCHECK_EQ(masked_hash & JSReceiver::kHashMask, masked_hash); | ||
| 6272 | + Object* SetHashAndUpdateProperties(HeapObject* properties, int hash) { | ||
| 6273 | + DCHECK_NE(PropertyArray::kNoHashSentinel, hash); | ||
| 6274 | + DCHECK(PropertyArray::HashField::is_valid(hash)); | ||
| 6275 | 6275 | ||
| 6276 | 6276 | if (properties == properties->GetHeap()->empty_fixed_array() || | |
| 6277 | 6277 | properties == properties->GetHeap()->empty_property_dictionary()) { | |
| 6278 | - return Smi::FromInt(masked_hash); | ||
| 6278 | + return Smi::FromInt(hash); | ||
| 6279 | 6279 | } | |
| 6280 | 6280 | ||
| 6281 | 6281 | if (properties->IsPropertyArray()) { | |
| 6282 | - PropertyArray::cast(properties)->SetHash(masked_hash); | ||
| 6282 | + PropertyArray::cast(properties)->SetHash(hash); | ||
| 6283 | 6283 | return properties; | |
| 6284 | 6284 | } | |
| 6285 | 6285 | ||
| 6286 | 6286 | DCHECK(properties->IsDictionary()); | |
| 6287 | - NameDictionary::cast(properties)->SetHash(masked_hash); | ||
| 6287 | + NameDictionary::cast(properties)->SetHash(hash); | ||
| 6288 | 6288 | return properties; | |
| 6289 | 6289 | } | |
| 6290 | 6290 | ||
@@ -6315,14 +6315,14 @@ int GetIdentityHashHelper(Isolate* isolate, JSReceiver* object) { | |||
| 6315 | 6315 | } | |
| 6316 | 6316 | } // namespace | |
| 6317 | 6317 | ||
| 6318 | - void JSReceiver::SetIdentityHash(int masked_hash) { | ||
| 6318 | + void JSReceiver::SetIdentityHash(int hash) { | ||
| 6319 | 6319 | DisallowHeapAllocation no_gc; | |
| 6320 | - DCHECK_NE(PropertyArray::kNoHashSentinel, masked_hash); | ||
| 6321 | - DCHECK_EQ(masked_hash & JSReceiver::kHashMask, masked_hash); | ||
| 6320 | + DCHECK_NE(PropertyArray::kNoHashSentinel, hash); | ||
| 6321 | + DCHECK(PropertyArray::HashField::is_valid(hash)); | ||
| 6322 | 6322 | ||
| 6323 | 6323 | HeapObject* existing_properties = HeapObject::cast(raw_properties_or_hash()); | |
| 6324 | 6324 | Object* new_properties = | |
| 6325 | - SetHashAndUpdateProperties(existing_properties, masked_hash); | ||
| 6325 | + SetHashAndUpdateProperties(existing_properties, hash); | ||
| 6326 | 6326 | set_raw_properties_or_hash(new_properties); | |
| 6327 | 6327 | } | |
| 6328 | 6328 | ||
@@ -6377,11 +6377,11 @@ Smi* JSObject::GetOrCreateIdentityHash(Isolate* isolate) { | |||
| 6377 | 6377 | return Smi::cast(hash_obj); | |
| 6378 | 6378 | } | |
| 6379 | 6379 | ||
| 6380 | - int masked_hash = isolate->GenerateIdentityHash(JSReceiver::kHashMask); | ||
| 6381 | - DCHECK_NE(PropertyArray::kNoHashSentinel, masked_hash); | ||
| 6380 | + int hash = isolate->GenerateIdentityHash(PropertyArray::HashField::kMax); | ||
| 6381 | + DCHECK_NE(PropertyArray::kNoHashSentinel, hash); | ||
| 6382 | 6382 | ||
| 6383 | - SetIdentityHash(masked_hash); | ||
| 6384 | - return Smi::FromInt(masked_hash); | ||
| 6383 | + SetIdentityHash(hash); | ||
| 6384 | + return Smi::FromInt(hash); | ||
| 6385 | 6385 | } | |
| 6386 | 6386 | ||
| 6387 | 6387 | Object* JSProxy::GetIdentityHash() { return hash(); } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1953,17 +1953,10 @@ class PropertyArray : public HeapObject { | |||
| 1953 | 1953 | // No weak fields. | |
| 1954 | 1954 | typedef BodyDescriptor BodyDescriptorWeak; | |
| 1955 | 1955 | ||
| 1956 | - static const int kLengthMask = 0x3ff; | ||
| 1957 | - #if V8_TARGET_ARCH_64_BIT | ||
| 1958 | - static const int kHashMask = 0x7ffffc00; | ||
| 1959 | - STATIC_ASSERT(kLengthMask + kHashMask == 0x7fffffff); | ||
| 1960 | - #else | ||
| 1961 | - static const int kHashMask = 0x3ffffc00; | ||
| 1962 | - STATIC_ASSERT(kLengthMask + kHashMask == 0x3fffffff); | ||
| 1963 | - #endif | ||
| 1964 | - | ||
| 1965 | - static const int kMaxLength = kLengthMask; | ||
| 1966 | - STATIC_ASSERT(kMaxLength > kMaxNumberOfDescriptors); | ||
| 1956 | + static const int kLengthFieldSize = 10; | ||
| 1957 | + class LengthField : public BitField<int, 0, kLengthFieldSize> {}; | ||
| 1958 | + class HashField : public BitField<int, kLengthFieldSize, | ||
| 1959 | + kSmiValueSize - kLengthFieldSize - 1> {}; | ||
| 1967 | 1960 | ||
| 1968 | 1961 | static const int kNoHashSentinel = 0; | |
| 1969 | 1962 | ||
@@ -2190,7 +2183,7 @@ class JSReceiver: public HeapObject { | |||
| 2190 | 2183 | MUST_USE_RESULT static MaybeHandle<FixedArray> GetOwnEntries( | |
| 2191 | 2184 | Handle<JSReceiver> object, PropertyFilter filter); | |
| 2192 | 2185 | ||
| 2193 | - static const int kHashMask = PropertyArray::kHashMask; | ||
| 2186 | + static const int kHashMask = PropertyArray::HashField::kMask; | ||
| 2194 | 2187 | ||
| 2195 | 2188 | // Layout description. | |
| 2196 | 2189 | static const int kPropertiesOrHashOffset = HeapObject::kHeaderSize; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -138,14 +138,16 @@ class BaseNameDictionary : public Dictionary<Derived, Shape> { | |||
| 138 | 138 | return Smi::ToInt(this->get(kNextEnumerationIndexIndex)); | |
| 139 | 139 | } | |
| 140 | 140 | ||
| 141 | - void SetHash(int masked_hash) { | ||
| 142 | - DCHECK_EQ(masked_hash & JSReceiver::kHashMask, masked_hash); | ||
| 143 | - this->set(kObjectHashIndex, Smi::FromInt(masked_hash)); | ||
| 141 | + void SetHash(int hash) { | ||
| 142 | + DCHECK(PropertyArray::HashField::is_valid(hash)); | ||
| 143 | + this->set(kObjectHashIndex, Smi::FromInt(hash)); | ||
| 144 | 144 | } | |
| 145 | 145 | ||
| 146 | 146 | int Hash() const { | |
| 147 | 147 | Object* hash_obj = this->get(kObjectHashIndex); | |
| 148 | - return Smi::ToInt(hash_obj); | ||
| 148 | + int hash = Smi::ToInt(hash_obj); | ||
| 149 | + DCHECK(PropertyArray::HashField::is_valid(hash)); | ||
| 150 | + return hash; | ||
| 149 | 151 | } | |
| 150 | 152 | ||
| 151 | 153 | // Creates a new dictionary. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -191,7 +191,7 @@ TEST(Regress2060a) { | |||
| 191 | 191 | Handle<JSObject> object = factory->NewJSObject(function, TENURED); | |
| 192 | 192 | CHECK(!heap->InNewSpace(*object)); | |
| 193 | 193 | CHECK(!first_page->Contains(object->address())); | |
| 194 | - int32_t hash = object->GetOrCreateHash(isolate)->value(); | ||
| 194 | + int32_t hash = key->GetOrCreateHash(isolate)->value(); | ||
| 195 | 195 | JSWeakCollection::Set(weakmap, key, object, hash); | |
| 196 | 196 | } | |
| 197 | 197 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments