OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 bool IsValidLeftHandSide() { return is_valid_LHS_; } | 85 bool IsValidLeftHandSide() { return is_valid_LHS_; } |
86 | 86 |
87 // The source code for an eval() call may refer to a variable that is | 87 // The source code for an eval() call may refer to a variable that is |
88 // in an outer scope about which we don't know anything (it may not | 88 // in an outer scope about which we don't know anything (it may not |
89 // be the global scope). scope() is NULL in that case. Currently the | 89 // be the global scope). scope() is NULL in that case. Currently the |
90 // scope is only used to follow the context chain length. | 90 // scope is only used to follow the context chain length. |
91 Scope* scope() const { return scope_; } | 91 Scope* scope() const { return scope_; } |
92 | 92 |
93 Handle<String> name() const { return name_; } | 93 Handle<String> name() const { return name_; } |
94 VariableMode mode() const { return mode_; } | 94 VariableMode mode() const { return mode_; } |
95 bool is_accessed_from_inner_scope() const { | 95 bool has_forced_context_allocation() const { |
96 return is_accessed_from_inner_scope_; | 96 return force_context_allocation_; |
97 } | 97 } |
98 void MarkAsAccessedFromInnerScope() { | 98 void ForceContextAllocation() { |
99 ASSERT(mode_ != TEMPORARY); | 99 ASSERT(mode_ != TEMPORARY); |
100 is_accessed_from_inner_scope_ = true; | 100 force_context_allocation_ = true; |
101 } | 101 } |
102 bool is_used() { return is_used_; } | 102 bool is_used() { return is_used_; } |
103 void set_is_used(bool flag) { is_used_ = flag; } | 103 void set_is_used(bool flag) { is_used_ = flag; } |
104 | 104 |
105 bool IsVariable(Handle<String> n) const { | 105 bool IsVariable(Handle<String> n) const { |
106 return !is_this() && name().is_identical_to(n); | 106 return !is_this() && name().is_identical_to(n); |
107 } | 107 } |
108 | 108 |
109 bool IsUnallocated() const { return location_ == UNALLOCATED; } | 109 bool IsUnallocated() const { return location_ == UNALLOCATED; } |
110 bool IsParameter() const { return location_ == PARAMETER; } | 110 bool IsParameter() const { return location_ == PARAMETER; } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // If this field is set, this variable references the stored locally bound | 165 // If this field is set, this variable references the stored locally bound |
166 // variable, but it might be shadowed by variable bindings introduced by | 166 // variable, but it might be shadowed by variable bindings introduced by |
167 // non-strict 'eval' calls between the reference scope (inclusive) and the | 167 // non-strict 'eval' calls between the reference scope (inclusive) and the |
168 // binding scope (exclusive). | 168 // binding scope (exclusive). |
169 Variable* local_if_not_shadowed_; | 169 Variable* local_if_not_shadowed_; |
170 | 170 |
171 // Valid as a LHS? (const and this are not valid LHS, for example) | 171 // Valid as a LHS? (const and this are not valid LHS, for example) |
172 bool is_valid_LHS_; | 172 bool is_valid_LHS_; |
173 | 173 |
174 // Usage info. | 174 // Usage info. |
175 bool is_accessed_from_inner_scope_; // set by variable resolver | 175 bool force_context_allocation_; // set by variable resolver |
176 bool is_used_; | 176 bool is_used_; |
177 }; | 177 }; |
178 | 178 |
179 | 179 |
180 } } // namespace v8::internal | 180 } } // namespace v8::internal |
181 | 181 |
182 #endif // V8_VARIABLES_H_ | 182 #endif // V8_VARIABLES_H_ |
OLD | NEW |