| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 28 matching lines...) Expand all Loading... |
| 39 V(_ImmutableArray, get:length, ImmutableArrayLength, 433698233) \ | 39 V(_ImmutableArray, get:length, ImmutableArrayLength, 433698233) \ |
| 40 V(_TypedList, get:length, TypedDataLength, 231908172) \ | 40 V(_TypedList, get:length, TypedDataLength, 231908172) \ |
| 41 V(_TypedList, _getInt8, ByteArrayBaseGetInt8, 380843687) \ | 41 V(_TypedList, _getInt8, ByteArrayBaseGetInt8, 380843687) \ |
| 42 V(_TypedList, _getUint8, ByteArrayBaseGetUint8, 380843687) \ | 42 V(_TypedList, _getUint8, ByteArrayBaseGetUint8, 380843687) \ |
| 43 V(_TypedList, _getInt16, ByteArrayBaseGetInt16, 380843687) \ | 43 V(_TypedList, _getInt16, ByteArrayBaseGetInt16, 380843687) \ |
| 44 V(_TypedList, _getUint16, ByteArrayBaseGetUint16, 380843687) \ | 44 V(_TypedList, _getUint16, ByteArrayBaseGetUint16, 380843687) \ |
| 45 V(_TypedList, _getInt32, ByteArrayBaseGetInt32, 380843687) \ | 45 V(_TypedList, _getInt32, ByteArrayBaseGetInt32, 380843687) \ |
| 46 V(_TypedList, _getUint32, ByteArrayBaseGetUint32, 380843687) \ | 46 V(_TypedList, _getUint32, ByteArrayBaseGetUint32, 380843687) \ |
| 47 V(_TypedList, _getFloat32, ByteArrayBaseGetFloat32, 979971573) \ | 47 V(_TypedList, _getFloat32, ByteArrayBaseGetFloat32, 979971573) \ |
| 48 V(_TypedList, _getFloat64, ByteArrayBaseGetFloat64, 979971573) \ | 48 V(_TypedList, _getFloat64, ByteArrayBaseGetFloat64, 979971573) \ |
| 49 V(_TypedList, _getFloat32x4, ByteArrayBaseGetFloat32x4, 690339584) \ |
| 49 V(_TypedList, _setInt8, ByteArrayBaseSetInt8, 287047804) \ | 50 V(_TypedList, _setInt8, ByteArrayBaseSetInt8, 287047804) \ |
| 50 V(_TypedList, _setUint8, ByteArrayBaseSetUint8, 287047804) \ | 51 V(_TypedList, _setUint8, ByteArrayBaseSetUint8, 287047804) \ |
| 51 V(_TypedList, _setInt16, ByteArrayBaseSetInt16, 287047804) \ | 52 V(_TypedList, _setInt16, ByteArrayBaseSetInt16, 287047804) \ |
| 52 V(_TypedList, _setUint16, ByteArrayBaseSetUint16, 287047804) \ | 53 V(_TypedList, _setUint16, ByteArrayBaseSetUint16, 287047804) \ |
| 53 V(_TypedList, _setInt32, ByteArrayBaseSetInt32, 287047804) \ | 54 V(_TypedList, _setInt32, ByteArrayBaseSetInt32, 287047804) \ |
| 54 V(_TypedList, _setUint32, ByteArrayBaseSetUint32, 287047804) \ | 55 V(_TypedList, _setUint32, ByteArrayBaseSetUint32, 287047804) \ |
| 55 V(_TypedList, _setFloat32, ByteArrayBaseSetFloat32, 1032541114) \ | 56 V(_TypedList, _setFloat32, ByteArrayBaseSetFloat32, 1032541114) \ |
| 56 V(_TypedList, _setFloat64, ByteArrayBaseSetFloat64, 1032541114) \ | 57 V(_TypedList, _setFloat64, ByteArrayBaseSetFloat64, 1032541114) \ |
| 58 V(_TypedList, _setFloat32x4, ByteArrayBaseSetFloat32x4, 1016704782) \ |
| 57 V(_GrowableObjectArray, get:length, GrowableArrayLength, 725548050) \ | 59 V(_GrowableObjectArray, get:length, GrowableArrayLength, 725548050) \ |
| 58 V(_GrowableObjectArray, get:_capacity, GrowableArrayCapacity, 725548050) \ | 60 V(_GrowableObjectArray, get:_capacity, GrowableArrayCapacity, 725548050) \ |
| 59 V(_StringBase, get:length, StringBaseLength, 320803993) \ | 61 V(_StringBase, get:length, StringBaseLength, 320803993) \ |
| 60 V(_StringBase, get:isEmpty, StringBaseIsEmpty, 110632481) \ | 62 V(_StringBase, get:isEmpty, StringBaseIsEmpty, 110632481) \ |
| 61 V(_StringBase, codeUnitAt, StringBaseCodeUnitAt, 984449525) \ | 63 V(_StringBase, codeUnitAt, StringBaseCodeUnitAt, 984449525) \ |
| 62 V(_StringBase, [], StringBaseCharAt, 1062366987) \ | 64 V(_StringBase, [], StringBaseCharAt, 1062366987) \ |
| 63 V(_IntegerImplementation, toDouble, IntegerToDouble, 927078825) \ | 65 V(_IntegerImplementation, toDouble, IntegerToDouble, 927078825) \ |
| 64 V(_Double, toInt, DoubleToInteger, 362666636) \ | 66 V(_Double, toInt, DoubleToInteger, 362666636) \ |
| 65 V(_Double, truncateToDouble, DoubleTruncate, 620870996) \ | 67 V(_Double, truncateToDouble, DoubleTruncate, 620870996) \ |
| 66 V(_Double, roundToDouble, DoubleRound, 620870996) \ | 68 V(_Double, roundToDouble, DoubleRound, 620870996) \ |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 M(DoubleToSmi) \ | 484 M(DoubleToSmi) \ |
| 483 M(DoubleToDouble) \ | 485 M(DoubleToDouble) \ |
| 484 M(CheckClass) \ | 486 M(CheckClass) \ |
| 485 M(CheckSmi) \ | 487 M(CheckSmi) \ |
| 486 M(Constant) \ | 488 M(Constant) \ |
| 487 M(CheckEitherNonSmi) \ | 489 M(CheckEitherNonSmi) \ |
| 488 M(BinaryDoubleOp) \ | 490 M(BinaryDoubleOp) \ |
| 489 M(MathSqrt) \ | 491 M(MathSqrt) \ |
| 490 M(UnboxDouble) \ | 492 M(UnboxDouble) \ |
| 491 M(BoxDouble) \ | 493 M(BoxDouble) \ |
| 494 M(BoxFloat32x4) \ |
| 495 M(UnboxFloat32x4) \ |
| 492 M(UnboxInteger) \ | 496 M(UnboxInteger) \ |
| 493 M(BoxInteger) \ | 497 M(BoxInteger) \ |
| 494 M(BinaryMintOp) \ | 498 M(BinaryMintOp) \ |
| 495 M(ShiftMintOp) \ | 499 M(ShiftMintOp) \ |
| 496 M(UnaryMintOp) \ | 500 M(UnaryMintOp) \ |
| 497 M(CheckArrayBound) \ | 501 M(CheckArrayBound) \ |
| 498 M(Constraint) \ | 502 M(Constraint) \ |
| 499 M(StringFromCharCode) \ | 503 M(StringFromCharCode) \ |
| 500 M(InvokeMathCFunction) \ | 504 M(InvokeMathCFunction) \ |
| 501 M(GuardField) \ | 505 M(GuardField) \ |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 intptr_t GetDeoptId() const { | 737 intptr_t GetDeoptId() const { |
| 734 return deopt_id_; | 738 return deopt_id_; |
| 735 } | 739 } |
| 736 | 740 |
| 737 private: | 741 private: |
| 738 friend class Definition; // Needed for InsertBefore, InsertAfter. | 742 friend class Definition; // Needed for InsertBefore, InsertAfter. |
| 739 | 743 |
| 740 // Classes that set deopt_id_. | 744 // Classes that set deopt_id_. |
| 741 friend class UnboxIntegerInstr; | 745 friend class UnboxIntegerInstr; |
| 742 friend class UnboxDoubleInstr; | 746 friend class UnboxDoubleInstr; |
| 747 friend class UnboxFloat32x4Instr; |
| 743 friend class BinaryDoubleOpInstr; | 748 friend class BinaryDoubleOpInstr; |
| 744 friend class BinaryMintOpInstr; | 749 friend class BinaryMintOpInstr; |
| 745 friend class BinarySmiOpInstr; | 750 friend class BinarySmiOpInstr; |
| 746 friend class UnarySmiOpInstr; | 751 friend class UnarySmiOpInstr; |
| 747 friend class ShiftMintOpInstr; | 752 friend class ShiftMintOpInstr; |
| 748 friend class UnaryMintOpInstr; | 753 friend class UnaryMintOpInstr; |
| 749 friend class MathSqrtInstr; | 754 friend class MathSqrtInstr; |
| 750 friend class CheckClassInstr; | 755 friend class CheckClassInstr; |
| 751 friend class GuardFieldInstr; | 756 friend class GuardFieldInstr; |
| 752 friend class CheckSmiInstr; | 757 friend class CheckSmiInstr; |
| (...skipping 2917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3670 | 3675 |
| 3671 virtual Instruction* Canonicalize(FlowGraphOptimizer* optimizer); | 3676 virtual Instruction* Canonicalize(FlowGraphOptimizer* optimizer); |
| 3672 | 3677 |
| 3673 private: | 3678 private: |
| 3674 DISALLOW_COPY_AND_ASSIGN(CheckEitherNonSmiInstr); | 3679 DISALLOW_COPY_AND_ASSIGN(CheckEitherNonSmiInstr); |
| 3675 }; | 3680 }; |
| 3676 | 3681 |
| 3677 | 3682 |
| 3678 class BoxDoubleInstr : public TemplateDefinition<1> { | 3683 class BoxDoubleInstr : public TemplateDefinition<1> { |
| 3679 public: | 3684 public: |
| 3680 BoxDoubleInstr(Value* value, InstanceCallInstr* instance_call) | 3685 explicit BoxDoubleInstr(Value* value) { |
| 3681 : token_pos_((instance_call != NULL) ? instance_call->token_pos() : 0) { | |
| 3682 SetInputAt(0, value); | 3686 SetInputAt(0, value); |
| 3683 } | 3687 } |
| 3684 | 3688 |
| 3685 Value* value() const { return inputs_[0]; } | 3689 Value* value() const { return inputs_[0]; } |
| 3686 | 3690 |
| 3687 intptr_t token_pos() const { return token_pos_; } | |
| 3688 | |
| 3689 virtual bool CanDeoptimize() const { return false; } | 3691 virtual bool CanDeoptimize() const { return false; } |
| 3690 | 3692 |
| 3691 virtual bool HasSideEffect() const { return false; } | 3693 virtual bool HasSideEffect() const { return false; } |
| 3692 | 3694 |
| 3693 virtual bool AffectedBySideEffect() const { return false; } | 3695 virtual bool AffectedBySideEffect() const { return false; } |
| 3694 virtual bool AttributesEqual(Instruction* other) const { return true; } | 3696 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 3695 | 3697 |
| 3696 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3698 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3697 ASSERT(idx == 0); | 3699 ASSERT(idx == 0); |
| 3698 return kUnboxedDouble; | 3700 return kUnboxedDouble; |
| 3699 } | 3701 } |
| 3700 | 3702 |
| 3701 DECLARE_INSTRUCTION(BoxDouble) | 3703 DECLARE_INSTRUCTION(BoxDouble) |
| 3702 virtual CompileType ComputeType() const; | 3704 virtual CompileType ComputeType() const; |
| 3703 | 3705 |
| 3704 private: | 3706 private: |
| 3705 const intptr_t token_pos_; | 3707 DISALLOW_COPY_AND_ASSIGN(BoxDoubleInstr); |
| 3708 }; |
| 3706 | 3709 |
| 3707 DISALLOW_COPY_AND_ASSIGN(BoxDoubleInstr); | 3710 |
| 3711 class BoxFloat32x4Instr : public TemplateDefinition<1> { |
| 3712 public: |
| 3713 explicit BoxFloat32x4Instr(Value* value) { |
| 3714 SetInputAt(0, value); |
| 3715 } |
| 3716 |
| 3717 Value* value() const { return inputs_[0]; } |
| 3718 |
| 3719 virtual bool CanDeoptimize() const { return false; } |
| 3720 |
| 3721 virtual bool HasSideEffect() const { return false; } |
| 3722 |
| 3723 virtual bool AffectedBySideEffect() const { return false; } |
| 3724 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 3725 |
| 3726 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3727 ASSERT(idx == 0); |
| 3728 return kUnboxedFloat32x4; |
| 3729 } |
| 3730 |
| 3731 DECLARE_INSTRUCTION(BoxFloat32x4) |
| 3732 virtual CompileType ComputeType() const; |
| 3733 |
| 3734 private: |
| 3735 DISALLOW_COPY_AND_ASSIGN(BoxFloat32x4Instr); |
| 3708 }; | 3736 }; |
| 3709 | 3737 |
| 3710 | 3738 |
| 3711 class BoxIntegerInstr : public TemplateDefinition<1> { | 3739 class BoxIntegerInstr : public TemplateDefinition<1> { |
| 3712 public: | 3740 public: |
| 3713 explicit BoxIntegerInstr(Value* value) { | 3741 explicit BoxIntegerInstr(Value* value) { |
| 3714 SetInputAt(0, value); | 3742 SetInputAt(0, value); |
| 3715 } | 3743 } |
| 3716 | 3744 |
| 3717 Value* value() const { return inputs_[0]; } | 3745 Value* value() const { return inputs_[0]; } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3760 virtual bool AttributesEqual(Instruction* other) const { return true; } | 3788 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 3761 | 3789 |
| 3762 DECLARE_INSTRUCTION(UnboxDouble) | 3790 DECLARE_INSTRUCTION(UnboxDouble) |
| 3763 virtual CompileType ComputeType() const; | 3791 virtual CompileType ComputeType() const; |
| 3764 | 3792 |
| 3765 private: | 3793 private: |
| 3766 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr); | 3794 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr); |
| 3767 }; | 3795 }; |
| 3768 | 3796 |
| 3769 | 3797 |
| 3798 class UnboxFloat32x4Instr : public TemplateDefinition<1> { |
| 3799 public: |
| 3800 UnboxFloat32x4Instr(Value* value, intptr_t deopt_id) { |
| 3801 SetInputAt(0, value); |
| 3802 deopt_id_ = deopt_id; |
| 3803 } |
| 3804 |
| 3805 Value* value() const { return inputs_[0]; } |
| 3806 |
| 3807 virtual bool CanDeoptimize() const { |
| 3808 return (value()->Type()->ToCid() != kFloat32x4Cid); |
| 3809 } |
| 3810 |
| 3811 virtual bool HasSideEffect() const { return false; } |
| 3812 |
| 3813 virtual Representation representation() const { |
| 3814 return kUnboxedFloat32x4; |
| 3815 } |
| 3816 |
| 3817 virtual bool AffectedBySideEffect() const { return false; } |
| 3818 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 3819 |
| 3820 DECLARE_INSTRUCTION(UnboxFloat32x4) |
| 3821 virtual CompileType ComputeType() const; |
| 3822 |
| 3823 private: |
| 3824 DISALLOW_COPY_AND_ASSIGN(UnboxFloat32x4Instr); |
| 3825 }; |
| 3826 |
| 3827 |
| 3770 class UnboxIntegerInstr : public TemplateDefinition<1> { | 3828 class UnboxIntegerInstr : public TemplateDefinition<1> { |
| 3771 public: | 3829 public: |
| 3772 UnboxIntegerInstr(Value* value, intptr_t deopt_id) { | 3830 UnboxIntegerInstr(Value* value, intptr_t deopt_id) { |
| 3773 SetInputAt(0, value); | 3831 SetInputAt(0, value); |
| 3774 deopt_id_ = deopt_id; | 3832 deopt_id_ = deopt_id; |
| 3775 } | 3833 } |
| 3776 | 3834 |
| 3777 Value* value() const { return inputs_[0]; } | 3835 Value* value() const { return inputs_[0]; } |
| 3778 | 3836 |
| 3779 virtual bool CanDeoptimize() const { | 3837 virtual bool CanDeoptimize() const { |
| (...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4697 ForwardInstructionIterator* current_iterator_; | 4755 ForwardInstructionIterator* current_iterator_; |
| 4698 | 4756 |
| 4699 private: | 4757 private: |
| 4700 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4758 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4701 }; | 4759 }; |
| 4702 | 4760 |
| 4703 | 4761 |
| 4704 } // namespace dart | 4762 } // namespace dart |
| 4705 | 4763 |
| 4706 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4764 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |