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

Unified Diff: runtime/vm/flow_graph_compiler_ia32.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_ia32.cc
diff --git a/runtime/vm/flow_graph_compiler_ia32.cc b/runtime/vm/flow_graph_compiler_ia32.cc
index 3146ac174af12e16d0f8722ec6fc301c0fe9d5ae..9854bb0590826fe9b603b77c4f599dd44c73e440 100644
--- a/runtime/vm/flow_graph_compiler_ia32.cc
+++ b/runtime/vm/flow_graph_compiler_ia32.cc
@@ -95,10 +95,21 @@ void FlowGraphCompiler::GenerateInlinedMathSqrt(Label* done) {
}
+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);
+}
+
+
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);
}
@@ -414,15 +425,6 @@ intptr_t FlowGraphCompiler::EmitStaticCall(const Function& function,
}
-void FlowGraphCompiler::GenerateCall(intptr_t token_index,
- intptr_t try_index,
- const ExternalLabel* label,
- PcDescriptors::Kind kind) {
- __ call(label);
- AddCurrentDescriptor(kind, AstNode::kNoId, token_index, try_index);
-}
-
-
// Fall through if bool_register contains null.
void FlowGraphCompiler::GenerateBoolToJump(Register bool_register,
Label* is_true,
@@ -971,14 +973,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);
- __ popl(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()));
}

Powered by Google App Engine
This is Rietveld 408576698