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

Unified Diff: src/scopes.cc

Issue 1163853002: Revert of [es6] implement default parameters via desugaring (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 98c689b4c5ce23a8a9d5ee849ffd852d265c6961..21a8805c54aad396364829e66110c72752cfd3c2 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -77,7 +77,6 @@
internals_(4, zone),
temps_(4, zone),
params_(4, zone),
- param_positions_(4, zone),
unresolved_(16, zone),
decls_(4, zone),
module_descriptor_(
@@ -101,7 +100,6 @@
internals_(4, zone),
temps_(4, zone),
params_(4, zone),
- param_positions_(4, zone),
unresolved_(16, zone),
decls_(4, zone),
module_descriptor_(NULL),
@@ -128,7 +126,6 @@
internals_(0, zone),
temps_(0, zone),
params_(0, zone),
- param_positions_(0, zone),
unresolved_(0, zone),
decls_(0, zone),
module_descriptor_(NULL),
@@ -186,7 +183,6 @@
module_var_ = NULL,
rest_parameter_ = NULL;
rest_index_ = -1;
- has_parameter_expressions_ = false;
scope_info_ = scope_info;
start_position_ = RelocInfo::kNoPosition;
end_position_ = RelocInfo::kNoPosition;
@@ -474,7 +470,7 @@
Variable* Scope::DeclareParameter(const AstRawString* name, VariableMode mode,
- bool is_rest, bool* is_duplicate, int pos) {
+ bool is_rest, bool* is_duplicate) {
DCHECK(!already_resolved());
DCHECK(is_function_scope());
Variable* var = variables_.Declare(this, name, mode, Variable::NORMAL,
@@ -487,7 +483,6 @@
// TODO(wingo): Avoid O(n^2) check.
*is_duplicate = IsDeclaredParameter(name);
params_.Add(var, zone());
- param_positions_.Add(pos, zone());
return var;
}
@@ -555,18 +550,6 @@
void Scope::AddDeclaration(Declaration* declaration) {
decls_.Add(declaration, zone());
-}
-
-
-void Scope::UndeclareParametersForExpressions() {
- DCHECK(is_function_scope());
- DCHECK(!has_parameter_expressions_);
- has_parameter_expressions_ = true;
- for (int i = 0; i < num_parameters(); ++i) {
- Variable* p = parameter(i);
- const AstRawString* name = p->raw_name();
- variables_.Remove(const_cast<AstRawString*>(name), name->hash());
- }
}
@@ -1436,21 +1419,16 @@
// If it does, and if it is not copied into the context object, it must
// receive the highest parameter index for that parameter; thus iteration
// order is relevant!
- //
- // If hasParameterExpressions is true, parameters are redeclared during
- // desugaring, and must not be allocated here.
- if (!has_parameter_expressions_) {
- for (int i = params_.length() - 1; i >= 0; --i) {
- Variable* var = params_[i];
- if (var == rest_parameter_) continue;
-
- DCHECK(var->scope() == this);
- if (uses_sloppy_arguments || has_forced_context_allocation()) {
- // Force context allocation of the parameter.
- var->ForceContextAllocation();
- }
- AllocateParameter(var, i);
- }
+ for (int i = params_.length() - 1; i >= 0; --i) {
+ Variable* var = params_[i];
+ if (var == rest_parameter_) continue;
+
+ DCHECK(var->scope() == this);
+ if (uses_sloppy_arguments || has_forced_context_allocation()) {
+ // Force context allocation of the parameter.
+ var->ForceContextAllocation();
+ }
+ AllocateParameter(var, i);
}
}
« 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