| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 V(_Uint16Array, [], Uint16ArrayGetIndexed, 1050460407) \ | 161 V(_Uint16Array, [], Uint16ArrayGetIndexed, 1050460407) \ |
| 162 V(_Uint16Array, []=, Uint16ArraySetIndexed, 1895506641) \ | 162 V(_Uint16Array, []=, Uint16ArraySetIndexed, 1895506641) \ |
| 163 V(_Int32Array, [], Int32ArrayGetIndexed, 1023604903) \ | 163 V(_Int32Array, [], Int32ArrayGetIndexed, 1023604903) \ |
| 164 V(_Int32Array, []=, Int32ArraySetIndexed, 599753059) \ | 164 V(_Int32Array, []=, Int32ArraySetIndexed, 599753059) \ |
| 165 V(_Uint32Array, [], Uint32ArrayGetIndexed, 1658205989) \ | 165 V(_Uint32Array, [], Uint32ArrayGetIndexed, 1658205989) \ |
| 166 V(_Uint32Array, []=, Uint32ArraySetIndexed, 1065461643) \ | 166 V(_Uint32Array, []=, Uint32ArraySetIndexed, 1065461643) \ |
| 167 V(_Float32x4Array, [], Float32x4ArrayGetIndexed, 2137410088) \ | 167 V(_Float32x4Array, [], Float32x4ArrayGetIndexed, 2137410088) \ |
| 168 V(_Float32x4Array, []=, Float32x4ArraySetIndexed, 1583018506) \ | 168 V(_Float32x4Array, []=, Float32x4ArraySetIndexed, 1583018506) \ |
| 169 V(_Int32x4Array, [], Int32x4ArrayGetIndexed, 1911863146) \ | 169 V(_Int32x4Array, [], Int32x4ArrayGetIndexed, 1911863146) \ |
| 170 V(_Int32x4Array, []=, Int32x4ArraySetIndexed, 973572811) \ | 170 V(_Int32x4Array, []=, Int32x4ArraySetIndexed, 973572811) \ |
| 171 V(_Float64x2Array, [], Float64x2ArrayGetIndexed, 325873961) \ |
| 172 V(_Float64x2Array, []=, Float64x2ArraySetIndexed, 2105580462) \ |
| 173 |
| 171 | 174 |
| 172 | 175 |
| 173 // A list of core function that should always be inlined. | 176 // A list of core function that should always be inlined. |
| 174 #define INLINE_WHITE_LIST(V) \ | 177 #define INLINE_WHITE_LIST(V) \ |
| 175 V(_List, get:length, ObjectArrayLength, 215183186) \ | 178 V(_List, get:length, ObjectArrayLength, 215183186) \ |
| 176 V(_ImmutableList, get:length, ImmutableArrayLength, 578762861) \ | 179 V(_ImmutableList, get:length, ImmutableArrayLength, 578762861) \ |
| 177 V(_TypedList, get:length, TypedDataLength, 26646119) \ | 180 V(_TypedList, get:length, TypedDataLength, 26646119) \ |
| 178 V(_GrowableList, get:length, GrowableArrayLength, 1654255033) \ | 181 V(_GrowableList, get:length, GrowableArrayLength, 1654255033) \ |
| 179 V(_StringBase, get:length, StringBaseLength, 1483549854) \ | 182 V(_StringBase, get:length, StringBaseLength, 1483549854) \ |
| 180 V(ListIterator, moveNext, ListIteratorMoveNext, 2062984847) \ | 183 V(ListIterator, moveNext, ListIteratorMoveNext, 2062984847) \ |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 M(Float32x4With) \ | 706 M(Float32x4With) \ |
| 704 M(Float32x4ToInt32x4) \ | 707 M(Float32x4ToInt32x4) \ |
| 705 M(MaterializeObject) \ | 708 M(MaterializeObject) \ |
| 706 M(Int32x4BoolConstructor) \ | 709 M(Int32x4BoolConstructor) \ |
| 707 M(Int32x4GetFlag) \ | 710 M(Int32x4GetFlag) \ |
| 708 M(Int32x4Select) \ | 711 M(Int32x4Select) \ |
| 709 M(Int32x4SetFlag) \ | 712 M(Int32x4SetFlag) \ |
| 710 M(Int32x4ToFloat32x4) \ | 713 M(Int32x4ToFloat32x4) \ |
| 711 M(BinaryInt32x4Op) \ | 714 M(BinaryInt32x4Op) \ |
| 712 M(TestSmi) \ | 715 M(TestSmi) \ |
| 716 M(BoxFloat64x2) \ |
| 717 M(UnboxFloat64x2) \ |
| 713 | 718 |
| 714 | 719 |
| 715 #define FORWARD_DECLARATION(type) class type##Instr; | 720 #define FORWARD_DECLARATION(type) class type##Instr; |
| 716 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) | 721 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) |
| 717 #undef FORWARD_DECLARATION | 722 #undef FORWARD_DECLARATION |
| 718 | 723 |
| 719 | 724 |
| 720 // Functions required in all concrete instruction classes. | 725 // Functions required in all concrete instruction classes. |
| 721 #define DECLARE_INSTRUCTION(type) \ | 726 #define DECLARE_INSTRUCTION(type) \ |
| 722 virtual Tag tag() const { return k##type; } \ | 727 virtual Tag tag() const { return k##type; } \ |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 } | 974 } |
| 970 | 975 |
| 971 private: | 976 private: |
| 972 friend class FlowGraphPrinter; | 977 friend class FlowGraphPrinter; |
| 973 friend class Definition; // Needed for InsertBefore, InsertAfter. | 978 friend class Definition; // Needed for InsertBefore, InsertAfter. |
| 974 | 979 |
| 975 // Classes that set or read deopt_id_. | 980 // Classes that set or read deopt_id_. |
| 976 friend class UnboxIntegerInstr; | 981 friend class UnboxIntegerInstr; |
| 977 friend class UnboxDoubleInstr; | 982 friend class UnboxDoubleInstr; |
| 978 friend class UnboxFloat32x4Instr; | 983 friend class UnboxFloat32x4Instr; |
| 984 friend class UnboxFloat64x2Instr; |
| 979 friend class UnboxInt32x4Instr; | 985 friend class UnboxInt32x4Instr; |
| 980 friend class BinaryDoubleOpInstr; | 986 friend class BinaryDoubleOpInstr; |
| 981 friend class BinaryFloat32x4OpInstr; | 987 friend class BinaryFloat32x4OpInstr; |
| 982 friend class Float32x4ZeroInstr; | 988 friend class Float32x4ZeroInstr; |
| 983 friend class Float32x4SplatInstr; | 989 friend class Float32x4SplatInstr; |
| 984 friend class Simd32x4ShuffleInstr; | 990 friend class Simd32x4ShuffleInstr; |
| 985 friend class Simd32x4ShuffleMixInstr; | 991 friend class Simd32x4ShuffleMixInstr; |
| 986 friend class Simd32x4GetSignMaskInstr; | 992 friend class Simd32x4GetSignMaskInstr; |
| 987 friend class Float32x4ConstructorInstr; | 993 friend class Float32x4ConstructorInstr; |
| 988 friend class Float32x4ComparisonInstr; | 994 friend class Float32x4ComparisonInstr; |
| (...skipping 3574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4563 | 4569 |
| 4564 virtual bool MayThrow() const { return false; } | 4570 virtual bool MayThrow() const { return false; } |
| 4565 | 4571 |
| 4566 Definition* Canonicalize(FlowGraph* flow_graph); | 4572 Definition* Canonicalize(FlowGraph* flow_graph); |
| 4567 | 4573 |
| 4568 private: | 4574 private: |
| 4569 DISALLOW_COPY_AND_ASSIGN(BoxFloat32x4Instr); | 4575 DISALLOW_COPY_AND_ASSIGN(BoxFloat32x4Instr); |
| 4570 }; | 4576 }; |
| 4571 | 4577 |
| 4572 | 4578 |
| 4579 class BoxFloat64x2Instr : public TemplateDefinition<1> { |
| 4580 public: |
| 4581 explicit BoxFloat64x2Instr(Value* value) { |
| 4582 SetInputAt(0, value); |
| 4583 } |
| 4584 |
| 4585 Value* value() const { return inputs_[0]; } |
| 4586 |
| 4587 virtual bool CanDeoptimize() const { return false; } |
| 4588 |
| 4589 virtual intptr_t DeoptimizationTarget() const { |
| 4590 return Isolate::kNoDeoptId; |
| 4591 } |
| 4592 |
| 4593 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 4594 ASSERT(idx == 0); |
| 4595 return kUnboxedFloat64x2; |
| 4596 } |
| 4597 |
| 4598 DECLARE_INSTRUCTION(BoxFloat64x2) |
| 4599 virtual CompileType ComputeType() const; |
| 4600 |
| 4601 virtual bool AllowsCSE() const { return true; } |
| 4602 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 4603 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
| 4604 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 4605 |
| 4606 virtual bool MayThrow() const { return false; } |
| 4607 |
| 4608 Definition* Canonicalize(FlowGraph* flow_graph); |
| 4609 |
| 4610 private: |
| 4611 DISALLOW_COPY_AND_ASSIGN(BoxFloat64x2Instr); |
| 4612 }; |
| 4613 |
| 4614 |
| 4615 |
| 4573 class BoxInt32x4Instr : public TemplateDefinition<1> { | 4616 class BoxInt32x4Instr : public TemplateDefinition<1> { |
| 4574 public: | 4617 public: |
| 4575 explicit BoxInt32x4Instr(Value* value) { | 4618 explicit BoxInt32x4Instr(Value* value) { |
| 4576 SetInputAt(0, value); | 4619 SetInputAt(0, value); |
| 4577 } | 4620 } |
| 4578 | 4621 |
| 4579 Value* value() const { return inputs_[0]; } | 4622 Value* value() const { return inputs_[0]; } |
| 4580 | 4623 |
| 4581 virtual bool CanDeoptimize() const { return false; } | 4624 virtual bool CanDeoptimize() const { return false; } |
| 4582 | 4625 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4702 | 4745 |
| 4703 virtual bool MayThrow() const { return false; } | 4746 virtual bool MayThrow() const { return false; } |
| 4704 | 4747 |
| 4705 Definition* Canonicalize(FlowGraph* flow_graph); | 4748 Definition* Canonicalize(FlowGraph* flow_graph); |
| 4706 | 4749 |
| 4707 private: | 4750 private: |
| 4708 DISALLOW_COPY_AND_ASSIGN(UnboxFloat32x4Instr); | 4751 DISALLOW_COPY_AND_ASSIGN(UnboxFloat32x4Instr); |
| 4709 }; | 4752 }; |
| 4710 | 4753 |
| 4711 | 4754 |
| 4755 class UnboxFloat64x2Instr : public TemplateDefinition<1> { |
| 4756 public: |
| 4757 UnboxFloat64x2Instr(Value* value, intptr_t deopt_id) { |
| 4758 SetInputAt(0, value); |
| 4759 deopt_id_ = deopt_id; |
| 4760 } |
| 4761 |
| 4762 Value* value() const { return inputs_[0]; } |
| 4763 |
| 4764 virtual bool CanDeoptimize() const { |
| 4765 return (value()->Type()->ToCid() != kFloat64x2Cid); |
| 4766 } |
| 4767 |
| 4768 virtual Representation representation() const { |
| 4769 return kUnboxedFloat64x2; |
| 4770 } |
| 4771 |
| 4772 DECLARE_INSTRUCTION(UnboxFloat64x2) |
| 4773 virtual CompileType ComputeType() const; |
| 4774 |
| 4775 virtual bool AllowsCSE() const { return true; } |
| 4776 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 4777 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
| 4778 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 4779 |
| 4780 virtual bool MayThrow() const { return false; } |
| 4781 |
| 4782 Definition* Canonicalize(FlowGraph* flow_graph); |
| 4783 |
| 4784 private: |
| 4785 DISALLOW_COPY_AND_ASSIGN(UnboxFloat64x2Instr); |
| 4786 }; |
| 4787 |
| 4788 |
| 4712 class UnboxInt32x4Instr : public TemplateDefinition<1> { | 4789 class UnboxInt32x4Instr : public TemplateDefinition<1> { |
| 4713 public: | 4790 public: |
| 4714 UnboxInt32x4Instr(Value* value, intptr_t deopt_id) { | 4791 UnboxInt32x4Instr(Value* value, intptr_t deopt_id) { |
| 4715 SetInputAt(0, value); | 4792 SetInputAt(0, value); |
| 4716 deopt_id_ = deopt_id; | 4793 deopt_id_ = deopt_id; |
| 4717 } | 4794 } |
| 4718 | 4795 |
| 4719 Value* value() const { return inputs_[0]; } | 4796 Value* value() const { return inputs_[0]; } |
| 4720 | 4797 |
| 4721 virtual bool CanDeoptimize() const { | 4798 virtual bool CanDeoptimize() const { |
| (...skipping 2314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7036 ForwardInstructionIterator* current_iterator_; | 7113 ForwardInstructionIterator* current_iterator_; |
| 7037 | 7114 |
| 7038 private: | 7115 private: |
| 7039 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 7116 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 7040 }; | 7117 }; |
| 7041 | 7118 |
| 7042 | 7119 |
| 7043 } // namespace dart | 7120 } // namespace dart |
| 7044 | 7121 |
| 7045 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 7122 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |