Chromium Code Reviews| Index: src/scopes.cc |
| diff --git a/src/scopes.cc b/src/scopes.cc |
| index e1297b332ca52bd224bce0129ae3c72d3419ceac..b226be1b573148c23c030ed7cc8294816d73ff2e 100644 |
| --- a/src/scopes.cc |
| +++ b/src/scopes.cc |
| @@ -160,10 +160,14 @@ void Scope::SetDefaults(ScopeType scope_type, |
| scope_inside_with_ = false; |
| scope_contains_with_ = false; |
| scope_calls_eval_ = false; |
| + scope_uses_this_ = false; |
| + scope_uses_arguments_ = false; |
| // Inherit the strict mode from the parent scope. |
| strict_mode_ = outer_scope != NULL ? outer_scope->strict_mode_ : SLOPPY; |
| outer_scope_calls_sloppy_eval_ = false; |
| inner_scope_calls_eval_ = false; |
| + inner_scope_uses_this_ = false; |
| + inner_scope_uses_arguments_ = false; |
| force_eager_compilation_ = false; |
| force_context_allocation_ = (outer_scope != NULL && !is_function_scope()) |
| ? outer_scope->has_forced_context_allocation() : false; |
| @@ -881,6 +885,12 @@ void Scope::Print(int n) { |
| if (scope_inside_with_) Indent(n1, "// scope inside 'with'\n"); |
| if (scope_contains_with_) Indent(n1, "// scope contains 'with'\n"); |
| if (scope_calls_eval_) Indent(n1, "// scope calls 'eval'\n"); |
| + if (scope_uses_this_) Indent(n1, "// scope uses 'this'\n"); |
| + if (scope_uses_arguments_) Indent(n1, "// scope uses 'arguments'\n"); |
| + if (inner_scope_uses_this_) Indent(n1, "// inner scope uses 'this'\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"); |
| } |
| @@ -1162,6 +1172,12 @@ 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 (inner->scope_uses_this_ || inner->inner_scope_uses_this_) { |
|
rossberg
2014/09/10 06:33:56
If inner is a function scope and not an arrow func
|
| + inner_scope_uses_this_ = true; |
| + } |
| + if (inner->scope_uses_arguments_ || inner->inner_scope_uses_arguments_) { |
| + inner_scope_uses_arguments_ = true; |
| + } |
| if (inner->force_eager_compilation_) { |
| force_eager_compilation_ = true; |
| } |