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

Unified Diff: runtime/vm/flow_graph_compiler.cc

Issue 1288863006: Use zone allocated growable array to populate interim static and stub calls table, thus allocating … (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_compiler_arm.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
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
index c7d3215bd9473da59ef811dad3fb5c816185140f..d70c549e67144a039575eb070788cce318b523f3 100644
--- a/runtime/vm/flow_graph_compiler.cc
+++ b/runtime/vm/flow_graph_compiler.cc
@@ -174,8 +174,7 @@ FlowGraphCompiler::FlowGraphCompiler(
stackmap_table_builder_(NULL),
block_info_(block_order_.length()),
deopt_infos_(),
- static_calls_target_table_(GrowableObjectArray::ZoneHandle(
- GrowableObjectArray::New())),
+ static_calls_target_table_(),
is_optimizing_(is_optimizing),
may_reoptimize_(false),
intrinsic_mode_(false),
@@ -717,26 +716,20 @@ void FlowGraphCompiler::AddCurrentDescriptor(RawPcDescriptors::Kind kind,
void FlowGraphCompiler::AddStaticCallTarget(const Function& func) {
- ASSERT(Code::kSCallTableEntryLength == 3);
- ASSERT(Code::kSCallTableOffsetEntry == 0);
+ ASSERT(func.IsZoneHandle());
static_calls_target_table_.Add(
- Smi::Handle(Smi::New(assembler()->CodeSize())));
- ASSERT(Code::kSCallTableFunctionEntry == 1);
- static_calls_target_table_.Add(func);
- ASSERT(Code::kSCallTableCodeEntry == 2);
- static_calls_target_table_.Add(Code::Handle());
+ StaticCallsStruct(assembler()->CodeSize(),
+ &func,
+ &Code::ZoneHandle(zone())));
}
void FlowGraphCompiler::AddStubCallTarget(const Code& code) {
- ASSERT(Code::kSCallTableEntryLength == 3);
- ASSERT(Code::kSCallTableOffsetEntry == 0);
+ ASSERT(code.IsZoneHandle());
static_calls_target_table_.Add(
- Smi::Handle(Smi::New(assembler()->CodeSize())));
- ASSERT(Code::kSCallTableFunctionEntry == 1);
- static_calls_target_table_.Add(Function::Handle());
- ASSERT(Code::kSCallTableCodeEntry == 2);
- static_calls_target_table_.Add(code);
+ StaticCallsStruct(assembler()->CodeSize(),
+ &Function::ZoneHandle(zone()),
koda 2015/08/20 14:14:14 As I understand it, exactly one of the 'code' and
srdjan 2015/08/20 16:25:39 Using (C++) NULL instead of creating Null handles.
+ &code));
}
@@ -1000,8 +993,18 @@ void FlowGraphCompiler::FinalizeVarDescriptors(const Code& code) {
void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) {
ASSERT(code.static_calls_target_table() == Array::null());
- const Array& targets =
- Array::Handle(Array::MakeArray(static_calls_target_table_));
+ const Array& targets = Array::Handle(zone(), Array::New(
+ static_calls_target_table_.length() * Code::kSCallTableEntryLength));
+ Smi& smi_offset = Smi::Handle(zone());
+ for (intptr_t i = 0; i < static_calls_target_table_.length(); i++) {
+ const intptr_t target_ix = Code::kSCallTableEntryLength * i;
+ smi_offset = Smi::New(static_calls_target_table_[i].offset);
+ targets.SetAt(target_ix + Code::kSCallTableOffsetEntry, smi_offset);
+ targets.SetAt(target_ix + Code::kSCallTableFunctionEntry,
+ *static_calls_target_table_[i].function);
+ targets.SetAt(target_ix + Code::kSCallTableCodeEntry,
+ *static_calls_target_table_[i].code);
+ }
code.set_static_calls_target_table(targets);
INC_STAT(isolate(), total_code_size, targets.Length() * sizeof(uword));
}
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698