Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Unified Diff: runtime/vm/flow_graph_compiler.cc

Issue 381483002: Allocate fewer empty arrays. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler.cc
===================================================================
--- runtime/vm/flow_graph_compiler.cc (revision 38433)
+++ runtime/vm/flow_graph_compiler.cc (working copy)
@@ -731,23 +731,28 @@
function.HasOptionalParameters() ? 0 : function.num_fixed_parameters();
DeoptInfoBuilder builder(isolate(), incoming_arg_count);
- const Array& array =
- Array::Handle(Array::New(DeoptTable::SizeFor(deopt_infos_.length()),
- Heap::kOld));
- Smi& offset = Smi::Handle();
- DeoptInfo& info = DeoptInfo::Handle();
- Smi& reason = Smi::Handle();
- for (intptr_t i = 0; i < deopt_infos_.length(); i++) {
- offset = Smi::New(deopt_infos_[i]->pc_offset());
- info = deopt_infos_[i]->CreateDeoptInfo(this, &builder, array);
- reason = Smi::New(deopt_infos_[i]->reason());
- DeoptTable::SetEntry(array, i, offset, info, reason);
+ intptr_t deopt_info_table_size = DeoptTable::SizeFor(deopt_infos_.length());
+ if (deopt_info_table_size == 0) {
+ code.set_deopt_info_array(Object::empty_array());
+ code.set_object_table(Object::empty_array());
+ } else {
+ const Array& array =
+ Array::Handle(Array::New(deopt_info_table_size, Heap::kOld));
+ Smi& offset = Smi::Handle();
+ DeoptInfo& info = DeoptInfo::Handle();
+ Smi& reason = Smi::Handle();
+ for (intptr_t i = 0; i < deopt_infos_.length(); i++) {
+ offset = Smi::New(deopt_infos_[i]->pc_offset());
+ info = deopt_infos_[i]->CreateDeoptInfo(this, &builder, array);
+ reason = Smi::New(deopt_infos_[i]->reason());
+ DeoptTable::SetEntry(array, i, offset, info, reason);
+ }
+ code.set_deopt_info_array(array);
+ const Array& object_array =
+ Array::Handle(Array::MakeArray(builder.object_table()));
+ ASSERT(code.object_table() == Array::null());
+ code.set_object_table(object_array);
}
- code.set_deopt_info_array(array);
- const Array& object_array =
- Array::Handle(Array::MakeArray(builder.object_table()));
- ASSERT(code.object_table() == Array::null());
- code.set_object_table(object_array);
}
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698