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/ast/ast-types.h" | 8 #include "src/ast/ast-types.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 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1436 struct Accessors: public ZoneObject { | 1436 struct Accessors: public ZoneObject { |
1437 Accessors() : getter(NULL), setter(NULL), bailout_id(BailoutId::None()) {} | 1437 Accessors() : getter(NULL), setter(NULL), bailout_id(BailoutId::None()) {} |
1438 ObjectLiteralProperty* getter; | 1438 ObjectLiteralProperty* getter; |
1439 ObjectLiteralProperty* setter; | 1439 ObjectLiteralProperty* setter; |
1440 BailoutId bailout_id; | 1440 BailoutId bailout_id; |
1441 }; | 1441 }; |
1442 | 1442 |
1443 BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); } | 1443 BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); } |
1444 | 1444 |
1445 // Return an AST id for a property that is used in simulate instructions. | 1445 // Return an AST id for a property that is used in simulate instructions. |
1446 BailoutId GetIdForPropertyName(int i) { | 1446 BailoutId GetIdForPropertySet(int i) { return BailoutId(local_id(i + 1)); } |
1447 return BailoutId(local_id(2 * i + 1)); | |
1448 } | |
1449 BailoutId GetIdForPropertySet(int i) { | |
1450 return BailoutId(local_id(2 * i + 2)); | |
1451 } | |
1452 | 1447 |
1453 // Unlike other AST nodes, this number of bailout IDs allocated for an | 1448 // Unlike other AST nodes, this number of bailout IDs allocated for an |
1454 // ObjectLiteral can vary, so num_ids() is not a static method. | 1449 // ObjectLiteral can vary, so num_ids() is not a static method. |
1455 int num_ids() const { | 1450 int num_ids() const { return parent_num_ids() + 1 + properties()->length(); } |
1456 return parent_num_ids() + 1 + 2 * properties()->length(); | |
1457 } | |
1458 | 1451 |
1459 // Object literals need one feedback slot for each non-trivial value, as well | 1452 // Object literals need one feedback slot for each non-trivial value, as well |
1460 // as some slots for home objects. | 1453 // as some slots for home objects. |
1461 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 1454 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
1462 FeedbackVectorSlotCache* cache); | 1455 FeedbackVectorSlotCache* cache); |
1463 | 1456 |
1464 private: | 1457 private: |
1465 friend class AstNodeFactory; | 1458 friend class AstNodeFactory; |
1466 | 1459 |
1467 ObjectLiteral(ZoneList<Property*>* properties, int literal_index, | 1460 ObjectLiteral(ZoneList<Property*>* properties, int literal_index, |
(...skipping 2110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3578 : NULL; \ | 3571 : NULL; \ |
3579 } | 3572 } |
3580 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3573 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3581 #undef DECLARE_NODE_FUNCTIONS | 3574 #undef DECLARE_NODE_FUNCTIONS |
3582 | 3575 |
3583 | 3576 |
3584 } // namespace internal | 3577 } // namespace internal |
3585 } // namespace v8 | 3578 } // namespace v8 |
3586 | 3579 |
3587 #endif // V8_AST_AST_H_ | 3580 #endif // V8_AST_AST_H_ |
OLD | NEW |