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

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

Issue 2457393003: Thread decls-list through Declaration (Closed)
Patch Set: rebase Created 4 years, 1 month 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/prettyprinter.cc ('k') | src/ast/scopes.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 #ifndef V8_AST_SCOPES_H_ 5 #ifndef V8_AST_SCOPES_H_
6 #define V8_AST_SCOPES_H_ 6 #define V8_AST_SCOPES_H_
7 7
8 #include "src/base/compiler-specific.h" 8 #include "src/base/compiler-specific.h"
9 #include "src/base/hashmap.h" 9 #include "src/base/hashmap.h"
10 #include "src/globals.h" 10 #include "src/globals.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 public: 90 public:
91 explicit Snapshot(Scope* scope); 91 explicit Snapshot(Scope* scope);
92 92
93 void Reparent(DeclarationScope* new_parent) const; 93 void Reparent(DeclarationScope* new_parent) const;
94 94
95 private: 95 private:
96 Scope* outer_scope_; 96 Scope* outer_scope_;
97 Scope* top_inner_scope_; 97 Scope* top_inner_scope_;
98 VariableProxy* top_unresolved_; 98 VariableProxy* top_unresolved_;
99 int top_local_; 99 int top_local_;
100 int top_decl_; 100 ThreadedList<Declaration>::Iterator top_decl_;
101 }; 101 };
102 102
103 enum class DeserializationMode { kIncludingVariables, kScopesOnly }; 103 enum class DeserializationMode { kIncludingVariables, kScopesOnly };
104 104
105 static Scope* DeserializeScopeChain(Isolate* isolate, Zone* zone, 105 static Scope* DeserializeScopeChain(Isolate* isolate, Zone* zone,
106 ScopeInfo* scope_info, 106 ScopeInfo* scope_info,
107 DeclarationScope* script_scope, 107 DeclarationScope* script_scope,
108 AstValueFactory* ast_value_factory, 108 AstValueFactory* ast_value_factory,
109 DeserializationMode deserialization_mode); 109 DeserializationMode deserialization_mode);
110 110
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 InitializationFlag init_flag, VariableKind kind, 146 InitializationFlag init_flag, VariableKind kind,
147 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned); 147 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned);
148 148
149 Variable* DeclareVariable(Declaration* declaration, VariableMode mode, 149 Variable* DeclareVariable(Declaration* declaration, VariableMode mode,
150 InitializationFlag init, 150 InitializationFlag init,
151 bool allow_harmony_restrictive_generators, 151 bool allow_harmony_restrictive_generators,
152 bool* sloppy_mode_block_scope_function_redefinition, 152 bool* sloppy_mode_block_scope_function_redefinition,
153 bool* ok); 153 bool* ok);
154 154
155 // Declarations list. 155 // Declarations list.
156 ZoneList<Declaration*>* declarations() { return &decls_; } 156 ThreadedList<Declaration>* declarations() { return &decls_; }
157 157
158 ZoneList<Variable*>* locals() { return &locals_; } 158 ZoneList<Variable*>* locals() { return &locals_; }
159 159
160 // Create a new unresolved variable. 160 // Create a new unresolved variable.
161 VariableProxy* NewUnresolved(AstNodeFactory* factory, 161 VariableProxy* NewUnresolved(AstNodeFactory* factory,
162 const AstRawString* name, 162 const AstRawString* name,
163 int start_position = kNoSourcePosition, 163 int start_position = kNoSourcePosition,
164 VariableKind kind = NORMAL_VARIABLE); 164 VariableKind kind = NORMAL_VARIABLE);
165 165
166 void AddUnresolved(VariableProxy* proxy); 166 void AddUnresolved(VariableProxy* proxy);
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 // an inner scope) with no intervening with statements or eval calls. 458 // an inner scope) with no intervening with statements or eval calls.
459 VariableMap variables_; 459 VariableMap variables_;
460 // In case of non-scopeinfo-backed scopes, this contains the variables of the 460 // In case of non-scopeinfo-backed scopes, this contains the variables of the
461 // map above in order of addition. 461 // map above in order of addition.
462 // TODO(verwaest): Thread through Variable. 462 // TODO(verwaest): Thread through Variable.
463 ZoneList<Variable*> locals_; 463 ZoneList<Variable*> locals_;
464 // Unresolved variables referred to from this scope. The proxies themselves 464 // Unresolved variables referred to from this scope. The proxies themselves
465 // form a linked list of all unresolved proxies. 465 // form a linked list of all unresolved proxies.
466 VariableProxy* unresolved_; 466 VariableProxy* unresolved_;
467 // Declarations. 467 // Declarations.
468 ZoneList<Declaration*> decls_; 468 ThreadedList<Declaration> decls_;
469 469
470 // Serialized scope info support. 470 // Serialized scope info support.
471 Handle<ScopeInfo> scope_info_; 471 Handle<ScopeInfo> scope_info_;
472 // Debugging support. 472 // Debugging support.
473 #ifdef DEBUG 473 #ifdef DEBUG
474 const AstRawString* scope_name_; 474 const AstRawString* scope_name_;
475 475
476 // True if it doesn't need scope resolution (e.g., if the scope was 476 // True if it doesn't need scope resolution (e.g., if the scope was
477 // constructed based on a serialized scope info or a catch context). 477 // constructed based on a serialized scope info or a catch context).
478 bool already_resolved_; 478 bool already_resolved_;
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 void AllocateModuleVariables(); 867 void AllocateModuleVariables();
868 868
869 private: 869 private:
870 ModuleDescriptor* module_descriptor_; 870 ModuleDescriptor* module_descriptor_;
871 }; 871 };
872 872
873 } // namespace internal 873 } // namespace internal
874 } // namespace v8 874 } // namespace v8
875 875
876 #endif // V8_AST_SCOPES_H_ 876 #endif // V8_AST_SCOPES_H_
OLDNEW
« no previous file with comments | « src/ast/prettyprinter.cc ('k') | src/ast/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698