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 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback, rebase and "git cl format" Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/v8.cc ('k') | src/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_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"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // the context object on the heap, starting at 0. scope() is the 45 // the context object on the heap, starting at 0. scope() is the
46 // corresponding scope. 46 // corresponding scope.
47 CONTEXT, 47 CONTEXT,
48 48
49 // A named slot in a heap context. name() is the variable name in the 49 // A named slot in a heap context. name() is the variable name in the
50 // context object on the heap, with lookup starting at the current 50 // context object on the heap, with lookup starting at the current
51 // context. index() is invalid. 51 // context. index() is invalid.
52 LOOKUP 52 LOOKUP
53 }; 53 };
54 54
55 Variable(Scope* scope, 55 Variable(Scope* scope, const AstRawString* name, VariableMode mode,
56 const AstRawString* name, 56 bool is_valid_ref, Kind kind, InitializationFlag initialization_flag,
57 VariableMode mode, 57 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned,
58 bool is_valid_ref,
59 Kind kind,
60 InitializationFlag initialization_flag,
61 Interface* interface = Interface::NewValue()); 58 Interface* interface = Interface::NewValue());
62 59
63 // Printing support 60 // Printing support
64 static const char* Mode2String(VariableMode mode); 61 static const char* Mode2String(VariableMode mode);
65 62
66 bool IsValidReference() { return is_valid_ref_; } 63 bool IsValidReference() { return is_valid_ref_; }
67 64
68 // The source code for an eval() call may refer to a variable that is 65 // The source code for an eval() call may refer to a variable that is
69 // in an outer scope about which we don't know anything (it may not 66 // in an outer scope about which we don't know anything (it may not
70 // be the global scope). scope() is NULL in that case. Currently the 67 // be the global scope). scope() is NULL in that case. Currently the
71 // scope is only used to follow the context chain length. 68 // scope is only used to follow the context chain length.
72 Scope* scope() const { return scope_; } 69 Scope* scope() const { return scope_; }
73 70
74 Handle<String> name() const { return name_->string(); } 71 Handle<String> name() const { return name_->string(); }
75 const AstRawString* raw_name() const { return name_; } 72 const AstRawString* raw_name() const { return name_; }
76 VariableMode mode() const { return mode_; } 73 VariableMode mode() const { return mode_; }
77 bool has_forced_context_allocation() const { 74 bool has_forced_context_allocation() const {
78 return force_context_allocation_; 75 return force_context_allocation_;
79 } 76 }
80 void ForceContextAllocation() { 77 void ForceContextAllocation() {
81 ASSERT(mode_ != TEMPORARY); 78 ASSERT(mode_ != TEMPORARY);
82 force_context_allocation_ = true; 79 force_context_allocation_ = true;
83 } 80 }
84 bool is_used() { return is_used_; } 81 bool is_used() { return is_used_; }
85 void set_is_used() { is_used_ = true; } 82 void set_is_used() { is_used_ = true; }
86 bool maybe_assigned() { return maybe_assigned_; } 83 MaybeAssignedFlag maybe_assigned() const { return maybe_assigned_; }
87 void set_maybe_assigned() { maybe_assigned_ = true; } 84 void set_maybe_assigned() { maybe_assigned_ = kMaybeAssigned; }
88 85
89 int initializer_position() { return initializer_position_; } 86 int initializer_position() { return initializer_position_; }
90 void set_initializer_position(int pos) { initializer_position_ = pos; } 87 void set_initializer_position(int pos) { initializer_position_ = pos; }
91 88
92 bool IsVariable(Handle<String> n) const { 89 bool IsVariable(Handle<String> n) const {
93 return !is_this() && name().is_identical_to(n); 90 return !is_this() && name().is_identical_to(n);
94 } 91 }
95 92
96 bool IsUnallocated() const { return location_ == UNALLOCATED; } 93 bool IsUnallocated() const { return location_ == UNALLOCATED; }
97 bool IsParameter() const { return location_ == PARAMETER; } 94 bool IsParameter() const { return location_ == PARAMETER; }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // sloppy 'eval' calls between the reference scope (inclusive) and the 149 // sloppy 'eval' calls between the reference scope (inclusive) and the
153 // binding scope (exclusive). 150 // binding scope (exclusive).
154 Variable* local_if_not_shadowed_; 151 Variable* local_if_not_shadowed_;
155 152
156 // Valid as a reference? (const and this are not valid, for example) 153 // Valid as a reference? (const and this are not valid, for example)
157 bool is_valid_ref_; 154 bool is_valid_ref_;
158 155
159 // Usage info. 156 // Usage info.
160 bool force_context_allocation_; // set by variable resolver 157 bool force_context_allocation_; // set by variable resolver
161 bool is_used_; 158 bool is_used_;
162 bool maybe_assigned_;
163 InitializationFlag initialization_flag_; 159 InitializationFlag initialization_flag_;
160 MaybeAssignedFlag maybe_assigned_;
164 161
165 // Module type info. 162 // Module type info.
166 Interface* interface_; 163 Interface* interface_;
167 }; 164 };
168 165
169 166
170 } } // namespace v8::internal 167 } } // namespace v8::internal
171 168
172 #endif // V8_VARIABLES_H_ 169 #endif // V8_VARIABLES_H_
OLDNEW
« no previous file with comments | « src/v8.cc ('k') | src/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698