Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Unified Diff: src/code-stub-assembler.cc

Issue 2220673002: [stubs] Cleanup FixedArray copying builtin (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tests pass Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/code-stub-assembler.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stub-assembler.cc
diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc
index 85a60118b7673b0d00a90abe8af3167a3bc4e934..7b41af3cce10e718604151eddc8baf58d0d51ddd 100644
--- a/src/code-stub-assembler.cc
+++ b/src/code-stub-assembler.cc
@@ -1392,17 +1392,21 @@ Node* CodeStubAssembler::AllocateJSArray(ElementsKind kind, Node* array_map,
Node* CodeStubAssembler::AllocateFixedArray(ElementsKind kind,
Node* capacity_node,
- ParameterMode mode) {
- Node* total_size = ElementOffsetFromIndex(capacity_node, kind, mode,
- FixedArray::kHeaderSize);
+ ParameterMode mode,
+ AllocationFlags flags) {
+ Node* total_size = GetFixedAarrayAllocationSize(capacity_node, kind, mode);
// Allocate both array and elements object, and initialize the JSArray.
- Node* array = Allocate(total_size);
+ Node* array = Allocate(total_size, flags);
Heap* heap = isolate()->heap();
Handle<Map> map(IsFastDoubleElementsKind(kind)
? heap->fixed_double_array_map()
: heap->fixed_array_map());
- StoreMapNoWriteBarrier(array, HeapConstant(map));
+ if (flags & kPretenured) {
+ StoreObjectField(array, JSObject::kMapOffset, HeapConstant(map));
+ } else {
+ StoreMapNoWriteBarrier(array, HeapConstant(map));
+ }
StoreObjectFieldNoWriteBarrier(
array, FixedArray::kLengthOffset,
mode == INTEGER_PARAMETERS ? SmiTag(capacity_node) : capacity_node);
@@ -1593,8 +1597,7 @@ Node* CodeStubAssembler::CheckAndGrowElementsCapacity(Node* context,
// If size of the allocation for the new capacity doesn't fit in a page
// that we can bump-pointer allocate from, fall back to the runtime,
- int max_size = ((Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) >>
- ElementsKindToShiftSize(kind));
+ int max_size = FixedArrayBase::GetMaxLengthForNewSpaceAllocation(kind);
GotoIf(UintPtrGreaterThanOrEqual(new_capacity,
IntPtrOrSmiConstant(max_size, mode)),
fail);
« no previous file with comments | « src/code-stub-assembler.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698