Commit 6968d3b4 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[cleanup] Tnodify FixedArray/PropertyArray functions in CSA

This changes many functions in code-stub-assembler.h to pass or return
TNode parameters rather than Node*. In general these are functions that
take ParameterMode and so optionally pass IntPtrT or Smi in a Node which
cannot be easily fixed so these parameters and are left alone.

Also move StoreFixedArrayOrPropertyArrayElement into the private section
of CodeStubAssembler's class definition.

Bug: v8:10155
Change-Id: I010a928cecf105bcf9a5e9f86a402e47733ba7f2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2059994
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarSantiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66340}
parent 4b1fd35b
......@@ -42,7 +42,7 @@ TF_BUILTIN(CopyFastSmiOrObjectElements, CodeStubAssembler) {
TF_BUILTIN(GrowFastDoubleElements, CodeStubAssembler) {
TNode<JSObject> object = CAST(Parameter(Descriptor::kObject));
TNode<Number> key = CAST(Parameter(Descriptor::kKey));
TNode<Smi> key = CAST(Parameter(Descriptor::kKey));
Label runtime(this, Label::kDeferred);
TNode<FixedArrayBase> elements = LoadElements(object);
......@@ -57,7 +57,7 @@ TF_BUILTIN(GrowFastDoubleElements, CodeStubAssembler) {
TF_BUILTIN(GrowFastSmiOrObjectElements, CodeStubAssembler) {
TNode<JSObject> object = CAST(Parameter(Descriptor::kObject));
TNode<Number> key = CAST(Parameter(Descriptor::kKey));
TNode<Smi> key = CAST(Parameter(Descriptor::kKey));
Label runtime(this, Label::kDeferred);
TNode<FixedArrayBase> elements = LoadElements(object);
......
......@@ -502,8 +502,8 @@ TF_BUILTIN(ObjectKeys, ObjectBuiltinsAssembler) {
TNode<DescriptorArray> object_descriptors = LoadMapDescriptors(object_map);
TNode<EnumCache> object_enum_cache = LoadObjectField<EnumCache>(
object_descriptors, DescriptorArray::kEnumCacheOffset);
TNode<Object> object_enum_keys =
LoadObjectField(object_enum_cache, EnumCache::kKeysOffset);
auto object_enum_keys = LoadObjectField<FixedArrayBase>(
object_enum_cache, EnumCache::kKeysOffset);
// Allocate a JSArray and copy the elements from the {object_enum_keys}.
TNode<JSArray> array;
......@@ -598,8 +598,8 @@ TF_BUILTIN(ObjectGetOwnPropertyNames, ObjectBuiltinsAssembler) {
TNode<DescriptorArray> object_descriptors = LoadMapDescriptors(object_map);
TNode<EnumCache> object_enum_cache = CAST(
LoadObjectField(object_descriptors, DescriptorArray::kEnumCacheOffset));
TNode<Object> object_enum_keys =
LoadObjectField(object_enum_cache, EnumCache::kKeysOffset);
auto object_enum_keys = LoadObjectField<FixedArrayBase>(
object_enum_cache, EnumCache::kKeysOffset);
// Allocate a JSArray and copy the elements from the {object_enum_keys}.
TNode<NativeContext> native_context = LoadNativeContext(context);
......
This diff is collapsed.
This diff is collapsed.
......@@ -1988,7 +1988,7 @@ TNode<PropertyArray> AccessorAssembler::ExtendPropertiesBackingStore(
mode));
TNode<PropertyArray> new_properties =
CAST(AllocatePropertyArray(new_capacity, mode));
AllocatePropertyArray(new_capacity, mode);
var_new_properties = new_properties;
FillPropertyArrayWithUndefined(new_properties, var_length.value(),
......@@ -4055,17 +4055,18 @@ void AccessorAssembler::GenerateCloneObjectIC() {
GotoIf(IsEmptyFixedArray(source_properties), &allocate_object);
// This IC requires that the source object has fast properties.
CSA_SLOW_ASSERT(this, IsPropertyArray(CAST(source_properties)));
TNode<IntPtrT> length = LoadPropertyArrayLength(
UncheckedCast<PropertyArray>(source_properties));
TNode<PropertyArray> source_property_array = CAST(source_properties);
TNode<IntPtrT> length = LoadPropertyArrayLength(source_property_array);
GotoIf(IntPtrEqual(length, IntPtrConstant(0)), &allocate_object);
auto mode = INTPTR_PARAMETERS;
var_properties = CAST(AllocatePropertyArray(length, mode));
FillPropertyArrayWithUndefined(var_properties.value(), IntPtrConstant(0),
length, mode);
CopyPropertyArrayValues(source_properties, var_properties.value(), length,
TNode<PropertyArray> property_array = AllocatePropertyArray(length, mode);
FillPropertyArrayWithUndefined(property_array, IntPtrConstant(0), length,
mode);
CopyPropertyArrayValues(source_property_array, property_array, length,
SKIP_WRITE_BARRIER, mode, DestroySource::kNo);
var_properties = property_array;
}
Goto(&allocate_object);
......
......@@ -3313,8 +3313,8 @@ TEST(ExtractFixedArrayCOWForceCopy) {
CodeStubAssembler m(asm_tester.state());
CodeStubAssembler::ExtractFixedArrayFlags flags;
flags |= CodeStubAssembler::ExtractFixedArrayFlag::kAllFixedArrays;
m.Return(m.ExtractFixedArray(m.Parameter(0), m.SmiConstant(0), nullptr,
nullptr, flags,
m.Return(m.ExtractFixedArray(m.CAST(m.Parameter(0)), m.SmiConstant(0),
nullptr, nullptr, flags,
CodeStubAssembler::SMI_PARAMETERS));
}
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
......@@ -3342,8 +3342,8 @@ TEST(ExtractFixedArraySimple) {
CodeStubAssembler::ExtractFixedArrayFlags flags;
flags |= CodeStubAssembler::ExtractFixedArrayFlag::kAllFixedArrays;
flags |= CodeStubAssembler::ExtractFixedArrayFlag::kDontCopyCOW;
m.Return(m.ExtractFixedArray(m.Parameter(0), m.Parameter(1), m.Parameter(2),
nullptr, flags,
m.Return(m.ExtractFixedArray(m.CAST(m.Parameter(0)), m.Parameter(1),
m.Parameter(2), nullptr, flags,
CodeStubAssembler::SMI_PARAMETERS));
}
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
......@@ -3369,7 +3369,7 @@ TEST(ExtractFixedArraySimpleSmiConstant) {
CodeStubAssembler::ExtractFixedArrayFlags flags;
flags |= CodeStubAssembler::ExtractFixedArrayFlag::kAllFixedArrays;
flags |= CodeStubAssembler::ExtractFixedArrayFlag::kDontCopyCOW;
m.Return(m.ExtractFixedArray(m.Parameter(0), m.SmiConstant(1),
m.Return(m.ExtractFixedArray(m.CAST(m.Parameter(0)), m.SmiConstant(1),
m.SmiConstant(2), nullptr, flags,
CodeStubAssembler::SMI_PARAMETERS));
}
......@@ -3393,7 +3393,7 @@ TEST(ExtractFixedArraySimpleIntPtrConstant) {
CodeStubAssembler::ExtractFixedArrayFlags flags;
flags |= CodeStubAssembler::ExtractFixedArrayFlag::kAllFixedArrays;
flags |= CodeStubAssembler::ExtractFixedArrayFlag::kDontCopyCOW;
m.Return(m.ExtractFixedArray(m.Parameter(0), m.IntPtrConstant(1),
m.Return(m.ExtractFixedArray(m.CAST(m.Parameter(0)), m.IntPtrConstant(1),
m.IntPtrConstant(2), nullptr, flags,
CodeStubAssembler::INTPTR_PARAMETERS));
}
......@@ -3415,8 +3415,8 @@ TEST(ExtractFixedArraySimpleIntPtrConstantNoDoubles) {
{
CodeStubAssembler m(asm_tester.state());
m.Return(m.ExtractFixedArray(
m.Parameter(0), m.IntPtrConstant(1), m.IntPtrConstant(2), nullptr,
CodeStubAssembler::ExtractFixedArrayFlag::kFixedArrays,
m.CAST(m.Parameter(0)), m.IntPtrConstant(1), m.IntPtrConstant(2),
nullptr, CodeStubAssembler::ExtractFixedArrayFlag::kFixedArrays,
CodeStubAssembler::INTPTR_PARAMETERS));
}
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
......@@ -3438,7 +3438,8 @@ TEST(ExtractFixedArraySimpleIntPtrParameters) {
CodeStubAssembler m(asm_tester.state());
TNode<IntPtrT> p1_untagged = m.SmiUntag(m.Parameter(1));
TNode<IntPtrT> p2_untagged = m.SmiUntag(m.Parameter(2));
m.Return(m.ExtractFixedArray(m.Parameter(0), p1_untagged, p2_untagged));
m.Return(
m.ExtractFixedArray(m.CAST(m.Parameter(0)), p1_untagged, p2_untagged));
}
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
......
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