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

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: Add comment Created 4 years, 3 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 | « no previous file | src/parsing/parser.cc » ('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 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 migrate_to->set_start_position(start_position_); 1211 migrate_to->set_start_position(start_position_);
1212 migrate_to->set_end_position(end_position_); 1212 migrate_to->set_end_position(end_position_);
1213 migrate_to->set_language_mode(language_mode()); 1213 migrate_to->set_language_mode(language_mode());
1214 migrate_to->arity_ = arity_; 1214 migrate_to->arity_ = arity_;
1215 migrate_to->force_context_allocation_ = force_context_allocation_; 1215 migrate_to->force_context_allocation_ = force_context_allocation_;
1216 outer_scope_->RemoveInnerScope(this); 1216 outer_scope_->RemoveInnerScope(this);
1217 DCHECK_EQ(outer_scope_, migrate_to->outer_scope_); 1217 DCHECK_EQ(outer_scope_, migrate_to->outer_scope_);
1218 DCHECK_EQ(outer_scope_->zone(), migrate_to->zone()); 1218 DCHECK_EQ(outer_scope_->zone(), migrate_to->zone());
1219 DCHECK_EQ(NeedsHomeObject(), migrate_to->NeedsHomeObject()); 1219 DCHECK_EQ(NeedsHomeObject(), migrate_to->NeedsHomeObject());
1220 DCHECK_EQ(asm_function_, migrate_to->asm_function_); 1220 DCHECK_EQ(asm_function_, migrate_to->asm_function_);
1221 DCHECK_EQ(arguments() != nullptr, migrate_to->arguments() != nullptr);
1222 } 1221 }
1223 1222
1224 #ifdef DEBUG 1223 #ifdef DEBUG
1225 static const char* Header(ScopeType scope_type, FunctionKind function_kind, 1224 static const char* Header(ScopeType scope_type, FunctionKind function_kind,
1226 bool is_declaration_scope) { 1225 bool is_declaration_scope) {
1227 switch (scope_type) { 1226 switch (scope_type) {
1228 case EVAL_SCOPE: return "eval"; 1227 case EVAL_SCOPE: return "eval";
1229 // TODO(adamk): Should we print concise method scopes specially? 1228 // TODO(adamk): Should we print concise method scopes specially?
1230 case FUNCTION_SCOPE: 1229 case FUNCTION_SCOPE:
1231 if (IsGeneratorFunction(function_kind)) return "function*"; 1230 if (IsGeneratorFunction(function_kind)) return "function*";
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
1832 Variable* function = 1831 Variable* function =
1833 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; 1832 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr;
1834 bool is_function_var_in_context = 1833 bool is_function_var_in_context =
1835 function != nullptr && function->IsContextSlot(); 1834 function != nullptr && function->IsContextSlot();
1836 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 1835 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
1837 (is_function_var_in_context ? 1 : 0); 1836 (is_function_var_in_context ? 1 : 0);
1838 } 1837 }
1839 1838
1840 } // namespace internal 1839 } // namespace internal
1841 } // namespace v8 1840 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698