Chromium Code Reviews| Index: src/scopes.cc |
| diff --git a/src/scopes.cc b/src/scopes.cc |
| index 60c14dbdc8d752af1cb209897c97eb7d944f553e..c60c5f7d19fe333411678d561cd50834176c5190 100644 |
| --- a/src/scopes.cc |
| +++ b/src/scopes.cc |
| @@ -77,6 +77,7 @@ Scope::Scope(Zone* zone, Scope* outer_scope, ScopeType scope_type, |
| internals_(4, zone), |
| temps_(4, zone), |
| params_(4, zone), |
| + param_positions_(4, zone), |
| unresolved_(16, zone), |
| decls_(4, zone), |
| module_descriptor_( |
| @@ -100,6 +101,7 @@ Scope::Scope(Zone* zone, Scope* inner_scope, ScopeType scope_type, |
| internals_(4, zone), |
| temps_(4, zone), |
| params_(4, zone), |
| + param_positions_(4, zone), |
| unresolved_(16, zone), |
| decls_(4, zone), |
| module_descriptor_(NULL), |
| @@ -126,6 +128,7 @@ Scope::Scope(Zone* zone, Scope* inner_scope, |
| internals_(0, zone), |
| temps_(0, zone), |
| params_(0, zone), |
| + param_positions_(0, zone), |
| unresolved_(0, zone), |
| decls_(0, zone), |
| module_descriptor_(NULL), |
| @@ -459,7 +462,7 @@ Variable* Scope::Lookup(const AstRawString* name) { |
| Variable* Scope::DeclareParameter(const AstRawString* name, VariableMode mode, |
| - bool is_rest, bool* is_duplicate) { |
| + bool is_rest, bool* is_duplicate, int pos) { |
| DCHECK(!already_resolved()); |
| DCHECK(is_function_scope()); |
| Variable* var = variables_.Declare(this, name, mode, Variable::NORMAL, |
| @@ -472,6 +475,7 @@ Variable* Scope::DeclareParameter(const AstRawString* name, VariableMode mode, |
| // TODO(wingo): Avoid O(n^2) check. |
| *is_duplicate = IsDeclaredParameter(name); |
| params_.Add(var, zone()); |
| + param_positions_.Add(pos, zone()); |
| return var; |
| } |
| @@ -1426,7 +1430,11 @@ void Scope::AllocateParameter(Variable* var, int index) { |
| } else { |
| DCHECK(var->IsUnallocated() || var->IsParameter()); |
| if (var->IsUnallocated()) { |
| - var->AllocateTo(Variable::PARAMETER, index); |
| + if (IsLexicalVariableMode(var->mode())) { |
|
caitp (gmail)
2015/05/20 17:05:16
So this approach doesn't work --- it causes the `D
|
| + AllocateStackSlot(var); |
| + } else { |
| + var->AllocateTo(Variable::PARAMETER, index); |
| + } |
| } |
| } |
| } |