Commit 942c61ab authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[runtime] Rename PropertyArray::kLengthOffset to kLengthAndHashOffset

LengthAndHashOffset describes the value stored in the offset better.

Bug: v8:6404
Change-Id: Ie5ea2a362c54aa03e0a4e314d1adb8b91d74a044
Reviewed-on: https://chromium-review.googlesource.com/624458Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47503}
parent fe50e817
......@@ -2557,9 +2557,9 @@ void CodeStubAssembler::InitializePropertyArrayLength(Node* property_array,
this,
IntPtrOrSmiLessThanOrEqual(
length, IntPtrOrSmiConstant(PropertyArray::kMaxLength, mode), mode));
StoreObjectFieldNoWriteBarrier(property_array, PropertyArray::kLengthOffset,
ParameterToTagged(length, mode),
MachineRepresentation::kTaggedSigned);
StoreObjectFieldNoWriteBarrier(
property_array, PropertyArray::kLengthAndHashOffset,
ParameterToTagged(length, mode), MachineRepresentation::kTaggedSigned);
}
Node* CodeStubAssembler::AllocatePropertyArray(Node* capacity_node,
......
......@@ -491,7 +491,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
// doesn't have an existing hash.
void InitializePropertyArrayLength(Node* property_array, Node* length,
ParameterMode mode);
Node* LoadPropertyArrayLength(Node* property_array);
// Check if the map is set for slow properties.
TNode<BoolT> IsDictionaryMap(SloppyTNode<Map> map);
......
......@@ -477,12 +477,12 @@ FieldAccess AccessBuilder::ForFixedArrayLength() {
}
// static
// TODO(gsathya): Rename this to PropertyArrayLengthAndHash.
FieldAccess AccessBuilder::ForPropertyArrayLength() {
FieldAccess access = {kTaggedBase, PropertyArray::kLengthOffset,
MaybeHandle<Name>(), MaybeHandle<Map>(),
Type::SignedSmall(), MachineType::TaggedSigned(),
kNoWriteBarrier};
FieldAccess AccessBuilder::ForPropertyArrayLengthAndHash() {
FieldAccess access = {
kTaggedBase, PropertyArray::kLengthAndHashOffset,
MaybeHandle<Name>(), MaybeHandle<Map>(),
Type::SignedSmall(), MachineType::TaggedSigned(),
kNoWriteBarrier};
return access;
}
......
......@@ -161,7 +161,7 @@ class V8_EXPORT_PRIVATE AccessBuilder final
static FieldAccess ForFixedArrayLength();
// Provides access to PropertyArray::length() field.
static FieldAccess ForPropertyArrayLength();
static FieldAccess ForPropertyArrayLengthAndHash();
// Provides access to FixedTypedArrayBase::base_pointer() field.
static FieldAccess ForFixedTypedArrayBaseBasePointer();
......
......@@ -2278,7 +2278,7 @@ Node* JSNativeContextSpecialization::BuildExtendPropertiesBackingStore(
control);
} else {
hash = effect = graph()->NewNode(
simplified()->LoadField(AccessBuilder::ForPropertyArrayLength()),
simplified()->LoadField(AccessBuilder::ForPropertyArrayLengthAndHash()),
properties, effect, control);
effect = graph()->NewNode(
common()->BeginRegion(RegionObservability::kNotObservable), effect);
......@@ -2295,7 +2295,7 @@ Node* JSNativeContextSpecialization::BuildExtendPropertiesBackingStore(
simplified()->StoreField(AccessBuilder::ForMap()), new_properties,
jsgraph()->PropertyArrayMapConstant(), effect, control);
effect = graph()->NewNode(
simplified()->StoreField(AccessBuilder::ForPropertyArrayLength()),
simplified()->StoreField(AccessBuilder::ForPropertyArrayLengthAndHash()),
new_properties, new_length_and_hash, effect, control);
for (int i = 0; i < new_length; ++i) {
effect = graph()->NewNode(
......
......@@ -1083,7 +1083,7 @@ void AccessorAssembler::ExtendPropertiesBackingStore(Node* object,
BIND(&if_property_array);
{
Node* length_and_hash_int32 = LoadAndUntagToWord32ObjectField(
var_properties.value(), PropertyArray::kLengthOffset);
var_properties.value(), PropertyArray::kLengthAndHashOffset);
var_hash.Bind(Word32And(length_and_hash_int32,
Int32Constant(PropertyArray::kHashMask)));
Node* length_intptr = ChangeInt32ToIntPtr(Word32And(
......@@ -1134,7 +1134,7 @@ void AccessorAssembler::ExtendPropertiesBackingStore(Node* object,
TruncateWordToWord32(ParameterToWord(new_capacity, mode));
Node* new_length_and_hash_int32 =
Word32Or(var_hash.value(), new_capacity_int32);
StoreObjectField(new_properties, PropertyArray::kLengthOffset,
StoreObjectField(new_properties, PropertyArray::kLengthAndHashOffset,
SmiFromWord32(new_length_and_hash_int32));
StoreObjectField(object, JSObject::kPropertiesOrHashOffset, new_properties);
Comment("] Extend storage");
......
......@@ -2687,7 +2687,7 @@ SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset)
SYNCHRONIZED_SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset)
int PropertyArray::length() const {
Object* value_obj = READ_FIELD(this, kLengthOffset);
Object* value_obj = READ_FIELD(this, kLengthAndHashOffset);
int value = Smi::ToInt(value_obj);
return value & kLengthMask;
}
......@@ -2695,17 +2695,17 @@ int PropertyArray::length() const {
void PropertyArray::initialize_length(int len) {
SLOW_DCHECK(len >= 0);
SLOW_DCHECK(len < kMaxLength);
WRITE_FIELD(this, kLengthOffset, Smi::FromInt(len));
WRITE_FIELD(this, kLengthAndHashOffset, Smi::FromInt(len));
}
int PropertyArray::synchronized_length() const {
Object* value_obj = ACQUIRE_READ_FIELD(this, kLengthOffset);
Object* value_obj = ACQUIRE_READ_FIELD(this, kLengthAndHashOffset);
int value = Smi::ToInt(value_obj);
return value & kLengthMask;
}
int PropertyArray::Hash() const {
Object* value_obj = READ_FIELD(this, kLengthOffset);
Object* value_obj = READ_FIELD(this, kLengthAndHashOffset);
int value = Smi::ToInt(value_obj);
int hash = value & kHashMask;
return hash;
......@@ -2713,10 +2713,10 @@ int PropertyArray::Hash() const {
void PropertyArray::SetHash(int masked_hash) {
DCHECK_EQ(masked_hash & JSReceiver::kHashMask, masked_hash);
Object* value_obj = READ_FIELD(this, kLengthOffset);
Object* value_obj = READ_FIELD(this, kLengthAndHashOffset);
int value = Smi::ToInt(value_obj);
value = (value & kLengthMask) | masked_hash;
WRITE_FIELD(this, kLengthOffset, Smi::FromInt(value));
WRITE_FIELD(this, kLengthAndHashOffset, Smi::FromInt(value));
}
SMI_ACCESSORS(FreeSpace, size, kSizeOffset)
......
......@@ -1947,9 +1947,8 @@ class PropertyArray : public HeapObject {
DECL_VERIFIER(PropertyArray)
// Layout description.
// TODO(gsathya): Rename kLengthOffset to kLengthAndHashOffset.
static const int kLengthOffset = HeapObject::kHeaderSize;
static const int kHeaderSize = kLengthOffset + kPointerSize;
static const int kLengthAndHashOffset = HeapObject::kHeaderSize;
static const int kHeaderSize = kLengthAndHashOffset + kPointerSize;
// Garbage collection support.
typedef FlexibleBodyDescriptor<kHeaderSize> BodyDescriptor;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment