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

Side by Side Diff: src/ast/scopes.cc

Issue 2413213002: Allow lazy parsing of eval-created functions (Closed)
Patch Set: disallow preparsing without scope resolution of strict-mode evaled functions Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698