Commit d3940aa3 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[builtins] Make Array constructor consistent with other code

Make ArrayBuiltinsAssembler::GenerateConstructor use the
JSArray::kInitialMaxFastElementArray constant instead of trying to
manually compute it and end up with a different result depending on the
build. This brings the code in sync with CodeStubAssembler::CreateArray
and with Turbofan's JSCallReducer.

Change-Id: I7fcc955166484a91f8982b359b94d9a586fdb50a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2312780
Commit-Queue: Georg Neis <neis@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Auto-Submit: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68995}
parent fafb4769
......@@ -1852,13 +1852,8 @@ void ArrayBuiltinsAssembler::GenerateConstructor(
SmiConstant(AbortReason::kAllocatingNonEmptyPackedArray);
TailCallRuntime(Runtime::kAbort, context, reason);
} else {
int element_size =
IsDoubleElementsKind(elements_kind) ? kDoubleSize : kTaggedSize;
int max_fast_elements =
(kMaxRegularHeapObjectSize - FixedArray::kHeaderSize -
JSArray::kHeaderSize - AllocationMemento::kSize) /
element_size;
Branch(SmiAboveOrEqual(array_size_smi, SmiConstant(max_fast_elements)),
Branch(SmiAboveOrEqual(array_size_smi,
SmiConstant(JSArray::kInitialMaxFastElementArray)),
&call_runtime, &small_smi_size);
}
......
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