VM: [Kernel] Allocate objects in KernelReader/kernel::FlowGraphBuilder in Heap::kOld if appropriate

If we generate too much surviving objects in Heap::kNew during program reading
time or flow graph construction time we trigger (very aggressive) growth of new
space.

R=vegorov@google.com

Review URL: https://codereview.chromium.org/2539173002 .
This commit is contained in:
Martin Kustermann 2016-12-01 13:51:29 +01:00
parent abd77cab64
commit ff8951a515
3 changed files with 6 additions and 8 deletions

View file

@ -104,7 +104,7 @@ KernelReader::KernelReader(Program* program)
&active_class_,
/*finalize=*/false) {
intptr_t source_file_count = program_->line_starting_table().size();
scripts_ = Array::New(source_file_count);
scripts_ = Array::New(source_file_count, Heap::kOld);
}
Object& KernelReader::ReadProgram() {
@ -265,7 +265,7 @@ void KernelReader::ReadPreliminaryClass(dart::Class* klass,
// Build implemented interface types
intptr_t interface_count = kernel_klass->implemented_classes().length();
const dart::Array& interfaces =
dart::Array::Handle(Z, dart::Array::New(interface_count));
dart::Array::Handle(Z, dart::Array::New(interface_count, Heap::kOld));
for (intptr_t i = 0; i < interface_count; i++) {
InterfaceType* kernel_interface_type =
kernel_klass->implemented_classes()[i];
@ -435,13 +435,13 @@ Script& KernelReader::ScriptAt(intptr_t source_uri_index) {
script ^= scripts_.At(source_uri_index);
if (script.IsNull()) {
String* uri = program_->source_uri_table().strings()[source_uri_index];
script = Script::New(H.DartString(uri), dart::String::ZoneHandle(Z),
RawScript::kKernelTag);
script = Script::New(H.DartString(uri, Heap::kOld),
dart::String::ZoneHandle(Z), RawScript::kKernelTag);
scripts_.SetAt(source_uri_index, script);
intptr_t* line_starts =
program_->line_starting_table().valuesFor(source_uri_index);
intptr_t line_count = line_starts[0];
Array& array_object = Array::Handle(Z, Array::New(line_count));
Array& array_object = Array::Handle(Z, Array::New(line_count, Heap::kOld));
Smi& value = Smi::Handle(Z);
for (intptr_t i = 0; i < line_count; ++i) {
value = Smi::New(line_starts[i + 1]);

View file

@ -1273,7 +1273,7 @@ const Array& TranslationHelper::ArgumentNames(List<NamedExpression>* named) {
if (named->length() == 0) return Array::ZoneHandle(Z);
const Array& names =
Array::ZoneHandle(Z, Array::New(named->length(), allocation_space_));
Array::ZoneHandle(Z, Array::New(named->length(), Heap::kOld));
for (intptr_t i = 0; i < named->length(); ++i) {
names.SetAt(i, DartSymbol((*named)[i]->name()));
}

View file

@ -331,8 +331,6 @@ Language/Libraries_and_Scripts/Imports/static_type_t01/07: Pass
Language/Expressions/Shift/syntax_t15: Crash # Invalid class id during isolate shutdown Heap::VerifyGC
Language/Expressions/Spawning_an_Isolate/new_isolate_t01: Crash # Class finalization issue
Language/Libraries_and_Scripts/Scripts/top_level_main_t05: Crash # !main_obj.IsNull()
LibTest/typed_data/ByteBuffer/runtimeType_A01_t02: Pass, Crash # Out of memory
LibTest/collection/DoubleLinkedQueue/every_A01_t02: Pass, Crash # Out of memory
# dartk: precompilation failures
[ $compiler == dartkp && $runtime == dart_precompiled ]