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

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

Issue 2405813002: Allow lazy parsing of functions nested in eager compiled functions (Closed)
Patch Set: Rebase 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/compiler.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()) return false; 1122 if (s->is_block_scope() || s->is_function_scope()) return false;
1123 // TODO(marja): Refactor parsing modes: also add s->is_function_scope()
1124 // here.
1125 } 1123 }
1126 return true; 1124 return true;
1127 } 1125 }
1128 1126
1129 bool DeclarationScope::AllowsLazyCompilation() const { 1127 bool DeclarationScope::AllowsLazyCompilation() const {
1130 return !force_eager_compilation_; 1128 return !force_eager_compilation_;
1131 } 1129 }
1132 1130
1133 int Scope::ContextChainLength(Scope* scope) const { 1131 int Scope::ContextChainLength(Scope* scope) const {
1134 int n = 0; 1132 int n = 0;
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 Variable* function = 1944 Variable* function =
1947 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; 1945 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr;
1948 bool is_function_var_in_context = 1946 bool is_function_var_in_context =
1949 function != nullptr && function->IsContextSlot(); 1947 function != nullptr && function->IsContextSlot();
1950 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 1948 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
1951 (is_function_var_in_context ? 1 : 0); 1949 (is_function_var_in_context ? 1 : 0);
1952 } 1950 }
1953 1951
1954 } // namespace internal 1952 } // namespace internal
1955 } // namespace v8 1953 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698