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

Side by Side Diff: src/variables.h

Issue 918373002: Strip Interface class of most of its logic, make it all about Module exports (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Properly freeze interface at the end of ParseModule Created 5 years, 10 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/typing.cc ('k') | src/variables.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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_VARIABLES_H_ 5 #ifndef V8_VARIABLES_H_
6 #define V8_VARIABLES_H_ 6 #define V8_VARIABLES_H_
7 7
8 #include "src/ast-value-factory.h" 8 #include "src/ast-value-factory.h"
9 #include "src/interface.h"
10 #include "src/zone.h" 9 #include "src/zone.h"
11 10
12 namespace v8 { 11 namespace v8 {
13 namespace internal { 12 namespace internal {
14 13
15 // The AST refers to variables via VariableProxies - placeholders for the actual 14 // The AST refers to variables via VariableProxies - placeholders for the actual
16 // variables. Variables themselves are never directly referred to from the AST, 15 // variables. Variables themselves are never directly referred to from the AST,
17 // they are maintained by scopes, and referred to from VariableProxies and Slots 16 // they are maintained by scopes, and referred to from VariableProxies and Slots
18 // after binding and variable allocation. 17 // after binding and variable allocation.
19 18
(...skipping 23 matching lines...) Expand all
43 CONTEXT, 42 CONTEXT,
44 43
45 // A named slot in a heap context. name() is the variable name in the 44 // A named slot in a heap context. name() is the variable name in the
46 // context object on the heap, with lookup starting at the current 45 // context object on the heap, with lookup starting at the current
47 // context. index() is invalid. 46 // context. index() is invalid.
48 LOOKUP 47 LOOKUP
49 }; 48 };
50 49
51 Variable(Scope* scope, const AstRawString* name, VariableMode mode, 50 Variable(Scope* scope, const AstRawString* name, VariableMode mode,
52 bool is_valid_ref, Kind kind, InitializationFlag initialization_flag, 51 bool is_valid_ref, Kind kind, InitializationFlag initialization_flag,
53 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned, 52 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned);
54 Interface* interface = Interface::NewValue());
55 53
56 // Printing support 54 // Printing support
57 static const char* Mode2String(VariableMode mode); 55 static const char* Mode2String(VariableMode mode);
58 56
59 bool IsValidReference() { return is_valid_ref_; } 57 bool IsValidReference() { return is_valid_ref_; }
60 58
61 // The source code for an eval() call may refer to a variable that is 59 // The source code for an eval() call may refer to a variable that is
62 // in an outer scope about which we don't know anything (it may not 60 // in an outer scope about which we don't know anything (it may not
63 // be the script scope). scope() is NULL in that case. Currently the 61 // be the script scope). scope() is NULL in that case. Currently the
64 // scope is only used to follow the context chain length. 62 // scope is only used to follow the context chain length.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 114
117 void set_local_if_not_shadowed(Variable* local) { 115 void set_local_if_not_shadowed(Variable* local) {
118 local_if_not_shadowed_ = local; 116 local_if_not_shadowed_ = local;
119 } 117 }
120 118
121 Location location() const { return location_; } 119 Location location() const { return location_; }
122 int index() const { return index_; } 120 int index() const { return index_; }
123 InitializationFlag initialization_flag() const { 121 InitializationFlag initialization_flag() const {
124 return initialization_flag_; 122 return initialization_flag_;
125 } 123 }
126 Interface* interface() const { return interface_; }
127 124
128 void AllocateTo(Location location, int index) { 125 void AllocateTo(Location location, int index) {
129 location_ = location; 126 location_ = location;
130 index_ = index; 127 index_ = index;
131 } 128 }
132 129
133 static int CompareIndex(Variable* const* v, Variable* const* w); 130 static int CompareIndex(Variable* const* v, Variable* const* w);
134 131
135 private: 132 private:
136 Scope* scope_; 133 Scope* scope_;
(...skipping 11 matching lines...) Expand all
148 Variable* local_if_not_shadowed_; 145 Variable* local_if_not_shadowed_;
149 146
150 // Valid as a reference? (const and this are not valid, for example) 147 // Valid as a reference? (const and this are not valid, for example)
151 bool is_valid_ref_; 148 bool is_valid_ref_;
152 149
153 // Usage info. 150 // Usage info.
154 bool force_context_allocation_; // set by variable resolver 151 bool force_context_allocation_; // set by variable resolver
155 bool is_used_; 152 bool is_used_;
156 InitializationFlag initialization_flag_; 153 InitializationFlag initialization_flag_;
157 MaybeAssignedFlag maybe_assigned_; 154 MaybeAssignedFlag maybe_assigned_;
158
159 // Module type info.
160 Interface* interface_;
161 }; 155 };
162 156
163 157
164 } } // namespace v8::internal 158 } } // namespace v8::internal
165 159
166 #endif // V8_VARIABLES_H_ 160 #endif // V8_VARIABLES_H_
OLDNEW
« no previous file with comments | « src/typing.cc ('k') | src/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698