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

Unified Diff: src/scopes.cc

Issue 1127063003: [es6] implement default parameters via desugaring (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase + add lazy parsing test + WIP review comments Created 5 years, 7 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 | « src/scopes.h ('k') | src/variables.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ }
}
}
}
« no previous file with comments | « src/scopes.h ('k') | src/variables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698