| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ | 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ |
| 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ | 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ |
| 7 | 7 |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 #include <iosfwd> | 9 #include <iosfwd> |
| 10 | 10 |
| (...skipping 3762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3773 | 3773 |
| 3774 int32_t int32_value_; | 3774 int32_t int32_value_; |
| 3775 double double_value_; | 3775 double double_value_; |
| 3776 ExternalReference external_reference_value_; | 3776 ExternalReference external_reference_value_; |
| 3777 }; | 3777 }; |
| 3778 | 3778 |
| 3779 | 3779 |
| 3780 class HBinaryOperation : public HTemplateInstruction<3> { | 3780 class HBinaryOperation : public HTemplateInstruction<3> { |
| 3781 public: | 3781 public: |
| 3782 HBinaryOperation(HValue* context, HValue* left, HValue* right, | 3782 HBinaryOperation(HValue* context, HValue* left, HValue* right, |
| 3783 LanguageMode language_mode, HType type = HType::Tagged()) | 3783 Strength strength, HType type = HType::Tagged()) |
| 3784 : HTemplateInstruction<3>(type), language_mode_(language_mode), | 3784 : HTemplateInstruction<3>(type), |
| 3785 strength_(strength), |
| 3785 observed_output_representation_(Representation::None()) { | 3786 observed_output_representation_(Representation::None()) { |
| 3786 DCHECK(left != NULL && right != NULL); | 3787 DCHECK(left != NULL && right != NULL); |
| 3787 SetOperandAt(0, context); | 3788 SetOperandAt(0, context); |
| 3788 SetOperandAt(1, left); | 3789 SetOperandAt(1, left); |
| 3789 SetOperandAt(2, right); | 3790 SetOperandAt(2, right); |
| 3790 observed_input_representation_[0] = Representation::None(); | 3791 observed_input_representation_[0] = Representation::None(); |
| 3791 observed_input_representation_[1] = Representation::None(); | 3792 observed_input_representation_[1] = Representation::None(); |
| 3792 } | 3793 } |
| 3793 | 3794 |
| 3794 HValue* context() const { return OperandAt(0); } | 3795 HValue* context() const { return OperandAt(0); } |
| 3795 HValue* left() const { return OperandAt(1); } | 3796 HValue* left() const { return OperandAt(1); } |
| 3796 HValue* right() const { return OperandAt(2); } | 3797 HValue* right() const { return OperandAt(2); } |
| 3797 LanguageMode language_mode() const { return language_mode_; } | 3798 Strength strength() const { return strength_; } |
| 3798 | 3799 |
| 3799 // True if switching left and right operands likely generates better code. | 3800 // True if switching left and right operands likely generates better code. |
| 3800 bool AreOperandsBetterSwitched() { | 3801 bool AreOperandsBetterSwitched() { |
| 3801 if (!IsCommutative()) return false; | 3802 if (!IsCommutative()) return false; |
| 3802 | 3803 |
| 3803 // Constant operands are better off on the right, they can be inlined in | 3804 // Constant operands are better off on the right, they can be inlined in |
| 3804 // many situations on most platforms. | 3805 // many situations on most platforms. |
| 3805 if (left()->IsConstant()) return true; | 3806 if (left()->IsConstant()) return true; |
| 3806 if (right()->IsConstant()) return false; | 3807 if (right()->IsConstant()) return false; |
| 3807 | 3808 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3863 | 3864 |
| 3864 bool RightIsPowerOf2() { | 3865 bool RightIsPowerOf2() { |
| 3865 if (!right()->IsInteger32Constant()) return false; | 3866 if (!right()->IsInteger32Constant()) return false; |
| 3866 int32_t value = right()->GetInteger32Constant(); | 3867 int32_t value = right()->GetInteger32Constant(); |
| 3867 if (value < 0) { | 3868 if (value < 0) { |
| 3868 return base::bits::IsPowerOfTwo32(static_cast<uint32_t>(-value)); | 3869 return base::bits::IsPowerOfTwo32(static_cast<uint32_t>(-value)); |
| 3869 } | 3870 } |
| 3870 return base::bits::IsPowerOfTwo32(static_cast<uint32_t>(value)); | 3871 return base::bits::IsPowerOfTwo32(static_cast<uint32_t>(value)); |
| 3871 } | 3872 } |
| 3872 | 3873 |
| 3873 LanguageMode language_mode() { | 3874 Strength strength() { return strength_; } |
| 3874 return language_mode_; | |
| 3875 } | |
| 3876 | 3875 |
| 3877 DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation) | 3876 DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation) |
| 3878 | 3877 |
| 3879 private: | 3878 private: |
| 3880 bool IgnoreObservedOutputRepresentation(Representation current_rep); | 3879 bool IgnoreObservedOutputRepresentation(Representation current_rep); |
| 3881 LanguageMode language_mode_; | 3880 Strength strength_; |
| 3882 | 3881 |
| 3883 Representation observed_input_representation_[2]; | 3882 Representation observed_input_representation_[2]; |
| 3884 Representation observed_output_representation_; | 3883 Representation observed_output_representation_; |
| 3885 }; | 3884 }; |
| 3886 | 3885 |
| 3887 | 3886 |
| 3888 class HWrapReceiver final : public HTemplateInstruction<2> { | 3887 class HWrapReceiver final : public HTemplateInstruction<2> { |
| 3889 public: | 3888 public: |
| 3890 DECLARE_INSTRUCTION_FACTORY_P2(HWrapReceiver, HValue*, HValue*); | 3889 DECLARE_INSTRUCTION_FACTORY_P2(HWrapReceiver, HValue*, HValue*); |
| 3891 | 3890 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4141 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT | 4140 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 4142 | 4141 |
| 4143 int RedefinedOperandIndex() override { return 0; } | 4142 int RedefinedOperandIndex() override { return 0; } |
| 4144 bool IsPurelyInformativeDefinition() override { return true; } | 4143 bool IsPurelyInformativeDefinition() override { return true; } |
| 4145 }; | 4144 }; |
| 4146 | 4145 |
| 4147 | 4146 |
| 4148 class HBitwiseBinaryOperation : public HBinaryOperation { | 4147 class HBitwiseBinaryOperation : public HBinaryOperation { |
| 4149 public: | 4148 public: |
| 4150 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, | 4149 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, |
| 4151 LanguageMode language_mode, | 4150 Strength strength, HType type = HType::TaggedNumber()) |
| 4152 HType type = HType::TaggedNumber()) | 4151 : HBinaryOperation(context, left, right, strength, type) { |
| 4153 : HBinaryOperation(context, left, right, language_mode, type) { | |
| 4154 SetFlag(kFlexibleRepresentation); | 4152 SetFlag(kFlexibleRepresentation); |
| 4155 SetFlag(kTruncatingToInt32); | 4153 SetFlag(kTruncatingToInt32); |
| 4156 SetFlag(kAllowUndefinedAsNaN); | 4154 SetFlag(kAllowUndefinedAsNaN); |
| 4157 SetAllSideEffects(); | 4155 SetAllSideEffects(); |
| 4158 } | 4156 } |
| 4159 | 4157 |
| 4160 void RepresentationChanged(Representation to) override { | 4158 void RepresentationChanged(Representation to) override { |
| 4161 if (to.IsTagged() && | 4159 if (to.IsTagged() && |
| 4162 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { | 4160 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { |
| 4163 SetAllSideEffects(); | 4161 SetAllSideEffects(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4202 HValue*, | 4200 HValue*, |
| 4203 HValue*); | 4201 HValue*); |
| 4204 | 4202 |
| 4205 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv) | 4203 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv) |
| 4206 | 4204 |
| 4207 protected: | 4205 protected: |
| 4208 bool DataEquals(HValue* other) override { return true; } | 4206 bool DataEquals(HValue* other) override { return true; } |
| 4209 | 4207 |
| 4210 private: | 4208 private: |
| 4211 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) | 4209 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) |
| 4212 : HBinaryOperation(context, left, right, SLOPPY) { | 4210 : HBinaryOperation(context, left, right, Strength::WEAK) { |
| 4213 set_representation(Representation::Integer32()); | 4211 set_representation(Representation::Integer32()); |
| 4214 SetFlag(kUseGVN); | 4212 SetFlag(kUseGVN); |
| 4215 SetFlag(kCanOverflow); | 4213 SetFlag(kCanOverflow); |
| 4216 SetFlag(kCanBeDivByZero); | 4214 SetFlag(kCanBeDivByZero); |
| 4217 SetFlag(kLeftCanBeMinInt); | 4215 SetFlag(kLeftCanBeMinInt); |
| 4218 SetFlag(kLeftCanBeNegative); | 4216 SetFlag(kLeftCanBeNegative); |
| 4219 SetFlag(kLeftCanBePositive); | 4217 SetFlag(kLeftCanBePositive); |
| 4220 SetFlag(kAllowUndefinedAsNaN); | 4218 SetFlag(kAllowUndefinedAsNaN); |
| 4221 } | 4219 } |
| 4222 | 4220 |
| 4223 Range* InferRange(Zone* zone) override; | 4221 Range* InferRange(Zone* zone) override; |
| 4224 | 4222 |
| 4225 bool IsDeletable() const override { return true; } | 4223 bool IsDeletable() const override { return true; } |
| 4226 }; | 4224 }; |
| 4227 | 4225 |
| 4228 | 4226 |
| 4229 class HArithmeticBinaryOperation : public HBinaryOperation { | 4227 class HArithmeticBinaryOperation : public HBinaryOperation { |
| 4230 public: | 4228 public: |
| 4231 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right, | 4229 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right, |
| 4232 LanguageMode language_mode) | 4230 Strength strength) |
| 4233 : HBinaryOperation(context, left, right, language_mode, | 4231 : HBinaryOperation(context, left, right, strength, |
| 4234 HType::TaggedNumber()) { | 4232 HType::TaggedNumber()) { |
| 4235 SetAllSideEffects(); | 4233 SetAllSideEffects(); |
| 4236 SetFlag(kFlexibleRepresentation); | 4234 SetFlag(kFlexibleRepresentation); |
| 4237 SetFlag(kAllowUndefinedAsNaN); | 4235 SetFlag(kAllowUndefinedAsNaN); |
| 4238 } | 4236 } |
| 4239 | 4237 |
| 4240 void RepresentationChanged(Representation to) override { | 4238 void RepresentationChanged(Representation to) override { |
| 4241 if (to.IsTagged() && | 4239 if (to.IsTagged() && |
| 4242 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { | 4240 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { |
| 4243 SetAllSideEffects(); | 4241 SetAllSideEffects(); |
| 4244 ClearFlag(kUseGVN); | 4242 ClearFlag(kUseGVN); |
| 4245 } else { | 4243 } else { |
| 4246 ClearAllSideEffects(); | 4244 ClearAllSideEffects(); |
| 4247 SetFlag(kUseGVN); | 4245 SetFlag(kUseGVN); |
| 4248 } | 4246 } |
| 4249 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); | 4247 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); |
| 4250 } | 4248 } |
| 4251 | 4249 |
| 4252 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) | 4250 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) |
| 4253 | 4251 |
| 4254 private: | 4252 private: |
| 4255 bool IsDeletable() const override { return true; } | 4253 bool IsDeletable() const override { return true; } |
| 4256 }; | 4254 }; |
| 4257 | 4255 |
| 4258 | 4256 |
| 4259 class HCompareGeneric final : public HBinaryOperation { | 4257 class HCompareGeneric final : public HBinaryOperation { |
| 4260 public: | 4258 public: |
| 4261 static HCompareGeneric* New(Isolate* isolate, Zone* zone, HValue* context, | 4259 static HCompareGeneric* New(Isolate* isolate, Zone* zone, HValue* context, |
| 4262 HValue* left, HValue* right, Token::Value token, | 4260 HValue* left, HValue* right, Token::Value token, |
| 4263 LanguageMode language_mode = SLOPPY) { | 4261 Strength strength = Strength::WEAK) { |
| 4264 return new(zone) HCompareGeneric(context, left, right, token, | 4262 return new (zone) HCompareGeneric(context, left, right, token, strength); |
| 4265 language_mode); | |
| 4266 } | 4263 } |
| 4267 | 4264 |
| 4268 Representation RequiredInputRepresentation(int index) override { | 4265 Representation RequiredInputRepresentation(int index) override { |
| 4269 return index == 0 | 4266 return index == 0 |
| 4270 ? Representation::Tagged() | 4267 ? Representation::Tagged() |
| 4271 : representation(); | 4268 : representation(); |
| 4272 } | 4269 } |
| 4273 | 4270 |
| 4274 Token::Value token() const { return token_; } | 4271 Token::Value token() const { return token_; } |
| 4275 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT | 4272 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 4276 | 4273 |
| 4277 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) | 4274 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) |
| 4278 | 4275 |
| 4279 private: | 4276 private: |
| 4280 HCompareGeneric(HValue* context, | 4277 HCompareGeneric(HValue* context, HValue* left, HValue* right, |
| 4281 HValue* left, | 4278 Token::Value token, Strength strength) |
| 4282 HValue* right, | 4279 : HBinaryOperation(context, left, right, strength, HType::Boolean()), |
| 4283 Token::Value token, | |
| 4284 LanguageMode language_mode) | |
| 4285 : HBinaryOperation(context, left, right, language_mode, HType::Boolean()), | |
| 4286 token_(token) { | 4280 token_(token) { |
| 4287 DCHECK(Token::IsCompareOp(token)); | 4281 DCHECK(Token::IsCompareOp(token)); |
| 4288 set_representation(Representation::Tagged()); | 4282 set_representation(Representation::Tagged()); |
| 4289 SetAllSideEffects(); | 4283 SetAllSideEffects(); |
| 4290 } | 4284 } |
| 4291 | 4285 |
| 4292 Token::Value token_; | 4286 Token::Value token_; |
| 4293 }; | 4287 }; |
| 4294 | 4288 |
| 4295 | 4289 |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4734 Representation RequiredInputRepresentation(int index) override { | 4728 Representation RequiredInputRepresentation(int index) override { |
| 4735 return Representation::Tagged(); | 4729 return Representation::Tagged(); |
| 4736 } | 4730 } |
| 4737 | 4731 |
| 4738 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT | 4732 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 4739 | 4733 |
| 4740 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) | 4734 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) |
| 4741 | 4735 |
| 4742 private: | 4736 private: |
| 4743 HInstanceOf(HValue* context, HValue* left, HValue* right) | 4737 HInstanceOf(HValue* context, HValue* left, HValue* right) |
| 4744 : HBinaryOperation(context, left, right, SLOPPY, HType::Boolean()) { | 4738 : HBinaryOperation(context, left, right, Strength::WEAK, |
| 4739 HType::Boolean()) { |
| 4745 set_representation(Representation::Tagged()); | 4740 set_representation(Representation::Tagged()); |
| 4746 SetAllSideEffects(); | 4741 SetAllSideEffects(); |
| 4747 } | 4742 } |
| 4748 }; | 4743 }; |
| 4749 | 4744 |
| 4750 | 4745 |
| 4751 class HInstanceOfKnownGlobal final : public HTemplateInstruction<2> { | 4746 class HInstanceOfKnownGlobal final : public HTemplateInstruction<2> { |
| 4752 public: | 4747 public: |
| 4753 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOfKnownGlobal, | 4748 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOfKnownGlobal, |
| 4754 HValue*, | 4749 HValue*, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4813 bool IsDeletable() const override { | 4808 bool IsDeletable() const override { |
| 4814 return !right()->representation().IsTagged(); | 4809 return !right()->representation().IsTagged(); |
| 4815 } | 4810 } |
| 4816 }; | 4811 }; |
| 4817 | 4812 |
| 4818 | 4813 |
| 4819 class HAdd final : public HArithmeticBinaryOperation { | 4814 class HAdd final : public HArithmeticBinaryOperation { |
| 4820 public: | 4815 public: |
| 4821 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 4816 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 4822 HValue* left, HValue* right, | 4817 HValue* left, HValue* right, |
| 4823 LanguageMode language_mode = SLOPPY); | 4818 Strength strength = Strength::WEAK); |
| 4824 | 4819 |
| 4825 // Add is only commutative if two integer values are added and not if two | 4820 // Add is only commutative if two integer values are added and not if two |
| 4826 // tagged values are added (because it might be a String concatenation). | 4821 // tagged values are added (because it might be a String concatenation). |
| 4827 // We also do not commute (pointer + offset). | 4822 // We also do not commute (pointer + offset). |
| 4828 bool IsCommutative() const override { | 4823 bool IsCommutative() const override { |
| 4829 return !representation().IsTagged() && !representation().IsExternal(); | 4824 return !representation().IsTagged() && !representation().IsExternal(); |
| 4830 } | 4825 } |
| 4831 | 4826 |
| 4832 HValue* Canonicalize() override; | 4827 HValue* Canonicalize() override; |
| 4833 | 4828 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 4864 Representation RequiredInputRepresentation(int index) override; | 4859 Representation RequiredInputRepresentation(int index) override; |
| 4865 | 4860 |
| 4866 DECLARE_CONCRETE_INSTRUCTION(Add) | 4861 DECLARE_CONCRETE_INSTRUCTION(Add) |
| 4867 | 4862 |
| 4868 protected: | 4863 protected: |
| 4869 bool DataEquals(HValue* other) override { return true; } | 4864 bool DataEquals(HValue* other) override { return true; } |
| 4870 | 4865 |
| 4871 Range* InferRange(Zone* zone) override; | 4866 Range* InferRange(Zone* zone) override; |
| 4872 | 4867 |
| 4873 private: | 4868 private: |
| 4874 HAdd(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) | 4869 HAdd(HValue* context, HValue* left, HValue* right, Strength strength) |
| 4875 : HArithmeticBinaryOperation(context, left, right, language_mode) { | 4870 : HArithmeticBinaryOperation(context, left, right, strength) { |
| 4876 SetFlag(kCanOverflow); | 4871 SetFlag(kCanOverflow); |
| 4877 } | 4872 } |
| 4878 }; | 4873 }; |
| 4879 | 4874 |
| 4880 | 4875 |
| 4881 class HSub final : public HArithmeticBinaryOperation { | 4876 class HSub final : public HArithmeticBinaryOperation { |
| 4882 public: | 4877 public: |
| 4883 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 4878 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 4884 HValue* left, HValue* right, | 4879 HValue* left, HValue* right, |
| 4885 LanguageMode language_mode = SLOPPY); | 4880 Strength strength = Strength::WEAK); |
| 4886 | 4881 |
| 4887 HValue* Canonicalize() override; | 4882 HValue* Canonicalize() override; |
| 4888 | 4883 |
| 4889 bool TryDecompose(DecompositionResult* decomposition) override { | 4884 bool TryDecompose(DecompositionResult* decomposition) override { |
| 4890 if (right()->IsInteger32Constant()) { | 4885 if (right()->IsInteger32Constant()) { |
| 4891 decomposition->Apply(left(), -right()->GetInteger32Constant()); | 4886 decomposition->Apply(left(), -right()->GetInteger32Constant()); |
| 4892 return true; | 4887 return true; |
| 4893 } else { | 4888 } else { |
| 4894 return false; | 4889 return false; |
| 4895 } | 4890 } |
| 4896 } | 4891 } |
| 4897 | 4892 |
| 4898 DECLARE_CONCRETE_INSTRUCTION(Sub) | 4893 DECLARE_CONCRETE_INSTRUCTION(Sub) |
| 4899 | 4894 |
| 4900 protected: | 4895 protected: |
| 4901 bool DataEquals(HValue* other) override { return true; } | 4896 bool DataEquals(HValue* other) override { return true; } |
| 4902 | 4897 |
| 4903 Range* InferRange(Zone* zone) override; | 4898 Range* InferRange(Zone* zone) override; |
| 4904 | 4899 |
| 4905 private: | 4900 private: |
| 4906 HSub(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) | 4901 HSub(HValue* context, HValue* left, HValue* right, Strength strength) |
| 4907 : HArithmeticBinaryOperation(context, left, right, language_mode) { | 4902 : HArithmeticBinaryOperation(context, left, right, strength) { |
| 4908 SetFlag(kCanOverflow); | 4903 SetFlag(kCanOverflow); |
| 4909 } | 4904 } |
| 4910 }; | 4905 }; |
| 4911 | 4906 |
| 4912 | 4907 |
| 4913 class HMul final : public HArithmeticBinaryOperation { | 4908 class HMul final : public HArithmeticBinaryOperation { |
| 4914 public: | 4909 public: |
| 4915 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 4910 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 4916 HValue* left, HValue* right, | 4911 HValue* left, HValue* right, |
| 4917 LanguageMode language_mode = SLOPPY); | 4912 Strength strength = Strength::WEAK); |
| 4918 | 4913 |
| 4919 static HInstruction* NewImul(Isolate* isolate, Zone* zone, HValue* context, | 4914 static HInstruction* NewImul(Isolate* isolate, Zone* zone, HValue* context, |
| 4920 HValue* left, HValue* right, | 4915 HValue* left, HValue* right, |
| 4921 LanguageMode language_mode = SLOPPY) { | 4916 Strength strength = Strength::WEAK) { |
| 4922 HInstruction* instr = HMul::New(isolate, zone, context, left, right, | 4917 HInstruction* instr = |
| 4923 language_mode); | 4918 HMul::New(isolate, zone, context, left, right, strength); |
| 4924 if (!instr->IsMul()) return instr; | 4919 if (!instr->IsMul()) return instr; |
| 4925 HMul* mul = HMul::cast(instr); | 4920 HMul* mul = HMul::cast(instr); |
| 4926 // TODO(mstarzinger): Prevent bailout on minus zero for imul. | 4921 // TODO(mstarzinger): Prevent bailout on minus zero for imul. |
| 4927 mul->AssumeRepresentation(Representation::Integer32()); | 4922 mul->AssumeRepresentation(Representation::Integer32()); |
| 4928 mul->ClearFlag(HValue::kCanOverflow); | 4923 mul->ClearFlag(HValue::kCanOverflow); |
| 4929 return mul; | 4924 return mul; |
| 4930 } | 4925 } |
| 4931 | 4926 |
| 4932 HValue* Canonicalize() override; | 4927 HValue* Canonicalize() override; |
| 4933 | 4928 |
| 4934 // Only commutative if it is certain that not two objects are multiplicated. | 4929 // Only commutative if it is certain that not two objects are multiplicated. |
| 4935 bool IsCommutative() const override { return !representation().IsTagged(); } | 4930 bool IsCommutative() const override { return !representation().IsTagged(); } |
| 4936 | 4931 |
| 4937 virtual void UpdateRepresentation(Representation new_rep, | 4932 virtual void UpdateRepresentation(Representation new_rep, |
| 4938 HInferRepresentationPhase* h_infer, | 4933 HInferRepresentationPhase* h_infer, |
| 4939 const char* reason) override { | 4934 const char* reason) override { |
| 4940 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4935 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
| 4941 } | 4936 } |
| 4942 | 4937 |
| 4943 bool MulMinusOne(); | 4938 bool MulMinusOne(); |
| 4944 | 4939 |
| 4945 DECLARE_CONCRETE_INSTRUCTION(Mul) | 4940 DECLARE_CONCRETE_INSTRUCTION(Mul) |
| 4946 | 4941 |
| 4947 protected: | 4942 protected: |
| 4948 bool DataEquals(HValue* other) override { return true; } | 4943 bool DataEquals(HValue* other) override { return true; } |
| 4949 | 4944 |
| 4950 Range* InferRange(Zone* zone) override; | 4945 Range* InferRange(Zone* zone) override; |
| 4951 | 4946 |
| 4952 private: | 4947 private: |
| 4953 HMul(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) | 4948 HMul(HValue* context, HValue* left, HValue* right, Strength strength) |
| 4954 : HArithmeticBinaryOperation(context, left, right, language_mode) { | 4949 : HArithmeticBinaryOperation(context, left, right, strength) { |
| 4955 SetFlag(kCanOverflow); | 4950 SetFlag(kCanOverflow); |
| 4956 } | 4951 } |
| 4957 }; | 4952 }; |
| 4958 | 4953 |
| 4959 | 4954 |
| 4960 class HMod final : public HArithmeticBinaryOperation { | 4955 class HMod final : public HArithmeticBinaryOperation { |
| 4961 public: | 4956 public: |
| 4962 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 4957 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 4963 HValue* left, HValue* right, | 4958 HValue* left, HValue* right, |
| 4964 LanguageMode language_mode = SLOPPY); | 4959 Strength strength = Strength::WEAK); |
| 4965 | 4960 |
| 4966 HValue* Canonicalize() override; | 4961 HValue* Canonicalize() override; |
| 4967 | 4962 |
| 4968 virtual void UpdateRepresentation(Representation new_rep, | 4963 virtual void UpdateRepresentation(Representation new_rep, |
| 4969 HInferRepresentationPhase* h_infer, | 4964 HInferRepresentationPhase* h_infer, |
| 4970 const char* reason) override { | 4965 const char* reason) override { |
| 4971 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 4966 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
| 4972 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4967 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
| 4973 } | 4968 } |
| 4974 | 4969 |
| 4975 DECLARE_CONCRETE_INSTRUCTION(Mod) | 4970 DECLARE_CONCRETE_INSTRUCTION(Mod) |
| 4976 | 4971 |
| 4977 protected: | 4972 protected: |
| 4978 bool DataEquals(HValue* other) override { return true; } | 4973 bool DataEquals(HValue* other) override { return true; } |
| 4979 | 4974 |
| 4980 Range* InferRange(Zone* zone) override; | 4975 Range* InferRange(Zone* zone) override; |
| 4981 | 4976 |
| 4982 private: | 4977 private: |
| 4983 HMod(HValue* context, | 4978 HMod(HValue* context, HValue* left, HValue* right, Strength strength) |
| 4984 HValue* left, | 4979 : HArithmeticBinaryOperation(context, left, right, strength) { |
| 4985 HValue* right, | |
| 4986 LanguageMode language_mode) : HArithmeticBinaryOperation(context, left, | |
| 4987 right, | |
| 4988 language_mode) { | |
| 4989 SetFlag(kCanBeDivByZero); | 4980 SetFlag(kCanBeDivByZero); |
| 4990 SetFlag(kCanOverflow); | 4981 SetFlag(kCanOverflow); |
| 4991 SetFlag(kLeftCanBeNegative); | 4982 SetFlag(kLeftCanBeNegative); |
| 4992 } | 4983 } |
| 4993 }; | 4984 }; |
| 4994 | 4985 |
| 4995 | 4986 |
| 4996 class HDiv final : public HArithmeticBinaryOperation { | 4987 class HDiv final : public HArithmeticBinaryOperation { |
| 4997 public: | 4988 public: |
| 4998 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 4989 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 4999 HValue* left, HValue* right, | 4990 HValue* left, HValue* right, |
| 5000 LanguageMode language_mode = SLOPPY); | 4991 Strength strength = Strength::WEAK); |
| 5001 | 4992 |
| 5002 HValue* Canonicalize() override; | 4993 HValue* Canonicalize() override; |
| 5003 | 4994 |
| 5004 virtual void UpdateRepresentation(Representation new_rep, | 4995 virtual void UpdateRepresentation(Representation new_rep, |
| 5005 HInferRepresentationPhase* h_infer, | 4996 HInferRepresentationPhase* h_infer, |
| 5006 const char* reason) override { | 4997 const char* reason) override { |
| 5007 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 4998 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
| 5008 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4999 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
| 5009 } | 5000 } |
| 5010 | 5001 |
| 5011 DECLARE_CONCRETE_INSTRUCTION(Div) | 5002 DECLARE_CONCRETE_INSTRUCTION(Div) |
| 5012 | 5003 |
| 5013 protected: | 5004 protected: |
| 5014 bool DataEquals(HValue* other) override { return true; } | 5005 bool DataEquals(HValue* other) override { return true; } |
| 5015 | 5006 |
| 5016 Range* InferRange(Zone* zone) override; | 5007 Range* InferRange(Zone* zone) override; |
| 5017 | 5008 |
| 5018 private: | 5009 private: |
| 5019 HDiv(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) | 5010 HDiv(HValue* context, HValue* left, HValue* right, Strength strength) |
| 5020 : HArithmeticBinaryOperation(context, left, right, language_mode) { | 5011 : HArithmeticBinaryOperation(context, left, right, strength) { |
| 5021 SetFlag(kCanBeDivByZero); | 5012 SetFlag(kCanBeDivByZero); |
| 5022 SetFlag(kCanOverflow); | 5013 SetFlag(kCanOverflow); |
| 5023 } | 5014 } |
| 5024 }; | 5015 }; |
| 5025 | 5016 |
| 5026 | 5017 |
| 5027 class HMathMinMax final : public HArithmeticBinaryOperation { | 5018 class HMathMinMax final : public HArithmeticBinaryOperation { |
| 5028 public: | 5019 public: |
| 5029 enum Operation { kMathMin, kMathMax }; | 5020 enum Operation { kMathMin, kMathMax }; |
| 5030 | 5021 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 5056 protected: | 5047 protected: |
| 5057 bool DataEquals(HValue* other) override { | 5048 bool DataEquals(HValue* other) override { |
| 5058 return other->IsMathMinMax() && | 5049 return other->IsMathMinMax() && |
| 5059 HMathMinMax::cast(other)->operation_ == operation_; | 5050 HMathMinMax::cast(other)->operation_ == operation_; |
| 5060 } | 5051 } |
| 5061 | 5052 |
| 5062 Range* InferRange(Zone* zone) override; | 5053 Range* InferRange(Zone* zone) override; |
| 5063 | 5054 |
| 5064 private: | 5055 private: |
| 5065 HMathMinMax(HValue* context, HValue* left, HValue* right, Operation op) | 5056 HMathMinMax(HValue* context, HValue* left, HValue* right, Operation op) |
| 5066 : HArithmeticBinaryOperation(context, left, right, SLOPPY), | 5057 : HArithmeticBinaryOperation(context, left, right, Strength::WEAK), |
| 5067 operation_(op) { } | 5058 operation_(op) {} |
| 5068 | 5059 |
| 5069 Operation operation_; | 5060 Operation operation_; |
| 5070 }; | 5061 }; |
| 5071 | 5062 |
| 5072 | 5063 |
| 5073 class HBitwise final : public HBitwiseBinaryOperation { | 5064 class HBitwise final : public HBitwiseBinaryOperation { |
| 5074 public: | 5065 public: |
| 5075 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5066 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 5076 Token::Value op, HValue* left, HValue* right, | 5067 Token::Value op, HValue* left, HValue* right, |
| 5077 LanguageMode language_mode = SLOPPY); | 5068 Strength strength = Strength::WEAK); |
| 5078 | 5069 |
| 5079 Token::Value op() const { return op_; } | 5070 Token::Value op() const { return op_; } |
| 5080 | 5071 |
| 5081 bool IsCommutative() const override { return true; } | 5072 bool IsCommutative() const override { return true; } |
| 5082 | 5073 |
| 5083 HValue* Canonicalize() override; | 5074 HValue* Canonicalize() override; |
| 5084 | 5075 |
| 5085 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT | 5076 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 5086 | 5077 |
| 5087 DECLARE_CONCRETE_INSTRUCTION(Bitwise) | 5078 DECLARE_CONCRETE_INSTRUCTION(Bitwise) |
| 5088 | 5079 |
| 5089 protected: | 5080 protected: |
| 5090 bool DataEquals(HValue* other) override { | 5081 bool DataEquals(HValue* other) override { |
| 5091 return op() == HBitwise::cast(other)->op(); | 5082 return op() == HBitwise::cast(other)->op(); |
| 5092 } | 5083 } |
| 5093 | 5084 |
| 5094 Range* InferRange(Zone* zone) override; | 5085 Range* InferRange(Zone* zone) override; |
| 5095 | 5086 |
| 5096 private: | 5087 private: |
| 5097 HBitwise(HValue* context, | 5088 HBitwise(HValue* context, Token::Value op, HValue* left, HValue* right, |
| 5098 Token::Value op, | 5089 Strength strength) |
| 5099 HValue* left, | 5090 : HBitwiseBinaryOperation(context, left, right, strength), op_(op) { |
| 5100 HValue* right, | |
| 5101 LanguageMode language_mode) | |
| 5102 : HBitwiseBinaryOperation(context, left, right, language_mode), | |
| 5103 op_(op) { | |
| 5104 DCHECK(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR); | 5091 DCHECK(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR); |
| 5105 // BIT_AND with a smi-range positive value will always unset the | 5092 // BIT_AND with a smi-range positive value will always unset the |
| 5106 // entire sign-extension of the smi-sign. | 5093 // entire sign-extension of the smi-sign. |
| 5107 if (op == Token::BIT_AND && | 5094 if (op == Token::BIT_AND && |
| 5108 ((left->IsConstant() && | 5095 ((left->IsConstant() && |
| 5109 left->representation().IsSmi() && | 5096 left->representation().IsSmi() && |
| 5110 HConstant::cast(left)->Integer32Value() >= 0) || | 5097 HConstant::cast(left)->Integer32Value() >= 0) || |
| 5111 (right->IsConstant() && | 5098 (right->IsConstant() && |
| 5112 right->representation().IsSmi() && | 5099 right->representation().IsSmi() && |
| 5113 HConstant::cast(right)->Integer32Value() >= 0))) { | 5100 HConstant::cast(right)->Integer32Value() >= 0))) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 5128 } | 5115 } |
| 5129 | 5116 |
| 5130 Token::Value op_; | 5117 Token::Value op_; |
| 5131 }; | 5118 }; |
| 5132 | 5119 |
| 5133 | 5120 |
| 5134 class HShl final : public HBitwiseBinaryOperation { | 5121 class HShl final : public HBitwiseBinaryOperation { |
| 5135 public: | 5122 public: |
| 5136 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5123 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 5137 HValue* left, HValue* right, | 5124 HValue* left, HValue* right, |
| 5138 LanguageMode language_mode = SLOPPY); | 5125 Strength strength = Strength::WEAK); |
| 5139 | 5126 |
| 5140 Range* InferRange(Zone* zone) override; | 5127 Range* InferRange(Zone* zone) override; |
| 5141 | 5128 |
| 5142 virtual void UpdateRepresentation(Representation new_rep, | 5129 virtual void UpdateRepresentation(Representation new_rep, |
| 5143 HInferRepresentationPhase* h_infer, | 5130 HInferRepresentationPhase* h_infer, |
| 5144 const char* reason) override { | 5131 const char* reason) override { |
| 5145 if (new_rep.IsSmi() && | 5132 if (new_rep.IsSmi() && |
| 5146 !(right()->IsInteger32Constant() && | 5133 !(right()->IsInteger32Constant() && |
| 5147 right()->GetInteger32Constant() >= 0)) { | 5134 right()->GetInteger32Constant() >= 0)) { |
| 5148 new_rep = Representation::Integer32(); | 5135 new_rep = Representation::Integer32(); |
| 5149 } | 5136 } |
| 5150 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5137 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
| 5151 } | 5138 } |
| 5152 | 5139 |
| 5153 DECLARE_CONCRETE_INSTRUCTION(Shl) | 5140 DECLARE_CONCRETE_INSTRUCTION(Shl) |
| 5154 | 5141 |
| 5155 protected: | 5142 protected: |
| 5156 bool DataEquals(HValue* other) override { return true; } | 5143 bool DataEquals(HValue* other) override { return true; } |
| 5157 | 5144 |
| 5158 private: | 5145 private: |
| 5159 HShl(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) | 5146 HShl(HValue* context, HValue* left, HValue* right, Strength strength) |
| 5160 : HBitwiseBinaryOperation(context, left, right, language_mode) { } | 5147 : HBitwiseBinaryOperation(context, left, right, strength) {} |
| 5161 }; | 5148 }; |
| 5162 | 5149 |
| 5163 | 5150 |
| 5164 class HShr final : public HBitwiseBinaryOperation { | 5151 class HShr final : public HBitwiseBinaryOperation { |
| 5165 public: | 5152 public: |
| 5166 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5153 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 5167 HValue* left, HValue* right, | 5154 HValue* left, HValue* right, |
| 5168 LanguageMode language_mode = SLOPPY); | 5155 Strength strength = Strength::WEAK); |
| 5169 | 5156 |
| 5170 bool TryDecompose(DecompositionResult* decomposition) override { | 5157 bool TryDecompose(DecompositionResult* decomposition) override { |
| 5171 if (right()->IsInteger32Constant()) { | 5158 if (right()->IsInteger32Constant()) { |
| 5172 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { | 5159 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { |
| 5173 // This is intended to look for HAdd and HSub, to handle compounds | 5160 // This is intended to look for HAdd and HSub, to handle compounds |
| 5174 // like ((base + offset) >> scale) with one single decomposition. | 5161 // like ((base + offset) >> scale) with one single decomposition. |
| 5175 left()->TryDecompose(decomposition); | 5162 left()->TryDecompose(decomposition); |
| 5176 return true; | 5163 return true; |
| 5177 } | 5164 } |
| 5178 } | 5165 } |
| 5179 return false; | 5166 return false; |
| 5180 } | 5167 } |
| 5181 | 5168 |
| 5182 Range* InferRange(Zone* zone) override; | 5169 Range* InferRange(Zone* zone) override; |
| 5183 | 5170 |
| 5184 virtual void UpdateRepresentation(Representation new_rep, | 5171 virtual void UpdateRepresentation(Representation new_rep, |
| 5185 HInferRepresentationPhase* h_infer, | 5172 HInferRepresentationPhase* h_infer, |
| 5186 const char* reason) override { | 5173 const char* reason) override { |
| 5187 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 5174 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
| 5188 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5175 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
| 5189 } | 5176 } |
| 5190 | 5177 |
| 5191 DECLARE_CONCRETE_INSTRUCTION(Shr) | 5178 DECLARE_CONCRETE_INSTRUCTION(Shr) |
| 5192 | 5179 |
| 5193 protected: | 5180 protected: |
| 5194 bool DataEquals(HValue* other) override { return true; } | 5181 bool DataEquals(HValue* other) override { return true; } |
| 5195 | 5182 |
| 5196 private: | 5183 private: |
| 5197 HShr(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) | 5184 HShr(HValue* context, HValue* left, HValue* right, Strength strength) |
| 5198 : HBitwiseBinaryOperation(context, left, right, language_mode) { } | 5185 : HBitwiseBinaryOperation(context, left, right, strength) {} |
| 5199 }; | 5186 }; |
| 5200 | 5187 |
| 5201 | 5188 |
| 5202 class HSar final : public HBitwiseBinaryOperation { | 5189 class HSar final : public HBitwiseBinaryOperation { |
| 5203 public: | 5190 public: |
| 5204 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5191 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 5205 HValue* left, HValue* right, | 5192 HValue* left, HValue* right, |
| 5206 LanguageMode language_mode = SLOPPY); | 5193 Strength strength = Strength::WEAK); |
| 5207 | 5194 |
| 5208 bool TryDecompose(DecompositionResult* decomposition) override { | 5195 bool TryDecompose(DecompositionResult* decomposition) override { |
| 5209 if (right()->IsInteger32Constant()) { | 5196 if (right()->IsInteger32Constant()) { |
| 5210 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { | 5197 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { |
| 5211 // This is intended to look for HAdd and HSub, to handle compounds | 5198 // This is intended to look for HAdd and HSub, to handle compounds |
| 5212 // like ((base + offset) >> scale) with one single decomposition. | 5199 // like ((base + offset) >> scale) with one single decomposition. |
| 5213 left()->TryDecompose(decomposition); | 5200 left()->TryDecompose(decomposition); |
| 5214 return true; | 5201 return true; |
| 5215 } | 5202 } |
| 5216 } | 5203 } |
| 5217 return false; | 5204 return false; |
| 5218 } | 5205 } |
| 5219 | 5206 |
| 5220 Range* InferRange(Zone* zone) override; | 5207 Range* InferRange(Zone* zone) override; |
| 5221 | 5208 |
| 5222 virtual void UpdateRepresentation(Representation new_rep, | 5209 virtual void UpdateRepresentation(Representation new_rep, |
| 5223 HInferRepresentationPhase* h_infer, | 5210 HInferRepresentationPhase* h_infer, |
| 5224 const char* reason) override { | 5211 const char* reason) override { |
| 5225 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 5212 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
| 5226 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5213 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
| 5227 } | 5214 } |
| 5228 | 5215 |
| 5229 DECLARE_CONCRETE_INSTRUCTION(Sar) | 5216 DECLARE_CONCRETE_INSTRUCTION(Sar) |
| 5230 | 5217 |
| 5231 protected: | 5218 protected: |
| 5232 bool DataEquals(HValue* other) override { return true; } | 5219 bool DataEquals(HValue* other) override { return true; } |
| 5233 | 5220 |
| 5234 private: | 5221 private: |
| 5235 HSar(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) | 5222 HSar(HValue* context, HValue* left, HValue* right, Strength strength) |
| 5236 : HBitwiseBinaryOperation(context, left, right, language_mode) { } | 5223 : HBitwiseBinaryOperation(context, left, right, strength) {} |
| 5237 }; | 5224 }; |
| 5238 | 5225 |
| 5239 | 5226 |
| 5240 class HRor final : public HBitwiseBinaryOperation { | 5227 class HRor final : public HBitwiseBinaryOperation { |
| 5241 public: | 5228 public: |
| 5242 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5229 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 5243 HValue* left, HValue* right, | 5230 HValue* left, HValue* right, |
| 5244 LanguageMode language_mode = SLOPPY) { | 5231 Strength strength = Strength::WEAK) { |
| 5245 return new(zone) HRor(context, left, right, language_mode); | 5232 return new (zone) HRor(context, left, right, strength); |
| 5246 } | 5233 } |
| 5247 | 5234 |
| 5248 virtual void UpdateRepresentation(Representation new_rep, | 5235 virtual void UpdateRepresentation(Representation new_rep, |
| 5249 HInferRepresentationPhase* h_infer, | 5236 HInferRepresentationPhase* h_infer, |
| 5250 const char* reason) override { | 5237 const char* reason) override { |
| 5251 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 5238 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
| 5252 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5239 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
| 5253 } | 5240 } |
| 5254 | 5241 |
| 5255 DECLARE_CONCRETE_INSTRUCTION(Ror) | 5242 DECLARE_CONCRETE_INSTRUCTION(Ror) |
| 5256 | 5243 |
| 5257 protected: | 5244 protected: |
| 5258 bool DataEquals(HValue* other) override { return true; } | 5245 bool DataEquals(HValue* other) override { return true; } |
| 5259 | 5246 |
| 5260 private: | 5247 private: |
| 5261 HRor(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) | 5248 HRor(HValue* context, HValue* left, HValue* right, Strength strength) |
| 5262 : HBitwiseBinaryOperation(context, left, right, language_mode) { | 5249 : HBitwiseBinaryOperation(context, left, right, strength) { |
| 5263 ChangeRepresentation(Representation::Integer32()); | 5250 ChangeRepresentation(Representation::Integer32()); |
| 5264 } | 5251 } |
| 5265 }; | 5252 }; |
| 5266 | 5253 |
| 5267 | 5254 |
| 5268 class HOsrEntry final : public HTemplateInstruction<0> { | 5255 class HOsrEntry final : public HTemplateInstruction<0> { |
| 5269 public: | 5256 public: |
| 5270 DECLARE_INSTRUCTION_FACTORY_P1(HOsrEntry, BailoutId); | 5257 DECLARE_INSTRUCTION_FACTORY_P1(HOsrEntry, BailoutId); |
| 5271 | 5258 |
| 5272 BailoutId ast_id() const { return ast_id_; } | 5259 BailoutId ast_id() const { return ast_id_; } |
| (...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7227 Unique<Map> original_map_; | 7214 Unique<Map> original_map_; |
| 7228 Unique<Map> transitioned_map_; | 7215 Unique<Map> transitioned_map_; |
| 7229 uint32_t bit_field_; | 7216 uint32_t bit_field_; |
| 7230 }; | 7217 }; |
| 7231 | 7218 |
| 7232 | 7219 |
| 7233 class HStringAdd final : public HBinaryOperation { | 7220 class HStringAdd final : public HBinaryOperation { |
| 7234 public: | 7221 public: |
| 7235 static HInstruction* New( | 7222 static HInstruction* New( |
| 7236 Isolate* isolate, Zone* zone, HValue* context, HValue* left, | 7223 Isolate* isolate, Zone* zone, HValue* context, HValue* left, |
| 7237 HValue* right, LanguageMode language_mode = SLOPPY, | 7224 HValue* right, Strength strength = Strength::WEAK, |
| 7238 PretenureFlag pretenure_flag = NOT_TENURED, | 7225 PretenureFlag pretenure_flag = NOT_TENURED, |
| 7239 StringAddFlags flags = STRING_ADD_CHECK_BOTH, | 7226 StringAddFlags flags = STRING_ADD_CHECK_BOTH, |
| 7240 Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()); | 7227 Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()); |
| 7241 | 7228 |
| 7242 StringAddFlags flags() const { return flags_; } | 7229 StringAddFlags flags() const { return flags_; } |
| 7243 PretenureFlag pretenure_flag() const { return pretenure_flag_; } | 7230 PretenureFlag pretenure_flag() const { return pretenure_flag_; } |
| 7244 | 7231 |
| 7245 Representation RequiredInputRepresentation(int index) override { | 7232 Representation RequiredInputRepresentation(int index) override { |
| 7246 return Representation::Tagged(); | 7233 return Representation::Tagged(); |
| 7247 } | 7234 } |
| 7248 | 7235 |
| 7249 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT | 7236 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 7250 | 7237 |
| 7251 DECLARE_CONCRETE_INSTRUCTION(StringAdd) | 7238 DECLARE_CONCRETE_INSTRUCTION(StringAdd) |
| 7252 | 7239 |
| 7253 protected: | 7240 protected: |
| 7254 bool DataEquals(HValue* other) override { | 7241 bool DataEquals(HValue* other) override { |
| 7255 return flags_ == HStringAdd::cast(other)->flags_ && | 7242 return flags_ == HStringAdd::cast(other)->flags_ && |
| 7256 pretenure_flag_ == HStringAdd::cast(other)->pretenure_flag_; | 7243 pretenure_flag_ == HStringAdd::cast(other)->pretenure_flag_; |
| 7257 } | 7244 } |
| 7258 | 7245 |
| 7259 private: | 7246 private: |
| 7260 HStringAdd(HValue* context, | 7247 HStringAdd(HValue* context, HValue* left, HValue* right, Strength strength, |
| 7261 HValue* left, | 7248 PretenureFlag pretenure_flag, StringAddFlags flags, |
| 7262 HValue* right, | |
| 7263 LanguageMode language_mode, | |
| 7264 PretenureFlag pretenure_flag, | |
| 7265 StringAddFlags flags, | |
| 7266 Handle<AllocationSite> allocation_site) | 7249 Handle<AllocationSite> allocation_site) |
| 7267 : HBinaryOperation(context, left, right, language_mode, HType::String()), | 7250 : HBinaryOperation(context, left, right, strength, HType::String()), |
| 7268 flags_(flags), pretenure_flag_(pretenure_flag) { | 7251 flags_(flags), |
| 7252 pretenure_flag_(pretenure_flag) { |
| 7269 set_representation(Representation::Tagged()); | 7253 set_representation(Representation::Tagged()); |
| 7270 SetFlag(kUseGVN); | 7254 SetFlag(kUseGVN); |
| 7271 SetDependsOnFlag(kMaps); | 7255 SetDependsOnFlag(kMaps); |
| 7272 SetChangesFlag(kNewSpacePromotion); | 7256 SetChangesFlag(kNewSpacePromotion); |
| 7273 if (FLAG_trace_pretenuring) { | 7257 if (FLAG_trace_pretenuring) { |
| 7274 PrintF("HStringAdd with AllocationSite %p %s\n", | 7258 PrintF("HStringAdd with AllocationSite %p %s\n", |
| 7275 allocation_site.is_null() | 7259 allocation_site.is_null() |
| 7276 ? static_cast<void*>(NULL) | 7260 ? static_cast<void*>(NULL) |
| 7277 : static_cast<void*>(*allocation_site), | 7261 : static_cast<void*>(*allocation_site), |
| 7278 pretenure_flag == TENURED ? "tenured" : "not tenured"); | 7262 pretenure_flag == TENURED ? "tenured" : "not tenured"); |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7908 }; | 7892 }; |
| 7909 | 7893 |
| 7910 | 7894 |
| 7911 | 7895 |
| 7912 #undef DECLARE_INSTRUCTION | 7896 #undef DECLARE_INSTRUCTION |
| 7913 #undef DECLARE_CONCRETE_INSTRUCTION | 7897 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7914 | 7898 |
| 7915 } } // namespace v8::internal | 7899 } } // namespace v8::internal |
| 7916 | 7900 |
| 7917 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7901 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |