Commit e249dd87 authored by jgruber's avatar jgruber Committed by Commit Bot

Add pretenure argument to NewUninitializedFixedArray

Will be needed in a follow-up (the constants cache builder needs to
grow arrays in old space).

Bug: v8:6666
Change-Id: Ibd911ffd30e2b0f43881e649b5601111d23e4509
Reviewed-on: https://chromium-review.googlesource.com/924068Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51326}
parent b88db258
......@@ -220,7 +220,8 @@ Handle<FixedArray> Factory::NewFixedArrayWithHoles(int length,
FixedArray);
}
Handle<FixedArray> Factory::NewUninitializedFixedArray(int length) {
Handle<FixedArray> Factory::NewUninitializedFixedArray(
int length, PretenureFlag pretenure) {
DCHECK_LE(0, length);
if (length == 0) return empty_fixed_array();
......@@ -228,7 +229,7 @@ Handle<FixedArray> Factory::NewUninitializedFixedArray(int length) {
// array. After getting canary/performance coverage, either remove the
// function or revert to returning uninitilized array.
CALL_HEAP_FUNCTION(isolate(),
isolate()->heap()->AllocateFixedArray(length, NOT_TENURED),
isolate()->heap()->AllocateFixedArray(length, pretenure),
FixedArray);
}
......
......@@ -101,7 +101,8 @@ class V8_EXPORT_PRIVATE Factory final {
int length, PretenureFlag pretenure = NOT_TENURED);
// Allocates an uninitialized fixed array. It must be filled by the caller.
Handle<FixedArray> NewUninitializedFixedArray(int length);
Handle<FixedArray> NewUninitializedFixedArray(
int length, PretenureFlag pretenure = NOT_TENURED);
// Allocates a feedback vector whose slots are initialized with undefined
// values.
......
......@@ -10083,7 +10083,8 @@ Handle<Map> Map::CopyReplaceDescriptor(Handle<Map> map,
}
Handle<FixedArray> FixedArray::SetAndGrow(Handle<FixedArray> array, int index,
Handle<Object> value) {
Handle<Object> value,
PretenureFlag pretenure) {
if (index < array->length()) {
array->set(index, *value);
return array;
......@@ -10093,7 +10094,8 @@ Handle<FixedArray> FixedArray::SetAndGrow(Handle<FixedArray> array, int index,
capacity = JSObject::NewElementsCapacity(capacity);
} while (capacity <= index);
Handle<FixedArray> new_array =
array->GetIsolate()->factory()->NewUninitializedFixedArray(capacity);
array->GetIsolate()->factory()->NewUninitializedFixedArray(capacity,
pretenure);
array->CopyTo(0, *new_array, 0, array->length());
new_array->FillWithHoles(array->length(), new_array->length());
new_array->set(index, *value);
......
......@@ -103,7 +103,8 @@ class FixedArray : public FixedArrayBase {
// Return a grown copy if the index is bigger than the array's length.
static Handle<FixedArray> SetAndGrow(Handle<FixedArray> array, int index,
Handle<Object> value);
Handle<Object> value,
PretenureFlag pretenure = NOT_TENURED);
// Setter that uses write barrier.
inline void set(int index, Object* value);
......
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