Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1376)

Side by Side Diff: vm/flow_graph_compiler.cc

Issue 10700034: Add a goto instruction to the IL use it to terminate basic blocks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/debugger.h" 9 #include "vm/debugger.h"
10 #include "vm/il_printer.h" 10 #include "vm/il_printer.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 for (intptr_t i = 0; i < block_order().length(); ++i) { 84 for (intptr_t i = 0; i < block_order().length(); ++i) {
85 ASSERT(frame_register_allocator()->IsSpilled()); 85 ASSERT(frame_register_allocator()->IsSpilled());
86 assembler()->Comment("B%d", i); 86 assembler()->Comment("B%d", i);
87 // Compile the block entry. 87 // Compile the block entry.
88 set_current_block(block_order()[i]); 88 set_current_block(block_order()[i]);
89 current_block()->PrepareEntry(this); 89 current_block()->PrepareEntry(this);
90 Instruction* instr = current_block()->StraightLineSuccessor(); 90 Instruction* instr = current_block()->StraightLineSuccessor();
91 // Compile all successors until an exit, branch, or a block entry. 91 // Compile all successors until an exit, branch, or a block entry.
92 while ((instr != NULL) && !instr->IsBlockEntry()) { 92 while ((instr != NULL) && !instr->IsBlockEntry()) {
93 if (FLAG_code_comments) EmitComment(instr); 93 if (FLAG_code_comments) EmitComment(instr);
94 ASSERT(instr->locs() != NULL); 94 ASSERT(instr->IsGoto() || instr->locs() != NULL);
95 EmitInstructionPrologue(instr); 95 if (instr->locs() != NULL) {
96 instr->EmitNativeCode(this); 96 EmitInstructionPrologue(instr);
97 instr->EmitNativeCode(this);
98 }
97 instr = instr->StraightLineSuccessor(); 99 instr = instr->StraightLineSuccessor();
98 } 100 }
99 BlockEntryInstr* successor = 101 BlockEntryInstr* successor =
100 (instr == NULL) ? NULL : instr->AsBlockEntry(); 102 (instr == NULL) ? NULL : instr->AsBlockEntry();
101 if (successor != NULL) { 103 if (successor != NULL) {
102 frame_register_allocator()->Spill(); 104 frame_register_allocator()->Spill();
103 // Block ended with a "goto". We can fall through if it is the 105 // Block ended with a "goto". We can fall through if it is the
104 // next block in the list. Otherwise, we need a jump. 106 // next block in the list. Otherwise, we need a jump.
105 if ((i == block_order().length() - 1) || 107 if ((i == block_order().length() - 1) ||
106 (block_order()[i + 1] != successor)) { 108 (block_order()[i + 1] != successor)) {
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 623
622 624
623 void FrameRegisterAllocator::SpillInDeoptStub(DeoptimizationStub* stub) { 625 void FrameRegisterAllocator::SpillInDeoptStub(DeoptimizationStub* stub) {
624 for (int i = 0; i < stack_.length(); i++) { 626 for (int i = 0; i < stack_.length(); i++) {
625 stub->Push(stack_[i]); 627 stub->Push(stack_[i]);
626 } 628 }
627 } 629 }
628 630
629 631
630 } // namespace dart 632 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698