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-types.h" | 9 #include "src/ast/ast-types.h" |
10 #include "src/ast/ast-value-factory.h" | 10 #include "src/ast/ast-value-factory.h" |
(...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1462 | 1462 |
1463 // Object literals need one feedback slot for each non-trivial value, as well | 1463 // Object literals need one feedback slot for each non-trivial value, as well |
1464 // as some slots for home objects. | 1464 // as some slots for home objects. |
1465 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 1465 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
1466 FeedbackVectorSlotCache* cache); | 1466 FeedbackVectorSlotCache* cache); |
1467 | 1467 |
1468 private: | 1468 private: |
1469 friend class AstNodeFactory; | 1469 friend class AstNodeFactory; |
1470 | 1470 |
1471 ObjectLiteral(ZoneList<Property*>* properties, int literal_index, | 1471 ObjectLiteral(ZoneList<Property*>* properties, int literal_index, |
1472 uint32_t boilerplate_properties, int pos) | 1472 uint32_t boilerplate_properties, uint32_t total_properties, |
| 1473 int pos) |
1473 : MaterializedLiteral(literal_index, pos, kObjectLiteral), | 1474 : MaterializedLiteral(literal_index, pos, kObjectLiteral), |
1474 boilerplate_properties_(boilerplate_properties), | 1475 boilerplate_properties_(boilerplate_properties), |
| 1476 total_properties_(total_properties), |
1475 properties_(properties) { | 1477 properties_(properties) { |
1476 bit_field_ |= FastElementsField::encode(false) | | 1478 bit_field_ |= FastElementsField::encode(false) | |
1477 HasElementsField::encode(false) | | 1479 HasElementsField::encode(false) | |
1478 MayStoreDoublesField::encode(false); | 1480 MayStoreDoublesField::encode(false); |
1479 } | 1481 } |
1480 | 1482 |
1481 static int parent_num_ids() { return MaterializedLiteral::num_ids(); } | 1483 static int parent_num_ids() { return MaterializedLiteral::num_ids(); } |
1482 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1484 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
1483 | 1485 |
1484 uint32_t boilerplate_properties_; | 1486 uint32_t boilerplate_properties_; |
| 1487 // Includes properties with computed names. |
| 1488 uint32_t total_properties_; |
1485 Handle<FixedArray> constant_properties_; | 1489 Handle<FixedArray> constant_properties_; |
1486 ZoneList<Property*>* properties_; | 1490 ZoneList<Property*>* properties_; |
1487 | 1491 |
1488 class FastElementsField | 1492 class FastElementsField |
1489 : public BitField<bool, MaterializedLiteral::kNextBitFieldIndex, 1> {}; | 1493 : public BitField<bool, MaterializedLiteral::kNextBitFieldIndex, 1> {}; |
1490 class HasElementsField : public BitField<bool, FastElementsField::kNext, 1> { | 1494 class HasElementsField : public BitField<bool, FastElementsField::kNext, 1> { |
1491 }; | 1495 }; |
1492 class MayStoreDoublesField | 1496 class MayStoreDoublesField |
1493 : public BitField<bool, HasElementsField::kNext, 1> {}; | 1497 : public BitField<bool, HasElementsField::kNext, 1> {}; |
1494 }; | 1498 }; |
(...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3322 Literal* NewUndefinedLiteral(int pos) { | 3326 Literal* NewUndefinedLiteral(int pos) { |
3323 return new (zone_) Literal(ast_value_factory_->NewUndefined(), pos); | 3327 return new (zone_) Literal(ast_value_factory_->NewUndefined(), pos); |
3324 } | 3328 } |
3325 | 3329 |
3326 Literal* NewTheHoleLiteral(int pos) { | 3330 Literal* NewTheHoleLiteral(int pos) { |
3327 return new (zone_) Literal(ast_value_factory_->NewTheHole(), pos); | 3331 return new (zone_) Literal(ast_value_factory_->NewTheHole(), pos); |
3328 } | 3332 } |
3329 | 3333 |
3330 ObjectLiteral* NewObjectLiteral( | 3334 ObjectLiteral* NewObjectLiteral( |
3331 ZoneList<ObjectLiteral::Property*>* properties, int literal_index, | 3335 ZoneList<ObjectLiteral::Property*>* properties, int literal_index, |
3332 uint32_t boilerplate_properties, int pos) { | 3336 uint32_t boilerplate_properties, uint32_t total_properties, int pos) { |
3333 return new (zone_) | 3337 return new (zone_) |
3334 ObjectLiteral(properties, literal_index, boilerplate_properties, pos); | 3338 ObjectLiteral(properties, literal_index, boilerplate_properties, |
| 3339 total_properties, pos); |
3335 } | 3340 } |
3336 | 3341 |
3337 ObjectLiteral::Property* NewObjectLiteralProperty( | 3342 ObjectLiteral::Property* NewObjectLiteralProperty( |
3338 Expression* key, Expression* value, ObjectLiteralProperty::Kind kind, | 3343 Expression* key, Expression* value, ObjectLiteralProperty::Kind kind, |
3339 bool is_computed_name) { | 3344 bool is_computed_name) { |
3340 return new (zone_) | 3345 return new (zone_) |
3341 ObjectLiteral::Property(key, value, kind, is_computed_name); | 3346 ObjectLiteral::Property(key, value, kind, is_computed_name); |
3342 } | 3347 } |
3343 | 3348 |
3344 ObjectLiteral::Property* NewObjectLiteralProperty(Expression* key, | 3349 ObjectLiteral::Property* NewObjectLiteralProperty(Expression* key, |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3639 : NULL; \ | 3644 : NULL; \ |
3640 } | 3645 } |
3641 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3646 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3642 #undef DECLARE_NODE_FUNCTIONS | 3647 #undef DECLARE_NODE_FUNCTIONS |
3643 | 3648 |
3644 | 3649 |
3645 } // namespace internal | 3650 } // namespace internal |
3646 } // namespace v8 | 3651 } // namespace v8 |
3647 | 3652 |
3648 #endif // V8_AST_AST_H_ | 3653 #endif // V8_AST_AST_H_ |
OLD | NEW |