OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/ast/scopes.h" | 5 #include "src/ast/scopes.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/ast/ast.h" | 10 #include "src/ast/ast.h" |
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 if (scope_info_.is_null()) { | 1112 if (scope_info_.is_null()) { |
1113 scope_info_ = ScopeInfo::Create(info->isolate(), zone(), this, outer_scope); | 1113 scope_info_ = ScopeInfo::Create(info->isolate(), zone(), this, outer_scope); |
1114 } | 1114 } |
1115 } | 1115 } |
1116 | 1116 |
1117 bool Scope::AllowsLazyParsingWithoutUnresolvedVariables() const { | 1117 bool Scope::AllowsLazyParsingWithoutUnresolvedVariables() const { |
1118 // If we are inside a block scope, we must find unresolved variables in the | 1118 // If we are inside a block scope, we must find unresolved variables in the |
1119 // inner scopes to find out how to allocate variables on the block scope. At | 1119 // inner scopes to find out how to allocate variables on the block scope. At |
1120 // this point, declarations may not have yet been parsed. | 1120 // this point, declarations may not have yet been parsed. |
1121 for (const Scope* s = this; s != nullptr; s = s->outer_scope_) { | 1121 for (const Scope* s = this; s != nullptr; s = s->outer_scope_) { |
1122 if (s->is_block_scope() || s->is_function_scope()) return false; | 1122 if (s->is_block_scope()) return false; |
| 1123 if (s->is_function_scope()) return false; |
| 1124 if (s->is_eval_scope() && is_strict(s->language_mode())) return false; |
1123 } | 1125 } |
1124 return true; | 1126 return true; |
1125 } | 1127 } |
1126 | 1128 |
1127 bool DeclarationScope::AllowsLazyCompilation() const { | 1129 bool DeclarationScope::AllowsLazyCompilation() const { |
1128 return !force_eager_compilation_; | 1130 return !force_eager_compilation_; |
1129 } | 1131 } |
1130 | 1132 |
1131 int Scope::ContextChainLength(Scope* scope) const { | 1133 int Scope::ContextChainLength(Scope* scope) const { |
1132 int n = 0; | 1134 int n = 0; |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1945 Variable* function = | 1947 Variable* function = |
1946 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; | 1948 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; |
1947 bool is_function_var_in_context = | 1949 bool is_function_var_in_context = |
1948 function != nullptr && function->IsContextSlot(); | 1950 function != nullptr && function->IsContextSlot(); |
1949 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1951 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1950 (is_function_var_in_context ? 1 : 0); | 1952 (is_function_var_in_context ? 1 : 0); |
1951 } | 1953 } |
1952 | 1954 |
1953 } // namespace internal | 1955 } // namespace internal |
1954 } // namespace v8 | 1956 } // namespace v8 |
OLD | NEW |