| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ |
| 6 #define VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define VM_INTERMEDIATE_LANGUAGE_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 2640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2651 | 2651 |
| 2652 private: | 2652 private: |
| 2653 const Field& field_; | 2653 const Field& field_; |
| 2654 | 2654 |
| 2655 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr); | 2655 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr); |
| 2656 }; | 2656 }; |
| 2657 | 2657 |
| 2658 | 2658 |
| 2659 class LoadIndexedInstr : public TemplateDefinition<2> { | 2659 class LoadIndexedInstr : public TemplateDefinition<2> { |
| 2660 public: | 2660 public: |
| 2661 LoadIndexedInstr(Value* array, Value* index) { | 2661 LoadIndexedInstr(Value* array, Value* index, intptr_t class_id) |
| 2662 : class_id_(class_id) { |
| 2662 ASSERT(array != NULL); | 2663 ASSERT(array != NULL); |
| 2663 ASSERT(index != NULL); | 2664 ASSERT(index != NULL); |
| 2664 inputs_[0] = array; | 2665 inputs_[0] = array; |
| 2665 inputs_[1] = index; | 2666 inputs_[1] = index; |
| 2666 } | 2667 } |
| 2667 | 2668 |
| 2668 DECLARE_INSTRUCTION(LoadIndexed) | 2669 DECLARE_INSTRUCTION(LoadIndexed) |
| 2669 virtual RawAbstractType* CompileType() const; | 2670 virtual RawAbstractType* CompileType() const; |
| 2670 | 2671 |
| 2671 Value* array() const { return inputs_[0]; } | 2672 Value* array() const { return inputs_[0]; } |
| 2672 Value* index() const { return inputs_[1]; } | 2673 Value* index() const { return inputs_[1]; } |
| 2674 intptr_t class_id() const { return class_id_; } |
| 2673 | 2675 |
| 2674 virtual bool CanDeoptimize() const { return false; } | 2676 virtual bool CanDeoptimize() const { return false; } |
| 2675 | 2677 |
| 2676 virtual bool HasSideEffect() const { return false; } | 2678 virtual bool HasSideEffect() const { return false; } |
| 2677 | 2679 |
| 2678 virtual intptr_t ResultCid() const { return kDynamicCid; } | 2680 virtual intptr_t ResultCid() const; |
| 2681 |
| 2682 virtual Representation representation() const; |
| 2679 | 2683 |
| 2680 private: | 2684 private: |
| 2685 const intptr_t class_id_; |
| 2686 |
| 2681 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr); | 2687 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr); |
| 2682 }; | 2688 }; |
| 2683 | 2689 |
| 2684 | 2690 |
| 2685 class StoreIndexedInstr : public TemplateDefinition<3> { | 2691 class StoreIndexedInstr : public TemplateDefinition<3> { |
| 2686 public: | 2692 public: |
| 2687 StoreIndexedInstr(Value* array, | 2693 StoreIndexedInstr(Value* array, |
| 2688 Value* index, | 2694 Value* index, |
| 2689 Value* value, | 2695 Value* value, |
| 2690 bool emit_store_barrier) | 2696 bool emit_store_barrier, |
| 2691 : emit_store_barrier_(emit_store_barrier) { | 2697 intptr_t class_id, |
| 2698 intptr_t deopt_id) |
| 2699 : emit_store_barrier_(emit_store_barrier), |
| 2700 class_id_(class_id), |
| 2701 deopt_id_(deopt_id) { |
| 2692 ASSERT(array != NULL); | 2702 ASSERT(array != NULL); |
| 2693 ASSERT(index != NULL); | 2703 ASSERT(index != NULL); |
| 2694 ASSERT(value != NULL); | 2704 ASSERT(value != NULL); |
| 2695 inputs_[0] = array; | 2705 inputs_[0] = array; |
| 2696 inputs_[1] = index; | 2706 inputs_[1] = index; |
| 2697 inputs_[2] = value; | 2707 inputs_[2] = value; |
| 2698 } | 2708 } |
| 2699 | 2709 |
| 2700 DECLARE_INSTRUCTION(StoreIndexed) | 2710 DECLARE_INSTRUCTION(StoreIndexed) |
| 2701 virtual RawAbstractType* CompileType() const; | 2711 virtual RawAbstractType* CompileType() const; |
| 2702 | 2712 |
| 2703 Value* array() const { return inputs_[0]; } | 2713 Value* array() const { return inputs_[0]; } |
| 2704 Value* index() const { return inputs_[1]; } | 2714 Value* index() const { return inputs_[1]; } |
| 2705 Value* value() const { return inputs_[2]; } | 2715 Value* value() const { return inputs_[2]; } |
| 2716 intptr_t class_id() const { return class_id_; } |
| 2706 | 2717 |
| 2707 bool ShouldEmitStoreBarrier() const { | 2718 bool ShouldEmitStoreBarrier() const { |
| 2708 return value()->NeedsStoreBuffer() && emit_store_barrier_; | 2719 return value()->NeedsStoreBuffer() && emit_store_barrier_; |
| 2709 } | 2720 } |
| 2710 | 2721 |
| 2711 virtual bool CanDeoptimize() const { return false; } | 2722 virtual bool CanDeoptimize() const { return false; } |
| 2712 | 2723 |
| 2713 virtual bool HasSideEffect() const { return true; } | 2724 virtual bool HasSideEffect() const { return true; } |
| 2714 | 2725 |
| 2715 virtual intptr_t ResultCid() const { return kDynamicCid; } | 2726 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 2716 | 2727 |
| 2728 virtual Representation RequiredInputRepresentation(intptr_t idx) const; |
| 2729 |
| 2730 virtual intptr_t DeoptimizationTarget() const { |
| 2731 // Direct access since this instruction cannot deoptimize, and the deopt-id |
| 2732 // was inherited from another instruction that could deoptimize. |
| 2733 return deopt_id_; |
| 2734 } |
| 2735 |
| 2717 private: | 2736 private: |
| 2718 const bool emit_store_barrier_; | 2737 const bool emit_store_barrier_; |
| 2738 const intptr_t class_id_; |
| 2739 const intptr_t deopt_id_; |
| 2719 | 2740 |
| 2720 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr); | 2741 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr); |
| 2721 }; | 2742 }; |
| 2722 | 2743 |
| 2723 | 2744 |
| 2724 // Note overrideable, built-in: value? false : true. | 2745 // Note overrideable, built-in: value? false : true. |
| 2725 class BooleanNegateInstr : public TemplateDefinition<1> { | 2746 class BooleanNegateInstr : public TemplateDefinition<1> { |
| 2726 public: | 2747 public: |
| 2727 explicit BooleanNegateInstr(Value* value) { | 2748 explicit BooleanNegateInstr(Value* value) { |
| 2728 ASSERT(value != NULL); | 2749 ASSERT(value != NULL); |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3440 virtual Representation representation() const { | 3461 virtual Representation representation() const { |
| 3441 return kUnboxedDouble; | 3462 return kUnboxedDouble; |
| 3442 } | 3463 } |
| 3443 | 3464 |
| 3444 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3465 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3445 ASSERT(idx == 0); | 3466 ASSERT(idx == 0); |
| 3446 return kUnboxedDouble; | 3467 return kUnboxedDouble; |
| 3447 } | 3468 } |
| 3448 | 3469 |
| 3449 virtual intptr_t DeoptimizationTarget() const { | 3470 virtual intptr_t DeoptimizationTarget() const { |
| 3450 // Direct access since this instuction cannot deoptimize, and the deopt-id | 3471 // Direct access since this instruction cannot deoptimize, and the deopt-id |
| 3451 // was inherited from another instuction that could deoptimize. | 3472 // was inherited from another instruction that could deoptimize. |
| 3452 return deopt_id_; | 3473 return deopt_id_; |
| 3453 } | 3474 } |
| 3454 | 3475 |
| 3455 DECLARE_INSTRUCTION(MathSqrt) | 3476 DECLARE_INSTRUCTION(MathSqrt) |
| 3456 virtual RawAbstractType* CompileType() const; | 3477 virtual RawAbstractType* CompileType() const; |
| 3457 | 3478 |
| 3458 private: | 3479 private: |
| 3459 DISALLOW_COPY_AND_ASSIGN(MathSqrtInstr); | 3480 DISALLOW_COPY_AND_ASSIGN(MathSqrtInstr); |
| 3460 }; | 3481 }; |
| 3461 | 3482 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3496 virtual Representation representation() const { | 3517 virtual Representation representation() const { |
| 3497 return kUnboxedDouble; | 3518 return kUnboxedDouble; |
| 3498 } | 3519 } |
| 3499 | 3520 |
| 3500 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3521 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3501 ASSERT((idx == 0) || (idx == 1)); | 3522 ASSERT((idx == 0) || (idx == 1)); |
| 3502 return kUnboxedDouble; | 3523 return kUnboxedDouble; |
| 3503 } | 3524 } |
| 3504 | 3525 |
| 3505 virtual intptr_t DeoptimizationTarget() const { | 3526 virtual intptr_t DeoptimizationTarget() const { |
| 3506 // Direct access since this instuction cannot deoptimize, and the deopt-id | 3527 // Direct access since this instruction cannot deoptimize, and the deopt-id |
| 3507 // was inherited from another instuction that could deoptimize. | 3528 // was inherited from another instruction that could deoptimize. |
| 3508 return deopt_id_; | 3529 return deopt_id_; |
| 3509 } | 3530 } |
| 3510 | 3531 |
| 3511 DECLARE_INSTRUCTION(BinaryDoubleOp) | 3532 DECLARE_INSTRUCTION(BinaryDoubleOp) |
| 3512 virtual RawAbstractType* CompileType() const; | 3533 virtual RawAbstractType* CompileType() const; |
| 3513 | 3534 |
| 3514 private: | 3535 private: |
| 3515 const Token::Kind op_kind_; | 3536 const Token::Kind op_kind_; |
| 3516 | 3537 |
| 3517 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr); | 3538 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3557 virtual Representation representation() const { | 3578 virtual Representation representation() const { |
| 3558 return kUnboxedMint; | 3579 return kUnboxedMint; |
| 3559 } | 3580 } |
| 3560 | 3581 |
| 3561 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3582 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3562 ASSERT((idx == 0) || (idx == 1)); | 3583 ASSERT((idx == 0) || (idx == 1)); |
| 3563 return kUnboxedMint; | 3584 return kUnboxedMint; |
| 3564 } | 3585 } |
| 3565 | 3586 |
| 3566 virtual intptr_t DeoptimizationTarget() const { | 3587 virtual intptr_t DeoptimizationTarget() const { |
| 3567 // Direct access since this instuction cannot deoptimize, and the deopt-id | 3588 // Direct access since this instruction cannot deoptimize, and the deopt-id |
| 3568 // was inherited from another instuction that could deoptimize. | 3589 // was inherited from another instruction that could deoptimize. |
| 3569 return deopt_id_; | 3590 return deopt_id_; |
| 3570 } | 3591 } |
| 3571 | 3592 |
| 3572 DECLARE_INSTRUCTION(BinaryMintOp) | 3593 DECLARE_INSTRUCTION(BinaryMintOp) |
| 3573 | 3594 |
| 3574 private: | 3595 private: |
| 3575 const Token::Kind op_kind_; | 3596 const Token::Kind op_kind_; |
| 3576 | 3597 |
| 3577 DISALLOW_COPY_AND_ASSIGN(BinaryMintOpInstr); | 3598 DISALLOW_COPY_AND_ASSIGN(BinaryMintOpInstr); |
| 3578 }; | 3599 }; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3616 virtual Representation representation() const { | 3637 virtual Representation representation() const { |
| 3617 return kUnboxedMint; | 3638 return kUnboxedMint; |
| 3618 } | 3639 } |
| 3619 | 3640 |
| 3620 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3641 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3621 ASSERT((idx == 0) || (idx == 1)); | 3642 ASSERT((idx == 0) || (idx == 1)); |
| 3622 return (idx == 0) ? kUnboxedMint : kTagged; | 3643 return (idx == 0) ? kUnboxedMint : kTagged; |
| 3623 } | 3644 } |
| 3624 | 3645 |
| 3625 virtual intptr_t DeoptimizationTarget() const { | 3646 virtual intptr_t DeoptimizationTarget() const { |
| 3626 // Direct access since this instuction cannot deoptimize, and the deopt-id | 3647 // Direct access since this instruction cannot deoptimize, and the deopt-id |
| 3627 // was inherited from another instuction that could deoptimize. | 3648 // was inherited from another instruction that could deoptimize. |
| 3628 return deopt_id_; | 3649 return deopt_id_; |
| 3629 } | 3650 } |
| 3630 | 3651 |
| 3631 DECLARE_INSTRUCTION(ShiftMintOp) | 3652 DECLARE_INSTRUCTION(ShiftMintOp) |
| 3632 | 3653 |
| 3633 private: | 3654 private: |
| 3634 const Token::Kind op_kind_; | 3655 const Token::Kind op_kind_; |
| 3635 | 3656 |
| 3636 DISALLOW_COPY_AND_ASSIGN(ShiftMintOpInstr); | 3657 DISALLOW_COPY_AND_ASSIGN(ShiftMintOpInstr); |
| 3637 }; | 3658 }; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3671 virtual Representation representation() const { | 3692 virtual Representation representation() const { |
| 3672 return kUnboxedMint; | 3693 return kUnboxedMint; |
| 3673 } | 3694 } |
| 3674 | 3695 |
| 3675 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3696 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3676 ASSERT(idx == 0); | 3697 ASSERT(idx == 0); |
| 3677 return kUnboxedMint; | 3698 return kUnboxedMint; |
| 3678 } | 3699 } |
| 3679 | 3700 |
| 3680 virtual intptr_t DeoptimizationTarget() const { | 3701 virtual intptr_t DeoptimizationTarget() const { |
| 3681 // Direct access since this instuction cannot deoptimize, and the deopt-id | 3702 // Direct access since this instruction cannot deoptimize, and the deopt-id |
| 3682 // was inherited from another instuction that could deoptimize. | 3703 // was inherited from another instruction that could deoptimize. |
| 3683 return deopt_id_; | 3704 return deopt_id_; |
| 3684 } | 3705 } |
| 3685 | 3706 |
| 3686 DECLARE_INSTRUCTION(UnaryMintOp) | 3707 DECLARE_INSTRUCTION(UnaryMintOp) |
| 3687 | 3708 |
| 3688 private: | 3709 private: |
| 3689 const Token::Kind op_kind_; | 3710 const Token::Kind op_kind_; |
| 3690 | 3711 |
| 3691 DISALLOW_COPY_AND_ASSIGN(UnaryMintOpInstr); | 3712 DISALLOW_COPY_AND_ASSIGN(UnaryMintOpInstr); |
| 3692 }; | 3713 }; |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4206 ForwardInstructionIterator* current_iterator_; | 4227 ForwardInstructionIterator* current_iterator_; |
| 4207 | 4228 |
| 4208 private: | 4229 private: |
| 4209 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4230 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4210 }; | 4231 }; |
| 4211 | 4232 |
| 4212 | 4233 |
| 4213 } // namespace dart | 4234 } // namespace dart |
| 4214 | 4235 |
| 4215 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4236 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |