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

Unified Diff: runtime/vm/flow_graph_compiler_x64.cc

Issue 10559035: Implement a simple register allocator that tries to keep instruction results in registers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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_x64.cc
diff --git a/runtime/vm/flow_graph_compiler_x64.cc b/runtime/vm/flow_graph_compiler_x64.cc
index 612f84423f2f561b70801639693d01728e372aac..00d2f28e6471efe770949cdfa4e6fb65ed463ae3 100644
--- a/runtime/vm/flow_graph_compiler_x64.cc
+++ b/runtime/vm/flow_graph_compiler_x64.cc
@@ -634,14 +634,13 @@ void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) {
LocationSummary* locs = instr->locs();
ASSERT(locs != NULL);
- locs->AllocateRegisters();
+ frame_register_allocator()->AllocateRegisters(instr);
- // Load instruction inputs into allocated registers.
- for (intptr_t i = locs->input_count() - 1; i >= 0; i--) {
- Location loc = locs->in(i);
- ASSERT(loc.kind() == Location::kRegister);
- __ popq(loc.reg());
- }
+ // TODO(vegorov): adjust assertion when we start removing comparison from the
+ // graph when it is merged with a branch.
+ ASSERT(locs->is_call() ||
+ (instr->IsBranch() && instr->AsBranch()->is_fused_with_comparison()) ||
+ (locs->input_count() == instr->InputCount()));
}
@@ -989,6 +988,7 @@ void FlowGraphCompiler::GenerateCall(intptr_t token_index,
intptr_t try_index,
const ExternalLabel* label,
PcDescriptors::Kind kind) {
+ ASSERT(frame_register_allocator()->IsSpilled());
__ call(label);
AddCurrentDescriptor(kind, AstNode::kNoId, token_index, try_index);
}
@@ -998,6 +998,7 @@ void FlowGraphCompiler::GenerateCallRuntime(intptr_t cid,
intptr_t token_index,
intptr_t try_index,
const RuntimeEntry& entry) {
+ ASSERT(frame_register_allocator()->IsSpilled());
__ CallRuntime(entry);
AddCurrentDescriptor(PcDescriptors::kOther, cid, token_index, try_index);
}

Powered by Google App Engine
This is Rietveld 408576698