diff --git a/src/parser.h b/src/parser.h index 7906563bd4..35a6f3af20 100644 --- a/src/parser.h +++ b/src/parser.h @@ -927,7 +927,6 @@ class Parser : public ParserBase { void SetCachedData(ParseInfo* info); - bool inside_with() const { return scope_->inside_with(); } ScriptCompiler::CompileOptions compile_options() const { return compile_options_; } @@ -1049,7 +1048,6 @@ class Parser : public ParserBase { AstValueFactory* ast_value_factory() const { return descriptor_->parser->ast_value_factory(); } - bool inside_with() const { return descriptor_->parser->inside_with(); } Zone* zone() const { return descriptor_->parser->zone(); } Expression* pattern_; diff --git a/src/pattern-rewriter.cc b/src/pattern-rewriter.cc index f2c1240b9c..e96aef8ba2 100644 --- a/src/pattern-rewriter.cc +++ b/src/pattern-rewriter.cc @@ -158,7 +158,7 @@ void Parser::PatternRewriter::VisitVariableProxy(VariableProxy* pattern) { // we're in a with. The initialization value should not // necessarily be stored in the global object in that case, // which is why we need to generate a separate assignment node. - if (value != NULL && !inside_with()) { + if (value != NULL && !descriptor_->scope->inside_with()) { arguments->Add(value, zone()); value = NULL; // zap the value to avoid the unnecessary assignment // Construct the call to Runtime_InitializeVarGlobal diff --git a/src/scopes.cc b/src/scopes.cc index cc3250704c..6f2e758631 100644 --- a/src/scopes.cc +++ b/src/scopes.cc @@ -194,7 +194,6 @@ void Scope::SetDefaults(ScopeType scope_type, Scope* outer_scope, language_mode_ = outer_scope != NULL ? outer_scope->language_mode_ : SLOPPY; outer_scope_calls_sloppy_eval_ = false; inner_scope_calls_eval_ = false; - inner_scope_uses_arguments_ = false; scope_nonlinear_ = false; force_eager_compilation_ = false; force_context_allocation_ = (outer_scope != NULL && !is_function_scope()) @@ -998,9 +997,6 @@ void Scope::Print(int n) { if (scope_uses_arguments_) Indent(n1, "// scope uses 'arguments'\n"); if (scope_uses_super_property_) Indent(n1, "// scope uses 'super' property\n"); - if (inner_scope_uses_arguments_) { - Indent(n1, "// inner scope uses 'arguments'\n"); - } if (outer_scope_calls_sloppy_eval_) { Indent(n1, "// outer scope calls 'eval' in sloppy context\n"); } @@ -1347,14 +1343,6 @@ void Scope::PropagateScopeInfo(bool outer_scope_calls_sloppy_eval ) { if (inner->scope_calls_eval_ || inner->inner_scope_calls_eval_) { inner_scope_calls_eval_ = true; } - // If the inner scope is an arrow function, propagate the flags tracking - // usage of arguments/super/this, but do not propagate them out from normal - // functions. - if (!inner->is_function_scope() || inner->is_arrow_scope()) { - if (inner->scope_uses_arguments_ || inner->inner_scope_uses_arguments_) { - inner_scope_uses_arguments_ = true; - } - } if (inner->force_eager_compilation_) { force_eager_compilation_ = true; } diff --git a/src/scopes.h b/src/scopes.h index 8400094564..6c976d90bd 100644 --- a/src/scopes.h +++ b/src/scopes.h @@ -339,13 +339,9 @@ class Scope: public ZoneObject { // Is this scope inside a with statement. bool inside_with() const { return scope_inside_with_; } - // Does this scope contain a with statement. - bool contains_with() const { return scope_contains_with_; } // Does this scope access "arguments". bool uses_arguments() const { return scope_uses_arguments_; } - // Does any inner scope access "arguments". - bool inner_uses_arguments() const { return inner_scope_uses_arguments_; } // Does this scope access "super" property (super.foo). bool uses_super_property() const { return scope_uses_super_property_; } // Does this scope have the potential to execute declarations non-linearly? @@ -675,7 +671,6 @@ class Scope: public ZoneObject { // Computed via PropagateScopeInfo. bool outer_scope_calls_sloppy_eval_; bool inner_scope_calls_eval_; - bool inner_scope_uses_arguments_; bool force_eager_compilation_; bool force_context_allocation_; diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc index a04e852bc2..463dc06285 100644 --- a/test/cctest/test-parsing.cc +++ b/test/cctest/test-parsing.cc @@ -979,7 +979,6 @@ TEST(ScopeUsesArgumentsSuperThis) { ARGUMENTS = 1, SUPER_PROPERTY = 1 << 1, THIS = 1 << 2, - INNER_ARGUMENTS = 1 << 3, EVAL = 1 << 4 }; @@ -1021,9 +1020,9 @@ TEST(ScopeUsesArgumentsSuperThis) { {"return { m(x) { return () => super.m() } }", NONE}, // Flags must be correctly set when using block scoping. {"\"use strict\"; while (true) { let x; this, arguments; }", - INNER_ARGUMENTS | THIS}, + THIS}, {"\"use strict\"; while (true) { let x; this, super.f(), arguments; }", - INNER_ARGUMENTS | SUPER_PROPERTY | THIS}, + SUPER_PROPERTY | THIS}, {"\"use strict\"; if (foo()) { let x; this.f() }", THIS}, {"\"use strict\"; if (foo()) { let x; super.f() }", SUPER_PROPERTY}, {"\"use strict\"; if (1) {" @@ -1094,8 +1093,6 @@ TEST(ScopeUsesArgumentsSuperThis) { // script scope are marked as used. CHECK(scope->LookupThis()->is_used()); } - CHECK_EQ((source_data[i].expected & INNER_ARGUMENTS) != 0, - scope->inner_uses_arguments()); CHECK_EQ((source_data[i].expected & EVAL) != 0, scope->calls_eval()); } }