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

Side by Side Diff: src/variables.h

Issue 911363002: Revert of new classes: implement new.target passing to superclass constructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/scopes.cc ('k') | src/x64/builtins-x64.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" 9 #include "src/interface.h"
10 #include "src/zone.h" 10 #include "src/zone.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 // The AST refers to variables via VariableProxies - placeholders for the actual 15 // The AST refers to variables via VariableProxies - placeholders for the actual
16 // variables. Variables themselves are never directly referred to from the AST, 16 // variables. Variables themselves are never directly referred to from the AST,
17 // they are maintained by scopes, and referred to from VariableProxies and Slots 17 // they are maintained by scopes, and referred to from VariableProxies and Slots
18 // after binding and variable allocation. 18 // after binding and variable allocation.
19 19
20 class Variable: public ZoneObject { 20 class Variable: public ZoneObject {
21 public: 21 public:
22 enum Kind { NORMAL, THIS, NEW_TARGET, ARGUMENTS }; 22 enum Kind {
23 NORMAL,
24 THIS,
25 ARGUMENTS
26 };
23 27
24 enum Location { 28 enum Location {
25 // Before and during variable allocation, a variable whose location is 29 // Before and during variable allocation, a variable whose location is
26 // not yet determined. After allocation, a variable looked up as a 30 // not yet determined. After allocation, a variable looked up as a
27 // property on the global object (and possibly absent). name() is the 31 // property on the global object (and possibly absent). name() is the
28 // variable name, index() is invalid. 32 // variable name, index() is invalid.
29 UNALLOCATED, 33 UNALLOCATED,
30 34
31 // A slot in the parameter section on the stack. index() is the 35 // A slot in the parameter section on the stack. index() is the
32 // parameter index, counting left-to-right. The receiver is index -1; 36 // parameter index, counting left-to-right. The receiver is index -1;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 bool IsLookupSlot() const { return location_ == LOOKUP; } 98 bool IsLookupSlot() const { return location_ == LOOKUP; }
95 bool IsGlobalObjectProperty() const; 99 bool IsGlobalObjectProperty() const;
96 100
97 bool is_dynamic() const { return IsDynamicVariableMode(mode_); } 101 bool is_dynamic() const { return IsDynamicVariableMode(mode_); }
98 bool is_const_mode() const { return IsImmutableVariableMode(mode_); } 102 bool is_const_mode() const { return IsImmutableVariableMode(mode_); }
99 bool binding_needs_init() const { 103 bool binding_needs_init() const {
100 return initialization_flag_ == kNeedsInitialization; 104 return initialization_flag_ == kNeedsInitialization;
101 } 105 }
102 106
103 bool is_this() const { return kind_ == THIS; } 107 bool is_this() const { return kind_ == THIS; }
104 bool is_new_target() const { return kind_ == NEW_TARGET; }
105 bool is_arguments() const { return kind_ == ARGUMENTS; } 108 bool is_arguments() const { return kind_ == ARGUMENTS; }
106 109
107 // True if the variable is named eval and not known to be shadowed. 110 // True if the variable is named eval and not known to be shadowed.
108 bool is_possibly_eval(Isolate* isolate) const { 111 bool is_possibly_eval(Isolate* isolate) const {
109 return IsVariable(isolate->factory()->eval_string()); 112 return IsVariable(isolate->factory()->eval_string());
110 } 113 }
111 114
112 Variable* local_if_not_shadowed() const { 115 Variable* local_if_not_shadowed() const {
113 DCHECK(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL); 116 DCHECK(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL);
114 return local_if_not_shadowed_; 117 return local_if_not_shadowed_;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 MaybeAssignedFlag maybe_assigned_; 160 MaybeAssignedFlag maybe_assigned_;
158 161
159 // Module type info. 162 // Module type info.
160 Interface* interface_; 163 Interface* interface_;
161 }; 164 };
162 165
163 166
164 } } // namespace v8::internal 167 } } // namespace v8::internal
165 168
166 #endif // V8_VARIABLES_H_ 169 #endif // V8_VARIABLES_H_
OLDNEW
« no previous file with comments | « src/scopes.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698