| Index: src/heap.cc
|
| diff --git a/src/heap.cc b/src/heap.cc
|
| index f28c9260b9d8ebc211381ed971db3bbfaad88977..8e0d6ced288d48a84e26ba93bff8368b71caff83 100644
|
| --- a/src/heap.cc
|
| +++ b/src/heap.cc
|
| @@ -2620,6 +2620,12 @@ bool Heap::CreateInitialMaps() {
|
| }
|
| set_oddball_map(Map::cast(obj));
|
|
|
| + { MaybeObject* maybe_obj =
|
| + AllocatePartialMap(CONSTANT_POOL_ARRAY_TYPE, kVariableSizeSentinel);
|
| + if (!maybe_obj->ToObject(&obj)) return false;
|
| + }
|
| + set_constant_pool_array_map(Map::cast(obj));
|
| +
|
| // Allocate the empty array.
|
| { MaybeObject* maybe_obj = AllocateEmptyFixedArray();
|
| if (!maybe_obj->ToObject(&obj)) return false;
|
| @@ -2645,6 +2651,12 @@ bool Heap::CreateInitialMaps() {
|
| }
|
| set_empty_descriptor_array(DescriptorArray::cast(obj));
|
|
|
| + // Allocate the constant pool array.
|
| + { MaybeObject* maybe_obj = AllocateEmptyConstantPoolArray();
|
| + if (!maybe_obj->ToObject(&obj)) return false;
|
| + }
|
| + set_empty_constant_pool_array(ConstantPoolArray::cast(obj));
|
| +
|
| // Fix the instance_descriptors for the existing maps.
|
| meta_map()->set_code_cache(empty_fixed_array());
|
| meta_map()->set_dependent_code(DependentCode::cast(empty_fixed_array()));
|
| @@ -2662,6 +2674,12 @@ bool Heap::CreateInitialMaps() {
|
| oddball_map()->init_back_pointer(undefined_value());
|
| oddball_map()->set_instance_descriptors(empty_descriptor_array());
|
|
|
| + constant_pool_array_map()->set_code_cache(empty_fixed_array());
|
| + constant_pool_array_map()->set_dependent_code(
|
| + DependentCode::cast(empty_fixed_array()));
|
| + constant_pool_array_map()->init_back_pointer(undefined_value());
|
| + constant_pool_array_map()->set_instance_descriptors(empty_descriptor_array());
|
| +
|
| // Fix prototype object for existing maps.
|
| meta_map()->set_prototype(null_value());
|
| meta_map()->set_constructor(null_value());
|
| @@ -2672,6 +2690,9 @@ bool Heap::CreateInitialMaps() {
|
| oddball_map()->set_prototype(null_value());
|
| oddball_map()->set_constructor(null_value());
|
|
|
| + constant_pool_array_map()->set_prototype(null_value());
|
| + constant_pool_array_map()->set_constructor(null_value());
|
| +
|
| { MaybeObject* maybe_obj =
|
| AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
|
| if (!maybe_obj->ToObject(&obj)) return false;
|
| @@ -2728,12 +2749,6 @@ bool Heap::CreateInitialMaps() {
|
| set_fixed_double_array_map(Map::cast(obj));
|
|
|
| { MaybeObject* maybe_obj =
|
| - AllocateMap(CONSTANT_POOL_ARRAY_TYPE, kVariableSizeSentinel);
|
| - if (!maybe_obj->ToObject(&obj)) return false;
|
| - }
|
| - set_constant_pool_array_map(Map::cast(obj));
|
| -
|
| - { MaybeObject* maybe_obj =
|
| AllocateMap(BYTE_ARRAY_TYPE, kVariableSizeSentinel);
|
| if (!maybe_obj->ToObject(&obj)) return false;
|
| }
|
| @@ -4407,6 +4422,7 @@ void Heap::InitializeFunction(JSFunction* function,
|
| function->set_code(shared->code());
|
| function->set_prototype_or_initial_map(prototype);
|
| function->set_context(undefined_value());
|
| + function->set_constant_pool(empty_constant_pool_array());
|
| function->set_literals_or_bindings(empty_fixed_array());
|
| function->set_next_function_link(undefined_value());
|
| }
|
| @@ -5484,16 +5500,31 @@ MaybeObject* Heap::AllocateConstantPoolArray(int number_of_int64_entries,
|
| constant_pool->SetEntryCounts(number_of_int64_entries,
|
| number_of_ptr_entries,
|
| number_of_int32_entries);
|
| - MemsetPointer(
|
| - HeapObject::RawField(
|
| - constant_pool,
|
| - constant_pool->OffsetOfElementAt(constant_pool->first_ptr_index())),
|
| - undefined_value(),
|
| - number_of_ptr_entries);
|
| + if (number_of_ptr_entries > 0) {
|
| + MemsetPointer(
|
| + HeapObject::RawField(
|
| + constant_pool,
|
| + constant_pool->OffsetOfElementAt(constant_pool->first_ptr_index())),
|
| + undefined_value(),
|
| + number_of_ptr_entries);
|
| + }
|
| return constant_pool;
|
| }
|
|
|
|
|
| +MaybeObject* Heap::AllocateEmptyConstantPoolArray() {
|
| + int size = ConstantPoolArray::SizeFor(0, 0, 0);
|
| + Object* result;
|
| + { MaybeObject* maybe_result =
|
| + AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE);
|
| + if (!maybe_result->ToObject(&result)) return maybe_result;
|
| + }
|
| + HeapObject::cast(result)->set_map_no_write_barrier(constant_pool_array_map());
|
| + ConstantPoolArray::cast(result)->SetEntryCounts(0, 0, 0);
|
| + return result;
|
| +}
|
| +
|
| +
|
| MaybeObject* Heap::AllocateHashTable(int length, PretenureFlag pretenure) {
|
| Object* result;
|
| { MaybeObject* maybe_result = AllocateFixedArray(length, pretenure);
|
|
|