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 2568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2579 kFinal // A return: { value: EXPRESSION, done: true } | 2579 kFinal // A return: { value: EXPRESSION, done: true } |
2580 }; | 2580 }; |
2581 | 2581 |
2582 Expression* generator_object() const { return generator_object_; } | 2582 Expression* generator_object() const { return generator_object_; } |
2583 Expression* expression() const { return expression_; } | 2583 Expression* expression() const { return expression_; } |
2584 Kind yield_kind() const { return yield_kind_; } | 2584 Kind yield_kind() const { return yield_kind_; } |
2585 | 2585 |
2586 void set_generator_object(Expression* e) { generator_object_ = e; } | 2586 void set_generator_object(Expression* e) { generator_object_ = e; } |
2587 void set_expression(Expression* e) { expression_ = e; } | 2587 void set_expression(Expression* e) { expression_ = e; } |
2588 | 2588 |
2589 // Type feedback information. | |
2590 bool HasFeedbackSlots() const { return yield_kind() == kDelegating; } | |
2591 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | |
2592 FeedbackVectorSlotCache* cache) override { | |
2593 if (HasFeedbackSlots()) { | |
2594 yield_first_feedback_slot_ = spec->AddKeyedLoadICSlot(); | |
2595 keyed_load_feedback_slot_ = spec->AddLoadICSlot(); | |
2596 done_feedback_slot_ = spec->AddLoadICSlot(); | |
2597 } | |
2598 } | |
2599 | |
2600 FeedbackVectorSlot KeyedLoadFeedbackSlot() { | |
2601 DCHECK(!HasFeedbackSlots() || !yield_first_feedback_slot_.IsInvalid()); | |
2602 return yield_first_feedback_slot_; | |
2603 } | |
2604 | |
2605 FeedbackVectorSlot DoneFeedbackSlot() { return keyed_load_feedback_slot_; } | |
2606 | |
2607 FeedbackVectorSlot ValueFeedbackSlot() { return done_feedback_slot_; } | |
2608 | |
2609 protected: | 2589 protected: |
2610 Yield(Zone* zone, Expression* generator_object, Expression* expression, | 2590 Yield(Zone* zone, Expression* generator_object, Expression* expression, |
2611 Kind yield_kind, int pos) | 2591 Kind yield_kind, int pos) |
2612 : Expression(zone, pos), | 2592 : Expression(zone, pos), |
2613 generator_object_(generator_object), | 2593 generator_object_(generator_object), |
2614 expression_(expression), | 2594 expression_(expression), |
2615 yield_kind_(yield_kind) {} | 2595 yield_kind_(yield_kind) {} |
2616 | 2596 |
2617 private: | 2597 private: |
2618 Expression* generator_object_; | 2598 Expression* generator_object_; |
2619 Expression* expression_; | 2599 Expression* expression_; |
2620 Kind yield_kind_; | 2600 Kind yield_kind_; |
2621 FeedbackVectorSlot yield_first_feedback_slot_; | |
2622 FeedbackVectorSlot keyed_load_feedback_slot_; | |
2623 FeedbackVectorSlot done_feedback_slot_; | |
2624 }; | 2601 }; |
2625 | 2602 |
2626 | 2603 |
2627 class Throw final : public Expression { | 2604 class Throw final : public Expression { |
2628 public: | 2605 public: |
2629 DECLARE_NODE_TYPE(Throw) | 2606 DECLARE_NODE_TYPE(Throw) |
2630 | 2607 |
2631 Expression* exception() const { return exception_; } | 2608 Expression* exception() const { return exception_; } |
2632 void set_exception(Expression* e) { exception_ = e; } | 2609 void set_exception(Expression* e) { exception_ = e; } |
2633 | 2610 |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3559 // the parser-level zone. | 3536 // the parser-level zone. |
3560 Zone* parser_zone_; | 3537 Zone* parser_zone_; |
3561 AstValueFactory* ast_value_factory_; | 3538 AstValueFactory* ast_value_factory_; |
3562 }; | 3539 }; |
3563 | 3540 |
3564 | 3541 |
3565 } // namespace internal | 3542 } // namespace internal |
3566 } // namespace v8 | 3543 } // namespace v8 |
3567 | 3544 |
3568 #endif // V8_AST_AST_H_ | 3545 #endif // V8_AST_AST_H_ |
OLD | NEW |