| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
| 6 | 6 |
| 7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
| 8 | 8 |
| 9 #include "vm/cha.h" | 9 #include "vm/cha.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } | 310 } |
| 311 | 311 |
| 312 | 312 |
| 313 bool FlowGraphCompiler::WasCompacted( | 313 bool FlowGraphCompiler::WasCompacted( |
| 314 BlockEntryInstr* block_entry) const { | 314 BlockEntryInstr* block_entry) const { |
| 315 const intptr_t block_index = block_entry->postorder_number(); | 315 const intptr_t block_index = block_entry->postorder_number(); |
| 316 return block_info_[block_index]->WasCompacted(); | 316 return block_info_[block_index]->WasCompacted(); |
| 317 } | 317 } |
| 318 | 318 |
| 319 | 319 |
| 320 Label* FlowGraphCompiler::NextNonEmptyLabel() const { |
| 321 const intptr_t current_index = current_block()->postorder_number(); |
| 322 return block_info_[current_index]->next_nonempty_label(); |
| 323 } |
| 324 |
| 325 |
| 320 bool FlowGraphCompiler::CanFallThroughTo(BlockEntryInstr* block_entry) const { | 326 bool FlowGraphCompiler::CanFallThroughTo(BlockEntryInstr* block_entry) const { |
| 321 const intptr_t current_index = current_block()->postorder_number(); | 327 return NextNonEmptyLabel() == GetJumpLabel(block_entry); |
| 322 Label* next_nonempty = block_info_[current_index]->next_nonempty_label(); | 328 } |
| 323 return next_nonempty == GetJumpLabel(block_entry); | 329 |
| 330 |
| 331 BranchLabels FlowGraphCompiler::CreateBranchLabels(BranchInstr* branch) const { |
| 332 Label* true_label = GetJumpLabel(branch->true_successor()); |
| 333 Label* false_label = GetJumpLabel(branch->false_successor()); |
| 334 Label* fall_through = NextNonEmptyLabel(); |
| 335 BranchLabels result = { true_label, false_label, fall_through }; |
| 336 return result; |
| 324 } | 337 } |
| 325 | 338 |
| 326 | 339 |
| 327 void FlowGraphCompiler::AddSlowPathCode(SlowPathCode* code) { | 340 void FlowGraphCompiler::AddSlowPathCode(SlowPathCode* code) { |
| 328 slow_path_code_.Add(code); | 341 slow_path_code_.Add(code); |
| 329 } | 342 } |
| 330 | 343 |
| 331 | 344 |
| 332 void FlowGraphCompiler::GenerateDeferredCode() { | 345 void FlowGraphCompiler::GenerateDeferredCode() { |
| 333 for (intptr_t i = 0; i < slow_path_code_.length(); i++) { | 346 for (intptr_t i = 0; i < slow_path_code_.length(); i++) { |
| (...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 | 1214 |
| 1202 for (int i = 0; i < len; i++) { | 1215 for (int i = 0; i < len; i++) { |
| 1203 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), | 1216 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), |
| 1204 &Function::ZoneHandle(ic_data.GetTargetAt(i)), | 1217 &Function::ZoneHandle(ic_data.GetTargetAt(i)), |
| 1205 ic_data.GetCountAt(i))); | 1218 ic_data.GetCountAt(i))); |
| 1206 } | 1219 } |
| 1207 sorted->Sort(HighestCountFirst); | 1220 sorted->Sort(HighestCountFirst); |
| 1208 } | 1221 } |
| 1209 | 1222 |
| 1210 } // namespace dart | 1223 } // namespace dart |
| OLD | NEW |