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

Unified Diff: runtime/vm/flow_graph_compiler.cc

Issue 10963027: Use the inner deoptimization frame when setting incoming arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Enabled inlining Created 8 years, 3 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
« no previous file with comments | « runtime/vm/compiler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler.cc
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
index 543db79fad6bbfe0b1b48e47c90b039ca767c9d1..40b7259b8a8bef75543fbbb5d0c5f49f38da4db1 100644
--- a/runtime/vm/flow_graph_compiler.cc
+++ b/runtime/vm/flow_graph_compiler.cc
@@ -77,39 +77,56 @@ RawDeoptInfo* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler) {
intptr_t slot_ix = 0;
Environment* env = deoptimization_env_;
- while (env != NULL) {
- const Function& function = env->function();
- const intptr_t fixed_parameter_count = env->fixed_parameter_count();
- if (slot_ix == 0) {
- // For the innermost environment call the virtual return builder.
- BuildReturnAddress(&builder, function, slot_ix++);
- } else {
- // For any outer environment the deopt id is that of the call instruction
- // which is recorded in the outer environment.
- builder.AddReturnAddressAfter(function, env->deopt_id(), slot_ix++);
- }
+ // For the innermost environment, call the virtual return builder.
+ BuildReturnAddress(&builder, env->function(), slot_ix++);
+
+ // For the innermost environment, set outgoing arguments and the locals.
+ for (intptr_t i = env->Length() - 1; i >= env->fixed_parameter_count(); i--) {
+ builder.AddCopy(env->LocationAt(i), *env->ValueAt(i), slot_ix++);
+ }
- for (intptr_t i = env->Length() - 1; i >= fixed_parameter_count; i--) {
+ // PC marker and caller FP.
+ builder.AddPcMarker(env->function(), slot_ix++);
+ builder.AddCallerFp(slot_ix++);
+
+ while (env->outer() != NULL) {
+ const Environment* outer = env->outer();
+
+ // For any outer environment the deopt id is that of the call instruction
+ // which is recorded in the outer environment.
+ builder.AddReturnAddressAfter(outer->function(),
+ outer->deopt_id(),
+ slot_ix++);
+
+ // Set incoming arguments from the inner frame.
Vyacheslav Egorov (Google) 2012/09/21 14:38:30 Please add a comment that clarifies that values of
zerny-google 2012/09/21 14:55:47 Done.
+ for (intptr_t i = env->fixed_parameter_count() - 1; i >= 0; i--) {
builder.AddCopy(env->LocationAt(i), *env->ValueAt(i), slot_ix++);
}
+ // Set the locals, not including the outgoing arguments.
Vyacheslav Egorov (Google) 2012/09/21 14:38:30 I would add an assertion here that outer->Length()
zerny-google 2012/09/21 14:55:47 Done.
+ for (intptr_t i = outer->Length() - env->fixed_parameter_count() - 1;
+ i >= outer->fixed_parameter_count();
+ i--) {
+ builder.AddCopy(outer->LocationAt(i), *outer->ValueAt(i), slot_ix++);
+ }
+
// PC marker and caller FP.
- builder.AddPcMarker(function, slot_ix++);
+ builder.AddPcMarker(outer->function(), slot_ix++);
builder.AddCallerFp(slot_ix++);
- // On the outermost environment set caller PC and incoming arguments.
- if (env->outer() == NULL) {
- builder.AddCallerPc(slot_ix++);
- for (intptr_t i = fixed_parameter_count - 1; i >= 0; i--) {
- builder.AddCopy(env->LocationAt(i), *env->ValueAt(i), slot_ix++);
- }
- }
-
// Iterate on the outer environment.
env = env->outer();
}
+ // For the outermost environment, set caller PC.
+ builder.AddCallerPc(slot_ix++);
+
+ // For the outermost environment, set the incoming arguments.
+ for (intptr_t i = env->fixed_parameter_count() - 1; i >= 0; i--) {
+ builder.AddCopy(env->LocationAt(i), *env->ValueAt(i), slot_ix++);
+ }
+
const DeoptInfo& deopt_info = DeoptInfo::Handle(builder.CreateDeoptInfo());
return deopt_info.raw();
}
« no previous file with comments | « runtime/vm/compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698