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/924068
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51326}
This commit is contained in:
jgruber 2018-02-16 14:15:07 +01:00 committed by Commit Bot
parent b88db2588e
commit e249dd878f
4 changed files with 11 additions and 6 deletions

View File

@ -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);
}

View File

@ -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.

View File

@ -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);

View File

@ -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);