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

Unified Diff: runtime/vm/flow_graph_compiler_x64.cc

Issue 10824017: Implement deoptimization in the SSA compiler as a parallel move. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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 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 7668eeac94e8e6c09b9689024924e70bc8a5f824..2e6481373946836dddd0c1b0b5eac6ec002bbb40 100644
--- a/runtime/vm/flow_graph_compiler_x64.cc
+++ b/runtime/vm/flow_graph_compiler_x64.cc
@@ -37,23 +37,30 @@ void DeoptimizationStub::GenerateCode(FlowGraphCompiler* compiler) {
}
}
} else {
- // We have a deoptimization environment, we have to tear down optimized
- // frame and recreate non-optimized one.
- __ leaq(RSP,
- Address(RBP, ParsedFunction::kFirstLocalSlotIndex * kWordSize));
+ // We have a deoptimization environment, we have to tear down the
+ // optimized frame and recreate a non-optimized one.
+ // 1. Set the stack pointer to the top of the non-optimized frame.
const GrowableArray<Value*>& values = deoptimization_env_->values();
+ const int top_offset =
+ ParsedFunction::kFirstLocalSlotIndex - values.length();
Vyacheslav Egorov (Google) 2012/07/26 12:59:56 this should have been actually ParsedFunction::kFi
+ __ leaq(RSP, Address(RBP, top_offset * kWordSize));
+
+ // 2. Build and emit a parallel move representing the frame translation.
+ ParallelMoveInstr* move = new ParallelMoveInstr();
for (intptr_t i = 0; i < values.length(); i++) {
- const Location loc = deoptimization_env_->LocationAt(i);
- if (loc.IsInvalid()) {
- ASSERT(values[i]->IsConstant());
- __ PushObject(values[i]->AsConstant()->value());
- } else if (loc.IsRegister()) {
- __ pushq(loc.reg());
- } else {
+ Location destination = Location::SpillSlot(i);
+ Location source = deoptimization_env_->LocationAt(i);
+ if (!source.IsRegister() && !source.IsInvalid()) {
compiler->Bailout("unsupported deoptimization state");
}
+ if (source.IsInvalid()) {
+ ASSERT(values[i]->IsConstant());
+ source = Location::Constant(values[i]->AsConstant()->value());
+ }
+ move->AddMove(destination, source);
}
+ compiler->parallel_move_resolver()->EmitNativeCode(move);
}
if (compiler->IsLeaf()) {

Powered by Google App Engine
This is Rietveld 408576698