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 f91eb1167bee3662660f60cd2f6b75c4e141841f..16345f17535bc8bf57971284e74735ed94218101 100644 |
| --- a/runtime/vm/flow_graph_compiler.cc |
| +++ b/runtime/vm/flow_graph_compiler.cc |
| @@ -300,15 +300,11 @@ void FlowGraphCompiler::AddCurrentDescriptor(PcDescriptors::Kind kind, |
| void FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id, |
| intptr_t token_pos) { |
| ASSERT(is_optimizing()); |
| - const intptr_t deopt_index = deopt_infos_.length(); |
| CompilerDeoptInfo* info = new CompilerDeoptInfo(deopt_id, kDeoptAtCall); |
| ASSERT(pending_deoptimization_env_ != NULL); |
| info->set_deoptimization_env(pending_deoptimization_env_); |
| + info->set_pc_offset(assembler()->CodeSize()); |
| deopt_infos_.Add(info); |
| - pc_descriptors_list()->AddDeoptIndex(assembler()->CodeSize(), |
| - deopt_id, |
| - kDeoptAtCall, |
| - deopt_index); |
| } |
| @@ -393,12 +389,20 @@ void FlowGraphCompiler::FinalizePcDescriptors(const Code& code) { |
| void FlowGraphCompiler::FinalizeDeoptInfo(const Code& code) { |
| + // An entry is a triple of (pc_offset, deopt_info, deopt_reason). |
| + const int kEntrySize = 3; |
|
srdjan
2012/09/28 21:00:26
Use a dedicated class to describe the structure of
Kevin Millikin (Google)
2012/10/01 09:38:56
Done.
|
| const Array& array = |
| - Array::Handle(Array::New(deopt_infos_.length(), Heap::kOld)); |
| + Array::Handle(Array::New(deopt_infos_.length() * kEntrySize, Heap::kOld)); |
| + Smi& offset = Smi::Handle(); |
| DeoptInfo& info = DeoptInfo::Handle(); |
| - for (intptr_t i = 0; i < deopt_infos_.length(); i++) { |
| + Smi& reason = Smi::Handle(); |
| + for (intptr_t i = 0, j = 0; i < deopt_infos_.length(); i++) { |
| + offset = Smi::New(deopt_infos_[i]->pc_offset()); |
| info = deopt_infos_[i]->CreateDeoptInfo(this); |
| - array.SetAt(i, info); |
| + reason = Smi::New(deopt_infos_[i]->reason()); |
| + array.SetAt(j++, offset); |
| + array.SetAt(j++, info); |
| + array.SetAt(j++, reason); |
| } |
| code.set_deopt_info_array(array); |
| const Array& object_array = Array::Handle(Array::MakeArray(object_table_)); |