| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flow_graph_allocator.h" | 9 #include "vm/flow_graph_allocator.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 parent, assigned_vars, | 550 parent, assigned_vars, |
| 551 variable_count, fixed_parameter_count); | 551 variable_count, fixed_parameter_count); |
| 552 } | 552 } |
| 553 | 553 |
| 554 // 6. Assign postorder number and add the block entry to the list. | 554 // 6. Assign postorder number and add the block entry to the list. |
| 555 set_postorder_number(postorder->length()); | 555 set_postorder_number(postorder->length()); |
| 556 postorder->Add(this); | 556 postorder->Add(this); |
| 557 } | 557 } |
| 558 | 558 |
| 559 | 559 |
| 560 void BranchInstr::DiscoverBlocks( | 560 void ControlInstruction::DiscoverBlocks( |
| 561 BlockEntryInstr* current_block, | 561 BlockEntryInstr* current_block, |
| 562 GrowableArray<BlockEntryInstr*>* preorder, | 562 GrowableArray<BlockEntryInstr*>* preorder, |
| 563 GrowableArray<BlockEntryInstr*>* postorder, | 563 GrowableArray<BlockEntryInstr*>* postorder, |
| 564 GrowableArray<intptr_t>* parent, | 564 GrowableArray<intptr_t>* parent, |
| 565 GrowableArray<BitVector*>* assigned_vars, | 565 GrowableArray<BitVector*>* assigned_vars, |
| 566 intptr_t variable_count, | 566 intptr_t variable_count, |
| 567 intptr_t fixed_parameter_count) { | 567 intptr_t fixed_parameter_count) { |
| 568 current_block->set_last_instruction(this); | 568 current_block->set_last_instruction(this); |
| 569 // Visit the false successor before the true successor so they appear in | 569 // Visit the false successor before the true successor so they appear in |
| 570 // true/false order in reverse postorder used as the block ordering in the | 570 // true/false order in reverse postorder used as the block ordering in the |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 return 1 + catch_entries_.length(); | 630 return 1 + catch_entries_.length(); |
| 631 } | 631 } |
| 632 | 632 |
| 633 | 633 |
| 634 BlockEntryInstr* GraphEntryInstr::SuccessorAt(intptr_t index) const { | 634 BlockEntryInstr* GraphEntryInstr::SuccessorAt(intptr_t index) const { |
| 635 if (index == 0) return normal_entry_; | 635 if (index == 0) return normal_entry_; |
| 636 return catch_entries_[index - 1]; | 636 return catch_entries_[index - 1]; |
| 637 } | 637 } |
| 638 | 638 |
| 639 | 639 |
| 640 intptr_t BranchInstr::SuccessorCount() const { | 640 intptr_t ControlInstruction::SuccessorCount() const { |
| 641 return 2; | 641 return 2; |
| 642 } | 642 } |
| 643 | 643 |
| 644 | 644 |
| 645 BlockEntryInstr* BranchInstr::SuccessorAt(intptr_t index) const { | 645 BlockEntryInstr* ControlInstruction::SuccessorAt(intptr_t index) const { |
| 646 if (index == 0) return true_successor_; | 646 if (index == 0) return true_successor_; |
| 647 if (index == 1) return false_successor_; | 647 if (index == 1) return false_successor_; |
| 648 UNREACHABLE(); | 648 UNREACHABLE(); |
| 649 return NULL; | 649 return NULL; |
| 650 } | 650 } |
| 651 | 651 |
| 652 | 652 |
| 653 intptr_t GotoInstr::SuccessorCount() const { | 653 intptr_t GotoInstr::SuccessorCount() const { |
| 654 return 1; | 654 return 1; |
| 655 } | 655 } |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 case ABOVE: return BELOW_EQUAL; | 1219 case ABOVE: return BELOW_EQUAL; |
| 1220 case ABOVE_EQUAL: return BELOW; | 1220 case ABOVE_EQUAL: return BELOW; |
| 1221 default: | 1221 default: |
| 1222 OS::Print("Error %d\n", condition); | 1222 OS::Print("Error %d\n", condition); |
| 1223 UNIMPLEMENTED(); | 1223 UNIMPLEMENTED(); |
| 1224 return EQUAL; | 1224 return EQUAL; |
| 1225 } | 1225 } |
| 1226 } | 1226 } |
| 1227 | 1227 |
| 1228 | 1228 |
| 1229 void BranchInstr::EmitBranchOnCondition(FlowGraphCompiler* compiler, | 1229 void ControlInstruction::EmitBranchOnCondition(FlowGraphCompiler* compiler, |
| 1230 Condition true_condition) { | 1230 Condition true_condition) { |
| 1231 if (compiler->IsNextBlock(false_successor())) { | 1231 if (compiler->IsNextBlock(false_successor())) { |
| 1232 // If the next block is the false successor we will fall through to it. | 1232 // If the next block is the false successor we will fall through to it. |
| 1233 __ j(true_condition, compiler->GetBlockLabel(true_successor())); | 1233 __ j(true_condition, compiler->GetBlockLabel(true_successor())); |
| 1234 } else { | 1234 } else { |
| 1235 // If the next block is the true successor we negate comparison and fall | 1235 // If the next block is the true successor we negate comparison and fall |
| 1236 // through to it. | 1236 // through to it. |
| 1237 ASSERT(compiler->IsNextBlock(true_successor())); | 1237 ASSERT(compiler->IsNextBlock(true_successor())); |
| 1238 Condition false_condition = NegateCondition(true_condition); | 1238 Condition false_condition = NegateCondition(true_condition); |
| 1239 __ j(false_condition, compiler->GetBlockLabel(false_successor())); | 1239 __ j(false_condition, compiler->GetBlockLabel(false_successor())); |
| 1240 } | 1240 } |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1534 ? UseDefinition(values()[i]->AsUse()->definition()) | 1534 ? UseDefinition(values()[i]->AsUse()->definition()) |
| 1535 : val); | 1535 : val); |
| 1536 } | 1536 } |
| 1537 return copy; | 1537 return copy; |
| 1538 } | 1538 } |
| 1539 | 1539 |
| 1540 | 1540 |
| 1541 #undef __ | 1541 #undef __ |
| 1542 | 1542 |
| 1543 } // namespace dart | 1543 } // namespace dart |
| OLD | NEW |