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

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

Issue 2374963002: Preparse top-level functions in discardable zones (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 | « src/ast/ast.h ('k') | 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 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 } 1189 }
1190 1190
1191 void DeclarationScope::ResetAfterPreparsing(bool aborted) { 1191 void DeclarationScope::ResetAfterPreparsing(bool aborted) {
1192 // Reset all non-trivial members. 1192 // Reset all non-trivial members.
1193 decls_.Clear(); 1193 decls_.Clear();
1194 locals_.Clear(); 1194 locals_.Clear();
1195 sloppy_block_function_map_.Clear(); 1195 sloppy_block_function_map_.Clear();
1196 variables_.Clear(); 1196 variables_.Clear();
1197 // Make sure we won't walk the scope tree from here on. 1197 // Make sure we won't walk the scope tree from here on.
1198 inner_scope_ = nullptr; 1198 inner_scope_ = nullptr;
1199 unresolved_ = nullptr;
1199 1200
1200 // TODO(verwaest): We should properly preparse the parameters (no declarations 1201 // TODO(verwaest): We should properly preparse the parameters (no declarations
1201 // should be created), and reparse on abort. 1202 // should be created), and reparse on abort.
1202 if (aborted) { 1203 if (aborted) {
1203 // Recreate declarations for parameters. 1204 // Recreate declarations for parameters.
1204 for (int i = 0; i < params_.length(); i++) { 1205 for (int i = 0; i < params_.length(); i++) {
1205 Variable* var = params_[i]; 1206 Variable* var = params_[i];
1206 if (var->mode() == TEMPORARY) { 1207 if (var->mode() == TEMPORARY) {
1207 locals_.Add(var, zone()); 1208 locals_.Add(var, zone());
1208 } else if (variables_.Lookup(var->raw_name()) == nullptr) { 1209 } else if (variables_.Lookup(var->raw_name()) == nullptr) {
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 Variable* function = 1894 Variable* function =
1894 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; 1895 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr;
1895 bool is_function_var_in_context = 1896 bool is_function_var_in_context =
1896 function != nullptr && function->IsContextSlot(); 1897 function != nullptr && function->IsContextSlot();
1897 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 1898 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
1898 (is_function_var_in_context ? 1 : 0); 1899 (is_function_var_in_context ? 1 : 0);
1899 } 1900 }
1900 1901
1901 } // namespace internal 1902 } // namespace internal
1902 } // namespace v8 1903 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast.h ('k') | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698