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 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1147 } | 1147 } |
1148 | 1148 |
1149 virtual bool IsInlineable() const; | 1149 virtual bool IsInlineable() const; |
1150 | 1150 |
1151 bool IsVariable(Handle<String> n) { | 1151 bool IsVariable(Handle<String> n) { |
1152 return !is_this() && name().is_identical_to(n); | 1152 return !is_this() && name().is_identical_to(n); |
1153 } | 1153 } |
1154 | 1154 |
1155 bool IsArguments() { return var_ != NULL && var_->is_arguments(); } | 1155 bool IsArguments() { return var_ != NULL && var_->is_arguments(); } |
1156 | 1156 |
1157 bool IsLValue() { | |
1158 return is_lvalue_; | |
1159 } | |
1160 | |
1157 Handle<String> name() const { return name_; } | 1161 Handle<String> name() const { return name_; } |
1158 Variable* var() const { return var_; } | 1162 Variable* var() const { return var_; } |
1159 bool is_this() const { return is_this_; } | 1163 bool is_this() const { return is_this_; } |
1160 int position() const { return position_; } | 1164 int position() const { return position_; } |
1161 | 1165 |
1162 void MarkAsTrivial() { is_trivial_ = true; } | 1166 void MarkAsTrivial() { is_trivial_ = true; } |
1167 void MarkAsLValue() { is_lvalue_ = true; } | |
1163 | 1168 |
1164 // Bind this proxy to the variable var. | 1169 // Bind this proxy to the variable var. |
1165 void BindTo(Variable* var); | 1170 void BindTo(Variable* var); |
1166 | 1171 |
1167 protected: | 1172 protected: |
1168 Handle<String> name_; | 1173 Handle<String> name_; |
1169 Variable* var_; // resolved variable, or NULL | 1174 Variable* var_; // resolved variable, or NULL |
1170 bool is_this_; | 1175 bool is_this_; |
1171 bool is_trivial_; | 1176 bool is_trivial_; |
1177 // True if this variable proxy is being used in an assignment | |
1178 // or with a increment/decrement operator. | |
1179 bool is_lvalue_; | |
fschneider
2011/12/05 13:30:05
Please make sure the instance size (sizeof) for Va
Steven
2011/12/05 14:41:10
Still 28 bytes on arm, ia32 and 40 bytes on x64.
| |
1172 int position_; | 1180 int position_; |
1173 | 1181 |
1174 VariableProxy(Isolate* isolate, | 1182 VariableProxy(Isolate* isolate, |
1175 Handle<String> name, | 1183 Handle<String> name, |
1176 bool is_this, | 1184 bool is_this, |
1177 int position = RelocInfo::kNoPosition); | 1185 int position = RelocInfo::kNoPosition); |
1178 | 1186 |
1179 friend class Scope; | 1187 friend class Scope; |
1180 }; | 1188 }; |
1181 | 1189 |
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2176 | 2184 |
2177 private: | 2185 private: |
2178 Isolate* isolate_; | 2186 Isolate* isolate_; |
2179 bool stack_overflow_; | 2187 bool stack_overflow_; |
2180 }; | 2188 }; |
2181 | 2189 |
2182 | 2190 |
2183 } } // namespace v8::internal | 2191 } } // namespace v8::internal |
2184 | 2192 |
2185 #endif // V8_AST_H_ | 2193 #endif // V8_AST_H_ |
OLD | NEW |