Commit 49fe8291 authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

Restore pretenuring of DescriptorArrays.

Bug: chromium:913448, chromium:912935, chromium:913482
Change-Id: Iea85d14a9695b8c8157400f92b9576285799c944
Reviewed-on: https://chromium-review.googlesource.com/c/1371831Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58169}
parent 148039e6
......@@ -1892,14 +1892,15 @@ Handle<PropertyCell> Factory::NewPropertyCell(Handle<Name> name,
}
Handle<DescriptorArray> Factory::NewDescriptorArray(int number_of_descriptors,
int slack) {
int slack,
PretenureFlag pretenure) {
int number_of_all_descriptors = number_of_descriptors + slack;
// Zero-length case must be handled outside.
DCHECK_LT(0, number_of_all_descriptors);
int size = DescriptorArray::SizeFor(number_of_all_descriptors);
DCHECK_LT(size, kMaxRegularHeapObjectSize);
HeapObject* obj =
isolate()->heap()->AllocateRawWithRetryOrFail(size, NEW_SPACE);
AllocationSpace space = Heap::SelectSpace(pretenure);
HeapObject* obj = isolate()->heap()->AllocateRawWithRetryOrFail(size, space);
obj->set_map_after_allocation(*descriptor_array_map(), SKIP_WRITE_BARRIER);
DescriptorArray array = DescriptorArray::cast(obj);
array->Initialize(*empty_enum_cache(), *undefined_value(),
......
......@@ -481,8 +481,9 @@ class V8_EXPORT_PRIVATE Factory {
Handle<FeedbackCell> NewManyClosuresCell(Handle<HeapObject> value);
Handle<FeedbackCell> NewNoFeedbackCell();
Handle<DescriptorArray> NewDescriptorArray(int number_of_entries,
int slack = 0);
Handle<DescriptorArray> NewDescriptorArray(
int number_of_entries, int slack = 0,
PretenureFlag pretenure = NOT_TENURED);
Handle<TransitionArray> NewTransitionArray(int number_of_transitions,
int slack = 0);
......
......@@ -6712,8 +6712,8 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
}
// Allocate the instance descriptor.
Handle<DescriptorArray> descriptors =
DescriptorArray::Allocate(isolate, instance_descriptor_length, 0);
Handle<DescriptorArray> descriptors = DescriptorArray::Allocate(
isolate, instance_descriptor_length, 0, TENURED);
int number_of_allocated_fields =
number_of_fields + unused_property_fields - inobject_props;
......@@ -10755,10 +10755,12 @@ Handle<FrameArray> FrameArray::EnsureSpace(Isolate* isolate,
Handle<DescriptorArray> DescriptorArray::Allocate(Isolate* isolate,
int nof_descriptors,
int slack) {
int slack,
PretenureFlag pretenure) {
return nof_descriptors + slack == 0
? isolate->factory()->empty_descriptor_array()
: isolate->factory()->NewDescriptorArray(nof_descriptors, slack);
: isolate->factory()->NewDescriptorArray(nof_descriptors, slack,
pretenure);
}
void DescriptorArray::Initialize(EnumCache* enum_cache,
......
......@@ -122,8 +122,9 @@ class DescriptorArray : public HeapObjectPtr {
// Allocates a DescriptorArray, but returns the singleton
// empty descriptor array object if number_of_descriptors is 0.
static Handle<DescriptorArray> Allocate(Isolate* isolate, int nof_descriptors,
int slack);
static Handle<DescriptorArray> Allocate(
Isolate* isolate, int nof_descriptors, int slack,
PretenureFlag pretenure = NOT_TENURED);
void Initialize(EnumCache* enum_cache, HeapObject* undefined_value,
int nof_descriptors, int slack);
......
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