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

Unified Diff: src/scopes.cc

Issue 1278783002: [es6] Use strict arguments objects for destructured parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Doh Created 5 years, 4 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') | test/mjsunit/harmony/destructuring.js » ('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 319aca518ed69187dc29cc817c58f9266b2a8700..8ce28bd6aba130598ff24eb39df95f3967a37e4d 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -180,7 +180,8 @@ void Scope::SetDefaults(ScopeType scope_type, Scope* outer_scope,
num_heap_slots_ = 0;
num_global_slots_ = 0;
num_modules_ = 0;
- module_var_ = NULL,
+ module_var_ = NULL;
+ has_simple_parameters_ = true;
rest_parameter_ = NULL;
rest_index_ = -1;
scope_info_ = scope_info;
@@ -468,6 +469,7 @@ Variable* Scope::DeclareParameter(const AstRawString* name, VariableMode mode,
Variable* var;
if (mode == TEMPORARY) {
var = NewTemporary(name);
+ has_simple_parameters_ = false;
} else {
var = variables_.Declare(this, name, mode, Variable::NORMAL,
kCreatedInitialized);
@@ -478,6 +480,7 @@ Variable* Scope::DeclareParameter(const AstRawString* name, VariableMode mode,
DCHECK_NULL(rest_parameter_);
rest_parameter_ = var;
rest_index_ = num_parameters();
+ has_simple_parameters_ = false;
}
params_.Add(var, zone());
return var;
@@ -1399,7 +1402,9 @@ void Scope::AllocateParameterLocals(Isolate* isolate) {
// In strict mode 'arguments' does not alias formal parameters.
// Therefore in strict mode we allocate parameters as if 'arguments'
// were not used.
- uses_sloppy_arguments = is_sloppy(language_mode());
+ // If the parameter list is not simple, arguments isn't sloppy either.
+ uses_sloppy_arguments =
+ is_sloppy(language_mode()) && has_simple_parameters();
}
if (rest_parameter_ && !MustAllocate(rest_parameter_)) {
« no previous file with comments | « src/scopes.h ('k') | test/mjsunit/harmony/destructuring.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698