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

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

Issue 1819123002: Remove support for legacy const, part 1 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased, deleted one more file Created 4 years, 9 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 | « src/ast/scopes.h ('k') | src/bailout-reason.h » ('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 "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/ast/scopeinfo.h" 8 #include "src/ast/scopeinfo.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 module_descriptor_( 93 module_descriptor_(
94 scope_type == MODULE_SCOPE ? ModuleDescriptor::New(zone) : NULL), 94 scope_type == MODULE_SCOPE ? ModuleDescriptor::New(zone) : NULL),
95 sloppy_block_function_map_(zone), 95 sloppy_block_function_map_(zone),
96 already_resolved_(false), 96 already_resolved_(false),
97 ast_value_factory_(ast_value_factory), 97 ast_value_factory_(ast_value_factory),
98 zone_(zone) { 98 zone_(zone) {
99 SetDefaults(scope_type, outer_scope, Handle<ScopeInfo>::null(), 99 SetDefaults(scope_type, outer_scope, Handle<ScopeInfo>::null(),
100 function_kind); 100 function_kind);
101 // The outermost scope must be a script scope. 101 // The outermost scope must be a script scope.
102 DCHECK(scope_type == SCRIPT_SCOPE || outer_scope != NULL); 102 DCHECK(scope_type == SCRIPT_SCOPE || outer_scope != NULL);
103 DCHECK(!HasIllegalRedeclaration());
104 } 103 }
105 104
106 Scope::Scope(Zone* zone, Scope* inner_scope, ScopeType scope_type, 105 Scope::Scope(Zone* zone, Scope* inner_scope, ScopeType scope_type,
107 Handle<ScopeInfo> scope_info, AstValueFactory* value_factory) 106 Handle<ScopeInfo> scope_info, AstValueFactory* value_factory)
108 : inner_scopes_(4, zone), 107 : inner_scopes_(4, zone),
109 variables_(zone), 108 variables_(zone),
110 temps_(4, zone), 109 temps_(4, zone),
111 params_(4, zone), 110 params_(4, zone),
112 unresolved_(16, zone), 111 unresolved_(16, zone),
113 decls_(4, zone), 112 decls_(4, zone),
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 is_eval_scope() || is_function_scope() || 161 is_eval_scope() || is_function_scope() ||
163 is_module_scope() || is_script_scope(); 162 is_module_scope() || is_script_scope();
164 function_kind_ = function_kind; 163 function_kind_ = function_kind;
165 scope_name_ = ast_value_factory_->empty_string(); 164 scope_name_ = ast_value_factory_->empty_string();
166 dynamics_ = nullptr; 165 dynamics_ = nullptr;
167 receiver_ = nullptr; 166 receiver_ = nullptr;
168 new_target_ = nullptr; 167 new_target_ = nullptr;
169 function_ = nullptr; 168 function_ = nullptr;
170 arguments_ = nullptr; 169 arguments_ = nullptr;
171 this_function_ = nullptr; 170 this_function_ = nullptr;
172 illegal_redecl_ = nullptr;
173 scope_inside_with_ = false; 171 scope_inside_with_ = false;
174 scope_calls_eval_ = false; 172 scope_calls_eval_ = false;
175 scope_uses_arguments_ = false; 173 scope_uses_arguments_ = false;
176 scope_uses_super_property_ = false; 174 scope_uses_super_property_ = false;
177 asm_module_ = false; 175 asm_module_ = false;
178 asm_function_ = outer_scope != NULL && outer_scope->asm_module_; 176 asm_function_ = outer_scope != NULL && outer_scope->asm_module_;
179 // Inherit the language mode from the parent scope. 177 // Inherit the language mode from the parent scope.
180 language_mode_ = outer_scope != NULL ? outer_scope->language_mode_ : SLOPPY; 178 language_mode_ = outer_scope != NULL ? outer_scope->language_mode_ : SLOPPY;
181 outer_scope_calls_sloppy_eval_ = false; 179 outer_scope_calls_sloppy_eval_ = false;
182 inner_scope_calls_eval_ = false; 180 inner_scope_calls_eval_ = false;
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 } 564 }
567 return false; 565 return false;
568 } 566 }
569 567
570 568
571 void Scope::AddDeclaration(Declaration* declaration) { 569 void Scope::AddDeclaration(Declaration* declaration) {
572 decls_.Add(declaration, zone()); 570 decls_.Add(declaration, zone());
573 } 571 }
574 572
575 573
576 void Scope::SetIllegalRedeclaration(Expression* expression) {
577 // Record only the first illegal redeclaration.
578 if (!HasIllegalRedeclaration()) {
579 illegal_redecl_ = expression;
580 }
581 DCHECK(HasIllegalRedeclaration());
582 }
583
584
585 Expression* Scope::GetIllegalRedeclaration() {
586 DCHECK(HasIllegalRedeclaration());
587 return illegal_redecl_;
588 }
589
590
591 Declaration* Scope::CheckConflictingVarDeclarations() { 574 Declaration* Scope::CheckConflictingVarDeclarations() {
592 int length = decls_.length(); 575 int length = decls_.length();
593 for (int i = 0; i < length; i++) { 576 for (int i = 0; i < length; i++) {
594 Declaration* decl = decls_[i]; 577 Declaration* decl = decls_[i];
595 // We don't create a separate scope to hold the function name of a function 578 // We don't create a separate scope to hold the function name of a function
596 // expression, so we have to make sure not to consider it when checking for 579 // expression, so we have to make sure not to consider it when checking for
597 // conflicts (since it's conceptually "outside" the declaration scope). 580 // conflicts (since it's conceptually "outside" the declaration scope).
598 if (is_function_scope() && decl == function()) continue; 581 if (is_function_scope() && decl == function()) continue;
599 if (IsLexicalVariableMode(decl->mode()) && !is_block_scope()) continue; 582 if (IsLexicalVariableMode(decl->mode()) && !is_block_scope()) continue;
600 const AstRawString* name = decl->proxy()->raw_name(); 583 const AstRawString* name = decl->proxy()->raw_name();
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 function_ != NULL && function_->proxy()->var()->IsContextSlot(); 1500 function_ != NULL && function_->proxy()->var()->IsContextSlot();
1518 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - 1501 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() -
1519 (is_function_var_in_context ? 1 : 0); 1502 (is_function_var_in_context ? 1 : 0);
1520 } 1503 }
1521 1504
1522 1505
1523 int Scope::ContextGlobalCount() const { return num_global_slots(); } 1506 int Scope::ContextGlobalCount() const { return num_global_slots(); }
1524 1507
1525 } // namespace internal 1508 } // namespace internal
1526 } // namespace v8 1509 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/scopes.h ('k') | src/bailout-reason.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698