OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |