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

Side by Side Diff: src/variables.h

Issue 908883002: new classes: implement new.target passing to superclass constructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix x64 arithmetic 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 { 22 enum Kind { NORMAL, THIS, NEW_TARGET, ARGUMENTS };
23 NORMAL,
24 THIS,
25 ARGUMENTS
26 };
27 23
28 enum Location { 24 enum Location {
29 // Before and during variable allocation, a variable whose location is 25 // Before and during variable allocation, a variable whose location is
30 // not yet determined. After allocation, a variable looked up as a 26 // not yet determined. After allocation, a variable looked up as a
31 // property on the global object (and possibly absent). name() is the 27 // property on the global object (and possibly absent). name() is the
32 // variable name, index() is invalid. 28 // variable name, index() is invalid.
33 UNALLOCATED, 29 UNALLOCATED,
34 30
35 // A slot in the parameter section on the stack. index() is the 31 // A slot in the parameter section on the stack. index() is the
36 // parameter index, counting left-to-right. The receiver is index -1; 32 // parameter index, counting left-to-right. The receiver is index -1;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 bool IsLookupSlot() const { return location_ == LOOKUP; } 94 bool IsLookupSlot() const { return location_ == LOOKUP; }
99 bool IsGlobalObjectProperty() const; 95 bool IsGlobalObjectProperty() const;
100 96
101 bool is_dynamic() const { return IsDynamicVariableMode(mode_); } 97 bool is_dynamic() const { return IsDynamicVariableMode(mode_); }
102 bool is_const_mode() const { return IsImmutableVariableMode(mode_); } 98 bool is_const_mode() const { return IsImmutableVariableMode(mode_); }
103 bool binding_needs_init() const { 99 bool binding_needs_init() const {
104 return initialization_flag_ == kNeedsInitialization; 100 return initialization_flag_ == kNeedsInitialization;
105 } 101 }
106 102
107 bool is_this() const { return kind_ == THIS; } 103 bool is_this() const { return kind_ == THIS; }
104 bool is_new_target() const { return kind_ == NEW_TARGET; }
108 bool is_arguments() const { return kind_ == ARGUMENTS; } 105 bool is_arguments() const { return kind_ == ARGUMENTS; }
109 106
110 // True if the variable is named eval and not known to be shadowed. 107 // True if the variable is named eval and not known to be shadowed.
111 bool is_possibly_eval(Isolate* isolate) const { 108 bool is_possibly_eval(Isolate* isolate) const {
112 return IsVariable(isolate->factory()->eval_string()); 109 return IsVariable(isolate->factory()->eval_string());
113 } 110 }
114 111
115 Variable* local_if_not_shadowed() const { 112 Variable* local_if_not_shadowed() const {
116 DCHECK(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL); 113 DCHECK(mode_ == DYNAMIC_LOCAL && local_if_not_shadowed_ != NULL);
117 return local_if_not_shadowed_; 114 return local_if_not_shadowed_;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 MaybeAssignedFlag maybe_assigned_; 157 MaybeAssignedFlag maybe_assigned_;
161 158
162 // Module type info. 159 // Module type info.
163 Interface* interface_; 160 Interface* interface_;
164 }; 161 };
165 162
166 163
167 } } // namespace v8::internal 164 } } // namespace v8::internal
168 165
169 #endif // V8_VARIABLES_H_ 166 #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