OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_H_ | 5 #ifndef V8_AST_H_ |
6 #define V8_AST_H_ | 6 #define V8_AST_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 | 1500 |
1501 // Mark all computed expressions that are bound to a key that | 1501 // Mark all computed expressions that are bound to a key that |
1502 // is shadowed by a later occurrence of the same key. For the | 1502 // is shadowed by a later occurrence of the same key. For the |
1503 // marked expressions, no store code is emitted. | 1503 // marked expressions, no store code is emitted. |
1504 void CalculateEmitStore(Zone* zone); | 1504 void CalculateEmitStore(Zone* zone); |
1505 | 1505 |
1506 // Assemble bitfield of flags for the CreateObjectLiteral helper. | 1506 // Assemble bitfield of flags for the CreateObjectLiteral helper. |
1507 int ComputeFlags(bool disable_mementos = false) const { | 1507 int ComputeFlags(bool disable_mementos = false) const { |
1508 int flags = fast_elements() ? kFastElements : kNoFlags; | 1508 int flags = fast_elements() ? kFastElements : kNoFlags; |
1509 flags |= has_function() ? kHasFunction : kNoFlags; | 1509 flags |= has_function() ? kHasFunction : kNoFlags; |
| 1510 if (depth() == 1 && !has_elements() && !may_store_doubles()) { |
| 1511 flags |= kShallowProperties; |
| 1512 } |
1510 if (disable_mementos) { | 1513 if (disable_mementos) { |
1511 flags |= kDisableMementos; | 1514 flags |= kDisableMementos; |
1512 } | 1515 } |
1513 return flags; | 1516 return flags; |
1514 } | 1517 } |
1515 | 1518 |
1516 enum Flags { | 1519 enum Flags { |
1517 kNoFlags = 0, | 1520 kNoFlags = 0, |
1518 kFastElements = 1, | 1521 kFastElements = 1, |
1519 kHasFunction = 1 << 1, | 1522 kHasFunction = 1 << 1, |
1520 kDisableMementos = 1 << 2 | 1523 kShallowProperties = 1 << 2, |
| 1524 kDisableMementos = 1 << 3 |
1521 }; | 1525 }; |
1522 | 1526 |
1523 struct Accessors: public ZoneObject { | 1527 struct Accessors: public ZoneObject { |
1524 Accessors() : getter(NULL), setter(NULL) {} | 1528 Accessors() : getter(NULL), setter(NULL) {} |
1525 Expression* getter; | 1529 Expression* getter; |
1526 Expression* setter; | 1530 Expression* setter; |
1527 }; | 1531 }; |
1528 | 1532 |
1529 BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); } | 1533 BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); } |
1530 | 1534 |
(...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3582 | 3586 |
3583 private: | 3587 private: |
3584 Zone* zone_; | 3588 Zone* zone_; |
3585 AstValueFactory* ast_value_factory_; | 3589 AstValueFactory* ast_value_factory_; |
3586 }; | 3590 }; |
3587 | 3591 |
3588 | 3592 |
3589 } } // namespace v8::internal | 3593 } } // namespace v8::internal |
3590 | 3594 |
3591 #endif // V8_AST_H_ | 3595 #endif // V8_AST_H_ |
OLD | NEW |