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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scopes.cc
diff --git a/runtime/vm/scopes.cc b/runtime/vm/scopes.cc
index dcae0be58f60b1df800516781d758d4e506d90f6..ed69838d920514df63e8d4d533f6190c64df2a27 100644
--- a/runtime/vm/scopes.cc
+++ b/runtime/vm/scopes.cc
@@ -229,22 +229,32 @@ int LocalScope::AllocateVariables(int first_parameter_index,
frame_index = first_frame_index;
while (pos < num_variables()) {
LocalVariable* variable = VariableAt(pos);
- pos++;
if (variable->owner() == this) {
if (variable->is_captured()) {
AllocateContextVariable(variable, &context_owner);
*found_captured_variables = true;
+ if (variable->name().raw() ==
+ Symbols::FunctionTypeArgumentsVar().raw()) {
+ ASSERT(pos == num_parameters);
+ // A captured type args variable has a slot allocated in the frame and
+ // one in the context, where it gets copied to.
+ frame_index--;
+ }
} else {
+ ASSERT((variable->name().raw() !=
+ Symbols::FunctionTypeArgumentsVar().raw()) ||
+ (pos == num_parameters));
variable->set_index(frame_index--);
}
}
+ pos++;
}
// Allocate variables of all children.
int min_frame_index = frame_index; // Frame index decreases with allocations.
LocalScope* child = this->child();
while (child != NULL) {
- int const dummy_parameter_index = 0; // Ignored, since no parameters.
- int const num_parameters_in_child = 0; // No parameters in children scopes.
+ const int dummy_parameter_index = 0; // Ignored, since no parameters.
+ const int num_parameters_in_child = 0; // No parameters in children scopes.
int child_frame_index = child->AllocateVariables(
dummy_parameter_index, num_parameters_in_child, frame_index,
context_owner, found_captured_variables);
« 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