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

Unified Diff: src/parsing/parser.cc

Issue 2062593002: Revert of Fix scope flags for default parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 8164c7d3b2cda7e9dd5af74dac0883f0ff95541e..50d875feb687347ca72b2f163f3ae84750105911 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -4554,7 +4554,6 @@
DCHECK(scope_->is_function_scope());
Block* init_block =
factory()->NewBlock(NULL, 1, true, RelocInfo::kNoPosition);
- ZoneList<Scope*>* param_scopes = new (zone()) ZoneList<Scope*>(0, zone());
for (int i = 0; i < parameters.params.length(); ++i) {
auto parameter = parameters.params[i];
if (parameter.is_rest && parameter.pattern->IsVariableProxy()) break;
@@ -4596,13 +4595,12 @@
Scope* param_scope = scope_;
Block* param_block = init_block;
- if (!parameter.is_simple()) {
+ if (!parameter.is_simple() && scope_->calls_sloppy_eval()) {
param_scope = NewScope(scope_, BLOCK_SCOPE);
param_scope->set_is_declaration_scope();
param_scope->set_start_position(descriptor.initialization_pos);
param_scope->set_end_position(parameter.initializer_end_position);
- param_scopes->Add(param_scope, zone());
- scope_->PropagateUsageFlagsToScope(param_scope);
+ param_scope->RecordEvalCall();
param_block = factory()->NewBlock(NULL, 8, true, RelocInfo::kNoPosition);
param_block->set_scope(param_scope);
descriptor.hoist_scope = scope_;
@@ -4616,16 +4614,13 @@
&decl, nullptr, CHECK_OK);
}
- if (!parameter.is_simple()) {
+ if (!parameter.is_simple() && scope_->calls_sloppy_eval()) {
param_scope = param_scope->FinalizeBlockScope();
if (param_scope != nullptr) {
CheckConflictingVarDeclarations(param_scope, CHECK_OK);
}
init_block->statements()->Add(param_block, zone());
}
- }
- for (Scope* param_scope : *param_scopes) {
- scope_->PropagateUsageFlagsToScope(param_scope);
}
return init_block;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698