Chromium Code Reviews

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

Issue 2362463003: Declare the arguments object before creating the function var, to make sure it masks it (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | src/parsing/parser.cc » ('J')
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 1197 matching lines...)
1208 migrate_to->set_start_position(start_position_); 1208 migrate_to->set_start_position(start_position_);
1209 migrate_to->set_end_position(end_position_); 1209 migrate_to->set_end_position(end_position_);
1210 migrate_to->set_language_mode(language_mode()); 1210 migrate_to->set_language_mode(language_mode());
1211 migrate_to->arity_ = arity_; 1211 migrate_to->arity_ = arity_;
1212 migrate_to->force_context_allocation_ = force_context_allocation_; 1212 migrate_to->force_context_allocation_ = force_context_allocation_;
1213 outer_scope_->RemoveInnerScope(this); 1213 outer_scope_->RemoveInnerScope(this);
1214 DCHECK_EQ(outer_scope_, migrate_to->outer_scope_); 1214 DCHECK_EQ(outer_scope_, migrate_to->outer_scope_);
1215 DCHECK_EQ(outer_scope_->zone(), migrate_to->zone()); 1215 DCHECK_EQ(outer_scope_->zone(), migrate_to->zone());
1216 DCHECK_EQ(NeedsHomeObject(), migrate_to->NeedsHomeObject()); 1216 DCHECK_EQ(NeedsHomeObject(), migrate_to->NeedsHomeObject());
1217 DCHECK_EQ(asm_function_, migrate_to->asm_function_); 1217 DCHECK_EQ(asm_function_, migrate_to->asm_function_);
1218 DCHECK_EQ(arguments() != nullptr, migrate_to->arguments() != nullptr);
1219 } 1218 }
1220 1219
1221 #ifdef DEBUG 1220 #ifdef DEBUG
1222 static const char* Header(ScopeType scope_type, FunctionKind function_kind, 1221 static const char* Header(ScopeType scope_type, FunctionKind function_kind,
1223 bool is_declaration_scope) { 1222 bool is_declaration_scope) {
1224 switch (scope_type) { 1223 switch (scope_type) {
1225 case EVAL_SCOPE: return "eval"; 1224 case EVAL_SCOPE: return "eval";
1226 // TODO(adamk): Should we print concise method scopes specially? 1225 // TODO(adamk): Should we print concise method scopes specially?
1227 case FUNCTION_SCOPE: 1226 case FUNCTION_SCOPE:
1228 if (IsGeneratorFunction(function_kind)) return "function*"; 1227 if (IsGeneratorFunction(function_kind)) return "function*";
(...skipping 600 matching lines...)
1829 Variable* function = 1828 Variable* function =
1830 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; 1829 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr;
1831 bool is_function_var_in_context = 1830 bool is_function_var_in_context =
1832 function != nullptr && function->IsContextSlot(); 1831 function != nullptr && function->IsContextSlot();
1833 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 1832 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
1834 (is_function_var_in_context ? 1 : 0); 1833 (is_function_var_in_context ? 1 : 0);
1835 } 1834 }
1836 1835
1837 } // namespace internal 1836 } // namespace internal
1838 } // namespace v8 1837 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | src/parsing/parser.cc » ('J')

Powered by Google App Engine