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(
Handle<Oddball> Factory::NewOddball(Handle<Map> map, const char* to_string,
Handle<Object> to_number,
const char* type_of, byte kind) {
Handle<Oddball> oddball(Oddball::cast(New(map, TENURED)), isolate());
const char* type_of, byte kind,
PretenureFlag pretenure) {
Handle<Oddball> oddball(Oddball::cast(New(map, pretenure)), isolate());
Oddball::Initialize(isolate(), oddball, to_string, to_number, type_of, kind);
return oddball;
}
Handle<Oddball> Factory::NewSelfReferenceMarker() {
Handle<Oddball> Factory::NewSelfReferenceMarker(PretenureFlag pretenure) {
return NewOddball(self_reference_marker_map(), "self_reference_marker",
handle(Smi::FromInt(-1), isolate()), "undefined",
Oddball::kSelfReferenceMarker);
Oddball::kSelfReferenceMarker, pretenure);
}
Handle<PropertyArray> Factory::NewPropertyArray(int length,
......@@ -401,11 +402,12 @@ Handle<FixedArrayBase> Factory::NewFixedDoubleArrayWithHoles(
return array;
}
Handle<FeedbackMetadata> Factory::NewFeedbackMetadata(int slot_count) {
Handle<FeedbackMetadata> Factory::NewFeedbackMetadata(int slot_count,
PretenureFlag tenure) {
DCHECK_LE(0, slot_count);
int size = FeedbackMetadata::SizeFor(slot_count);
HeapObject* result =
AllocateRawWithImmortalMap(size, TENURED, *feedback_metadata_map());
AllocateRawWithImmortalMap(size, tenure, *feedback_metadata_map());
Handle<FeedbackMetadata> data(FeedbackMetadata::cast(result), isolate());
data->set_slot_count(slot_count);
......@@ -1226,12 +1228,13 @@ Handle<JSStringIterator> Factory::NewJSStringIterator(Handle<String> string) {
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.
STATIC_ASSERT(Symbol::kSize <= kMaxRegularHeapObjectSize);
HeapObject* result =
AllocateRawWithImmortalMap(Symbol::kSize, TENURED, *symbol_map());
AllocateRawWithImmortalMap(Symbol::kSize, flag, *symbol_map());
// Generate a random hash value.
int hash = isolate()->GenerateIdentityHash(Name::kHashBitMask);
......@@ -1245,8 +1248,9 @@ Handle<Symbol> Factory::NewSymbol() {
return symbol;
}
Handle<Symbol> Factory::NewPrivateSymbol() {
Handle<Symbol> symbol = NewSymbol();
Handle<Symbol> Factory::NewPrivateSymbol(PretenureFlag flag) {
DCHECK(flag != NOT_TENURED);
Handle<Symbol> symbol = NewSymbol(flag);
symbol->set_is_private(true);
return symbol;
}
......@@ -1426,10 +1430,11 @@ Handle<AccessorInfo> Factory::NewAccessorInfo() {
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.
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_name(heap->undefined_value());
script->set_id(isolate()->heap()->NextScriptId());
......@@ -1616,11 +1621,12 @@ Handle<FeedbackCell> Factory::NewManyClosuresCell(Handle<HeapObject> value) {
return cell;
}
Handle<PropertyCell> Factory::NewPropertyCell(Handle<Name> name) {
Handle<PropertyCell> Factory::NewPropertyCell(Handle<Name> name,
PretenureFlag pretenure) {
DCHECK(name->IsUniqueName());
STATIC_ASSERT(PropertyCell::kSize <= kMaxRegularHeapObjectSize);
HeapObject* result = AllocateRawWithImmortalMap(PropertyCell::kSize, TENURED,
*global_property_cell_map());
HeapObject* result = AllocateRawWithImmortalMap(
PropertyCell::kSize, pretenure, *global_property_cell_map());
Handle<PropertyCell> cell(PropertyCell::cast(result), isolate());
cell->set_dependent_code(DependentCode::cast(*empty_fixed_array()),
SKIP_WRITE_BARRIER);
......
......@@ -88,10 +88,11 @@ class V8_EXPORT_PRIVATE Factory {
public:
Handle<Oddball> NewOddball(Handle<Map> map, const char* to_string,
Handle<Object> to_number, const char* type_of,
byte kind);
byte kind,
PretenureFlag pretenure = TENURED_READ_ONLY);
// 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
// undefined values.
......@@ -158,7 +159,8 @@ class V8_EXPORT_PRIVATE Factory {
int size, PretenureFlag pretenure = NOT_TENURED);
// 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,
PretenureFlag pretenure = NOT_TENURED);
......@@ -346,9 +348,9 @@ class V8_EXPORT_PRIVATE Factory {
Handle<ExternalOneByteString> NewNativeSourceString(
const ExternalOneByteString::Resource* resource);
// Create a symbol in old space.
Handle<Symbol> NewSymbol();
Handle<Symbol> NewPrivateSymbol();
// Create a symbol in old or read-only space.
Handle<Symbol> NewSymbol(PretenureFlag pretenure = TENURED);
Handle<Symbol> NewPrivateSymbol(PretenureFlag pretenure = TENURED);
Handle<Symbol> NewPrivateFieldSymbol();
// Create a global (but otherwise uninitialized) context.
......@@ -397,7 +399,8 @@ class V8_EXPORT_PRIVATE Factory {
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<BreakPoint> NewBreakPoint(int id, Handle<String> condition);
......@@ -437,7 +440,8 @@ class V8_EXPORT_PRIVATE Factory {
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,
PretenureFlag pretenure = TENURED);
......
......@@ -2173,8 +2173,8 @@ class Heap {
void FinalizePartialMap(Map* map);
// Allocate empty fixed typed array of given type.
V8_WARN_UNUSED_RESULT AllocationResult AllocateEmptyFixedTypedArray(
ExternalArrayType array_type, AllocationSpace space = OLD_SPACE);
V8_WARN_UNUSED_RESULT AllocationResult
AllocateEmptyFixedTypedArray(ExternalArrayType array_type);
void set_force_oom(bool value) { force_oom_ = value; }
......
This diff is collapsed.
......@@ -2416,7 +2416,7 @@ TEST(OptimizedPretenuringDoubleArrayProperties) {
return;
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()) {
CcTest::heap()->new_space()->Grow();
}
......@@ -2443,7 +2443,7 @@ TEST(OptimizedPretenuringDoubleArrayProperties) {
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res)));
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