Chromium Code Reviews| 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 2948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3701 DECLARE_INSTRUCTION(BoxDouble) | 3706 DECLARE_INSTRUCTION(BoxDouble) |
| 3702 virtual CompileType ComputeType() const; | 3707 virtual CompileType ComputeType() const; |
| 3703 | 3708 |
| 3704 private: | 3709 private: |
| 3705 const intptr_t token_pos_; | 3710 const intptr_t token_pos_; |
| 3706 | 3711 |
| 3707 DISALLOW_COPY_AND_ASSIGN(BoxDoubleInstr); | 3712 DISALLOW_COPY_AND_ASSIGN(BoxDoubleInstr); |
| 3708 }; | 3713 }; |
| 3709 | 3714 |
| 3710 | 3715 |
| 3716 class BoxFloat32x4Instr : public TemplateDefinition<1> { | |
| 3717 public: | |
| 3718 BoxFloat32x4Instr(Value* value, InstanceCallInstr* instance_call) | |
| 3719 : token_pos_((instance_call != NULL) ? instance_call->token_pos() : 0) { | |
| 3720 SetInputAt(0, value); | |
| 3721 } | |
| 3722 | |
| 3723 Value* value() const { return inputs_[0]; } | |
| 3724 | |
| 3725 intptr_t token_pos() const { return token_pos_; } | |
| 3726 | |
| 3727 virtual bool CanDeoptimize() const { return false; } | |
| 3728 | |
| 3729 virtual bool HasSideEffect() const { return false; } | |
| 3730 | |
| 3731 virtual bool AffectedBySideEffect() const { return false; } | |
| 3732 virtual bool AttributesEqual(Instruction* other) const { return true; } | |
| 3733 | |
| 3734 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | |
| 3735 ASSERT(idx == 0); | |
| 3736 return kUnboxedFloat32x4; | |
| 3737 } | |
| 3738 | |
| 3739 DECLARE_INSTRUCTION(BoxFloat32x4) | |
| 3740 virtual CompileType ComputeType() const; | |
| 3741 | |
| 3742 private: | |
| 3743 const intptr_t token_pos_; | |
|
srdjan
2013/04/10 15:33:23
Why do we need token_pos_ (here and in BoxDoubleIn
Cutch
2013/04/10 16:36:13
We don't. instance_call was always NULL. I've remo
| |
| 3744 | |
| 3745 DISALLOW_COPY_AND_ASSIGN(BoxFloat32x4Instr); | |
| 3746 }; | |
| 3747 | |
| 3748 | |
| 3711 class BoxIntegerInstr : public TemplateDefinition<1> { | 3749 class BoxIntegerInstr : public TemplateDefinition<1> { |
| 3712 public: | 3750 public: |
| 3713 explicit BoxIntegerInstr(Value* value) { | 3751 explicit BoxIntegerInstr(Value* value) { |
| 3714 SetInputAt(0, value); | 3752 SetInputAt(0, value); |
| 3715 } | 3753 } |
| 3716 | 3754 |
| 3717 Value* value() const { return inputs_[0]; } | 3755 Value* value() const { return inputs_[0]; } |
| 3718 | 3756 |
| 3719 virtual bool CanDeoptimize() const { return false; } | 3757 virtual bool CanDeoptimize() const { return false; } |
| 3720 | 3758 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3760 virtual bool AttributesEqual(Instruction* other) const { return true; } | 3798 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 3761 | 3799 |
| 3762 DECLARE_INSTRUCTION(UnboxDouble) | 3800 DECLARE_INSTRUCTION(UnboxDouble) |
| 3763 virtual CompileType ComputeType() const; | 3801 virtual CompileType ComputeType() const; |
| 3764 | 3802 |
| 3765 private: | 3803 private: |
| 3766 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr); | 3804 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr); |
| 3767 }; | 3805 }; |
| 3768 | 3806 |
| 3769 | 3807 |
| 3808 class UnboxFloat32x4Instr : public TemplateDefinition<1> { | |
| 3809 public: | |
| 3810 UnboxFloat32x4Instr(Value* value, intptr_t deopt_id) { | |
| 3811 SetInputAt(0, value); | |
| 3812 deopt_id_ = deopt_id; | |
| 3813 } | |
| 3814 | |
| 3815 Value* value() const { return inputs_[0]; } | |
| 3816 | |
| 3817 virtual bool CanDeoptimize() const { | |
| 3818 return (value()->Type()->ToCid() != kFloat32x4Cid); | |
| 3819 } | |
| 3820 | |
| 3821 virtual bool HasSideEffect() const { return false; } | |
| 3822 | |
| 3823 virtual Representation representation() const { | |
| 3824 return kUnboxedFloat32x4; | |
| 3825 } | |
| 3826 | |
| 3827 virtual bool AffectedBySideEffect() const { return false; } | |
| 3828 virtual bool AttributesEqual(Instruction* other) const { return true; } | |
| 3829 | |
| 3830 DECLARE_INSTRUCTION(UnboxFloat32x4) | |
| 3831 virtual CompileType ComputeType() const; | |
| 3832 | |
| 3833 private: | |
| 3834 DISALLOW_COPY_AND_ASSIGN(UnboxFloat32x4Instr); | |
| 3835 }; | |
| 3836 | |
| 3837 | |
| 3770 class UnboxIntegerInstr : public TemplateDefinition<1> { | 3838 class UnboxIntegerInstr : public TemplateDefinition<1> { |
| 3771 public: | 3839 public: |
| 3772 UnboxIntegerInstr(Value* value, intptr_t deopt_id) { | 3840 UnboxIntegerInstr(Value* value, intptr_t deopt_id) { |
| 3773 SetInputAt(0, value); | 3841 SetInputAt(0, value); |
| 3774 deopt_id_ = deopt_id; | 3842 deopt_id_ = deopt_id; |
| 3775 } | 3843 } |
| 3776 | 3844 |
| 3777 Value* value() const { return inputs_[0]; } | 3845 Value* value() const { return inputs_[0]; } |
| 3778 | 3846 |
| 3779 virtual bool CanDeoptimize() const { | 3847 virtual bool CanDeoptimize() const { |
| (...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4697 ForwardInstructionIterator* current_iterator_; | 4765 ForwardInstructionIterator* current_iterator_; |
| 4698 | 4766 |
| 4699 private: | 4767 private: |
| 4700 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4768 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4701 }; | 4769 }; |
| 4702 | 4770 |
| 4703 | 4771 |
| 4704 } // namespace dart | 4772 } // namespace dart |
| 4705 | 4773 |
| 4706 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4774 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |