OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 262 |
263 // Will ToInt32 (ECMA 262-3 9.5) or ToUint32 (ECMA 262-3 9.6) | 263 // Will ToInt32 (ECMA 262-3 9.5) or ToUint32 (ECMA 262-3 9.6) |
264 // be applied to the value of this expression? | 264 // be applied to the value of this expression? |
265 // If so, we may be able to optimize the calculation of the value. | 265 // If so, we may be able to optimize the calculation of the value. |
266 bool to_int32() { return ToInt32Field::decode(bitfields_); } | 266 bool to_int32() { return ToInt32Field::decode(bitfields_); } |
267 void set_to_int32(bool to_int32) { | 267 void set_to_int32(bool to_int32) { |
268 bitfields_ &= ~ToInt32Field::mask(); | 268 bitfields_ &= ~ToInt32Field::mask(); |
269 bitfields_ |= ToInt32Field::encode(to_int32); | 269 bitfields_ |= ToInt32Field::encode(to_int32); |
270 } | 270 } |
271 | 271 |
| 272 // How many bitwise logical or shift operators are used in this expression? |
| 273 int num_bit_ops() { return NumBitOpsField::decode(bitfields_); } |
| 274 void set_num_bit_ops(int num_bit_ops) { |
| 275 bitfields_ &= ~NumBitOpsField::mask(); |
| 276 num_bit_ops = Min(num_bit_ops, kMaxNumBitOps); |
| 277 bitfields_ |= NumBitOpsField::encode(num_bit_ops); |
| 278 } |
| 279 |
272 | 280 |
273 private: | 281 private: |
| 282 static const int kMaxNumBitOps = (1 << 5) - 1; |
| 283 |
274 uint32_t bitfields_; | 284 uint32_t bitfields_; |
275 StaticType type_; | 285 StaticType type_; |
276 | 286 |
277 DefinitionInfo* def_; | 287 DefinitionInfo* def_; |
278 ZoneList<DefinitionInfo*>* defined_vars_; | 288 ZoneList<DefinitionInfo*>* defined_vars_; |
279 | 289 |
280 // Using template BitField<type, start, size>. | 290 // Using template BitField<type, start, size>. |
281 class SideEffectFreeField : public BitField<bool, 0, 1> {}; | 291 class SideEffectFreeField : public BitField<bool, 0, 1> {}; |
282 class NoNegativeZeroField : public BitField<bool, 1, 1> {}; | 292 class NoNegativeZeroField : public BitField<bool, 1, 1> {}; |
283 class ToInt32Field : public BitField<bool, 2, 1> {}; | 293 class ToInt32Field : public BitField<bool, 2, 1> {}; |
| 294 class NumBitOpsField : public BitField<int, 3, 5> {}; |
284 }; | 295 }; |
285 | 296 |
286 | 297 |
287 /** | 298 /** |
288 * A sentinel used during pre parsing that represents some expression | 299 * A sentinel used during pre parsing that represents some expression |
289 * that is a valid left hand side without having to actually build | 300 * that is a valid left hand side without having to actually build |
290 * the expression. | 301 * the expression. |
291 */ | 302 */ |
292 class ValidLeftHandSideSentinel: public Expression { | 303 class ValidLeftHandSideSentinel: public Expression { |
293 public: | 304 public: |
(...skipping 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1993 #undef DEF_VISIT | 2004 #undef DEF_VISIT |
1994 | 2005 |
1995 private: | 2006 private: |
1996 bool stack_overflow_; | 2007 bool stack_overflow_; |
1997 }; | 2008 }; |
1998 | 2009 |
1999 | 2010 |
2000 } } // namespace v8::internal | 2011 } } // namespace v8::internal |
2001 | 2012 |
2002 #endif // V8_AST_H_ | 2013 #endif // V8_AST_H_ |
OLD | NEW |