Commit b19d123f authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[heap] Move even more objects into RO_SPACE

Moves all Oddballs, empty_feedback_metadata, lots of symbols and
immortal heap numbers and several other empty collection objects.

      RO_SPACE  NEW_SPACE  OLD_SPACE  CODE_SPACE  MAP_SPACE  LO_SPACE
old      31592          0     221160       33280        176         0
new      35016          0     217736       33280        176         0
diff     +3424                 -3424

Bug: v8:7464
Change-Id: Ic99411bcbcb9c9a48b33c59dddb68359278fb0b3
Reviewed-on: https://chromium-review.googlesource.com/1025996
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53053}
parent cc399a0d
...@@ -177,16 +177,17 @@ Handle<TemplateObjectDescription> Factory::NewTemplateObjectDescription( ...@@ -177,16 +177,17 @@ Handle<TemplateObjectDescription> Factory::NewTemplateObjectDescription(
Handle<Oddball> Factory::NewOddball(Handle<Map> map, const char* to_string, Handle<Oddball> Factory::NewOddball(Handle<Map> map, const char* to_string,
Handle<Object> to_number, Handle<Object> to_number,
const char* type_of, byte kind) { const char* type_of, byte kind,
Handle<Oddball> oddball(Oddball::cast(New(map, TENURED)), isolate()); PretenureFlag pretenure) {
Handle<Oddball> oddball(Oddball::cast(New(map, pretenure)), isolate());
Oddball::Initialize(isolate(), oddball, to_string, to_number, type_of, kind); Oddball::Initialize(isolate(), oddball, to_string, to_number, type_of, kind);
return oddball; return oddball;
} }
Handle<Oddball> Factory::NewSelfReferenceMarker() { Handle<Oddball> Factory::NewSelfReferenceMarker(PretenureFlag pretenure) {
return NewOddball(self_reference_marker_map(), "self_reference_marker", return NewOddball(self_reference_marker_map(), "self_reference_marker",
handle(Smi::FromInt(-1), isolate()), "undefined", handle(Smi::FromInt(-1), isolate()), "undefined",
Oddball::kSelfReferenceMarker); Oddball::kSelfReferenceMarker, pretenure);
} }
Handle<PropertyArray> Factory::NewPropertyArray(int length, Handle<PropertyArray> Factory::NewPropertyArray(int length,
...@@ -401,11 +402,12 @@ Handle<FixedArrayBase> Factory::NewFixedDoubleArrayWithHoles( ...@@ -401,11 +402,12 @@ Handle<FixedArrayBase> Factory::NewFixedDoubleArrayWithHoles(
return array; return array;
} }
Handle<FeedbackMetadata> Factory::NewFeedbackMetadata(int slot_count) { Handle<FeedbackMetadata> Factory::NewFeedbackMetadata(int slot_count,
PretenureFlag tenure) {
DCHECK_LE(0, slot_count); DCHECK_LE(0, slot_count);
int size = FeedbackMetadata::SizeFor(slot_count); int size = FeedbackMetadata::SizeFor(slot_count);
HeapObject* result = HeapObject* result =
AllocateRawWithImmortalMap(size, TENURED, *feedback_metadata_map()); AllocateRawWithImmortalMap(size, tenure, *feedback_metadata_map());
Handle<FeedbackMetadata> data(FeedbackMetadata::cast(result), isolate()); Handle<FeedbackMetadata> data(FeedbackMetadata::cast(result), isolate());
data->set_slot_count(slot_count); data->set_slot_count(slot_count);
...@@ -1226,12 +1228,13 @@ Handle<JSStringIterator> Factory::NewJSStringIterator(Handle<String> string) { ...@@ -1226,12 +1228,13 @@ Handle<JSStringIterator> Factory::NewJSStringIterator(Handle<String> string) {
return iterator; return iterator;
} }
Handle<Symbol> Factory::NewSymbol() { Handle<Symbol> Factory::NewSymbol(PretenureFlag flag) {
DCHECK(flag != NOT_TENURED);
// Statically ensure that it is safe to allocate symbols in paged spaces. // Statically ensure that it is safe to allocate symbols in paged spaces.
STATIC_ASSERT(Symbol::kSize <= kMaxRegularHeapObjectSize); STATIC_ASSERT(Symbol::kSize <= kMaxRegularHeapObjectSize);
HeapObject* result = HeapObject* result =
AllocateRawWithImmortalMap(Symbol::kSize, TENURED, *symbol_map()); AllocateRawWithImmortalMap(Symbol::kSize, flag, *symbol_map());
// Generate a random hash value. // Generate a random hash value.
int hash = isolate()->GenerateIdentityHash(Name::kHashBitMask); int hash = isolate()->GenerateIdentityHash(Name::kHashBitMask);
...@@ -1245,8 +1248,9 @@ Handle<Symbol> Factory::NewSymbol() { ...@@ -1245,8 +1248,9 @@ Handle<Symbol> Factory::NewSymbol() {
return symbol; return symbol;
} }
Handle<Symbol> Factory::NewPrivateSymbol() { Handle<Symbol> Factory::NewPrivateSymbol(PretenureFlag flag) {
Handle<Symbol> symbol = NewSymbol(); DCHECK(flag != NOT_TENURED);
Handle<Symbol> symbol = NewSymbol(flag);
symbol->set_is_private(true); symbol->set_is_private(true);
return symbol; return symbol;
} }
...@@ -1426,10 +1430,11 @@ Handle<AccessorInfo> Factory::NewAccessorInfo() { ...@@ -1426,10 +1430,11 @@ Handle<AccessorInfo> Factory::NewAccessorInfo() {
return info; return info;
} }
Handle<Script> Factory::NewScript(Handle<String> source) { Handle<Script> Factory::NewScript(Handle<String> source, PretenureFlag tenure) {
DCHECK(tenure == TENURED || tenure == TENURED_READ_ONLY);
// Create and initialize script object. // Create and initialize script object.
Heap* heap = isolate()->heap(); Heap* heap = isolate()->heap();
Handle<Script> script = Handle<Script>::cast(NewStruct(SCRIPT_TYPE, TENURED)); Handle<Script> script = Handle<Script>::cast(NewStruct(SCRIPT_TYPE, tenure));
script->set_source(*source); script->set_source(*source);
script->set_name(heap->undefined_value()); script->set_name(heap->undefined_value());
script->set_id(isolate()->heap()->NextScriptId()); script->set_id(isolate()->heap()->NextScriptId());
...@@ -1616,11 +1621,12 @@ Handle<FeedbackCell> Factory::NewManyClosuresCell(Handle<HeapObject> value) { ...@@ -1616,11 +1621,12 @@ Handle<FeedbackCell> Factory::NewManyClosuresCell(Handle<HeapObject> value) {
return cell; return cell;
} }
Handle<PropertyCell> Factory::NewPropertyCell(Handle<Name> name) { Handle<PropertyCell> Factory::NewPropertyCell(Handle<Name> name,
PretenureFlag pretenure) {
DCHECK(name->IsUniqueName()); DCHECK(name->IsUniqueName());
STATIC_ASSERT(PropertyCell::kSize <= kMaxRegularHeapObjectSize); STATIC_ASSERT(PropertyCell::kSize <= kMaxRegularHeapObjectSize);
HeapObject* result = AllocateRawWithImmortalMap(PropertyCell::kSize, TENURED, HeapObject* result = AllocateRawWithImmortalMap(
*global_property_cell_map()); PropertyCell::kSize, pretenure, *global_property_cell_map());
Handle<PropertyCell> cell(PropertyCell::cast(result), isolate()); Handle<PropertyCell> cell(PropertyCell::cast(result), isolate());
cell->set_dependent_code(DependentCode::cast(*empty_fixed_array()), cell->set_dependent_code(DependentCode::cast(*empty_fixed_array()),
SKIP_WRITE_BARRIER); SKIP_WRITE_BARRIER);
......
...@@ -88,10 +88,11 @@ class V8_EXPORT_PRIVATE Factory { ...@@ -88,10 +88,11 @@ class V8_EXPORT_PRIVATE Factory {
public: public:
Handle<Oddball> NewOddball(Handle<Map> map, const char* to_string, Handle<Oddball> NewOddball(Handle<Map> map, const char* to_string,
Handle<Object> to_number, const char* type_of, Handle<Object> to_number, const char* type_of,
byte kind); byte kind,
PretenureFlag pretenure = TENURED_READ_ONLY);
// Marks self references within code generation. // Marks self references within code generation.
Handle<Oddball> NewSelfReferenceMarker(); Handle<Oddball> NewSelfReferenceMarker(PretenureFlag pretenure = TENURED);
// Allocates a fixed array-like object with given map and initialized with // Allocates a fixed array-like object with given map and initialized with
// undefined values. // undefined values.
...@@ -158,7 +159,8 @@ class V8_EXPORT_PRIVATE Factory { ...@@ -158,7 +159,8 @@ class V8_EXPORT_PRIVATE Factory {
int size, PretenureFlag pretenure = NOT_TENURED); int size, PretenureFlag pretenure = NOT_TENURED);
// Allocates a FeedbackMedata object and zeroes the data section. // Allocates a FeedbackMedata object and zeroes the data section.
Handle<FeedbackMetadata> NewFeedbackMetadata(int slot_count); Handle<FeedbackMetadata> NewFeedbackMetadata(int slot_count,
PretenureFlag tenure = TENURED);
Handle<FrameArray> NewFrameArray(int number_of_frames, Handle<FrameArray> NewFrameArray(int number_of_frames,
PretenureFlag pretenure = NOT_TENURED); PretenureFlag pretenure = NOT_TENURED);
...@@ -346,9 +348,9 @@ class V8_EXPORT_PRIVATE Factory { ...@@ -346,9 +348,9 @@ class V8_EXPORT_PRIVATE Factory {
Handle<ExternalOneByteString> NewNativeSourceString( Handle<ExternalOneByteString> NewNativeSourceString(
const ExternalOneByteString::Resource* resource); const ExternalOneByteString::Resource* resource);
// Create a symbol in old space. // Create a symbol in old or read-only space.
Handle<Symbol> NewSymbol(); Handle<Symbol> NewSymbol(PretenureFlag pretenure = TENURED);
Handle<Symbol> NewPrivateSymbol(); Handle<Symbol> NewPrivateSymbol(PretenureFlag pretenure = TENURED);
Handle<Symbol> NewPrivateFieldSymbol(); Handle<Symbol> NewPrivateFieldSymbol();
// Create a global (but otherwise uninitialized) context. // Create a global (but otherwise uninitialized) context.
...@@ -397,7 +399,8 @@ class V8_EXPORT_PRIVATE Factory { ...@@ -397,7 +399,8 @@ class V8_EXPORT_PRIVATE Factory {
Handle<AccessorInfo> NewAccessorInfo(); Handle<AccessorInfo> NewAccessorInfo();
Handle<Script> NewScript(Handle<String> source); Handle<Script> NewScript(Handle<String> source,
PretenureFlag tenure = TENURED);
Handle<BreakPointInfo> NewBreakPointInfo(int source_position); Handle<BreakPointInfo> NewBreakPointInfo(int source_position);
Handle<BreakPoint> NewBreakPoint(int id, Handle<String> condition); Handle<BreakPoint> NewBreakPoint(int id, Handle<String> condition);
...@@ -437,7 +440,8 @@ class V8_EXPORT_PRIVATE Factory { ...@@ -437,7 +440,8 @@ class V8_EXPORT_PRIVATE Factory {
Handle<Cell> NewCell(Handle<Object> value); Handle<Cell> NewCell(Handle<Object> value);
Handle<PropertyCell> NewPropertyCell(Handle<Name> name); Handle<PropertyCell> NewPropertyCell(Handle<Name> name,
PretenureFlag pretenure = TENURED);
Handle<WeakCell> NewWeakCell(Handle<HeapObject> value, Handle<WeakCell> NewWeakCell(Handle<HeapObject> value,
PretenureFlag pretenure = TENURED); PretenureFlag pretenure = TENURED);
......
...@@ -2173,8 +2173,8 @@ class Heap { ...@@ -2173,8 +2173,8 @@ class Heap {
void FinalizePartialMap(Map* map); void FinalizePartialMap(Map* map);
// Allocate empty fixed typed array of given type. // Allocate empty fixed typed array of given type.
V8_WARN_UNUSED_RESULT AllocationResult AllocateEmptyFixedTypedArray( V8_WARN_UNUSED_RESULT AllocationResult
ExternalArrayType array_type, AllocationSpace space = OLD_SPACE); AllocateEmptyFixedTypedArray(ExternalArrayType array_type);
void set_force_oom(bool value) { force_oom_ = value; } void set_force_oom(bool value) { force_oom_ = value; }
......
...@@ -177,12 +177,12 @@ AllocationResult Heap::Allocate(Map* map, AllocationSpace space) { ...@@ -177,12 +177,12 @@ AllocationResult Heap::Allocate(Map* map, AllocationSpace space) {
} }
AllocationResult Heap::AllocateEmptyFixedTypedArray( AllocationResult Heap::AllocateEmptyFixedTypedArray(
ExternalArrayType array_type, AllocationSpace space) { ExternalArrayType array_type) {
int size = OBJECT_POINTER_ALIGN(FixedTypedArrayBase::kDataOffset); int size = OBJECT_POINTER_ALIGN(FixedTypedArrayBase::kDataOffset);
HeapObject* object = nullptr; HeapObject* object = nullptr;
AllocationResult allocation = AllocateRaw( AllocationResult allocation = AllocateRaw(
size, space, size, RO_SPACE,
array_type == kExternalFloat64Array ? kDoubleAligned : kWordAligned); array_type == kExternalFloat64Array ? kDoubleAligned : kWordAligned);
if (!allocation.To(&object)) return allocation; if (!allocation.To(&object)) return allocation;
...@@ -247,7 +247,7 @@ bool Heap::CreateInitialMaps() { ...@@ -247,7 +247,7 @@ bool Heap::CreateInitialMaps() {
set_empty_fixed_array(FixedArray::cast(obj)); set_empty_fixed_array(FixedArray::cast(obj));
{ {
AllocationResult alloc = AllocateRaw(WeakFixedArray::SizeFor(0), OLD_SPACE); AllocationResult alloc = AllocateRaw(WeakFixedArray::SizeFor(0), RO_SPACE);
if (!alloc.To(&obj)) return false; if (!alloc.To(&obj)) return false;
obj->set_map_after_allocation(weak_fixed_array_map(), SKIP_WRITE_BARRIER); obj->set_map_after_allocation(weak_fixed_array_map(), SKIP_WRITE_BARRIER);
WeakFixedArray::cast(obj)->set_length(0); WeakFixedArray::cast(obj)->set_length(0);
...@@ -256,7 +256,7 @@ bool Heap::CreateInitialMaps() { ...@@ -256,7 +256,7 @@ bool Heap::CreateInitialMaps() {
{ {
AllocationResult allocation = AllocationResult allocation =
AllocateRaw(WeakArrayList::SizeForCapacity(0), OLD_SPACE); AllocateRaw(WeakArrayList::SizeForCapacity(0), RO_SPACE);
if (!allocation.To(&obj)) return false; if (!allocation.To(&obj)) return false;
obj->set_map_after_allocation(weak_array_list_map(), SKIP_WRITE_BARRIER); obj->set_map_after_allocation(weak_array_list_map(), SKIP_WRITE_BARRIER);
WeakArrayList::cast(obj)->set_capacity(0); WeakArrayList::cast(obj)->set_capacity(0);
...@@ -496,7 +496,7 @@ bool Heap::CreateInitialMaps() { ...@@ -496,7 +496,7 @@ bool Heap::CreateInitialMaps() {
} }
{ {
AllocationResult alloc = AllocateRaw(FixedArray::SizeFor(0), OLD_SPACE); AllocationResult alloc = AllocateRaw(FixedArray::SizeFor(0), RO_SPACE);
if (!alloc.To(&obj)) return false; if (!alloc.To(&obj)) return false;
obj->set_map_after_allocation(scope_info_map(), SKIP_WRITE_BARRIER); obj->set_map_after_allocation(scope_info_map(), SKIP_WRITE_BARRIER);
FixedArray::cast(obj)->set_length(0); FixedArray::cast(obj)->set_length(0);
...@@ -504,7 +504,7 @@ bool Heap::CreateInitialMaps() { ...@@ -504,7 +504,7 @@ bool Heap::CreateInitialMaps() {
set_empty_scope_info(ScopeInfo::cast(obj)); set_empty_scope_info(ScopeInfo::cast(obj));
{ {
AllocationResult alloc = AllocateRaw(FixedArray::SizeFor(0), OLD_SPACE); AllocationResult alloc = AllocateRaw(FixedArray::SizeFor(0), RO_SPACE);
if (!alloc.To(&obj)) return false; if (!alloc.To(&obj)) return false;
obj->set_map_after_allocation(boilerplate_description_map(), obj->set_map_after_allocation(boilerplate_description_map(),
SKIP_WRITE_BARRIER); SKIP_WRITE_BARRIER);
...@@ -535,7 +535,7 @@ bool Heap::CreateInitialMaps() { ...@@ -535,7 +535,7 @@ bool Heap::CreateInitialMaps() {
} }
{ {
if (!AllocateRaw(FixedArray::SizeFor(0), OLD_SPACE).To(&obj)) { if (!AllocateRaw(FixedArray::SizeFor(0), RO_SPACE).To(&obj)) {
return false; return false;
} }
obj->set_map_after_allocation(property_array_map(), SKIP_WRITE_BARRIER); obj->set_map_after_allocation(property_array_map(), SKIP_WRITE_BARRIER);
...@@ -565,7 +565,7 @@ void Heap::CreateApiObjects() { ...@@ -565,7 +565,7 @@ void Heap::CreateApiObjects() {
set_message_listeners(*TemplateList::New(isolate, 2)); set_message_listeners(*TemplateList::New(isolate, 2));
Handle<InterceptorInfo> info = Handle<InterceptorInfo>::cast( Handle<InterceptorInfo> info = Handle<InterceptorInfo>::cast(
isolate->factory()->NewStruct(INTERCEPTOR_INFO_TYPE, TENURED)); isolate->factory()->NewStruct(INTERCEPTOR_INFO_TYPE, TENURED_READ_ONLY));
info->set_flags(0); info->set_flags(0);
set_noop_interceptor_info(*info); set_noop_interceptor_info(*info);
} }
...@@ -575,16 +575,18 @@ void Heap::CreateInitialObjects() { ...@@ -575,16 +575,18 @@ void Heap::CreateInitialObjects() {
Factory* factory = isolate()->factory(); Factory* factory = isolate()->factory();
// The -0 value must be set before NewNumber works. // The -0 value must be set before NewNumber works.
set_minus_zero_value(*factory->NewHeapNumber(-0.0, IMMUTABLE, TENURED)); set_minus_zero_value(
*factory->NewHeapNumber(-0.0, IMMUTABLE, TENURED_READ_ONLY));
DCHECK(std::signbit(minus_zero_value()->Number())); DCHECK(std::signbit(minus_zero_value()->Number()));
set_nan_value(*factory->NewHeapNumber( set_nan_value(*factory->NewHeapNumber(
std::numeric_limits<double>::quiet_NaN(), IMMUTABLE, TENURED_READ_ONLY)); std::numeric_limits<double>::quiet_NaN(), IMMUTABLE, TENURED_READ_ONLY));
set_hole_nan_value(*factory->NewHeapNumberFromBits(kHoleNanInt64, IMMUTABLE, set_hole_nan_value(*factory->NewHeapNumberFromBits(kHoleNanInt64, IMMUTABLE,
TENURED_READ_ONLY)); TENURED_READ_ONLY));
set_infinity_value(*factory->NewHeapNumber(V8_INFINITY, IMMUTABLE, TENURED)); set_infinity_value(
*factory->NewHeapNumber(V8_INFINITY, IMMUTABLE, TENURED_READ_ONLY));
set_minus_infinity_value( set_minus_infinity_value(
*factory->NewHeapNumber(-V8_INFINITY, IMMUTABLE, TENURED)); *factory->NewHeapNumber(-V8_INFINITY, IMMUTABLE, TENURED_READ_ONLY));
// Allocate cache for single character one byte strings. // Allocate cache for single character one byte strings.
set_single_character_string_cache( set_single_character_string_cache(
...@@ -653,7 +655,8 @@ void Heap::CreateInitialObjects() { ...@@ -653,7 +655,8 @@ void Heap::CreateInitialObjects() {
Oddball::kStaleRegister)); Oddball::kStaleRegister));
// Initialize the self-reference marker. // Initialize the self-reference marker.
set_self_reference_marker(*factory->NewSelfReferenceMarker()); set_self_reference_marker(
*factory->NewSelfReferenceMarker(TENURED_READ_ONLY));
// Create the code_stubs dictionary. The initial size is set to avoid // Create the code_stubs dictionary. The initial size is set to avoid
// expanding the dictionary during bootstrapping. // expanding the dictionary during bootstrapping.
...@@ -663,7 +666,8 @@ void Heap::CreateInitialObjects() { ...@@ -663,7 +666,8 @@ void Heap::CreateInitialObjects() {
HandleScope scope(isolate()); HandleScope scope(isolate());
#define SYMBOL_INIT(name) \ #define SYMBOL_INIT(name) \
{ \ { \
Handle<Symbol> symbol(isolate()->factory()->NewPrivateSymbol()); \ Handle<Symbol> symbol( \
isolate()->factory()->NewPrivateSymbol(TENURED_READ_ONLY)); \
roots_[k##name##RootIndex] = *symbol; \ roots_[k##name##RootIndex] = *symbol; \
} }
PRIVATE_SYMBOL_LIST(SYMBOL_INIT) PRIVATE_SYMBOL_LIST(SYMBOL_INIT)
...@@ -673,16 +677,18 @@ void Heap::CreateInitialObjects() { ...@@ -673,16 +677,18 @@ void Heap::CreateInitialObjects() {
{ {
HandleScope scope(isolate()); HandleScope scope(isolate());
#define SYMBOL_INIT(name, description) \ #define SYMBOL_INIT(name, description) \
Handle<Symbol> name = factory->NewSymbol(); \ Handle<Symbol> name = factory->NewSymbol(TENURED_READ_ONLY); \
Handle<String> name##d = factory->NewStringFromStaticChars(#description); \ Handle<String> name##d = \
factory->NewStringFromStaticChars(#description, TENURED_READ_ONLY); \
name->set_name(*name##d); \ name->set_name(*name##d); \
roots_[k##name##RootIndex] = *name; roots_[k##name##RootIndex] = *name;
PUBLIC_SYMBOL_LIST(SYMBOL_INIT) PUBLIC_SYMBOL_LIST(SYMBOL_INIT)
#undef SYMBOL_INIT #undef SYMBOL_INIT
#define SYMBOL_INIT(name, description) \ #define SYMBOL_INIT(name, description) \
Handle<Symbol> name = factory->NewSymbol(); \ Handle<Symbol> name = factory->NewSymbol(TENURED_READ_ONLY); \
Handle<String> name##d = factory->NewStringFromStaticChars(#description); \ Handle<String> name##d = \
factory->NewStringFromStaticChars(#description, TENURED_READ_ONLY); \
name->set_is_well_known_symbol(true); \ name->set_is_well_known_symbol(true); \
name->set_name(*name##d); \ name->set_name(*name##d); \
roots_[k##name##RootIndex] = *name; roots_[k##name##RootIndex] = *name;
...@@ -693,8 +699,8 @@ void Heap::CreateInitialObjects() { ...@@ -693,8 +699,8 @@ void Heap::CreateInitialObjects() {
to_string_tag_symbol->set_is_interesting_symbol(true); to_string_tag_symbol->set_is_interesting_symbol(true);
} }
Handle<NameDictionary> empty_property_dictionary = Handle<NameDictionary> empty_property_dictionary = NameDictionary::New(
NameDictionary::New(isolate(), 1, TENURED, USE_CUSTOM_MINIMUM_CAPACITY); isolate(), 1, TENURED_READ_ONLY, USE_CUSTOM_MINIMUM_CAPACITY);
DCHECK(!empty_property_dictionary->HasSufficientCapacityToAdd(1)); DCHECK(!empty_property_dictionary->HasSufficientCapacityToAdd(1));
set_empty_property_dictionary(*empty_property_dictionary); set_empty_property_dictionary(*empty_property_dictionary);
...@@ -722,14 +728,15 @@ void Heap::CreateInitialObjects() { ...@@ -722,14 +728,15 @@ void Heap::CreateInitialObjects() {
{ {
Handle<FixedArray> empty_sloppy_arguments_elements = Handle<FixedArray> empty_sloppy_arguments_elements =
factory->NewFixedArray(2, TENURED); factory->NewFixedArray(2, TENURED_READ_ONLY);
empty_sloppy_arguments_elements->set_map_after_allocation( empty_sloppy_arguments_elements->set_map_after_allocation(
sloppy_arguments_elements_map(), SKIP_WRITE_BARRIER); sloppy_arguments_elements_map(), SKIP_WRITE_BARRIER);
set_empty_sloppy_arguments_elements(*empty_sloppy_arguments_elements); set_empty_sloppy_arguments_elements(*empty_sloppy_arguments_elements);
} }
{ {
Handle<WeakCell> cell = factory->NewWeakCell(factory->undefined_value()); Handle<WeakCell> cell =
factory->NewWeakCell(factory->undefined_value(), TENURED_READ_ONLY);
set_empty_weak_cell(*cell); set_empty_weak_cell(*cell);
cell->clear(); cell->clear();
} }
...@@ -742,8 +749,8 @@ void Heap::CreateInitialObjects() { ...@@ -742,8 +749,8 @@ void Heap::CreateInitialObjects() {
set_script_list(Smi::kZero); set_script_list(Smi::kZero);
Handle<NumberDictionary> slow_element_dictionary = Handle<NumberDictionary> slow_element_dictionary = NumberDictionary::New(
NumberDictionary::New(isolate(), 1, TENURED, USE_CUSTOM_MINIMUM_CAPACITY); isolate(), 1, TENURED_READ_ONLY, USE_CUSTOM_MINIMUM_CAPACITY);
DCHECK(!slow_element_dictionary->HasSufficientCapacityToAdd(1)); DCHECK(!slow_element_dictionary->HasSufficientCapacityToAdd(1));
slow_element_dictionary->set_requires_slow_elements(); slow_element_dictionary->set_requires_slow_elements();
set_empty_slow_element_dictionary(*slow_element_dictionary); set_empty_slow_element_dictionary(*slow_element_dictionary);
...@@ -756,8 +763,8 @@ void Heap::CreateInitialObjects() { ...@@ -756,8 +763,8 @@ void Heap::CreateInitialObjects() {
set_next_template_serial_number(Smi::kZero); set_next_template_serial_number(Smi::kZero);
// Allocate the empty OrderedHashMap. // Allocate the empty OrderedHashMap.
Handle<FixedArray> empty_ordered_hash_map = Handle<FixedArray> empty_ordered_hash_map = factory->NewFixedArray(
factory->NewFixedArray(OrderedHashMap::kHashTableStartIndex, TENURED); OrderedHashMap::kHashTableStartIndex, TENURED_READ_ONLY);
empty_ordered_hash_map->set_map_no_write_barrier( empty_ordered_hash_map->set_map_no_write_barrier(
*factory->ordered_hash_map_map()); *factory->ordered_hash_map_map());
for (int i = 0; i < empty_ordered_hash_map->length(); ++i) { for (int i = 0; i < empty_ordered_hash_map->length(); ++i) {
...@@ -766,8 +773,8 @@ void Heap::CreateInitialObjects() { ...@@ -766,8 +773,8 @@ void Heap::CreateInitialObjects() {
set_empty_ordered_hash_map(*empty_ordered_hash_map); set_empty_ordered_hash_map(*empty_ordered_hash_map);
// Allocate the empty OrderedHashSet. // Allocate the empty OrderedHashSet.
Handle<FixedArray> empty_ordered_hash_set = Handle<FixedArray> empty_ordered_hash_set = factory->NewFixedArray(
factory->NewFixedArray(OrderedHashSet::kHashTableStartIndex, TENURED); OrderedHashSet::kHashTableStartIndex, TENURED_READ_ONLY);
empty_ordered_hash_set->set_map_no_write_barrier( empty_ordered_hash_set->set_map_no_write_barrier(
*factory->ordered_hash_set_map()); *factory->ordered_hash_set_map());
for (int i = 0; i < empty_ordered_hash_set->length(); ++i) { for (int i = 0; i < empty_ordered_hash_set->length(); ++i) {
...@@ -777,7 +784,7 @@ void Heap::CreateInitialObjects() { ...@@ -777,7 +784,7 @@ void Heap::CreateInitialObjects() {
// Allocate the empty FeedbackMetadata. // Allocate the empty FeedbackMetadata.
Handle<FeedbackMetadata> empty_feedback_metadata = Handle<FeedbackMetadata> empty_feedback_metadata =
factory->NewFeedbackMetadata(0); factory->NewFeedbackMetadata(0, TENURED_READ_ONLY);
set_empty_feedback_metadata(*empty_feedback_metadata); set_empty_feedback_metadata(*empty_feedback_metadata);
// Allocate the empty script. // Allocate the empty script.
...@@ -793,7 +800,7 @@ void Heap::CreateInitialObjects() { ...@@ -793,7 +800,7 @@ void Heap::CreateInitialObjects() {
cell->set_value(Smi::FromInt(Isolate::kProtectorValid)); cell->set_value(Smi::FromInt(Isolate::kProtectorValid));
set_no_elements_protector(*cell); set_no_elements_protector(*cell);
cell = factory->NewPropertyCell(factory->empty_string()); cell = factory->NewPropertyCell(factory->empty_string(), TENURED_READ_ONLY);
cell->set_value(the_hole_value()); cell->set_value(the_hole_value());
set_empty_property_cell(*cell); set_empty_property_cell(*cell);
......
...@@ -2416,7 +2416,7 @@ TEST(OptimizedPretenuringDoubleArrayProperties) { ...@@ -2416,7 +2416,7 @@ TEST(OptimizedPretenuringDoubleArrayProperties) {
return; return;
v8::HandleScope scope(CcTest::isolate()); v8::HandleScope scope(CcTest::isolate());
// Grow new space unitl maximum capacity reached. // Grow new space until maximum capacity reached.
while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) {
CcTest::heap()->new_space()->Grow(); CcTest::heap()->new_space()->Grow();
} }
...@@ -2443,7 +2443,7 @@ TEST(OptimizedPretenuringDoubleArrayProperties) { ...@@ -2443,7 +2443,7 @@ TEST(OptimizedPretenuringDoubleArrayProperties) {
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res))); v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res)));
CHECK(CcTest::heap()->InOldSpace(*o)); CHECK(CcTest::heap()->InOldSpace(*o));
CHECK(CcTest::heap()->InOldSpace(o->property_array())); CHECK_EQ(o->property_array(), CcTest::heap()->empty_property_array());
} }
......
This diff is collapsed.
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