| 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 RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ |
| 6 #define RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define RUNTIME_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/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 M(CheckEitherNonSmi) \ | 432 M(CheckEitherNonSmi) \ |
| 433 M(BinaryDoubleOp) \ | 433 M(BinaryDoubleOp) \ |
| 434 M(DoubleTestOp) \ | 434 M(DoubleTestOp) \ |
| 435 M(MathUnary) \ | 435 M(MathUnary) \ |
| 436 M(MathMinMax) \ | 436 M(MathMinMax) \ |
| 437 M(Box) \ | 437 M(Box) \ |
| 438 M(Unbox) \ | 438 M(Unbox) \ |
| 439 M(BoxInt64) \ | 439 M(BoxInt64) \ |
| 440 M(UnboxInt64) \ | 440 M(UnboxInt64) \ |
| 441 M(CaseInsensitiveCompareUC16) \ | 441 M(CaseInsensitiveCompareUC16) \ |
| 442 M(BinaryMintOp) \ | 442 M(BinaryInt64Op) \ |
| 443 M(ShiftMintOp) \ | 443 M(ShiftInt64Op) \ |
| 444 M(UnaryMintOp) \ | 444 M(UnaryInt64Op) \ |
| 445 M(CheckArrayBound) \ | 445 M(CheckArrayBound) \ |
| 446 M(GenericCheckBound) \ | 446 M(GenericCheckBound) \ |
| 447 M(Constraint) \ | 447 M(Constraint) \ |
| 448 M(StringToCharCode) \ | 448 M(StringToCharCode) \ |
| 449 M(OneByteStringFromCharCode) \ | 449 M(OneByteStringFromCharCode) \ |
| 450 M(StringInterpolate) \ | 450 M(StringInterpolate) \ |
| 451 M(InvokeMathCFunction) \ | 451 M(InvokeMathCFunction) \ |
| 452 M(TruncDivMod) \ | 452 M(TruncDivMod) \ |
| 453 M(GuardFieldClass) \ | 453 M(GuardFieldClass) \ |
| 454 M(GuardFieldLength) \ | 454 M(GuardFieldLength) \ |
| (...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1729 ASSERT(index >= 0); | 1729 ASSERT(index >= 0); |
| 1730 ssa_temp_index_ = index; | 1730 ssa_temp_index_ = index; |
| 1731 } | 1731 } |
| 1732 bool HasSSATemp() const { return ssa_temp_index_ >= 0; } | 1732 bool HasSSATemp() const { return ssa_temp_index_ >= 0; } |
| 1733 void ClearSSATempIndex() { ssa_temp_index_ = -1; } | 1733 void ClearSSATempIndex() { ssa_temp_index_ = -1; } |
| 1734 bool HasPairRepresentation() const { | 1734 bool HasPairRepresentation() const { |
| 1735 #if defined(TARGET_ARCH_X64) | 1735 #if defined(TARGET_ARCH_X64) |
| 1736 return representation() == kPairOfTagged; | 1736 return representation() == kPairOfTagged; |
| 1737 #else | 1737 #else |
| 1738 return (representation() == kPairOfTagged) || | 1738 return (representation() == kPairOfTagged) || |
| 1739 (representation() == kUnboxedMint); | 1739 (representation() == kUnboxedInt64); |
| 1740 #endif | 1740 #endif |
| 1741 } | 1741 } |
| 1742 | 1742 |
| 1743 // Compile time type of the definition, which may be requested before type | 1743 // Compile time type of the definition, which may be requested before type |
| 1744 // propagation during graph building. | 1744 // propagation during graph building. |
| 1745 CompileType* Type() { | 1745 CompileType* Type() { |
| 1746 if (type_ == NULL) { | 1746 if (type_ == NULL) { |
| 1747 type_ = new CompileType(ComputeType()); | 1747 type_ = new CompileType(ComputeType()); |
| 1748 } | 1748 } |
| 1749 return type_; | 1749 return type_; |
| (...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3143 | 3143 |
| 3144 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); | 3144 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); |
| 3145 | 3145 |
| 3146 virtual CompileType ComputeType() const; | 3146 virtual CompileType ComputeType() const; |
| 3147 | 3147 |
| 3148 virtual bool ComputeCanDeoptimize() const { return false; } | 3148 virtual bool ComputeCanDeoptimize() const { return false; } |
| 3149 | 3149 |
| 3150 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3150 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3151 ASSERT((idx == 0) || (idx == 1)); | 3151 ASSERT((idx == 0) || (idx == 1)); |
| 3152 if (operation_cid() == kDoubleCid) return kUnboxedDouble; | 3152 if (operation_cid() == kDoubleCid) return kUnboxedDouble; |
| 3153 if (operation_cid() == kMintCid) return kUnboxedMint; | 3153 if (operation_cid() == kMintCid) return kUnboxedInt64; |
| 3154 return kTagged; | 3154 return kTagged; |
| 3155 } | 3155 } |
| 3156 | 3156 |
| 3157 PRINT_OPERANDS_TO_SUPPORT | 3157 PRINT_OPERANDS_TO_SUPPORT |
| 3158 | 3158 |
| 3159 private: | 3159 private: |
| 3160 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr); | 3160 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr); |
| 3161 }; | 3161 }; |
| 3162 | 3162 |
| 3163 class RelationalOpInstr : public TemplateComparison<2, NoThrow, Pure> { | 3163 class RelationalOpInstr : public TemplateComparison<2, NoThrow, Pure> { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3179 | 3179 |
| 3180 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); | 3180 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); |
| 3181 | 3181 |
| 3182 virtual CompileType ComputeType() const; | 3182 virtual CompileType ComputeType() const; |
| 3183 | 3183 |
| 3184 virtual bool ComputeCanDeoptimize() const { return false; } | 3184 virtual bool ComputeCanDeoptimize() const { return false; } |
| 3185 | 3185 |
| 3186 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3186 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3187 ASSERT((idx == 0) || (idx == 1)); | 3187 ASSERT((idx == 0) || (idx == 1)); |
| 3188 if (operation_cid() == kDoubleCid) return kUnboxedDouble; | 3188 if (operation_cid() == kDoubleCid) return kUnboxedDouble; |
| 3189 if (operation_cid() == kMintCid) return kUnboxedMint; | 3189 if (operation_cid() == kMintCid) return kUnboxedInt64; |
| 3190 return kTagged; | 3190 return kTagged; |
| 3191 } | 3191 } |
| 3192 | 3192 |
| 3193 PRINT_OPERANDS_TO_SUPPORT | 3193 PRINT_OPERANDS_TO_SUPPORT |
| 3194 | 3194 |
| 3195 private: | 3195 private: |
| 3196 DISALLOW_COPY_AND_ASSIGN(RelationalOpInstr); | 3196 DISALLOW_COPY_AND_ASSIGN(RelationalOpInstr); |
| 3197 }; | 3197 }; |
| 3198 | 3198 |
| 3199 // TODO(vegorov): ComparisonInstr should be switched to use IfTheElseInstr for | 3199 // TODO(vegorov): ComparisonInstr should be switched to use IfTheElseInstr for |
| (...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4701 }; | 4701 }; |
| 4702 | 4702 |
| 4703 class Boxing : public AllStatic { | 4703 class Boxing : public AllStatic { |
| 4704 public: | 4704 public: |
| 4705 static bool Supports(Representation rep) { | 4705 static bool Supports(Representation rep) { |
| 4706 switch (rep) { | 4706 switch (rep) { |
| 4707 case kUnboxedDouble: | 4707 case kUnboxedDouble: |
| 4708 case kUnboxedFloat32x4: | 4708 case kUnboxedFloat32x4: |
| 4709 case kUnboxedFloat64x2: | 4709 case kUnboxedFloat64x2: |
| 4710 case kUnboxedInt32x4: | 4710 case kUnboxedInt32x4: |
| 4711 case kUnboxedMint: | 4711 case kUnboxedInt64: |
| 4712 case kUnboxedInt32: | 4712 case kUnboxedInt32: |
| 4713 case kUnboxedUint32: | 4713 case kUnboxedUint32: |
| 4714 return true; | 4714 return true; |
| 4715 default: | 4715 default: |
| 4716 return false; | 4716 return false; |
| 4717 } | 4717 } |
| 4718 } | 4718 } |
| 4719 | 4719 |
| 4720 static intptr_t ValueOffset(Representation rep) { | 4720 static intptr_t ValueOffset(Representation rep) { |
| 4721 switch (rep) { | 4721 switch (rep) { |
| 4722 case kUnboxedDouble: | 4722 case kUnboxedDouble: |
| 4723 return Double::value_offset(); | 4723 return Double::value_offset(); |
| 4724 | 4724 |
| 4725 case kUnboxedFloat32x4: | 4725 case kUnboxedFloat32x4: |
| 4726 return Float32x4::value_offset(); | 4726 return Float32x4::value_offset(); |
| 4727 | 4727 |
| 4728 case kUnboxedFloat64x2: | 4728 case kUnboxedFloat64x2: |
| 4729 return Float64x2::value_offset(); | 4729 return Float64x2::value_offset(); |
| 4730 | 4730 |
| 4731 case kUnboxedInt32x4: | 4731 case kUnboxedInt32x4: |
| 4732 return Int32x4::value_offset(); | 4732 return Int32x4::value_offset(); |
| 4733 | 4733 |
| 4734 case kUnboxedMint: | 4734 case kUnboxedInt64: |
| 4735 return Mint::value_offset(); | 4735 return Mint::value_offset(); |
| 4736 | 4736 |
| 4737 default: | 4737 default: |
| 4738 UNREACHABLE(); | 4738 UNREACHABLE(); |
| 4739 return 0; | 4739 return 0; |
| 4740 } | 4740 } |
| 4741 } | 4741 } |
| 4742 | 4742 |
| 4743 static intptr_t BoxCid(Representation rep) { | 4743 static intptr_t BoxCid(Representation rep) { |
| 4744 switch (rep) { | 4744 switch (rep) { |
| 4745 case kUnboxedMint: | 4745 case kUnboxedInt64: |
| 4746 return kMintCid; | 4746 return kMintCid; |
| 4747 case kUnboxedDouble: | 4747 case kUnboxedDouble: |
| 4748 return kDoubleCid; | 4748 return kDoubleCid; |
| 4749 case kUnboxedFloat32x4: | 4749 case kUnboxedFloat32x4: |
| 4750 return kFloat32x4Cid; | 4750 return kFloat32x4Cid; |
| 4751 case kUnboxedFloat64x2: | 4751 case kUnboxedFloat64x2: |
| 4752 return kFloat64x2Cid; | 4752 return kFloat64x2Cid; |
| 4753 case kUnboxedInt32x4: | 4753 case kUnboxedInt32x4: |
| 4754 return kInt32x4Cid; | 4754 return kInt32x4Cid; |
| 4755 default: | 4755 default: |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4849 : BoxInteger32Instr(kUnboxedUint32, value) {} | 4849 : BoxInteger32Instr(kUnboxedUint32, value) {} |
| 4850 | 4850 |
| 4851 DECLARE_INSTRUCTION_NO_BACKEND(BoxUint32) | 4851 DECLARE_INSTRUCTION_NO_BACKEND(BoxUint32) |
| 4852 | 4852 |
| 4853 private: | 4853 private: |
| 4854 DISALLOW_COPY_AND_ASSIGN(BoxUint32Instr); | 4854 DISALLOW_COPY_AND_ASSIGN(BoxUint32Instr); |
| 4855 }; | 4855 }; |
| 4856 | 4856 |
| 4857 class BoxInt64Instr : public BoxIntegerInstr { | 4857 class BoxInt64Instr : public BoxIntegerInstr { |
| 4858 public: | 4858 public: |
| 4859 explicit BoxInt64Instr(Value* value) : BoxIntegerInstr(kUnboxedMint, value) {} | 4859 explicit BoxInt64Instr(Value* value) |
| 4860 : BoxIntegerInstr(kUnboxedInt64, value) {} |
| 4860 | 4861 |
| 4861 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 4862 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
| 4862 | 4863 |
| 4863 DECLARE_INSTRUCTION(BoxInt64) | 4864 DECLARE_INSTRUCTION(BoxInt64) |
| 4864 | 4865 |
| 4865 private: | 4866 private: |
| 4866 DISALLOW_COPY_AND_ASSIGN(BoxInt64Instr); | 4867 DISALLOW_COPY_AND_ASSIGN(BoxInt64Instr); |
| 4867 }; | 4868 }; |
| 4868 | 4869 |
| 4869 class UnboxInstr : public TemplateDefinition<1, NoThrow, Pure> { | 4870 class UnboxInstr : public TemplateDefinition<1, NoThrow, Pure> { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4996 | 4997 |
| 4997 DECLARE_INSTRUCTION_NO_BACKEND(UnboxInt32) | 4998 DECLARE_INSTRUCTION_NO_BACKEND(UnboxInt32) |
| 4998 | 4999 |
| 4999 private: | 5000 private: |
| 5000 DISALLOW_COPY_AND_ASSIGN(UnboxInt32Instr); | 5001 DISALLOW_COPY_AND_ASSIGN(UnboxInt32Instr); |
| 5001 }; | 5002 }; |
| 5002 | 5003 |
| 5003 class UnboxInt64Instr : public UnboxIntegerInstr { | 5004 class UnboxInt64Instr : public UnboxIntegerInstr { |
| 5004 public: | 5005 public: |
| 5005 UnboxInt64Instr(Value* value, intptr_t deopt_id) | 5006 UnboxInt64Instr(Value* value, intptr_t deopt_id) |
| 5006 : UnboxIntegerInstr(kUnboxedMint, kNoTruncation, value, deopt_id) {} | 5007 : UnboxIntegerInstr(kUnboxedInt64, kNoTruncation, value, deopt_id) {} |
| 5007 | 5008 |
| 5008 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 5009 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
| 5009 | 5010 |
| 5010 DECLARE_INSTRUCTION_NO_BACKEND(UnboxInt64) | 5011 DECLARE_INSTRUCTION_NO_BACKEND(UnboxInt64) |
| 5011 | 5012 |
| 5012 private: | 5013 private: |
| 5013 DISALLOW_COPY_AND_ASSIGN(UnboxInt64Instr); | 5014 DISALLOW_COPY_AND_ASSIGN(UnboxInt64Instr); |
| 5014 }; | 5015 }; |
| 5015 | 5016 |
| 5016 bool Definition::IsMintDefinition() { | 5017 bool Definition::IsMintDefinition() { |
| 5017 return (Type()->ToCid() == kMintCid) || IsBinaryMintOp() || IsUnaryMintOp() || | 5018 return (Type()->ToCid() == kMintCid) || IsBinaryInt64Op() || |
| 5018 IsShiftMintOp() || IsBoxInt64() || IsUnboxInt64(); | 5019 IsUnaryInt64Op() || IsShiftInt64Op() || IsBoxInt64() || IsUnboxInt64(); |
| 5019 } | 5020 } |
| 5020 | 5021 |
| 5021 class MathUnaryInstr : public TemplateDefinition<1, NoThrow, Pure> { | 5022 class MathUnaryInstr : public TemplateDefinition<1, NoThrow, Pure> { |
| 5022 public: | 5023 public: |
| 5023 enum MathUnaryKind { | 5024 enum MathUnaryKind { |
| 5024 kIllegal, | 5025 kIllegal, |
| 5025 kSqrt, | 5026 kSqrt, |
| 5026 kDoubleSquare, | 5027 kDoubleSquare, |
| 5027 }; | 5028 }; |
| 5028 MathUnaryInstr(MathUnaryKind kind, Value* value, intptr_t deopt_id) | 5029 MathUnaryInstr(MathUnaryKind kind, Value* value, intptr_t deopt_id) |
| (...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6693 ASSERT(idx == 0); | 6694 ASSERT(idx == 0); |
| 6694 return kUnboxedUint32; | 6695 return kUnboxedUint32; |
| 6695 } | 6696 } |
| 6696 | 6697 |
| 6697 DECLARE_INSTRUCTION(UnaryUint32Op) | 6698 DECLARE_INSTRUCTION(UnaryUint32Op) |
| 6698 | 6699 |
| 6699 private: | 6700 private: |
| 6700 DISALLOW_COPY_AND_ASSIGN(UnaryUint32OpInstr); | 6701 DISALLOW_COPY_AND_ASSIGN(UnaryUint32OpInstr); |
| 6701 }; | 6702 }; |
| 6702 | 6703 |
| 6703 class UnaryMintOpInstr : public UnaryIntegerOpInstr { | 6704 class UnaryInt64OpInstr : public UnaryIntegerOpInstr { |
| 6704 public: | 6705 public: |
| 6705 UnaryMintOpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) | 6706 UnaryInt64OpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) |
| 6706 : UnaryIntegerOpInstr(op_kind, value, deopt_id) { | 6707 : UnaryIntegerOpInstr(op_kind, value, deopt_id) { |
| 6707 ASSERT(op_kind == Token::kBIT_NOT); | 6708 ASSERT(op_kind == Token::kBIT_NOT); |
| 6708 } | 6709 } |
| 6709 | 6710 |
| 6710 virtual bool ComputeCanDeoptimize() const { return false; } | 6711 virtual bool ComputeCanDeoptimize() const { return false; } |
| 6711 | 6712 |
| 6712 virtual CompileType ComputeType() const; | 6713 virtual CompileType ComputeType() const; |
| 6713 | 6714 |
| 6714 virtual Representation representation() const { return kUnboxedMint; } | 6715 virtual Representation representation() const { return kUnboxedInt64; } |
| 6715 | 6716 |
| 6716 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 6717 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 6717 ASSERT(idx == 0); | 6718 ASSERT(idx == 0); |
| 6718 return kUnboxedMint; | 6719 return kUnboxedInt64; |
| 6719 } | 6720 } |
| 6720 | 6721 |
| 6721 DECLARE_INSTRUCTION(UnaryMintOp) | 6722 DECLARE_INSTRUCTION(UnaryInt64Op) |
| 6722 | 6723 |
| 6723 private: | 6724 private: |
| 6724 DISALLOW_COPY_AND_ASSIGN(UnaryMintOpInstr); | 6725 DISALLOW_COPY_AND_ASSIGN(UnaryInt64OpInstr); |
| 6725 }; | 6726 }; |
| 6726 | 6727 |
| 6727 class CheckedSmiOpInstr : public TemplateDefinition<2, Throws> { | 6728 class CheckedSmiOpInstr : public TemplateDefinition<2, Throws> { |
| 6728 public: | 6729 public: |
| 6729 CheckedSmiOpInstr(Token::Kind op_kind, | 6730 CheckedSmiOpInstr(Token::Kind op_kind, |
| 6730 Value* left, | 6731 Value* left, |
| 6731 Value* right, | 6732 Value* right, |
| 6732 InstanceCallInstr* call) | 6733 InstanceCallInstr* call) |
| 6733 : TemplateDefinition(call->deopt_id()), call_(call), op_kind_(op_kind) { | 6734 : TemplateDefinition(call->deopt_id()), call_(call), op_kind_(op_kind) { |
| 6734 ASSERT(call->type_args_len() == 0); | 6735 ASSERT(call->type_args_len() == 0); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7007 } | 7008 } |
| 7008 | 7009 |
| 7009 virtual CompileType ComputeType() const; | 7010 virtual CompileType ComputeType() const; |
| 7010 | 7011 |
| 7011 DECLARE_INSTRUCTION(ShiftUint32Op) | 7012 DECLARE_INSTRUCTION(ShiftUint32Op) |
| 7012 | 7013 |
| 7013 private: | 7014 private: |
| 7014 DISALLOW_COPY_AND_ASSIGN(ShiftUint32OpInstr); | 7015 DISALLOW_COPY_AND_ASSIGN(ShiftUint32OpInstr); |
| 7015 }; | 7016 }; |
| 7016 | 7017 |
| 7017 class BinaryMintOpInstr : public BinaryIntegerOpInstr { | 7018 class BinaryInt64OpInstr : public BinaryIntegerOpInstr { |
| 7018 public: | 7019 public: |
| 7019 BinaryMintOpInstr(Token::Kind op_kind, | 7020 BinaryInt64OpInstr(Token::Kind op_kind, |
| 7020 Value* left, | 7021 Value* left, |
| 7021 Value* right, | 7022 Value* right, |
| 7022 intptr_t deopt_id) | 7023 intptr_t deopt_id) |
| 7023 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id) { | 7024 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id) { |
| 7024 if (FLAG_limit_ints_to_64_bits) { | 7025 if (FLAG_limit_ints_to_64_bits) { |
| 7025 mark_truncating(); | 7026 mark_truncating(); |
| 7026 } | 7027 } |
| 7027 } | 7028 } |
| 7028 | 7029 |
| 7029 virtual bool ComputeCanDeoptimize() const { | 7030 virtual bool ComputeCanDeoptimize() const { |
| 7030 switch (op_kind()) { | 7031 switch (op_kind()) { |
| 7031 case Token::kADD: | 7032 case Token::kADD: |
| 7032 case Token::kSUB: | 7033 case Token::kSUB: |
| 7033 return can_overflow(); | 7034 return can_overflow(); |
| 7034 case Token::kMUL: | 7035 case Token::kMUL: |
| 7035 // Note that ARM64 does not support operations with unboxed mints, | 7036 // Note that ARM64 does not support operations with unboxed mints, |
| 7036 // so it is not handled here. | 7037 // so it is not handled here. |
| 7037 #if defined(TARGET_ARCH_X64) | 7038 #if defined(TARGET_ARCH_X64) |
| 7038 return can_overflow(); // Deopt if overflow. | 7039 return can_overflow(); // Deopt if overflow. |
| 7039 #else | 7040 #else |
| 7040 // IA32, ARM | 7041 // IA32, ARM |
| 7041 return true; // Deopt if inputs are not int32. | 7042 return true; // Deopt if inputs are not int32. |
| 7042 #endif | 7043 #endif |
| 7043 default: | 7044 default: |
| 7044 return false; | 7045 return false; |
| 7045 } | 7046 } |
| 7046 } | 7047 } |
| 7047 | 7048 |
| 7048 virtual Representation representation() const { return kUnboxedMint; } | 7049 virtual Representation representation() const { return kUnboxedInt64; } |
| 7049 | 7050 |
| 7050 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 7051 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 7051 ASSERT((idx == 0) || (idx == 1)); | 7052 ASSERT((idx == 0) || (idx == 1)); |
| 7052 return kUnboxedMint; | 7053 return kUnboxedInt64; |
| 7053 } | 7054 } |
| 7054 | 7055 |
| 7055 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 7056 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
| 7056 virtual CompileType ComputeType() const; | 7057 virtual CompileType ComputeType() const; |
| 7057 | 7058 |
| 7058 DECLARE_INSTRUCTION(BinaryMintOp) | 7059 DECLARE_INSTRUCTION(BinaryInt64Op) |
| 7059 | 7060 |
| 7060 private: | 7061 private: |
| 7061 DISALLOW_COPY_AND_ASSIGN(BinaryMintOpInstr); | 7062 DISALLOW_COPY_AND_ASSIGN(BinaryInt64OpInstr); |
| 7062 }; | 7063 }; |
| 7063 | 7064 |
| 7064 class ShiftMintOpInstr : public BinaryIntegerOpInstr { | 7065 class ShiftInt64OpInstr : public BinaryIntegerOpInstr { |
| 7065 public: | 7066 public: |
| 7066 ShiftMintOpInstr(Token::Kind op_kind, | 7067 ShiftInt64OpInstr(Token::Kind op_kind, |
| 7067 Value* left, | 7068 Value* left, |
| 7068 Value* right, | 7069 Value* right, |
| 7069 intptr_t deopt_id) | 7070 intptr_t deopt_id) |
| 7070 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id), | 7071 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id), |
| 7071 shift_range_(NULL) { | 7072 shift_range_(NULL) { |
| 7072 ASSERT((op_kind == Token::kSHR) || (op_kind == Token::kSHL)); | 7073 ASSERT((op_kind == Token::kSHR) || (op_kind == Token::kSHL)); |
| 7073 if (FLAG_limit_ints_to_64_bits) { | 7074 if (FLAG_limit_ints_to_64_bits) { |
| 7074 mark_truncating(); | 7075 mark_truncating(); |
| 7075 } | 7076 } |
| 7076 } | 7077 } |
| 7077 | 7078 |
| 7078 Range* shift_range() const { return shift_range_; } | 7079 Range* shift_range() const { return shift_range_; } |
| 7079 | 7080 |
| 7080 virtual bool ComputeCanDeoptimize() const { | 7081 virtual bool ComputeCanDeoptimize() const { |
| 7081 return (!IsShiftCountInRange()) || | 7082 return (!IsShiftCountInRange()) || |
| 7082 (can_overflow() && (op_kind() == Token::kSHL)); | 7083 (can_overflow() && (op_kind() == Token::kSHL)); |
| 7083 } | 7084 } |
| 7084 | 7085 |
| 7085 virtual Representation representation() const { return kUnboxedMint; } | 7086 virtual Representation representation() const { return kUnboxedInt64; } |
| 7086 | 7087 |
| 7087 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 7088 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 7088 ASSERT((idx == 0) || (idx == 1)); | 7089 ASSERT((idx == 0) || (idx == 1)); |
| 7089 return (idx == 0) ? kUnboxedMint : kTagged; | 7090 return (idx == 0) ? kUnboxedInt64 : kTagged; |
| 7090 } | 7091 } |
| 7091 | 7092 |
| 7092 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 7093 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
| 7093 virtual CompileType ComputeType() const; | 7094 virtual CompileType ComputeType() const; |
| 7094 | 7095 |
| 7095 DECLARE_INSTRUCTION(ShiftMintOp) | 7096 DECLARE_INSTRUCTION(ShiftInt64Op) |
| 7096 | 7097 |
| 7097 private: | 7098 private: |
| 7098 static const intptr_t kMintShiftCountLimit = 63; | 7099 static const intptr_t kMintShiftCountLimit = 63; |
| 7099 | 7100 |
| 7100 // Returns true if the shift amount is guranteed to be in | 7101 // Returns true if the shift amount is guranteed to be in |
| 7101 // [0..kMintShiftCountLimit] range. | 7102 // [0..kMintShiftCountLimit] range. |
| 7102 bool IsShiftCountInRange() const; | 7103 bool IsShiftCountInRange() const; |
| 7103 | 7104 |
| 7104 Range* shift_range_; | 7105 Range* shift_range_; |
| 7105 | 7106 |
| 7106 DISALLOW_COPY_AND_ASSIGN(ShiftMintOpInstr); | 7107 DISALLOW_COPY_AND_ASSIGN(ShiftInt64OpInstr); |
| 7107 }; | 7108 }; |
| 7108 | 7109 |
| 7109 // Handles only NEGATE. | 7110 // Handles only NEGATE. |
| 7110 class UnaryDoubleOpInstr : public TemplateDefinition<1, NoThrow, Pure> { | 7111 class UnaryDoubleOpInstr : public TemplateDefinition<1, NoThrow, Pure> { |
| 7111 public: | 7112 public: |
| 7112 UnaryDoubleOpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) | 7113 UnaryDoubleOpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) |
| 7113 : TemplateDefinition(deopt_id), op_kind_(op_kind) { | 7114 : TemplateDefinition(deopt_id), op_kind_(op_kind) { |
| 7114 ASSERT(op_kind == Token::kNEGATE); | 7115 ASSERT(op_kind == Token::kNEGATE); |
| 7115 SetInputAt(0, value); | 7116 SetInputAt(0, value); |
| 7116 } | 7117 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7249 SetInputAt(0, value); | 7250 SetInputAt(0, value); |
| 7250 } | 7251 } |
| 7251 | 7252 |
| 7252 Value* value() const { return inputs_[0]; } | 7253 Value* value() const { return inputs_[0]; } |
| 7253 | 7254 |
| 7254 DECLARE_INSTRUCTION(MintToDouble) | 7255 DECLARE_INSTRUCTION(MintToDouble) |
| 7255 virtual CompileType ComputeType() const; | 7256 virtual CompileType ComputeType() const; |
| 7256 | 7257 |
| 7257 virtual Representation RequiredInputRepresentation(intptr_t index) const { | 7258 virtual Representation RequiredInputRepresentation(intptr_t index) const { |
| 7258 ASSERT(index == 0); | 7259 ASSERT(index == 0); |
| 7259 return kUnboxedMint; | 7260 return kUnboxedInt64; |
| 7260 } | 7261 } |
| 7261 | 7262 |
| 7262 virtual Representation representation() const { return kUnboxedDouble; } | 7263 virtual Representation representation() const { return kUnboxedDouble; } |
| 7263 | 7264 |
| 7264 virtual intptr_t DeoptimizationTarget() const { | 7265 virtual intptr_t DeoptimizationTarget() const { |
| 7265 // Direct access since this instruction cannot deoptimize, and the deopt-id | 7266 // Direct access since this instruction cannot deoptimize, and the deopt-id |
| 7266 // was inherited from another instruction that could deoptimize. | 7267 // was inherited from another instruction that could deoptimize. |
| 7267 return GetDeoptId(); | 7268 return GetDeoptId(); |
| 7268 } | 7269 } |
| 7269 | 7270 |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7777 public: | 7778 public: |
| 7778 UnboxedIntConverterInstr(Representation from, | 7779 UnboxedIntConverterInstr(Representation from, |
| 7779 Representation to, | 7780 Representation to, |
| 7780 Value* value, | 7781 Value* value, |
| 7781 intptr_t deopt_id) | 7782 intptr_t deopt_id) |
| 7782 : TemplateDefinition(deopt_id), | 7783 : TemplateDefinition(deopt_id), |
| 7783 from_representation_(from), | 7784 from_representation_(from), |
| 7784 to_representation_(to), | 7785 to_representation_(to), |
| 7785 is_truncating_(to == kUnboxedUint32) { | 7786 is_truncating_(to == kUnboxedUint32) { |
| 7786 ASSERT(from != to); | 7787 ASSERT(from != to); |
| 7787 ASSERT((from == kUnboxedMint) || (from == kUnboxedUint32) || | 7788 ASSERT((from == kUnboxedInt64) || (from == kUnboxedUint32) || |
| 7788 (from == kUnboxedInt32)); | 7789 (from == kUnboxedInt32)); |
| 7789 ASSERT((to == kUnboxedMint) || (to == kUnboxedUint32) || | 7790 ASSERT((to == kUnboxedInt64) || (to == kUnboxedUint32) || |
| 7790 (to == kUnboxedInt32)); | 7791 (to == kUnboxedInt32)); |
| 7791 SetInputAt(0, value); | 7792 SetInputAt(0, value); |
| 7792 } | 7793 } |
| 7793 | 7794 |
| 7794 Value* value() const { return inputs_[0]; } | 7795 Value* value() const { return inputs_[0]; } |
| 7795 | 7796 |
| 7796 Representation from() const { return from_representation_; } | 7797 Representation from() const { return from_representation_; } |
| 7797 Representation to() const { return to_representation_; } | 7798 Representation to() const { return to_representation_; } |
| 7798 bool is_truncating() const { return is_truncating_; } | 7799 bool is_truncating() const { return is_truncating_; } |
| 7799 | 7800 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8095 #define DEFINE_UNIMPLEMENTED_INSTRUCTION(Name) \ | 8096 #define DEFINE_UNIMPLEMENTED_INSTRUCTION(Name) \ |
| 8096 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8097 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
| 8097 UNIMPLEMENTED(); \ | 8098 UNIMPLEMENTED(); \ |
| 8098 return NULL; \ | 8099 return NULL; \ |
| 8099 } \ | 8100 } \ |
| 8100 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8101 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
| 8101 | 8102 |
| 8102 } // namespace dart | 8103 } // namespace dart |
| 8103 | 8104 |
| 8104 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 8105 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |