Commit 9035ca19 authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[refactoring] Return TNode in AllocateFixedArray.

R=petermarshall@chromium.org

Bug: v8:7570
Change-Id: I0418ea6d2eb114ddac4d7be1251f429596464b79
Reviewed-on: https://chromium-review.googlesource.com/1032438
Commit-Queue: Simon Zünd <szuend@google.com>
Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52887}
parent c224c67a
...@@ -2031,8 +2031,8 @@ TNode<Object> WeakCollectionsBuiltinsAssembler::AllocateTable( ...@@ -2031,8 +2031,8 @@ TNode<Object> WeakCollectionsBuiltinsAssembler::AllocateTable(
// See HashTable::NewInternal(). // See HashTable::NewInternal().
TNode<IntPtrT> length = KeyIndexFromEntry(capacity); TNode<IntPtrT> length = KeyIndexFromEntry(capacity);
TNode<Object> table = CAST(AllocateFixedArray( TNode<FixedArray> table = AllocateFixedArray(
HOLEY_ELEMENTS, length, INTPTR_PARAMETERS, kAllowLargeObjectAllocation)); HOLEY_ELEMENTS, length, INTPTR_PARAMETERS, kAllowLargeObjectAllocation);
Heap::RootListIndex map_root_index = Heap::RootListIndex map_root_index =
static_cast<Heap::RootListIndex>(ObjectHashTableShape::GetMapRootIndex()); static_cast<Heap::RootListIndex>(ObjectHashTableShape::GetMapRootIndex());
......
...@@ -827,7 +827,7 @@ TF_BUILTIN(EnqueueMicrotask, InternalBuiltinsAssembler) { ...@@ -827,7 +827,7 @@ TF_BUILTIN(EnqueueMicrotask, InternalBuiltinsAssembler) {
// This is the likely case where the new queue fits into new space, // This is the likely case where the new queue fits into new space,
// and thus we don't need any write barriers for initializing it. // and thus we don't need any write barriers for initializing it.
TNode<FixedArray> new_queue = TNode<FixedArray> new_queue =
CAST(AllocateFixedArray(PACKED_ELEMENTS, new_queue_length)); AllocateFixedArray(PACKED_ELEMENTS, new_queue_length);
CopyFixedArrayElements(PACKED_ELEMENTS, queue, new_queue, num_tasks, CopyFixedArrayElements(PACKED_ELEMENTS, queue, new_queue, num_tasks,
SKIP_WRITE_BARRIER); SKIP_WRITE_BARRIER);
StoreFixedArrayElement(new_queue, num_tasks, microtask, StoreFixedArrayElement(new_queue, num_tasks, microtask,
...@@ -841,9 +841,9 @@ TF_BUILTIN(EnqueueMicrotask, InternalBuiltinsAssembler) { ...@@ -841,9 +841,9 @@ TF_BUILTIN(EnqueueMicrotask, InternalBuiltinsAssembler) {
BIND(&if_lospace); BIND(&if_lospace);
{ {
// The fallback case where the new queue ends up in large object space. // The fallback case where the new queue ends up in large object space.
TNode<FixedArray> new_queue = CAST(AllocateFixedArray( TNode<FixedArray> new_queue = AllocateFixedArray(
PACKED_ELEMENTS, new_queue_length, INTPTR_PARAMETERS, PACKED_ELEMENTS, new_queue_length, INTPTR_PARAMETERS,
AllocationFlag::kAllowLargeObjectAllocation)); AllocationFlag::kAllowLargeObjectAllocation);
CopyFixedArrayElements(PACKED_ELEMENTS, queue, new_queue, num_tasks); CopyFixedArrayElements(PACKED_ELEMENTS, queue, new_queue, num_tasks);
StoreFixedArrayElement(new_queue, num_tasks, microtask); StoreFixedArrayElement(new_queue, num_tasks, microtask);
FillFixedArrayWithValue(PACKED_ELEMENTS, new_queue, new_num_tasks, FillFixedArrayWithValue(PACKED_ELEMENTS, new_queue, new_num_tasks,
......
...@@ -3407,16 +3407,14 @@ Node* CodeStubAssembler::CloneFastJSArray(Node* context, Node* array, ...@@ -3407,16 +3407,14 @@ Node* CodeStubAssembler::CloneFastJSArray(Node* context, Node* array,
return result; return result;
} }
Node* CodeStubAssembler::AllocateFixedArray(ElementsKind kind, TNode<FixedArray> CodeStubAssembler::AllocateFixedArray(
Node* capacity_node, ElementsKind kind, Node* capacity, ParameterMode mode,
ParameterMode mode, AllocationFlags flags, SloppyTNode<Map> fixed_array_map) {
AllocationFlags flags,
Node* fixed_array_map) {
Comment("AllocateFixedArray"); Comment("AllocateFixedArray");
CSA_SLOW_ASSERT(this, MatchesParameterMode(capacity_node, mode)); CSA_SLOW_ASSERT(this, MatchesParameterMode(capacity, mode));
CSA_ASSERT(this, IntPtrOrSmiGreaterThan(capacity_node, CSA_ASSERT(this, IntPtrOrSmiGreaterThan(capacity,
IntPtrOrSmiConstant(0, mode), mode)); IntPtrOrSmiConstant(0, mode), mode));
Node* total_size = GetFixedArrayAllocationSize(capacity_node, kind, mode); TNode<IntPtrT> total_size = GetFixedArrayAllocationSize(capacity, kind, mode);
if (IsDoubleElementsKind(kind)) flags |= kDoubleAlignment; if (IsDoubleElementsKind(kind)) flags |= kDoubleAlignment;
// Allocate both array and elements object, and initialize the JSArray. // Allocate both array and elements object, and initialize the JSArray.
...@@ -3441,8 +3439,8 @@ Node* CodeStubAssembler::AllocateFixedArray(ElementsKind kind, ...@@ -3441,8 +3439,8 @@ Node* CodeStubAssembler::AllocateFixedArray(ElementsKind kind,
StoreMapNoWriteBarrier(array, map_index); StoreMapNoWriteBarrier(array, map_index);
} }
StoreObjectFieldNoWriteBarrier(array, FixedArray::kLengthOffset, StoreObjectFieldNoWriteBarrier(array, FixedArray::kLengthOffset,
ParameterToTagged(capacity_node, mode)); ParameterToTagged(capacity, mode));
return array; return UncheckedCast<FixedArray>(array);
} }
TNode<FixedArray> CodeStubAssembler::ExtractFixedArray( TNode<FixedArray> CodeStubAssembler::ExtractFixedArray(
......
...@@ -1027,18 +1027,19 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -1027,18 +1027,19 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
Node* capacity = nullptr, Node* capacity = nullptr,
Node* allocation_site = nullptr); Node* allocation_site = nullptr);
Node* AllocateFixedArray(ElementsKind kind, Node* capacity, TNode<FixedArray> AllocateFixedArray(
ParameterMode mode = INTPTR_PARAMETERS, ElementsKind kind, Node* capacity, ParameterMode mode = INTPTR_PARAMETERS,
AllocationFlags flags = kNone, AllocationFlags flags = kNone,
Node* fixed_array_map = nullptr); SloppyTNode<Map> fixed_array_map = nullptr);
Node* AllocateFixedArray(ElementsKind kind, TNode<Smi> capacity, TNode<FixedArray> AllocateFixedArray(ElementsKind kind, TNode<Smi> capacity,
AllocationFlags flags = kNone) { AllocationFlags flags = kNone) {
return AllocateFixedArray(kind, capacity, SMI_PARAMETERS, flags); return AllocateFixedArray(kind, capacity, SMI_PARAMETERS, flags);
} }
Node* AllocateFixedArray(ElementsKind kind, TNode<Smi> capacity, TNode<FixedArray> AllocateFixedArray(ElementsKind kind, TNode<Smi> capacity,
TNode<Map> map, AllocationFlags flags = kNone) { TNode<Map> map,
AllocationFlags flags = kNone) {
return AllocateFixedArray(kind, capacity, SMI_PARAMETERS, flags, map); return AllocateFixedArray(kind, capacity, SMI_PARAMETERS, flags, map);
} }
......
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