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, ...@@ -1892,14 +1892,15 @@ Handle<PropertyCell> Factory::NewPropertyCell(Handle<Name> name,
} }
Handle<DescriptorArray> Factory::NewDescriptorArray(int number_of_descriptors, Handle<DescriptorArray> Factory::NewDescriptorArray(int number_of_descriptors,
int slack) { int slack,
PretenureFlag pretenure) {
int number_of_all_descriptors = number_of_descriptors + slack; int number_of_all_descriptors = number_of_descriptors + slack;
// Zero-length case must be handled outside. // Zero-length case must be handled outside.
DCHECK_LT(0, number_of_all_descriptors); DCHECK_LT(0, number_of_all_descriptors);
int size = DescriptorArray::SizeFor(number_of_all_descriptors); int size = DescriptorArray::SizeFor(number_of_all_descriptors);
DCHECK_LT(size, kMaxRegularHeapObjectSize); DCHECK_LT(size, kMaxRegularHeapObjectSize);
HeapObject* obj = AllocationSpace space = Heap::SelectSpace(pretenure);
isolate()->heap()->AllocateRawWithRetryOrFail(size, NEW_SPACE); HeapObject* obj = isolate()->heap()->AllocateRawWithRetryOrFail(size, space);
obj->set_map_after_allocation(*descriptor_array_map(), SKIP_WRITE_BARRIER); obj->set_map_after_allocation(*descriptor_array_map(), SKIP_WRITE_BARRIER);
DescriptorArray array = DescriptorArray::cast(obj); DescriptorArray array = DescriptorArray::cast(obj);
array->Initialize(*empty_enum_cache(), *undefined_value(), array->Initialize(*empty_enum_cache(), *undefined_value(),
......
...@@ -481,8 +481,9 @@ class V8_EXPORT_PRIVATE Factory { ...@@ -481,8 +481,9 @@ class V8_EXPORT_PRIVATE Factory {
Handle<FeedbackCell> NewManyClosuresCell(Handle<HeapObject> value); Handle<FeedbackCell> NewManyClosuresCell(Handle<HeapObject> value);
Handle<FeedbackCell> NewNoFeedbackCell(); Handle<FeedbackCell> NewNoFeedbackCell();
Handle<DescriptorArray> NewDescriptorArray(int number_of_entries, Handle<DescriptorArray> NewDescriptorArray(
int slack = 0); int number_of_entries, int slack = 0,
PretenureFlag pretenure = NOT_TENURED);
Handle<TransitionArray> NewTransitionArray(int number_of_transitions, Handle<TransitionArray> NewTransitionArray(int number_of_transitions,
int slack = 0); int slack = 0);
......
...@@ -6712,8 +6712,8 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object, ...@@ -6712,8 +6712,8 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
} }
// Allocate the instance descriptor. // Allocate the instance descriptor.
Handle<DescriptorArray> descriptors = Handle<DescriptorArray> descriptors = DescriptorArray::Allocate(
DescriptorArray::Allocate(isolate, instance_descriptor_length, 0); isolate, instance_descriptor_length, 0, TENURED);
int number_of_allocated_fields = int number_of_allocated_fields =
number_of_fields + unused_property_fields - inobject_props; number_of_fields + unused_property_fields - inobject_props;
...@@ -10755,10 +10755,12 @@ Handle<FrameArray> FrameArray::EnsureSpace(Isolate* isolate, ...@@ -10755,10 +10755,12 @@ Handle<FrameArray> FrameArray::EnsureSpace(Isolate* isolate,
Handle<DescriptorArray> DescriptorArray::Allocate(Isolate* isolate, Handle<DescriptorArray> DescriptorArray::Allocate(Isolate* isolate,
int nof_descriptors, int nof_descriptors,
int slack) { int slack,
PretenureFlag pretenure) {
return nof_descriptors + slack == 0 return nof_descriptors + slack == 0
? isolate->factory()->empty_descriptor_array() ? isolate->factory()->empty_descriptor_array()
: isolate->factory()->NewDescriptorArray(nof_descriptors, slack); : isolate->factory()->NewDescriptorArray(nof_descriptors, slack,
pretenure);
} }
void DescriptorArray::Initialize(EnumCache* enum_cache, void DescriptorArray::Initialize(EnumCache* enum_cache,
......
...@@ -122,8 +122,9 @@ class DescriptorArray : public HeapObjectPtr { ...@@ -122,8 +122,9 @@ class DescriptorArray : public HeapObjectPtr {
// Allocates a DescriptorArray, but returns the singleton // Allocates a DescriptorArray, but returns the singleton
// empty descriptor array object if number_of_descriptors is 0. // empty descriptor array object if number_of_descriptors is 0.
static Handle<DescriptorArray> Allocate(Isolate* isolate, int nof_descriptors, static Handle<DescriptorArray> Allocate(
int slack); Isolate* isolate, int nof_descriptors, int slack,
PretenureFlag pretenure = NOT_TENURED);
void Initialize(EnumCache* enum_cache, HeapObject* undefined_value, void Initialize(EnumCache* enum_cache, HeapObject* undefined_value,
int nof_descriptors, int slack); 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