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 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1643 void Scope::ResolveVariable(ParseInfo* info, VariableProxy* proxy) { | 1643 void Scope::ResolveVariable(ParseInfo* info, VariableProxy* proxy) { |
1644 DCHECK(info->script_scope()->is_script_scope()); | 1644 DCHECK(info->script_scope()->is_script_scope()); |
1645 DCHECK(!proxy->is_resolved()); | 1645 DCHECK(!proxy->is_resolved()); |
1646 Variable* var = LookupRecursive(proxy, nullptr); | 1646 Variable* var = LookupRecursive(proxy, nullptr); |
1647 ResolveTo(info, proxy, var); | 1647 ResolveTo(info, proxy, var); |
1648 } | 1648 } |
1649 | 1649 |
1650 namespace { | 1650 namespace { |
1651 | 1651 |
1652 bool AccessNeedsHoleCheck(Variable* var, VariableProxy* proxy, Scope* scope) { | 1652 bool AccessNeedsHoleCheck(Variable* var, VariableProxy* proxy, Scope* scope) { |
1653 if (var->mode() == DYNAMIC_LOCAL) { | |
1654 return AccessNeedsHoleCheck(var->local_if_not_shadowed(), proxy, scope); | |
adamk
2016/12/07 17:37:41
Can you add a DCHECK here:
DCHECK(!var->binding_n
| |
1655 } | |
1656 | |
1653 if (!var->binding_needs_init()) { | 1657 if (!var->binding_needs_init()) { |
1654 return false; | 1658 return false; |
1655 } | 1659 } |
1656 | 1660 |
1657 // It's impossible to eliminate module import hole checks here, because it's | 1661 // It's impossible to eliminate module import hole checks here, because it's |
1658 // unknown at compilation time whether the binding referred to in the | 1662 // unknown at compilation time whether the binding referred to in the |
1659 // exporting module itself requires hole checks. | 1663 // exporting module itself requires hole checks. |
1660 if (var->location() == VariableLocation::MODULE && !var->IsExport()) { | 1664 if (var->location() == VariableLocation::MODULE && !var->IsExport()) { |
1661 return true; | 1665 return true; |
1662 } | 1666 } |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2064 Variable* function = | 2068 Variable* function = |
2065 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; | 2069 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; |
2066 bool is_function_var_in_context = | 2070 bool is_function_var_in_context = |
2067 function != nullptr && function->IsContextSlot(); | 2071 function != nullptr && function->IsContextSlot(); |
2068 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 2072 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
2069 (is_function_var_in_context ? 1 : 0); | 2073 (is_function_var_in_context ? 1 : 0); |
2070 } | 2074 } |
2071 | 2075 |
2072 } // namespace internal | 2076 } // namespace internal |
2073 } // namespace v8 | 2077 } // namespace v8 |
OLD | NEW |