Commit 183b8579 authored by Mike Stanton's avatar Mike Stanton Committed by Commit Bot

[Builtins]: Array.prototype.map out of memory error

If we need to allocate a DOUBLE_ELEMENTS backing store, it's important
to allow large object space allocation.

BUG: chromium:926856

Change-Id: I9dd94f7176891a6f8f11d5f579b67df8151a40b5
Reviewed-on: https://chromium-review.googlesource.com/c/1449531Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59285}
parent 14c06a34
...@@ -136,8 +136,8 @@ namespace array_map { ...@@ -136,8 +136,8 @@ namespace array_map {
// We need to allocate and copy. // We need to allocate and copy.
// First, initialize the elements field before allocation to prevent // First, initialize the elements field before allocation to prevent
// heap corruption. // heap corruption.
const elements: FixedDoubleArray = const elements: FixedDoubleArray = AllocateFixedDoubleArrayWithHoles(
AllocateFixedDoubleArrayWithHoles(SmiUntag(length), kNone); SmiUntag(length), kAllowLargeObjectAllocation);
a = new JSArray{map, this.fixedArray}; a = new JSArray{map, this.fixedArray};
for (let i: Smi = 0; i < validLength; i++) { for (let i: Smi = 0; i < validLength; i++) {
typeswitch (this.fixedArray[i]) { typeswitch (this.fixedArray[i]) {
......
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Need a fast array with enough elements to surpass
// kMaxRegularHeapObjectSize.
var size = 63392;
var a = [];
function build() {
for (let i = 0; i < size; i++) {
a.push(i);
}
}
build();
function c(v) { return v + 0.5; }
a.map(c);
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