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

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

Issue 2551023004: [ignition] Fix hole check for dynamic local variables (Closed)
Patch Set: Move shadowed variable check to AccessNeedsHoleCheck Created 4 years 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 | « no previous file | test/mjsunit/regress/regress-crbug-669540.js » ('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 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-669540.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698