| 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 2978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3731 | 3736 |
| 3732 virtual Instruction* Canonicalize(FlowGraphOptimizer* optimizer); | 3737 virtual Instruction* Canonicalize(FlowGraphOptimizer* optimizer); |
| 3733 | 3738 |
| 3734 private: | 3739 private: |
| 3735 DISALLOW_COPY_AND_ASSIGN(CheckEitherNonSmiInstr); | 3740 DISALLOW_COPY_AND_ASSIGN(CheckEitherNonSmiInstr); |
| 3736 }; | 3741 }; |
| 3737 | 3742 |
| 3738 | 3743 |
| 3739 class BoxDoubleInstr : public TemplateDefinition<1> { | 3744 class BoxDoubleInstr : public TemplateDefinition<1> { |
| 3740 public: | 3745 public: |
| 3741 BoxDoubleInstr(Value* value, InstanceCallInstr* instance_call) | 3746 explicit BoxDoubleInstr(Value* value) { |
| 3742 : token_pos_((instance_call != NULL) ? instance_call->token_pos() : 0) { | |
| 3743 SetInputAt(0, value); | 3747 SetInputAt(0, value); |
| 3744 } | 3748 } |
| 3745 | 3749 |
| 3746 Value* value() const { return inputs_[0]; } | 3750 Value* value() const { return inputs_[0]; } |
| 3747 | 3751 |
| 3748 intptr_t token_pos() const { return token_pos_; } | |
| 3749 | |
| 3750 virtual bool CanDeoptimize() const { return false; } | 3752 virtual bool CanDeoptimize() const { return false; } |
| 3751 | 3753 |
| 3752 virtual bool HasSideEffect() const { return false; } | 3754 virtual bool HasSideEffect() const { return false; } |
| 3753 | 3755 |
| 3754 virtual bool AffectedBySideEffect() const { return false; } | 3756 virtual bool AffectedBySideEffect() const { return false; } |
| 3755 virtual bool AttributesEqual(Instruction* other) const { return true; } | 3757 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 3756 | 3758 |
| 3757 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3759 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3758 ASSERT(idx == 0); | 3760 ASSERT(idx == 0); |
| 3759 return kUnboxedDouble; | 3761 return kUnboxedDouble; |
| 3760 } | 3762 } |
| 3761 | 3763 |
| 3762 DECLARE_INSTRUCTION(BoxDouble) | 3764 DECLARE_INSTRUCTION(BoxDouble) |
| 3763 virtual CompileType ComputeType() const; | 3765 virtual CompileType ComputeType() const; |
| 3764 | 3766 |
| 3765 private: | 3767 private: |
| 3766 const intptr_t token_pos_; | 3768 DISALLOW_COPY_AND_ASSIGN(BoxDoubleInstr); |
| 3769 }; |
| 3767 | 3770 |
| 3768 DISALLOW_COPY_AND_ASSIGN(BoxDoubleInstr); | 3771 |
| 3772 class BoxFloat32x4Instr : public TemplateDefinition<1> { |
| 3773 public: |
| 3774 explicit BoxFloat32x4Instr(Value* value) { |
| 3775 SetInputAt(0, value); |
| 3776 } |
| 3777 |
| 3778 Value* value() const { return inputs_[0]; } |
| 3779 |
| 3780 virtual bool CanDeoptimize() const { return false; } |
| 3781 |
| 3782 virtual bool HasSideEffect() const { return false; } |
| 3783 |
| 3784 virtual bool AffectedBySideEffect() const { return false; } |
| 3785 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 3786 |
| 3787 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3788 ASSERT(idx == 0); |
| 3789 return kUnboxedFloat32x4; |
| 3790 } |
| 3791 |
| 3792 DECLARE_INSTRUCTION(BoxFloat32x4) |
| 3793 virtual CompileType ComputeType() const; |
| 3794 |
| 3795 private: |
| 3796 DISALLOW_COPY_AND_ASSIGN(BoxFloat32x4Instr); |
| 3769 }; | 3797 }; |
| 3770 | 3798 |
| 3771 | 3799 |
| 3772 class BoxIntegerInstr : public TemplateDefinition<1> { | 3800 class BoxIntegerInstr : public TemplateDefinition<1> { |
| 3773 public: | 3801 public: |
| 3774 explicit BoxIntegerInstr(Value* value) { | 3802 explicit BoxIntegerInstr(Value* value) { |
| 3775 SetInputAt(0, value); | 3803 SetInputAt(0, value); |
| 3776 } | 3804 } |
| 3777 | 3805 |
| 3778 Value* value() const { return inputs_[0]; } | 3806 Value* value() const { return inputs_[0]; } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3821 virtual bool AttributesEqual(Instruction* other) const { return true; } | 3849 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 3822 | 3850 |
| 3823 DECLARE_INSTRUCTION(UnboxDouble) | 3851 DECLARE_INSTRUCTION(UnboxDouble) |
| 3824 virtual CompileType ComputeType() const; | 3852 virtual CompileType ComputeType() const; |
| 3825 | 3853 |
| 3826 private: | 3854 private: |
| 3827 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr); | 3855 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr); |
| 3828 }; | 3856 }; |
| 3829 | 3857 |
| 3830 | 3858 |
| 3859 class UnboxFloat32x4Instr : public TemplateDefinition<1> { |
| 3860 public: |
| 3861 UnboxFloat32x4Instr(Value* value, intptr_t deopt_id) { |
| 3862 SetInputAt(0, value); |
| 3863 deopt_id_ = deopt_id; |
| 3864 } |
| 3865 |
| 3866 Value* value() const { return inputs_[0]; } |
| 3867 |
| 3868 virtual bool CanDeoptimize() const { |
| 3869 return (value()->Type()->ToCid() != kFloat32x4Cid); |
| 3870 } |
| 3871 |
| 3872 virtual bool HasSideEffect() const { return false; } |
| 3873 |
| 3874 virtual Representation representation() const { |
| 3875 return kUnboxedFloat32x4; |
| 3876 } |
| 3877 |
| 3878 virtual bool AffectedBySideEffect() const { return false; } |
| 3879 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 3880 |
| 3881 DECLARE_INSTRUCTION(UnboxFloat32x4) |
| 3882 virtual CompileType ComputeType() const; |
| 3883 |
| 3884 private: |
| 3885 DISALLOW_COPY_AND_ASSIGN(UnboxFloat32x4Instr); |
| 3886 }; |
| 3887 |
| 3888 |
| 3831 class UnboxIntegerInstr : public TemplateDefinition<1> { | 3889 class UnboxIntegerInstr : public TemplateDefinition<1> { |
| 3832 public: | 3890 public: |
| 3833 UnboxIntegerInstr(Value* value, intptr_t deopt_id) { | 3891 UnboxIntegerInstr(Value* value, intptr_t deopt_id) { |
| 3834 SetInputAt(0, value); | 3892 SetInputAt(0, value); |
| 3835 deopt_id_ = deopt_id; | 3893 deopt_id_ = deopt_id; |
| 3836 } | 3894 } |
| 3837 | 3895 |
| 3838 Value* value() const { return inputs_[0]; } | 3896 Value* value() const { return inputs_[0]; } |
| 3839 | 3897 |
| 3840 virtual bool CanDeoptimize() const { | 3898 virtual bool CanDeoptimize() const { |
| (...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4758 ForwardInstructionIterator* current_iterator_; | 4816 ForwardInstructionIterator* current_iterator_; |
| 4759 | 4817 |
| 4760 private: | 4818 private: |
| 4761 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4819 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4762 }; | 4820 }; |
| 4763 | 4821 |
| 4764 | 4822 |
| 4765 } // namespace dart | 4823 } // namespace dart |
| 4766 | 4824 |
| 4767 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4825 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |