Chromium Code Reviews| 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)); |
| } |