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

Unified Diff: runtime/vm/flow_graph_compiler.cc

Issue 15741002: Use a uniform way to emit code for all instructions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/flow_graph_compiler.cc
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
index a5d50b111fa942aa49cf4c64f8130d496736713c..a953c228128dee23391e17eff39ad72e19929fd5 100644
--- a/runtime/vm/flow_graph_compiler.cc
+++ b/runtime/vm/flow_graph_compiler.cc
@@ -212,29 +212,17 @@ void FlowGraphCompiler::VisitBlocks() {
for (intptr_t i = 0; i < block_order().length(); ++i) {
// Compile the block entry.
BlockEntryInstr* entry = block_order()[i];
- assembler()->Comment("B%"Pd"", entry->block_id());
set_current_block(entry);
if (WasCompacted(entry)) {
+ assembler()->Comment("B%"Pd"", entry->block_id());
continue;
}
- entry->EmitNativeCode(this);
- // Compile all successors until an exit, branch, or a block entry.
+ EmitInstruction(entry);
+ // Compile all successors in the block.
for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
- Instruction* instr = it.Current();
- if (FLAG_code_comments) EmitComment(instr);
- if (instr->IsParallelMove()) {
- parallel_move_resolver_.EmitNativeCode(instr->AsParallelMove());
- } else {
- ASSERT(instr->locs() != NULL);
- EmitInstructionPrologue(instr);
- ASSERT(pending_deoptimization_env_ == NULL);
- pending_deoptimization_env_ = instr->env();
- instr->EmitNativeCode(this);
- pending_deoptimization_env_ = NULL;
- EmitInstructionEpilogue(instr);
- }
+ EmitInstruction(it.Current());
}
}
set_current_block(NULL);
@@ -668,6 +656,24 @@ void FlowGraphCompiler::EmitComment(Instruction* instr) {
}
+void FlowGraphCompiler::EmitInstruction(Instruction* instr) {
+ if (FLAG_code_comments) {
+ if (instr->IsBlockEntry()) {
+ assembler()->Comment("B%"Pd"", instr->AsBlockEntry()->block_id());
+ } else {
+ EmitComment(instr);
+ }
+ }
+
+ EmitInstructionPrologue(instr);
+ ASSERT(pending_deoptimization_env_ == NULL);
+ pending_deoptimization_env_ = instr->env();
+ instr->EmitNativeCode(this);
+ pending_deoptimization_env_ = NULL;
+ EmitInstructionEpilogue(instr);
+}
+
+
// Allocate a register that is not explicitly blocked.
static Register AllocateFreeRegister(bool* blocked_registers) {
for (intptr_t regno = 0; regno < kNumberOfCpuRegisters; regno++) {

Powered by Google App Engine
This is Rietveld 408576698