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/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/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/debugger.h" | 10 #include "vm/debugger.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 } | 88 } |
89 | 89 |
90 | 90 |
91 void FlowGraphCompiler::VisitBlocks() { | 91 void FlowGraphCompiler::VisitBlocks() { |
92 for (intptr_t i = 0; i < block_order().length(); ++i) { | 92 for (intptr_t i = 0; i < block_order().length(); ++i) { |
93 ASSERT(frame_register_allocator()->IsSpilled()); | 93 ASSERT(frame_register_allocator()->IsSpilled()); |
94 assembler()->Comment("B%d", i); | 94 assembler()->Comment("B%d", i); |
95 // Compile the block entry. | 95 // Compile the block entry. |
96 set_current_block(block_order()[i]); | 96 set_current_block(block_order()[i]); |
97 current_block()->PrepareEntry(this); | 97 current_block()->PrepareEntry(this); |
98 Instruction* instr = current_block()->StraightLineSuccessor(); | 98 Instruction* instr = current_block()->successor(); |
99 // Compile all successors until an exit, branch, or a block entry. | 99 // Compile all successors until an exit, branch, or a block entry. |
100 while ((instr != NULL) && !instr->IsBlockEntry()) { | 100 while ((instr != NULL) && !instr->IsBlockEntry()) { |
101 if (FLAG_code_comments) EmitComment(instr); | 101 if (FLAG_code_comments) EmitComment(instr); |
102 ASSERT(instr->locs() != NULL); | 102 ASSERT(instr->locs() != NULL); |
103 EmitInstructionPrologue(instr); | 103 EmitInstructionPrologue(instr); |
104 instr->EmitNativeCode(this); | 104 instr->EmitNativeCode(this); |
105 instr = instr->StraightLineSuccessor(); | 105 instr = instr->successor(); |
106 } | 106 } |
107 BlockEntryInstr* successor = | 107 BlockEntryInstr* successor = |
108 (instr == NULL) ? NULL : instr->AsBlockEntry(); | 108 (instr == NULL) ? NULL : instr->AsBlockEntry(); |
109 if (successor != NULL) { | 109 if (successor != NULL) { |
110 frame_register_allocator()->Spill(); | 110 frame_register_allocator()->Spill(); |
111 // Block ended with a "goto". We can fall through if it is the | 111 // Block ended with a "goto". We can fall through if it is the |
112 // next block in the list. Otherwise, we need a jump. | 112 // next block in the list. Otherwise, we need a jump. |
113 if ((i == block_order().length() - 1) || | 113 if ((i == block_order().length() - 1) || |
114 (block_order()[i + 1] != successor)) { | 114 (block_order()[i + 1] != successor)) { |
115 assembler()->jmp(GetBlockLabel(successor)); | 115 assembler()->jmp(GetBlockLabel(successor)); |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 | 622 |
623 | 623 |
624 void FrameRegisterAllocator::SpillInDeoptStub(DeoptimizationStub* stub) { | 624 void FrameRegisterAllocator::SpillInDeoptStub(DeoptimizationStub* stub) { |
625 for (int i = 0; i < stack_.length(); i++) { | 625 for (int i = 0; i < stack_.length(); i++) { |
626 stub->Push(stack_[i]); | 626 stub->Push(stack_[i]); |
627 } | 627 } |
628 } | 628 } |
629 | 629 |
630 | 630 |
631 } // namespace dart | 631 } // namespace dart |
OLD | NEW |