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

Side by Side Diff: src/variables.h

Issue 1087543004: [strong] Allow mutually recursive classes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: . Created 5 years, 8 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/scopes.cc ('k') | test/mjsunit/strong/declaration-after-use.js » ('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/zone.h" 9 #include "src/zone.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 // The AST refers to variables via VariableProxies - placeholders for the actual 14 // The AST refers to variables via VariableProxies - placeholders for the actual
15 // variables. Variables themselves are never directly referred to from the AST, 15 // variables. Variables themselves are never directly referred to from the AST,
16 // 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
17 // after binding and variable allocation. 17 // after binding and variable allocation.
18 18
19 class Variable: public ZoneObject { 19 class Variable: public ZoneObject {
20 public: 20 public:
21 enum Kind { NORMAL, FUNCTION, THIS, NEW_TARGET, ARGUMENTS }; 21 enum Kind { NORMAL, FUNCTION, CLASS, THIS, NEW_TARGET, ARGUMENTS };
22 22
23 enum Location { 23 enum Location {
24 // Before and during variable allocation, a variable whose location is 24 // Before and during variable allocation, a variable whose location is
25 // not yet determined. After allocation, a variable looked up as a 25 // not yet determined. After allocation, a variable looked up as a
26 // property on the global object (and possibly absent). name() is the 26 // property on the global object (and possibly absent). name() is the
27 // variable name, index() is invalid. 27 // variable name, index() is invalid.
28 UNALLOCATED, 28 UNALLOCATED,
29 29
30 // A slot in the parameter section on the stack. index() is the 30 // A slot in the parameter section on the stack. index() is the
31 // parameter index, counting left-to-right. The receiver is index -1; 31 // parameter index, counting left-to-right. The receiver is index -1;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 bool IsLookupSlot() const { return location_ == LOOKUP; } 90 bool IsLookupSlot() const { return location_ == LOOKUP; }
91 bool IsGlobalObjectProperty() const; 91 bool IsGlobalObjectProperty() const;
92 92
93 bool is_dynamic() const { return IsDynamicVariableMode(mode_); } 93 bool is_dynamic() const { return IsDynamicVariableMode(mode_); }
94 bool is_const_mode() const { return IsImmutableVariableMode(mode_); } 94 bool is_const_mode() const { return IsImmutableVariableMode(mode_); }
95 bool binding_needs_init() const { 95 bool binding_needs_init() const {
96 return initialization_flag_ == kNeedsInitialization; 96 return initialization_flag_ == kNeedsInitialization;
97 } 97 }
98 98
99 bool is_function() const { return kind_ == FUNCTION; } 99 bool is_function() const { return kind_ == FUNCTION; }
100 bool is_class() const { return kind_ == CLASS; }
100 bool is_this() const { return kind_ == THIS; } 101 bool is_this() const { return kind_ == THIS; }
101 bool is_new_target() const { return kind_ == NEW_TARGET; } 102 bool is_new_target() const { return kind_ == NEW_TARGET; }
102 bool is_arguments() const { return kind_ == ARGUMENTS; } 103 bool is_arguments() const { return kind_ == ARGUMENTS; }
103 104
104 // True if the variable is named eval and not known to be shadowed. 105 // True if the variable is named eval and not known to be shadowed.
105 bool is_possibly_eval(Isolate* isolate) const { 106 bool is_possibly_eval(Isolate* isolate) const {
106 return IsVariable(isolate->factory()->eval_string()); 107 return IsVariable(isolate->factory()->eval_string());
107 } 108 }
108 109
109 Variable* local_if_not_shadowed() const { 110 Variable* local_if_not_shadowed() const {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 bool force_context_allocation_; // set by variable resolver 172 bool force_context_allocation_; // set by variable resolver
172 bool is_used_; 173 bool is_used_;
173 InitializationFlag initialization_flag_; 174 InitializationFlag initialization_flag_;
174 MaybeAssignedFlag maybe_assigned_; 175 MaybeAssignedFlag maybe_assigned_;
175 }; 176 };
176 177
177 178
178 } } // namespace v8::internal 179 } } // namespace v8::internal
179 180
180 #endif // V8_VARIABLES_H_ 181 #endif // V8_VARIABLES_H_
OLDNEW
« no previous file with comments | « src/scopes.cc ('k') | test/mjsunit/strong/declaration-after-use.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698