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

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

Issue 2322243002: Preparse inner functions. (Closed)
Patch Set: flag on again Created 4 years, 3 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
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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 1082
1083 MaybeHandle<ScopeInfo> outer_scope; 1083 MaybeHandle<ScopeInfo> outer_scope;
1084 for (const Scope* s = outer_scope_; s != nullptr; s = s->outer_scope_) { 1084 for (const Scope* s = outer_scope_; s != nullptr; s = s->outer_scope_) {
1085 if (s->scope_info_.is_null()) continue; 1085 if (s->scope_info_.is_null()) continue;
1086 outer_scope = s->scope_info_; 1086 outer_scope = s->scope_info_;
1087 break; 1087 break;
1088 } 1088 }
1089 AllocateScopeInfosRecursively(info->isolate(), mode, outer_scope); 1089 AllocateScopeInfosRecursively(info->isolate(), mode, outer_scope);
1090 } 1090 }
1091 1091
1092 bool Scope::AllowsLazyParsing() const { 1092 bool Scope::AllowsLazyParsingWithoutUnresolvedVariables() const {
1093 // If we are inside a block scope, we must parse eagerly to find out how 1093 // If we are inside a block scope, we must find unresolved variables in the
1094 // to allocate variables on the block scope. At this point, declarations may 1094 // inner scopes to find out how to allocate variables on the block scope. At
1095 // not have yet been parsed. 1095 // this point, declarations may not have yet been parsed.
1096 for (const Scope* s = this; s != nullptr; s = s->outer_scope_) { 1096 for (const Scope* s = this; s != nullptr; s = s->outer_scope_) {
1097 if (s->is_block_scope()) return false; 1097 if (s->is_block_scope()) return false;
1098 // TODO(marja): Refactor parsing modes: also add s->is_function_scope()
1099 // here.
1098 } 1100 }
1099 return true; 1101 return true;
1100 } 1102 }
1101 1103
1102 bool DeclarationScope::AllowsLazyCompilation() const { 1104 bool DeclarationScope::AllowsLazyCompilation() const {
1103 return !force_eager_compilation_; 1105 return !force_eager_compilation_;
1104 } 1106 }
1105 1107
1106 bool DeclarationScope::AllowsLazyCompilationWithoutContext() const { 1108 bool DeclarationScope::AllowsLazyCompilationWithoutContext() const {
1107 if (force_eager_compilation_) return false; 1109 if (force_eager_compilation_) return false;
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 Variable* function = 1857 Variable* function =
1856 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; 1858 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr;
1857 bool is_function_var_in_context = 1859 bool is_function_var_in_context =
1858 function != nullptr && function->IsContextSlot(); 1860 function != nullptr && function->IsContextSlot();
1859 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 1861 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
1860 (is_function_var_in_context ? 1 : 0); 1862 (is_function_var_in_context ? 1 : 0);
1861 } 1863 }
1862 1864
1863 } // namespace internal 1865 } // namespace internal
1864 } // namespace v8 1866 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/scopes.h ('k') | src/flag-definitions.h » ('j') | src/parsing/parser.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698