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

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

Issue 2312683002: Include only stuff you need, part 7: Fix scopes.h -> ast.h. (Closed)
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 | « src/ast/scopes.h ('k') | src/compilation-info.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/bootstrapper.h" 11 #include "src/bootstrapper.h"
11 #include "src/messages.h" 12 #include "src/messages.h"
12 #include "src/parsing/parse-info.h" 13 #include "src/parsing/parse-info.h"
13 14
14 namespace v8 { 15 namespace v8 {
15 namespace internal { 16 namespace internal {
16 17
17 // ---------------------------------------------------------------------------- 18 // ----------------------------------------------------------------------------
18 // Implementation of LocalsMap 19 // Implementation of LocalsMap
19 // 20 //
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 // 834 //
834 // This will lead to multiple declaration nodes for the 835 // This will lead to multiple declaration nodes for the
835 // same variable if it is declared several times. This is not a 836 // same variable if it is declared several times. This is not a
836 // semantic issue, but it may be a performance issue since it may 837 // semantic issue, but it may be a performance issue since it may
837 // lead to repeated DeclareEvalVar or DeclareEvalFunction calls. 838 // lead to repeated DeclareEvalVar or DeclareEvalFunction calls.
838 decls_.Add(declaration, zone()); 839 decls_.Add(declaration, zone());
839 proxy->BindTo(var); 840 proxy->BindTo(var);
840 return var; 841 return var;
841 } 842 }
842 843
844 VariableProxy* Scope::NewUnresolved(AstNodeFactory* factory,
845 const AstRawString* name,
846 int start_position, int end_position,
847 Variable::Kind kind) {
848 // Note that we must not share the unresolved variables with
849 // the same name because they may be removed selectively via
850 // RemoveUnresolved().
851 DCHECK(!already_resolved_);
852 DCHECK_EQ(factory->zone(), zone());
853 VariableProxy* proxy =
854 factory->NewVariableProxy(name, kind, start_position, end_position);
855 proxy->set_next_unresolved(unresolved_);
856 unresolved_ = proxy;
857 return proxy;
858 }
859
860 void Scope::AddUnresolved(VariableProxy* proxy) {
861 DCHECK(!already_resolved_);
862 DCHECK(!proxy->is_resolved());
863 proxy->set_next_unresolved(unresolved_);
864 unresolved_ = proxy;
865 }
866
843 Variable* DeclarationScope::DeclareDynamicGlobal(const AstRawString* name, 867 Variable* DeclarationScope::DeclareDynamicGlobal(const AstRawString* name,
844 Variable::Kind kind) { 868 Variable::Kind kind) {
845 DCHECK(is_script_scope()); 869 DCHECK(is_script_scope());
846 return variables_.Declare(zone(), this, name, DYNAMIC_GLOBAL, kind, 870 return variables_.Declare(zone(), this, name, DYNAMIC_GLOBAL, kind,
847 kCreatedInitialized); 871 kCreatedInitialized);
848 } 872 }
849 873
850 874
851 bool Scope::RemoveUnresolved(VariableProxy* var) { 875 bool Scope::RemoveUnresolved(VariableProxy* var) {
852 if (unresolved_ == var) { 876 if (unresolved_ == var) {
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
1687 Variable* function = 1711 Variable* function =
1688 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; 1712 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr;
1689 bool is_function_var_in_context = 1713 bool is_function_var_in_context =
1690 function != nullptr && function->IsContextSlot(); 1714 function != nullptr && function->IsContextSlot();
1691 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 1715 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
1692 (is_function_var_in_context ? 1 : 0); 1716 (is_function_var_in_context ? 1 : 0);
1693 } 1717 }
1694 1718
1695 } // namespace internal 1719 } // namespace internal
1696 } // namespace v8 1720 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/scopes.h ('k') | src/compilation-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698