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

Side by Side Diff: src/variables.h

Issue 1168513004: [es6] Super call in arrows and eval (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Push this_function earlier Created 5 years, 6 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/x64/full-codegen-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/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 ClassVariable; 19 class ClassVariable;
20 20
21 class Variable: public ZoneObject { 21 class Variable: public ZoneObject {
22 public: 22 public:
23 enum Kind { NORMAL, FUNCTION, CLASS, THIS, NEW_TARGET, ARGUMENTS }; 23 enum Kind { NORMAL, FUNCTION, CLASS, THIS, ARGUMENTS };
24 24
25 enum Location { 25 enum Location {
26 // Before and during variable allocation, a variable whose location is 26 // Before and during variable allocation, a variable whose location is
27 // not yet determined. After allocation, a variable looked up as a 27 // not yet determined. After allocation, a variable looked up as a
28 // property on the global object (and possibly absent). name() is the 28 // property on the global object (and possibly absent). name() is the
29 // variable name, index() is invalid. 29 // variable name, index() is invalid.
30 UNALLOCATED, 30 UNALLOCATED,
31 31
32 // A slot in the parameter section on the stack. index() is the 32 // A slot in the parameter section on the stack. index() is the
33 // parameter index, counting left-to-right. The receiver is index -1; 33 // parameter index, counting left-to-right. The receiver is index -1;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 bool is_dynamic() const { return IsDynamicVariableMode(mode_); } 97 bool is_dynamic() const { return IsDynamicVariableMode(mode_); }
98 bool is_const_mode() const { return IsImmutableVariableMode(mode_); } 98 bool is_const_mode() const { return IsImmutableVariableMode(mode_); }
99 bool binding_needs_init() const { 99 bool binding_needs_init() const {
100 return initialization_flag_ == kNeedsInitialization; 100 return initialization_flag_ == kNeedsInitialization;
101 } 101 }
102 102
103 bool is_function() const { return kind_ == FUNCTION; } 103 bool is_function() const { return kind_ == FUNCTION; }
104 bool is_class() const { return kind_ == CLASS; } 104 bool is_class() const { return kind_ == CLASS; }
105 bool is_this() const { return kind_ == THIS; } 105 bool is_this() const { return kind_ == THIS; }
106 bool is_new_target() const { return kind_ == NEW_TARGET; }
107 bool is_arguments() const { return kind_ == ARGUMENTS; } 106 bool is_arguments() const { return kind_ == ARGUMENTS; }
108 107
109 ClassVariable* AsClassVariable() { 108 ClassVariable* AsClassVariable() {
110 DCHECK(is_class()); 109 DCHECK(is_class());
111 return reinterpret_cast<ClassVariable*>(this); 110 return reinterpret_cast<ClassVariable*>(this);
112 } 111 }
113 112
114 // True if the variable is named eval and not known to be shadowed. 113 // True if the variable is named eval and not known to be shadowed.
115 bool is_possibly_eval(Isolate* isolate) const { 114 bool is_possibly_eval(Isolate* isolate) const {
116 return IsVariable(isolate->factory()->eval_string()); 115 return IsVariable(isolate->factory()->eval_string());
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 200
202 private: 201 private:
203 // For classes we keep track of consecutive groups of delcarations. They are 202 // For classes we keep track of consecutive groups of delcarations. They are
204 // needed for strong mode scoping checks. TODO(marja, rossberg): Implement 203 // needed for strong mode scoping checks. TODO(marja, rossberg): Implement
205 // checks for functions too. 204 // checks for functions too.
206 int declaration_group_start_; 205 int declaration_group_start_;
207 }; 206 };
208 } } // namespace v8::internal 207 } } // namespace v8::internal
209 208
210 #endif // V8_VARIABLES_H_ 209 #endif // V8_VARIABLES_H_
OLDNEW
« no previous file with comments | « src/typing.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698