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

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

Issue 2277303002: Don't require a context for global dynamic variables (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | no next file » | 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/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 // introduced during variable allocation, and TEMPORARY variables are 705 // introduced during variable allocation, and TEMPORARY variables are
706 // allocated via NewTemporary(). 706 // allocated via NewTemporary().
707 DCHECK(IsDeclaredVariableMode(mode)); 707 DCHECK(IsDeclaredVariableMode(mode));
708 return Declare(zone(), this, name, mode, kind, init_flag, 708 return Declare(zone(), this, name, mode, kind, init_flag,
709 maybe_assigned_flag); 709 maybe_assigned_flag);
710 } 710 }
711 711
712 Variable* DeclarationScope::DeclareDynamicGlobal(const AstRawString* name, 712 Variable* DeclarationScope::DeclareDynamicGlobal(const AstRawString* name,
713 Variable::Kind kind) { 713 Variable::Kind kind) {
714 DCHECK(is_script_scope()); 714 DCHECK(is_script_scope());
715 return Declare(zone(), this, name, DYNAMIC_GLOBAL, kind, kCreatedInitialized); 715 return variables_.Declare(zone(), this, name, DYNAMIC_GLOBAL, kind,
716 kCreatedInitialized);
716 } 717 }
717 718
718 719
719 bool Scope::RemoveUnresolved(VariableProxy* var) { 720 bool Scope::RemoveUnresolved(VariableProxy* var) {
720 if (unresolved_ == var) { 721 if (unresolved_ == var) {
721 unresolved_ = var->next_unresolved(); 722 unresolved_ = var->next_unresolved();
722 var->set_next_unresolved(nullptr); 723 var->set_next_unresolved(nullptr);
723 return true; 724 return true;
724 } 725 }
725 VariableProxy* current = unresolved_; 726 VariableProxy* current = unresolved_;
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 function != nullptr && function->IsContextSlot(); 1667 function != nullptr && function->IsContextSlot();
1667 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - 1668 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() -
1668 (is_function_var_in_context ? 1 : 0); 1669 (is_function_var_in_context ? 1 : 0);
1669 } 1670 }
1670 1671
1671 1672
1672 int Scope::ContextGlobalCount() const { return num_global_slots(); } 1673 int Scope::ContextGlobalCount() const { return num_global_slots(); }
1673 1674
1674 } // namespace internal 1675 } // namespace internal
1675 } // namespace v8 1676 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698