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

Side by Side 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, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/compiler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/debugger.h" 10 #include "vm/debugger.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 const Function& function = compiler->parsed_function().function(); 71 const Function& function = compiler->parsed_function().function();
72 // For functions with optional arguments, all incoming arguments are copied 72 // For functions with optional arguments, all incoming arguments are copied
73 // to spill slots. The deoptimization environment does not track them. 73 // to spill slots. The deoptimization environment does not track them.
74 const intptr_t incoming_arg_count = 74 const intptr_t incoming_arg_count =
75 function.HasOptionalParameters() ? 0 : function.num_fixed_parameters(); 75 function.HasOptionalParameters() ? 0 : function.num_fixed_parameters();
76 DeoptInfoBuilder builder(compiler->object_table(), incoming_arg_count); 76 DeoptInfoBuilder builder(compiler->object_table(), incoming_arg_count);
77 77
78 intptr_t slot_ix = 0; 78 intptr_t slot_ix = 0;
79 Environment* env = deoptimization_env_; 79 Environment* env = deoptimization_env_;
80 while (env != NULL) {
81 const Function& function = env->function();
82 const intptr_t fixed_parameter_count = env->fixed_parameter_count();
83 80
84 if (slot_ix == 0) { 81 // For the innermost environment, call the virtual return builder.
85 // For the innermost environment call the virtual return builder. 82 BuildReturnAddress(&builder, env->function(), slot_ix++);
86 BuildReturnAddress(&builder, function, slot_ix++);
87 } else {
88 // For any outer environment the deopt id is that of the call instruction
89 // which is recorded in the outer environment.
90 builder.AddReturnAddressAfter(function, env->deopt_id(), slot_ix++);
91 }
92 83
93 for (intptr_t i = env->Length() - 1; i >= fixed_parameter_count; i--) { 84 // For the innermost environment, set outgoing arguments and the locals.
85 for (intptr_t i = env->Length() - 1; i >= env->fixed_parameter_count(); i--) {
86 builder.AddCopy(env->LocationAt(i), *env->ValueAt(i), slot_ix++);
87 }
88
89 // PC marker and caller FP.
90 builder.AddPcMarker(env->function(), slot_ix++);
91 builder.AddCallerFp(slot_ix++);
92
93 while (env->outer() != NULL) {
94 const Environment* outer = env->outer();
95
96 // For any outer environment the deopt id is that of the call instruction
97 // which is recorded in the outer environment.
98 builder.AddReturnAddressAfter(outer->function(),
99 outer->deopt_id(),
100 slot_ix++);
101
102 // 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.
103 for (intptr_t i = env->fixed_parameter_count() - 1; i >= 0; i--) {
94 builder.AddCopy(env->LocationAt(i), *env->ValueAt(i), slot_ix++); 104 builder.AddCopy(env->LocationAt(i), *env->ValueAt(i), slot_ix++);
95 } 105 }
96 106
107 // 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.
108 for (intptr_t i = outer->Length() - env->fixed_parameter_count() - 1;
109 i >= outer->fixed_parameter_count();
110 i--) {
111 builder.AddCopy(outer->LocationAt(i), *outer->ValueAt(i), slot_ix++);
112 }
113
97 // PC marker and caller FP. 114 // PC marker and caller FP.
98 builder.AddPcMarker(function, slot_ix++); 115 builder.AddPcMarker(outer->function(), slot_ix++);
99 builder.AddCallerFp(slot_ix++); 116 builder.AddCallerFp(slot_ix++);
100 117
101 // On the outermost environment set caller PC and incoming arguments.
102 if (env->outer() == NULL) {
103 builder.AddCallerPc(slot_ix++);
104 for (intptr_t i = fixed_parameter_count - 1; i >= 0; i--) {
105 builder.AddCopy(env->LocationAt(i), *env->ValueAt(i), slot_ix++);
106 }
107 }
108
109 // Iterate on the outer environment. 118 // Iterate on the outer environment.
110 env = env->outer(); 119 env = env->outer();
111 } 120 }
112 121
122 // For the outermost environment, set caller PC.
123 builder.AddCallerPc(slot_ix++);
124
125 // For the outermost environment, set the incoming arguments.
126 for (intptr_t i = env->fixed_parameter_count() - 1; i >= 0; i--) {
127 builder.AddCopy(env->LocationAt(i), *env->ValueAt(i), slot_ix++);
128 }
129
113 const DeoptInfo& deopt_info = DeoptInfo::Handle(builder.CreateDeoptInfo()); 130 const DeoptInfo& deopt_info = DeoptInfo::Handle(builder.CreateDeoptInfo());
114 return deopt_info.raw(); 131 return deopt_info.raw();
115 } 132 }
116 133
117 134
118 FlowGraphCompiler::FlowGraphCompiler(Assembler* assembler, 135 FlowGraphCompiler::FlowGraphCompiler(Assembler* assembler,
119 const FlowGraph& flow_graph, 136 const FlowGraph& flow_graph,
120 bool is_optimizing, 137 bool is_optimizing,
121 bool is_leaf) 138 bool is_leaf)
122 : assembler_(assembler), 139 : assembler_(assembler),
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 case ABOVE: return unsigned_left > unsigned_right; 893 case ABOVE: return unsigned_left > unsigned_right;
877 case ABOVE_EQUAL: return unsigned_left >= unsigned_right; 894 case ABOVE_EQUAL: return unsigned_left >= unsigned_right;
878 default: 895 default:
879 UNIMPLEMENTED(); 896 UNIMPLEMENTED();
880 return false; 897 return false;
881 } 898 }
882 } 899 }
883 900
884 901
885 } // namespace dart 902 } // namespace dart
OLDNEW
« 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