Commit acea9fbe authored by Hannes Payer's avatar Hannes Payer Committed by Commit Bot

DescriptorArray allocation uses AllocationType.

Bug: v8:8945
Change-Id: Ib26d97bb6b5b1a6d523079bd3277ca28488eec9b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1503264
Commit-Queue: Hannes Payer <hpayer@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60037}
parent f4e322c3
......@@ -1906,12 +1906,12 @@ Handle<PropertyCell> Factory::NewPropertyCell(Handle<Name> name,
Handle<DescriptorArray> Factory::NewDescriptorArray(int number_of_descriptors,
int slack,
PretenureFlag pretenure) {
AllocationType type) {
DCHECK(Heap::IsRegularObjectAllocation(type));
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);
AllocationType type = Heap::SelectType(Heap::SelectSpace(pretenure));
HeapObject obj = isolate()->heap()->AllocateRawWithRetryOrFail(size, type);
obj->set_map_after_allocation(*descriptor_array_map(), SKIP_WRITE_BARRIER);
DescriptorArray array = DescriptorArray::cast(obj);
......
......@@ -491,7 +491,7 @@ class V8_EXPORT_PRIVATE Factory {
Handle<DescriptorArray> NewDescriptorArray(
int number_of_entries, int slack = 0,
PretenureFlag pretenure = NOT_TENURED);
AllocationType type = AllocationType::kYoung);
Handle<TransitionArray> NewTransitionArray(int number_of_transitions,
int slack = 0);
......
......@@ -1422,6 +1422,10 @@ class Heap {
}
}
static bool IsRegularObjectAllocation(AllocationType type) {
return AllocationType::kYoung == type || AllocationType::kOld == type;
}
static size_t DefaultGetExternallyAllocatedMemoryInBytesCallback() {
return 0;
}
......
......@@ -4148,11 +4148,11 @@ Handle<FrameArray> FrameArray::EnsureSpace(Isolate* isolate,
Handle<DescriptorArray> DescriptorArray::Allocate(Isolate* isolate,
int nof_descriptors,
int slack,
PretenureFlag pretenure) {
AllocationType type) {
return nof_descriptors + slack == 0
? isolate->factory()->empty_descriptor_array()
: isolate->factory()->NewDescriptorArray(nof_descriptors, slack,
pretenure);
type);
}
void DescriptorArray::Initialize(EnumCache enum_cache,
......
......@@ -125,7 +125,7 @@ class DescriptorArray : public HeapObject {
// empty descriptor array object if number_of_descriptors is 0.
static Handle<DescriptorArray> Allocate(
Isolate* isolate, int nof_descriptors, int slack,
PretenureFlag pretenure = NOT_TENURED);
AllocationType type = AllocationType::kYoung);
void Initialize(EnumCache enum_cache, HeapObject undefined_value,
int nof_descriptors, int slack);
......
......@@ -3370,7 +3370,7 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
// Allocate the instance descriptor.
Handle<DescriptorArray> descriptors = DescriptorArray::Allocate(
isolate, instance_descriptor_length, 0, TENURED);
isolate, instance_descriptor_length, 0, AllocationType::kOld);
int number_of_allocated_fields =
number_of_fields + unused_property_fields - inobject_props;
......
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