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

Side by Side Diff: src/ast/variables.h

Issue 1439693002: [runtime] Support Proxy setPrototypeOf trap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2015-11-09_new_Proxy_1417063011
Patch Set: merging with master Created 5 years 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/ast/scopes.cc ('k') | src/ast/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_AST_VARIABLES_H_ 5 #ifndef V8_AST_VARIABLES_H_
6 #define V8_AST_VARIABLES_H_ 6 #define V8_AST_VARIABLES_H_
7 7
8 #include "src/ast/ast-value-factory.h" 8 #include "src/ast/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, ARGUMENTS }; 23 enum Kind { NORMAL, FUNCTION, CLASS, THIS, ARGUMENTS };
24 24
25 Variable(Scope* scope, const AstRawString* name, VariableMode mode, Kind kind, 25 Variable(Scope* scope, const AstRawString* name, VariableMode mode, Kind kind,
26 InitializationFlag initialization_flag, 26 InitializationFlag initialization_flag,
27 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned); 27 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned);
28 28
29 virtual ~Variable() {} 29 virtual ~Variable() {}
30 30
31 // Printing support 31 // Printing support
32 static const char* Mode2String(VariableMode mode); 32 static const char* Mode2String(VariableMode mode);
33 33
34 // The source code for an eval() call may refer to a variable that is 34 // The source code for an eval() call may refer to a variable that is
35 // in an outer scope about which we don't know anything (it may not 35 // in an outer scope about which we don't know anything (it may not
36 // be the script scope). scope() is NULL in that case. Currently the 36 // be the script scope). scope() is NULL in that case. Currently the
37 // scope is only used to follow the context chain length. 37 // scope is only used to follow the context chain length.
38 Scope* scope() const { return scope_; } 38 Scope* scope() const { return scope_; }
39 39
40 Handle<String> name() const { return name_->string(); } 40 Handle<String> name() const { return name_->string(); }
41 const AstRawString* raw_name() const { return name_; } 41 const AstRawString* raw_name() const { return name_; }
42 VariableMode mode() const { return mode_; } 42 VariableMode mode() const { return mode_; }
43 bool has_forced_context_allocation() const { 43 bool has_forced_context_allocation() const {
44 return force_context_allocation_; 44 return force_context_allocation_;
45 } 45 }
46 void ForceContextAllocation() { 46 void ForceContextAllocation() { force_context_allocation_ = true; }
47 force_context_allocation_ = true;
48 }
49 bool is_used() { return is_used_; } 47 bool is_used() { return is_used_; }
50 void set_is_used() { is_used_ = true; } 48 void set_is_used() { is_used_ = true; }
51 MaybeAssignedFlag maybe_assigned() const { return maybe_assigned_; } 49 MaybeAssignedFlag maybe_assigned() const { return maybe_assigned_; }
52 void set_maybe_assigned() { maybe_assigned_ = kMaybeAssigned; } 50 void set_maybe_assigned() { maybe_assigned_ = kMaybeAssigned; }
53 51
54 int initializer_position() { return initializer_position_; } 52 int initializer_position() { return initializer_position_; }
55 void set_initializer_position(int pos) { initializer_position_ = pos; } 53 void set_initializer_position(int pos) { initializer_position_ = pos; }
56 54
57 bool IsVariable(Handle<String> n) const { 55 bool IsVariable(Handle<String> n) const {
58 return !is_this() && name().is_identical_to(n); 56 return !is_this() && name().is_identical_to(n);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 private: 203 private:
206 // For classes we keep track of consecutive groups of delcarations. They are 204 // For classes we keep track of consecutive groups of delcarations. They are
207 // needed for strong mode scoping checks. TODO(marja, rossberg): Implement 205 // needed for strong mode scoping checks. TODO(marja, rossberg): Implement
208 // checks for functions too. 206 // checks for functions too.
209 int declaration_group_start_; 207 int declaration_group_start_;
210 }; 208 };
211 } // namespace internal 209 } // namespace internal
212 } // namespace v8 210 } // namespace v8
213 211
214 #endif // V8_AST_VARIABLES_H_ 212 #endif // V8_AST_VARIABLES_H_
OLDNEW
« no previous file with comments | « src/ast/scopes.cc ('k') | src/ast/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698