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_AST_H_ | 5 #ifndef V8_AST_AST_H_ |
6 #define V8_AST_AST_H_ | 6 #define V8_AST_AST_H_ |
7 | 7 |
8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/ast/ast-value-factory.h" | 9 #include "src/ast/ast-value-factory.h" |
10 #include "src/ast/modules.h" | 10 #include "src/ast/modules.h" |
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 | 1510 |
1511 Handle<FixedArray> constant_properties() const { | 1511 Handle<FixedArray> constant_properties() const { |
1512 return constant_properties_; | 1512 return constant_properties_; |
1513 } | 1513 } |
1514 int properties_count() const { return constant_properties_->length() / 2; } | 1514 int properties_count() const { return constant_properties_->length() / 2; } |
1515 ZoneList<Property*>* properties() const { return properties_; } | 1515 ZoneList<Property*>* properties() const { return properties_; } |
1516 bool fast_elements() const { return fast_elements_; } | 1516 bool fast_elements() const { return fast_elements_; } |
1517 bool may_store_doubles() const { return may_store_doubles_; } | 1517 bool may_store_doubles() const { return may_store_doubles_; } |
1518 bool has_function() const { return has_function_; } | 1518 bool has_function() const { return has_function_; } |
1519 bool has_elements() const { return has_elements_; } | 1519 bool has_elements() const { return has_elements_; } |
| 1520 bool has_shallow_properties() const { |
| 1521 return depth() == 1 && !has_elements() && !may_store_doubles(); |
| 1522 } |
1520 | 1523 |
1521 // Decide if a property should be in the object boilerplate. | 1524 // Decide if a property should be in the object boilerplate. |
1522 static bool IsBoilerplateProperty(Property* property); | 1525 static bool IsBoilerplateProperty(Property* property); |
1523 | 1526 |
1524 // Populate the constant properties fixed array. | 1527 // Populate the constant properties fixed array. |
1525 void BuildConstantProperties(Isolate* isolate); | 1528 void BuildConstantProperties(Isolate* isolate); |
1526 | 1529 |
1527 // Mark all computed expressions that are bound to a key that | 1530 // Mark all computed expressions that are bound to a key that |
1528 // is shadowed by a later occurrence of the same key. For the | 1531 // is shadowed by a later occurrence of the same key. For the |
1529 // marked expressions, no store code is emitted. | 1532 // marked expressions, no store code is emitted. |
1530 void CalculateEmitStore(Zone* zone); | 1533 void CalculateEmitStore(Zone* zone); |
1531 | 1534 |
1532 // Assemble bitfield of flags for the CreateObjectLiteral helper. | 1535 // Assemble bitfield of flags for the CreateObjectLiteral helper. |
1533 int ComputeFlags(bool disable_mementos = false) const { | 1536 int ComputeFlags(bool disable_mementos = false) const { |
1534 int flags = fast_elements() ? kFastElements : kNoFlags; | 1537 int flags = fast_elements() ? kFastElements : kNoFlags; |
1535 flags |= has_function() ? kHasFunction : kNoFlags; | 1538 flags |= has_function() ? kHasFunction : kNoFlags; |
1536 if (depth() == 1 && !has_elements() && !may_store_doubles()) { | 1539 if (has_shallow_properties()) { |
1537 flags |= kShallowProperties; | 1540 flags |= kShallowProperties; |
1538 } | 1541 } |
1539 if (disable_mementos) { | 1542 if (disable_mementos) { |
1540 flags |= kDisableMementos; | 1543 flags |= kDisableMementos; |
1541 } | 1544 } |
1542 if (is_strong()) { | 1545 if (is_strong()) { |
1543 flags |= kIsStrong; | 1546 flags |= kIsStrong; |
1544 } | 1547 } |
1545 return flags; | 1548 return flags; |
1546 } | 1549 } |
(...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3552 // the parser-level zone. | 3555 // the parser-level zone. |
3553 Zone* parser_zone_; | 3556 Zone* parser_zone_; |
3554 AstValueFactory* ast_value_factory_; | 3557 AstValueFactory* ast_value_factory_; |
3555 }; | 3558 }; |
3556 | 3559 |
3557 | 3560 |
3558 } // namespace internal | 3561 } // namespace internal |
3559 } // namespace v8 | 3562 } // namespace v8 |
3560 | 3563 |
3561 #endif // V8_AST_AST_H_ | 3564 #endif // V8_AST_AST_H_ |
OLD | NEW |