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

Side by Side Diff: runtime/vm/scopes.cc

Issue 2941643002: Check for a passed-in type argument vector in the prolog of generic functions. (Closed)
Patch Set: address review comments Created 3 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/runtime_entry.cc ('k') | runtime/vm/stub_code_arm.cc » ('j') | 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/scopes.h" 5 #include "vm/scopes.h"
6 6
7 #include "vm/object.h" 7 #include "vm/object.h"
8 #include "vm/stack_frame.h" 8 #include "vm/stack_frame.h"
9 #include "vm/symbols.h" 9 #include "vm/symbols.h"
10 10
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 *found_captured_variables = true; 222 *found_captured_variables = true;
223 } else { 223 } else {
224 parameter->set_index(frame_index--); 224 parameter->set_index(frame_index--);
225 } 225 }
226 } 226 }
227 // No overlapping of parameters and locals. 227 // No overlapping of parameters and locals.
228 ASSERT(frame_index >= first_frame_index); 228 ASSERT(frame_index >= first_frame_index);
229 frame_index = first_frame_index; 229 frame_index = first_frame_index;
230 while (pos < num_variables()) { 230 while (pos < num_variables()) {
231 LocalVariable* variable = VariableAt(pos); 231 LocalVariable* variable = VariableAt(pos);
232 pos++;
233 if (variable->owner() == this) { 232 if (variable->owner() == this) {
234 if (variable->is_captured()) { 233 if (variable->is_captured()) {
235 AllocateContextVariable(variable, &context_owner); 234 AllocateContextVariable(variable, &context_owner);
236 *found_captured_variables = true; 235 *found_captured_variables = true;
236 if (variable->name().raw() ==
237 Symbols::FunctionTypeArgumentsVar().raw()) {
238 ASSERT(pos == num_parameters);
239 // A captured type args variable has a slot allocated in the frame and
240 // one in the context, where it gets copied to.
241 frame_index--;
242 }
237 } else { 243 } else {
244 ASSERT((variable->name().raw() !=
245 Symbols::FunctionTypeArgumentsVar().raw()) ||
246 (pos == num_parameters));
238 variable->set_index(frame_index--); 247 variable->set_index(frame_index--);
239 } 248 }
240 } 249 }
250 pos++;
241 } 251 }
242 // Allocate variables of all children. 252 // Allocate variables of all children.
243 int min_frame_index = frame_index; // Frame index decreases with allocations. 253 int min_frame_index = frame_index; // Frame index decreases with allocations.
244 LocalScope* child = this->child(); 254 LocalScope* child = this->child();
245 while (child != NULL) { 255 while (child != NULL) {
246 int const dummy_parameter_index = 0; // Ignored, since no parameters. 256 const int dummy_parameter_index = 0; // Ignored, since no parameters.
247 int const num_parameters_in_child = 0; // No parameters in children scopes. 257 const int num_parameters_in_child = 0; // No parameters in children scopes.
248 int child_frame_index = child->AllocateVariables( 258 int child_frame_index = child->AllocateVariables(
249 dummy_parameter_index, num_parameters_in_child, frame_index, 259 dummy_parameter_index, num_parameters_in_child, frame_index,
250 context_owner, found_captured_variables); 260 context_owner, found_captured_variables);
251 if (child_frame_index < min_frame_index) { 261 if (child_frame_index < min_frame_index) {
252 min_frame_index = child_frame_index; 262 min_frame_index = child_frame_index;
253 } 263 }
254 child = child->sibling(); 264 child = child->sibling();
255 } 265 }
256 return min_frame_index; 266 return min_frame_index;
257 } 267 }
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 return fixed_parameter_count - (index() - kParamEndSlotFromFp); 736 return fixed_parameter_count - (index() - kParamEndSlotFromFp);
727 } else { 737 } else {
728 // Shift negative indexes so that the lowest one is 0 (they are still 738 // Shift negative indexes so that the lowest one is 0 (they are still
729 // non-positive). 739 // non-positive).
730 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp); 740 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp);
731 } 741 }
732 } 742 }
733 743
734 744
735 } // namespace dart 745 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/runtime_entry.cc ('k') | runtime/vm/stub_code_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698