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

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

Issue 2656753003: [ast/parsing] Pessimistically assume all top-level variables will be assigned. (Closed)
Patch Set: Rebase. Created 3 years, 10 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.cc ('k') | src/parsing/parser.h » ('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 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 } 1837 }
1838 VariableLocation location = var->location(); 1838 VariableLocation location = var->location();
1839 CHECK(location == VariableLocation::LOCAL || 1839 CHECK(location == VariableLocation::LOCAL ||
1840 location == VariableLocation::CONTEXT || 1840 location == VariableLocation::CONTEXT ||
1841 location == VariableLocation::PARAMETER || 1841 location == VariableLocation::PARAMETER ||
1842 location == VariableLocation::UNALLOCATED); 1842 location == VariableLocation::UNALLOCATED);
1843 } 1843 }
1844 #endif 1844 #endif
1845 1845
1846 DCHECK_NOT_NULL(var); 1846 DCHECK_NOT_NULL(var);
1847 if (proxy->is_assigned()) var->set_maybe_assigned();
1848 if (AccessNeedsHoleCheck(var, proxy, this)) proxy->set_needs_hole_check(); 1847 if (AccessNeedsHoleCheck(var, proxy, this)) proxy->set_needs_hole_check();
1849 proxy->BindTo(var); 1848 proxy->BindTo(var);
1850 } 1849 }
1851 1850
1852 void Scope::ResolveVariablesRecursively(ParseInfo* info) { 1851 void Scope::ResolveVariablesRecursively(ParseInfo* info) {
1853 DCHECK(info->script_scope()->is_script_scope()); 1852 DCHECK(info->script_scope()->is_script_scope());
1854 // Lazy parsed declaration scopes are already partially analyzed. If there are 1853 // Lazy parsed declaration scopes are already partially analyzed. If there are
1855 // unresolved references remaining, they just need to be resolved in outer 1854 // unresolved references remaining, they just need to be resolved in outer
1856 // scopes. 1855 // scopes.
1857 if (is_declaration_scope() && AsDeclarationScope()->was_lazily_parsed()) { 1856 if (is_declaration_scope() && AsDeclarationScope()->was_lazily_parsed()) {
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 Variable* function = 2211 Variable* function =
2213 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; 2212 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr;
2214 bool is_function_var_in_context = 2213 bool is_function_var_in_context =
2215 function != nullptr && function->IsContextSlot(); 2214 function != nullptr && function->IsContextSlot();
2216 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 2215 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
2217 (is_function_var_in_context ? 1 : 0); 2216 (is_function_var_in_context ? 1 : 0);
2218 } 2217 }
2219 2218
2220 } // namespace internal 2219 } // namespace internal
2221 } // namespace v8 2220 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast.cc ('k') | src/parsing/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698