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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 V(::, min, MathMin, 1584022354) \ | 87 V(::, min, MathMin, 1584022354) \ |
| 88 V(::, max, MathMax, 328632232) \ | 88 V(::, max, MathMax, 328632232) \ |
| 89 V(Float32x4, Float32x4., Float32x4Constructor, 1876089990) \ | 89 V(Float32x4, Float32x4., Float32x4Constructor, 1876089990) \ |
| 90 V(Float32x4, Float32x4.zero, Float32x4Zero, 1903586222) \ | 90 V(Float32x4, Float32x4.zero, Float32x4Zero, 1903586222) \ |
| 91 V(Float32x4, Float32x4.splat, Float32x4Splat, 38462589) \ | 91 V(Float32x4, Float32x4.splat, Float32x4Splat, 38462589) \ |
| 92 V(_Float32x4, shuffle, Float32x4Shuffle, 713523911) \ | 92 V(_Float32x4, shuffle, Float32x4Shuffle, 713523911) \ |
| 93 V(_Float32x4, get:x, Float32x4ShuffleX, 1019523296) \ | 93 V(_Float32x4, get:x, Float32x4ShuffleX, 1019523296) \ |
| 94 V(_Float32x4, get:y, Float32x4ShuffleY, 710282243) \ | 94 V(_Float32x4, get:y, Float32x4ShuffleY, 710282243) \ |
| 95 V(_Float32x4, get:z, Float32x4ShuffleZ, 1612806041) \ | 95 V(_Float32x4, get:z, Float32x4ShuffleZ, 1612806041) \ |
| 96 V(_Float32x4, get:w, Float32x4ShuffleW, 1113701403) \ | 96 V(_Float32x4, get:w, Float32x4ShuffleW, 1113701403) \ |
| 97 V(_Float32x4, get:signMask, Float32x4GetSignMask, 465347632) \ | |
| 97 V(_Float32x4, _cmpequal, Float32x4Equal, 1559121703) \ | 98 V(_Float32x4, _cmpequal, Float32x4Equal, 1559121703) \ |
| 98 V(_Float32x4, _cmpgt, Float32x4GreaterThan, 1959692892) \ | 99 V(_Float32x4, _cmpgt, Float32x4GreaterThan, 1959692892) \ |
| 99 V(_Float32x4, _cmpgte, Float32x4GreaterThanOrEqual, 2128251808) \ | 100 V(_Float32x4, _cmpgte, Float32x4GreaterThanOrEqual, 2128251808) \ |
| 100 V(_Float32x4, _cmplt, Float32x4LessThan, 405464198) \ | 101 V(_Float32x4, _cmplt, Float32x4LessThan, 405464198) \ |
| 101 V(_Float32x4, _cmplte, Float32x4LessThanOrEqual, 1217836152) \ | 102 V(_Float32x4, _cmplte, Float32x4LessThanOrEqual, 1217836152) \ |
| 102 V(_Float32x4, _cmpnequal, Float32x4NotEqual, 498820440) \ | 103 V(_Float32x4, _cmpnequal, Float32x4NotEqual, 498820440) \ |
| 103 V(_Float32x4, _min, Float32x4Min, 1354880316) \ | 104 V(_Float32x4, _min, Float32x4Min, 1354880316) \ |
| 104 V(_Float32x4, _max, Float32x4Max, 171574145) \ | 105 V(_Float32x4, _max, Float32x4Max, 171574145) \ |
| 105 V(_Float32x4, _scale, Float32x4Scale, 1553559438) \ | 106 V(_Float32x4, _scale, Float32x4Scale, 1553559438) \ |
| 106 V(_Float32x4, _sqrt, Float32x4Sqrt, 612006112) \ | 107 V(_Float32x4, _sqrt, Float32x4Sqrt, 612006112) \ |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 117 V(_Float32x4, withZWInXY, Float32x4WithZWInXY, 1850941421) \ | 118 V(_Float32x4, withZWInXY, Float32x4WithZWInXY, 1850941421) \ |
| 118 V(_Float32x4, interleaveXY, Float32x4InterleaveXY, 1789523505) \ | 119 V(_Float32x4, interleaveXY, Float32x4InterleaveXY, 1789523505) \ |
| 119 V(_Float32x4, interleaveZW, Float32x4InterleaveZW, 1137302773) \ | 120 V(_Float32x4, interleaveZW, Float32x4InterleaveZW, 1137302773) \ |
| 120 V(_Float32x4, interleaveXYPairs, Float32x4InterleaveXYPairs, 2138669236) \ | 121 V(_Float32x4, interleaveXYPairs, Float32x4InterleaveXYPairs, 2138669236) \ |
| 121 V(_Float32x4, interleaveZWPairs, Float32x4InterleaveZWPairs, 1541966446) \ | 122 V(_Float32x4, interleaveZWPairs, Float32x4InterleaveZWPairs, 1541966446) \ |
| 122 V(Uint32x4, Uint32x4.bool, Uint32x4BoolConstructor, 733327933) \ | 123 V(Uint32x4, Uint32x4.bool, Uint32x4BoolConstructor, 733327933) \ |
| 123 V(_Uint32x4, get:flagX, Uint32x4GetFlagX, 765894409) \ | 124 V(_Uint32x4, get:flagX, Uint32x4GetFlagX, 765894409) \ |
| 124 V(_Uint32x4, get:flagY, Uint32x4GetFlagY, 1226233321) \ | 125 V(_Uint32x4, get:flagY, Uint32x4GetFlagY, 1226233321) \ |
| 125 V(_Uint32x4, get:flagZ, Uint32x4GetFlagZ, 1455452476) \ | 126 V(_Uint32x4, get:flagZ, Uint32x4GetFlagZ, 1455452476) \ |
| 126 V(_Uint32x4, get:flagW, Uint32x4GetFlagW, 1608549245) \ | 127 V(_Uint32x4, get:flagW, Uint32x4GetFlagW, 1608549245) \ |
| 128 V(_Uint32x4, get:signMask, Uint32x4GetSignMask, 231202664) \ | |
| 127 V(_Uint32x4, select, Uint32x4Select, 881590808) \ | 129 V(_Uint32x4, select, Uint32x4Select, 881590808) \ |
| 128 V(_Uint32x4, withFlagX, Uint32x4WithFlagX, 1987921054) \ | 130 V(_Uint32x4, withFlagX, Uint32x4WithFlagX, 1987921054) \ |
| 129 V(_Uint32x4, withFlagY, Uint32x4WithFlagY, 831632614) \ | 131 V(_Uint32x4, withFlagY, Uint32x4WithFlagY, 831632614) \ |
| 130 V(_Uint32x4, withFlagZ, Uint32x4WithFlagZ, 465765612) \ | 132 V(_Uint32x4, withFlagZ, Uint32x4WithFlagZ, 465765612) \ |
| 131 V(_Uint32x4, withFlagW, Uint32x4WithFlagW, 1545009993) \ | 133 V(_Uint32x4, withFlagW, Uint32x4WithFlagW, 1545009993) \ |
| 132 V(_Uint32x4, _toFloat32x4, Uint32x4ToUint32x4, 1545735523) \ | 134 V(_Uint32x4, _toFloat32x4, Uint32x4ToUint32x4, 1545735523) \ |
| 133 | 135 |
| 134 | 136 |
| 135 // A list of core function that should always be inlined. | 137 // A list of core function that should always be inlined. |
| 136 #define INLINE_WHITE_LIST(V) \ | 138 #define INLINE_WHITE_LIST(V) \ |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 606 M(ShiftMintOp) \ | 608 M(ShiftMintOp) \ |
| 607 M(UnaryMintOp) \ | 609 M(UnaryMintOp) \ |
| 608 M(CheckArrayBound) \ | 610 M(CheckArrayBound) \ |
| 609 M(Constraint) \ | 611 M(Constraint) \ |
| 610 M(StringFromCharCode) \ | 612 M(StringFromCharCode) \ |
| 611 M(InvokeMathCFunction) \ | 613 M(InvokeMathCFunction) \ |
| 612 M(GuardField) \ | 614 M(GuardField) \ |
| 613 M(IfThenElse) \ | 615 M(IfThenElse) \ |
| 614 M(BinaryFloat32x4Op) \ | 616 M(BinaryFloat32x4Op) \ |
| 615 M(Float32x4Shuffle) \ | 617 M(Float32x4Shuffle) \ |
| 618 M(Float32x4GetSignMask) \ | |
| 616 M(Float32x4Constructor) \ | 619 M(Float32x4Constructor) \ |
| 617 M(Float32x4Zero) \ | 620 M(Float32x4Zero) \ |
| 618 M(Float32x4Splat) \ | 621 M(Float32x4Splat) \ |
| 619 M(Float32x4Comparison) \ | 622 M(Float32x4Comparison) \ |
| 620 M(Float32x4MinMax) \ | 623 M(Float32x4MinMax) \ |
| 621 M(Float32x4Scale) \ | 624 M(Float32x4Scale) \ |
| 622 M(Float32x4Sqrt) \ | 625 M(Float32x4Sqrt) \ |
| 623 M(Float32x4ZeroArg) \ | 626 M(Float32x4ZeroArg) \ |
| 624 M(Float32x4Clamp) \ | 627 M(Float32x4Clamp) \ |
| 625 M(Float32x4With) \ | 628 M(Float32x4With) \ |
| 626 M(Float32x4ToUint32x4) \ | 629 M(Float32x4ToUint32x4) \ |
| 627 M(Float32x4TwoArgShuffle) \ | 630 M(Float32x4TwoArgShuffle) \ |
| 628 M(MaterializeObject) \ | 631 M(MaterializeObject) \ |
| 629 M(Uint32x4BoolConstructor) \ | 632 M(Uint32x4BoolConstructor) \ |
| 630 M(Uint32x4GetFlag) \ | 633 M(Uint32x4GetFlag) \ |
| 634 M(Uint32x4GetSignMask) \ | |
| 631 M(Uint32x4Select) \ | 635 M(Uint32x4Select) \ |
| 632 M(Uint32x4SetFlag) \ | 636 M(Uint32x4SetFlag) \ |
| 633 M(Uint32x4ToFloat32x4) \ | 637 M(Uint32x4ToFloat32x4) \ |
| 634 M(BinaryUint32x4Op) \ | 638 M(BinaryUint32x4Op) \ |
| 635 | 639 |
| 636 | 640 |
| 637 #define FORWARD_DECLARATION(type) class type##Instr; | 641 #define FORWARD_DECLARATION(type) class type##Instr; |
| 638 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) | 642 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) |
| 639 #undef FORWARD_DECLARATION | 643 #undef FORWARD_DECLARATION |
| 640 | 644 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 895 // Classes that set or read deopt_id_. | 899 // Classes that set or read deopt_id_. |
| 896 friend class UnboxIntegerInstr; | 900 friend class UnboxIntegerInstr; |
| 897 friend class UnboxDoubleInstr; | 901 friend class UnboxDoubleInstr; |
| 898 friend class UnboxFloat32x4Instr; | 902 friend class UnboxFloat32x4Instr; |
| 899 friend class UnboxUint32x4Instr; | 903 friend class UnboxUint32x4Instr; |
| 900 friend class BinaryDoubleOpInstr; | 904 friend class BinaryDoubleOpInstr; |
| 901 friend class BinaryFloat32x4OpInstr; | 905 friend class BinaryFloat32x4OpInstr; |
| 902 friend class Float32x4ZeroInstr; | 906 friend class Float32x4ZeroInstr; |
| 903 friend class Float32x4SplatInstr; | 907 friend class Float32x4SplatInstr; |
| 904 friend class Float32x4ShuffleInstr; | 908 friend class Float32x4ShuffleInstr; |
| 909 friend class Float32x4GetSignMaskInstr; | |
| 905 friend class Float32x4ConstructorInstr; | 910 friend class Float32x4ConstructorInstr; |
| 906 friend class Float32x4ComparisonInstr; | 911 friend class Float32x4ComparisonInstr; |
| 907 friend class Float32x4MinMaxInstr; | 912 friend class Float32x4MinMaxInstr; |
| 908 friend class Float32x4ScaleInstr; | 913 friend class Float32x4ScaleInstr; |
| 909 friend class Float32x4SqrtInstr; | 914 friend class Float32x4SqrtInstr; |
| 910 friend class Float32x4ZeroArgInstr; | 915 friend class Float32x4ZeroArgInstr; |
| 911 friend class Float32x4ClampInstr; | 916 friend class Float32x4ClampInstr; |
| 912 friend class Float32x4WithInstr; | 917 friend class Float32x4WithInstr; |
| 913 friend class Float32x4ToUint32x4Instr; | 918 friend class Float32x4ToUint32x4Instr; |
| 914 friend class Float32x4TwoArgShuffleInstr; | 919 friend class Float32x4TwoArgShuffleInstr; |
| 915 friend class Uint32x4BoolConstructorInstr; | 920 friend class Uint32x4BoolConstructorInstr; |
| 916 friend class Uint32x4GetFlagInstr; | 921 friend class Uint32x4GetFlagInstr; |
| 922 friend class Uint32x4GetSignMaskInstr; | |
| 917 friend class Uint32x4SetFlagInstr; | 923 friend class Uint32x4SetFlagInstr; |
| 918 friend class Uint32x4SelectInstr; | 924 friend class Uint32x4SelectInstr; |
| 919 friend class Uint32x4ToFloat32x4Instr; | 925 friend class Uint32x4ToFloat32x4Instr; |
| 920 friend class BinaryUint32x4OpInstr; | 926 friend class BinaryUint32x4OpInstr; |
| 921 friend class BinaryMintOpInstr; | 927 friend class BinaryMintOpInstr; |
| 922 friend class BinarySmiOpInstr; | 928 friend class BinarySmiOpInstr; |
| 923 friend class UnarySmiOpInstr; | 929 friend class UnarySmiOpInstr; |
| 924 friend class UnaryDoubleOpInstr; | 930 friend class UnaryDoubleOpInstr; |
| 925 friend class ShiftMintOpInstr; | 931 friend class ShiftMintOpInstr; |
| 926 friend class UnaryMintOpInstr; | 932 friend class UnaryMintOpInstr; |
| (...skipping 4593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5520 | 5526 |
| 5521 virtual bool MayThrow() const { return false; } | 5527 virtual bool MayThrow() const { return false; } |
| 5522 | 5528 |
| 5523 private: | 5529 private: |
| 5524 const MethodRecognizer::Kind op_kind_; | 5530 const MethodRecognizer::Kind op_kind_; |
| 5525 | 5531 |
| 5526 DISALLOW_COPY_AND_ASSIGN(Uint32x4GetFlagInstr); | 5532 DISALLOW_COPY_AND_ASSIGN(Uint32x4GetFlagInstr); |
| 5527 }; | 5533 }; |
| 5528 | 5534 |
| 5529 | 5535 |
| 5536 class Uint32x4GetSignMaskInstr : public TemplateDefinition<1> { | |
|
srdjan
2013/08/19 17:30:27
Could you merge the two instructions?
Cutch
2013/08/19 17:53:21
Done.
| |
| 5537 public: | |
| 5538 Uint32x4GetSignMaskInstr(Value* value, intptr_t deopt_id) { | |
| 5539 SetInputAt(0, value); | |
| 5540 deopt_id_ = deopt_id; | |
| 5541 } | |
| 5542 | |
| 5543 Value* value() const { return inputs_[0]; } | |
| 5544 | |
| 5545 virtual void PrintOperandsTo(BufferFormatter* f) const; | |
| 5546 | |
| 5547 virtual bool CanDeoptimize() const { return false; } | |
| 5548 | |
| 5549 virtual Representation representation() const { | |
| 5550 return kTagged; | |
|
srdjan
2013/08/19 17:30:27
Indent bad
Cutch
2013/08/19 17:53:21
Done.
| |
| 5551 } | |
| 5552 | |
| 5553 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | |
| 5554 ASSERT(idx == 0); | |
| 5555 return kUnboxedUint32x4; | |
| 5556 } | |
| 5557 | |
| 5558 virtual intptr_t DeoptimizationTarget() const { | |
| 5559 // Direct access since this instruction cannot deoptimize, and the deopt-id | |
| 5560 // was inherited from another instruction that could deoptimize. | |
| 5561 return deopt_id_; | |
| 5562 } | |
| 5563 | |
| 5564 DECLARE_INSTRUCTION(Uint32x4GetSignMask) | |
| 5565 virtual CompileType ComputeType() const; | |
| 5566 | |
| 5567 virtual bool AllowsCSE() const { return true; } | |
| 5568 virtual EffectSet Effects() const { return EffectSet::None(); } | |
| 5569 virtual EffectSet Dependencies() const { return EffectSet::None(); } | |
| 5570 virtual bool AttributesEqual(Instruction* other) const { | |
| 5571 return true; | |
| 5572 } | |
| 5573 | |
| 5574 virtual bool MayThrow() const { return false; } | |
| 5575 | |
| 5576 private: | |
| 5577 DISALLOW_COPY_AND_ASSIGN(Uint32x4GetSignMaskInstr); | |
| 5578 }; | |
| 5579 | |
| 5580 | |
| 5581 class Float32x4GetSignMaskInstr : public TemplateDefinition<1> { | |
| 5582 public: | |
| 5583 Float32x4GetSignMaskInstr(Value* value, intptr_t deopt_id) { | |
| 5584 SetInputAt(0, value); | |
| 5585 deopt_id_ = deopt_id; | |
| 5586 } | |
| 5587 | |
| 5588 Value* value() const { return inputs_[0]; } | |
| 5589 | |
| 5590 virtual void PrintOperandsTo(BufferFormatter* f) const; | |
| 5591 | |
| 5592 virtual bool CanDeoptimize() const { return false; } | |
| 5593 | |
| 5594 virtual Representation representation() const { | |
| 5595 return kTagged; | |
|
srdjan
2013/08/19 17:30:27
ditto
Cutch
2013/08/19 17:53:21
Done.
| |
| 5596 } | |
| 5597 | |
| 5598 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | |
| 5599 ASSERT(idx == 0); | |
| 5600 return kUnboxedFloat32x4; | |
| 5601 } | |
| 5602 | |
| 5603 virtual intptr_t DeoptimizationTarget() const { | |
| 5604 // Direct access since this instruction cannot deoptimize, and the deopt-id | |
| 5605 // was inherited from another instruction that could deoptimize. | |
| 5606 return deopt_id_; | |
| 5607 } | |
| 5608 | |
| 5609 DECLARE_INSTRUCTION(Float32x4GetSignMask) | |
| 5610 virtual CompileType ComputeType() const; | |
| 5611 | |
| 5612 virtual bool AllowsCSE() const { return true; } | |
| 5613 virtual EffectSet Effects() const { return EffectSet::None(); } | |
| 5614 virtual EffectSet Dependencies() const { return EffectSet::None(); } | |
| 5615 virtual bool AttributesEqual(Instruction* other) const { | |
| 5616 return true; | |
| 5617 } | |
| 5618 | |
| 5619 virtual bool MayThrow() const { return false; } | |
| 5620 | |
| 5621 private: | |
| 5622 DISALLOW_COPY_AND_ASSIGN(Float32x4GetSignMaskInstr); | |
| 5623 }; | |
| 5624 | |
| 5625 | |
| 5530 class Float32x4TwoArgShuffleInstr : public TemplateDefinition<2> { | 5626 class Float32x4TwoArgShuffleInstr : public TemplateDefinition<2> { |
| 5531 public: | 5627 public: |
| 5532 Float32x4TwoArgShuffleInstr(MethodRecognizer::Kind op_kind, Value* left, | 5628 Float32x4TwoArgShuffleInstr(MethodRecognizer::Kind op_kind, Value* left, |
| 5533 Value* right, intptr_t deopt_id) | 5629 Value* right, intptr_t deopt_id) |
| 5534 : op_kind_(op_kind) { | 5630 : op_kind_(op_kind) { |
| 5535 SetInputAt(0, left); | 5631 SetInputAt(0, left); |
| 5536 SetInputAt(1, right); | 5632 SetInputAt(1, right); |
| 5537 deopt_id_ = deopt_id; | 5633 deopt_id_ = deopt_id; |
| 5538 } | 5634 } |
| 5539 | 5635 |
| (...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6675 ForwardInstructionIterator* current_iterator_; | 6771 ForwardInstructionIterator* current_iterator_; |
| 6676 | 6772 |
| 6677 private: | 6773 private: |
| 6678 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 6774 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 6679 }; | 6775 }; |
| 6680 | 6776 |
| 6681 | 6777 |
| 6682 } // namespace dart | 6778 } // namespace dart |
| 6683 | 6779 |
| 6684 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 6780 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |