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 3750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3761 | 3761 |
3762 int32_t int32_value_; | 3762 int32_t int32_value_; |
3763 double double_value_; | 3763 double double_value_; |
3764 ExternalReference external_reference_value_; | 3764 ExternalReference external_reference_value_; |
3765 }; | 3765 }; |
3766 | 3766 |
3767 | 3767 |
3768 class HBinaryOperation : public HTemplateInstruction<3> { | 3768 class HBinaryOperation : public HTemplateInstruction<3> { |
3769 public: | 3769 public: |
3770 HBinaryOperation(HValue* context, HValue* left, HValue* right, | 3770 HBinaryOperation(HValue* context, HValue* left, HValue* right, |
3771 HType type = HType::Tagged()) | 3771 LanguageMode language_mode, HType type = HType::Tagged()) |
3772 : HTemplateInstruction<3>(type), | 3772 : HTemplateInstruction<3>(type), language_mode_(language_mode), |
3773 observed_output_representation_(Representation::None()) { | 3773 observed_output_representation_(Representation::None()) { |
3774 DCHECK(left != NULL && right != NULL); | 3774 DCHECK(left != NULL && right != NULL); |
3775 SetOperandAt(0, context); | 3775 SetOperandAt(0, context); |
3776 SetOperandAt(1, left); | 3776 SetOperandAt(1, left); |
3777 SetOperandAt(2, right); | 3777 SetOperandAt(2, right); |
3778 observed_input_representation_[0] = Representation::None(); | 3778 observed_input_representation_[0] = Representation::None(); |
3779 observed_input_representation_[1] = Representation::None(); | 3779 observed_input_representation_[1] = Representation::None(); |
3780 } | 3780 } |
3781 | 3781 |
3782 HValue* context() const { return OperandAt(0); } | 3782 HValue* context() const { return OperandAt(0); } |
3783 HValue* left() const { return OperandAt(1); } | 3783 HValue* left() const { return OperandAt(1); } |
3784 HValue* right() const { return OperandAt(2); } | 3784 HValue* right() const { return OperandAt(2); } |
| 3785 LanguageMode language_mode() const { return language_mode_; } |
3785 | 3786 |
3786 // True if switching left and right operands likely generates better code. | 3787 // True if switching left and right operands likely generates better code. |
3787 bool AreOperandsBetterSwitched() { | 3788 bool AreOperandsBetterSwitched() { |
3788 if (!IsCommutative()) return false; | 3789 if (!IsCommutative()) return false; |
3789 | 3790 |
3790 // Constant operands are better off on the right, they can be inlined in | 3791 // Constant operands are better off on the right, they can be inlined in |
3791 // many situations on most platforms. | 3792 // many situations on most platforms. |
3792 if (left()->IsConstant()) return true; | 3793 if (left()->IsConstant()) return true; |
3793 if (right()->IsConstant()) return false; | 3794 if (right()->IsConstant()) return false; |
3794 | 3795 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3850 | 3851 |
3851 bool RightIsPowerOf2() { | 3852 bool RightIsPowerOf2() { |
3852 if (!right()->IsInteger32Constant()) return false; | 3853 if (!right()->IsInteger32Constant()) return false; |
3853 int32_t value = right()->GetInteger32Constant(); | 3854 int32_t value = right()->GetInteger32Constant(); |
3854 if (value < 0) { | 3855 if (value < 0) { |
3855 return base::bits::IsPowerOfTwo32(static_cast<uint32_t>(-value)); | 3856 return base::bits::IsPowerOfTwo32(static_cast<uint32_t>(-value)); |
3856 } | 3857 } |
3857 return base::bits::IsPowerOfTwo32(static_cast<uint32_t>(value)); | 3858 return base::bits::IsPowerOfTwo32(static_cast<uint32_t>(value)); |
3858 } | 3859 } |
3859 | 3860 |
| 3861 LanguageMode language_mode() { |
| 3862 return language_mode_; |
| 3863 } |
| 3864 |
3860 DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation) | 3865 DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation) |
3861 | 3866 |
3862 private: | 3867 private: |
3863 bool IgnoreObservedOutputRepresentation(Representation current_rep); | 3868 bool IgnoreObservedOutputRepresentation(Representation current_rep); |
| 3869 LanguageMode language_mode_; |
3864 | 3870 |
3865 Representation observed_input_representation_[2]; | 3871 Representation observed_input_representation_[2]; |
3866 Representation observed_output_representation_; | 3872 Representation observed_output_representation_; |
3867 }; | 3873 }; |
3868 | 3874 |
3869 | 3875 |
3870 class HWrapReceiver final : public HTemplateInstruction<2> { | 3876 class HWrapReceiver final : public HTemplateInstruction<2> { |
3871 public: | 3877 public: |
3872 DECLARE_INSTRUCTION_FACTORY_P2(HWrapReceiver, HValue*, HValue*); | 3878 DECLARE_INSTRUCTION_FACTORY_P2(HWrapReceiver, HValue*, HValue*); |
3873 | 3879 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4123 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT | 4129 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
4124 | 4130 |
4125 int RedefinedOperandIndex() override { return 0; } | 4131 int RedefinedOperandIndex() override { return 0; } |
4126 bool IsPurelyInformativeDefinition() override { return true; } | 4132 bool IsPurelyInformativeDefinition() override { return true; } |
4127 }; | 4133 }; |
4128 | 4134 |
4129 | 4135 |
4130 class HBitwiseBinaryOperation : public HBinaryOperation { | 4136 class HBitwiseBinaryOperation : public HBinaryOperation { |
4131 public: | 4137 public: |
4132 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, | 4138 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, |
| 4139 LanguageMode language_mode, |
4133 HType type = HType::TaggedNumber()) | 4140 HType type = HType::TaggedNumber()) |
4134 : HBinaryOperation(context, left, right, type) { | 4141 : HBinaryOperation(context, left, right, language_mode, type) { |
4135 SetFlag(kFlexibleRepresentation); | 4142 SetFlag(kFlexibleRepresentation); |
4136 SetFlag(kTruncatingToInt32); | 4143 SetFlag(kTruncatingToInt32); |
4137 SetFlag(kAllowUndefinedAsNaN); | 4144 SetFlag(kAllowUndefinedAsNaN); |
4138 SetAllSideEffects(); | 4145 SetAllSideEffects(); |
4139 } | 4146 } |
4140 | 4147 |
4141 void RepresentationChanged(Representation to) override { | 4148 void RepresentationChanged(Representation to) override { |
4142 if (to.IsTagged() && | 4149 if (to.IsTagged() && |
4143 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { | 4150 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { |
4144 SetAllSideEffects(); | 4151 SetAllSideEffects(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4183 HValue*, | 4190 HValue*, |
4184 HValue*); | 4191 HValue*); |
4185 | 4192 |
4186 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv) | 4193 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv) |
4187 | 4194 |
4188 protected: | 4195 protected: |
4189 bool DataEquals(HValue* other) override { return true; } | 4196 bool DataEquals(HValue* other) override { return true; } |
4190 | 4197 |
4191 private: | 4198 private: |
4192 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) | 4199 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) |
4193 : HBinaryOperation(context, left, right) { | 4200 : HBinaryOperation(context, left, right, SLOPPY) { |
4194 set_representation(Representation::Integer32()); | 4201 set_representation(Representation::Integer32()); |
4195 SetFlag(kUseGVN); | 4202 SetFlag(kUseGVN); |
4196 SetFlag(kCanOverflow); | 4203 SetFlag(kCanOverflow); |
4197 SetFlag(kCanBeDivByZero); | 4204 SetFlag(kCanBeDivByZero); |
4198 SetFlag(kLeftCanBeMinInt); | 4205 SetFlag(kLeftCanBeMinInt); |
4199 SetFlag(kLeftCanBeNegative); | 4206 SetFlag(kLeftCanBeNegative); |
4200 SetFlag(kLeftCanBePositive); | 4207 SetFlag(kLeftCanBePositive); |
4201 SetFlag(kAllowUndefinedAsNaN); | 4208 SetFlag(kAllowUndefinedAsNaN); |
4202 } | 4209 } |
4203 | 4210 |
4204 Range* InferRange(Zone* zone) override; | 4211 Range* InferRange(Zone* zone) override; |
4205 | 4212 |
4206 bool IsDeletable() const override { return true; } | 4213 bool IsDeletable() const override { return true; } |
4207 }; | 4214 }; |
4208 | 4215 |
4209 | 4216 |
4210 class HArithmeticBinaryOperation : public HBinaryOperation { | 4217 class HArithmeticBinaryOperation : public HBinaryOperation { |
4211 public: | 4218 public: |
4212 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) | 4219 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right, |
4213 : HBinaryOperation(context, left, right, HType::TaggedNumber()) { | 4220 LanguageMode language_mode) |
| 4221 : HBinaryOperation(context, left, right, language_mode, |
| 4222 HType::TaggedNumber()) { |
4214 SetAllSideEffects(); | 4223 SetAllSideEffects(); |
4215 SetFlag(kFlexibleRepresentation); | 4224 SetFlag(kFlexibleRepresentation); |
4216 SetFlag(kAllowUndefinedAsNaN); | 4225 SetFlag(kAllowUndefinedAsNaN); |
4217 } | 4226 } |
4218 | 4227 |
4219 void RepresentationChanged(Representation to) override { | 4228 void RepresentationChanged(Representation to) override { |
4220 if (to.IsTagged() && | 4229 if (to.IsTagged() && |
4221 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { | 4230 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { |
4222 SetAllSideEffects(); | 4231 SetAllSideEffects(); |
4223 ClearFlag(kUseGVN); | 4232 ClearFlag(kUseGVN); |
4224 } else { | 4233 } else { |
4225 ClearAllSideEffects(); | 4234 ClearAllSideEffects(); |
4226 SetFlag(kUseGVN); | 4235 SetFlag(kUseGVN); |
4227 } | 4236 } |
4228 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); | 4237 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); |
4229 } | 4238 } |
4230 | 4239 |
4231 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) | 4240 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) |
4232 | 4241 |
4233 private: | 4242 private: |
4234 bool IsDeletable() const override { return true; } | 4243 bool IsDeletable() const override { return true; } |
4235 }; | 4244 }; |
4236 | 4245 |
4237 | 4246 |
4238 class HCompareGeneric final : public HBinaryOperation { | 4247 class HCompareGeneric final : public HBinaryOperation { |
4239 public: | 4248 public: |
4240 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCompareGeneric, HValue*, | 4249 static HCompareGeneric* New(Isolate* isolate, Zone* zone, HValue* context, |
4241 HValue*, Token::Value); | 4250 HValue* left, HValue* right, Token::Value token, |
| 4251 LanguageMode language_mode = SLOPPY) { |
| 4252 return new(zone) HCompareGeneric(context, left, right, token, |
| 4253 language_mode); |
| 4254 } |
4242 | 4255 |
4243 Representation RequiredInputRepresentation(int index) override { | 4256 Representation RequiredInputRepresentation(int index) override { |
4244 return index == 0 | 4257 return index == 0 |
4245 ? Representation::Tagged() | 4258 ? Representation::Tagged() |
4246 : representation(); | 4259 : representation(); |
4247 } | 4260 } |
4248 | 4261 |
4249 Token::Value token() const { return token_; } | 4262 Token::Value token() const { return token_; } |
4250 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT | 4263 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
4251 | 4264 |
4252 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) | 4265 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) |
4253 | 4266 |
4254 private: | 4267 private: |
4255 HCompareGeneric(HValue* context, | 4268 HCompareGeneric(HValue* context, |
4256 HValue* left, | 4269 HValue* left, |
4257 HValue* right, | 4270 HValue* right, |
4258 Token::Value token) | 4271 Token::Value token, |
4259 : HBinaryOperation(context, left, right, HType::Boolean()), | 4272 LanguageMode language_mode) |
| 4273 : HBinaryOperation(context, left, right, language_mode, HType::Boolean()), |
4260 token_(token) { | 4274 token_(token) { |
4261 DCHECK(Token::IsCompareOp(token)); | 4275 DCHECK(Token::IsCompareOp(token)); |
4262 set_representation(Representation::Tagged()); | 4276 set_representation(Representation::Tagged()); |
4263 SetAllSideEffects(); | 4277 SetAllSideEffects(); |
4264 } | 4278 } |
4265 | 4279 |
4266 Token::Value token_; | 4280 Token::Value token_; |
4267 }; | 4281 }; |
4268 | 4282 |
4269 | 4283 |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4708 Representation RequiredInputRepresentation(int index) override { | 4722 Representation RequiredInputRepresentation(int index) override { |
4709 return Representation::Tagged(); | 4723 return Representation::Tagged(); |
4710 } | 4724 } |
4711 | 4725 |
4712 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT | 4726 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
4713 | 4727 |
4714 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) | 4728 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) |
4715 | 4729 |
4716 private: | 4730 private: |
4717 HInstanceOf(HValue* context, HValue* left, HValue* right) | 4731 HInstanceOf(HValue* context, HValue* left, HValue* right) |
4718 : HBinaryOperation(context, left, right, HType::Boolean()) { | 4732 : HBinaryOperation(context, left, right, SLOPPY, HType::Boolean()) { |
4719 set_representation(Representation::Tagged()); | 4733 set_representation(Representation::Tagged()); |
4720 SetAllSideEffects(); | 4734 SetAllSideEffects(); |
4721 } | 4735 } |
4722 }; | 4736 }; |
4723 | 4737 |
4724 | 4738 |
4725 class HInstanceOfKnownGlobal final : public HTemplateInstruction<2> { | 4739 class HInstanceOfKnownGlobal final : public HTemplateInstruction<2> { |
4726 public: | 4740 public: |
4727 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOfKnownGlobal, | 4741 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOfKnownGlobal, |
4728 HValue*, | 4742 HValue*, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4786 | 4800 |
4787 bool IsDeletable() const override { | 4801 bool IsDeletable() const override { |
4788 return !right()->representation().IsTagged(); | 4802 return !right()->representation().IsTagged(); |
4789 } | 4803 } |
4790 }; | 4804 }; |
4791 | 4805 |
4792 | 4806 |
4793 class HAdd final : public HArithmeticBinaryOperation { | 4807 class HAdd final : public HArithmeticBinaryOperation { |
4794 public: | 4808 public: |
4795 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 4809 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
4796 HValue* left, HValue* right); | 4810 HValue* left, HValue* right, |
| 4811 LanguageMode language_mode = SLOPPY); |
4797 | 4812 |
4798 // Add is only commutative if two integer values are added and not if two | 4813 // Add is only commutative if two integer values are added and not if two |
4799 // tagged values are added (because it might be a String concatenation). | 4814 // tagged values are added (because it might be a String concatenation). |
4800 // We also do not commute (pointer + offset). | 4815 // We also do not commute (pointer + offset). |
4801 bool IsCommutative() const override { | 4816 bool IsCommutative() const override { |
4802 return !representation().IsTagged() && !representation().IsExternal(); | 4817 return !representation().IsTagged() && !representation().IsExternal(); |
4803 } | 4818 } |
4804 | 4819 |
4805 HValue* Canonicalize() override; | 4820 HValue* Canonicalize() override; |
4806 | 4821 |
(...skipping 30 matching lines...) Expand all Loading... |
4837 Representation RequiredInputRepresentation(int index) override; | 4852 Representation RequiredInputRepresentation(int index) override; |
4838 | 4853 |
4839 DECLARE_CONCRETE_INSTRUCTION(Add) | 4854 DECLARE_CONCRETE_INSTRUCTION(Add) |
4840 | 4855 |
4841 protected: | 4856 protected: |
4842 bool DataEquals(HValue* other) override { return true; } | 4857 bool DataEquals(HValue* other) override { return true; } |
4843 | 4858 |
4844 Range* InferRange(Zone* zone) override; | 4859 Range* InferRange(Zone* zone) override; |
4845 | 4860 |
4846 private: | 4861 private: |
4847 HAdd(HValue* context, HValue* left, HValue* right) | 4862 HAdd(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) |
4848 : HArithmeticBinaryOperation(context, left, right) { | 4863 : HArithmeticBinaryOperation(context, left, right, language_mode) { |
4849 SetFlag(kCanOverflow); | 4864 SetFlag(kCanOverflow); |
4850 } | 4865 } |
4851 }; | 4866 }; |
4852 | 4867 |
4853 | 4868 |
4854 class HSub final : public HArithmeticBinaryOperation { | 4869 class HSub final : public HArithmeticBinaryOperation { |
4855 public: | 4870 public: |
4856 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 4871 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
4857 HValue* left, HValue* right); | 4872 HValue* left, HValue* right, |
| 4873 LanguageMode language_mode = SLOPPY); |
4858 | 4874 |
4859 HValue* Canonicalize() override; | 4875 HValue* Canonicalize() override; |
4860 | 4876 |
4861 bool TryDecompose(DecompositionResult* decomposition) override { | 4877 bool TryDecompose(DecompositionResult* decomposition) override { |
4862 if (right()->IsInteger32Constant()) { | 4878 if (right()->IsInteger32Constant()) { |
4863 decomposition->Apply(left(), -right()->GetInteger32Constant()); | 4879 decomposition->Apply(left(), -right()->GetInteger32Constant()); |
4864 return true; | 4880 return true; |
4865 } else { | 4881 } else { |
4866 return false; | 4882 return false; |
4867 } | 4883 } |
4868 } | 4884 } |
4869 | 4885 |
4870 DECLARE_CONCRETE_INSTRUCTION(Sub) | 4886 DECLARE_CONCRETE_INSTRUCTION(Sub) |
4871 | 4887 |
4872 protected: | 4888 protected: |
4873 bool DataEquals(HValue* other) override { return true; } | 4889 bool DataEquals(HValue* other) override { return true; } |
4874 | 4890 |
4875 Range* InferRange(Zone* zone) override; | 4891 Range* InferRange(Zone* zone) override; |
4876 | 4892 |
4877 private: | 4893 private: |
4878 HSub(HValue* context, HValue* left, HValue* right) | 4894 HSub(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) |
4879 : HArithmeticBinaryOperation(context, left, right) { | 4895 : HArithmeticBinaryOperation(context, left, right, language_mode) { |
4880 SetFlag(kCanOverflow); | 4896 SetFlag(kCanOverflow); |
4881 } | 4897 } |
4882 }; | 4898 }; |
4883 | 4899 |
4884 | 4900 |
4885 class HMul final : public HArithmeticBinaryOperation { | 4901 class HMul final : public HArithmeticBinaryOperation { |
4886 public: | 4902 public: |
4887 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 4903 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
4888 HValue* left, HValue* right); | 4904 HValue* left, HValue* right, |
| 4905 LanguageMode language_mode = SLOPPY); |
4889 | 4906 |
4890 static HInstruction* NewImul(Isolate* isolate, Zone* zone, HValue* context, | 4907 static HInstruction* NewImul(Isolate* isolate, Zone* zone, HValue* context, |
4891 HValue* left, HValue* right) { | 4908 HValue* left, HValue* right, |
4892 HInstruction* instr = HMul::New(isolate, zone, context, left, right); | 4909 LanguageMode language_mode = SLOPPY) { |
| 4910 HInstruction* instr = HMul::New(isolate, zone, context, left, right, |
| 4911 language_mode); |
4893 if (!instr->IsMul()) return instr; | 4912 if (!instr->IsMul()) return instr; |
4894 HMul* mul = HMul::cast(instr); | 4913 HMul* mul = HMul::cast(instr); |
4895 // TODO(mstarzinger): Prevent bailout on minus zero for imul. | 4914 // TODO(mstarzinger): Prevent bailout on minus zero for imul. |
4896 mul->AssumeRepresentation(Representation::Integer32()); | 4915 mul->AssumeRepresentation(Representation::Integer32()); |
4897 mul->ClearFlag(HValue::kCanOverflow); | 4916 mul->ClearFlag(HValue::kCanOverflow); |
4898 return mul; | 4917 return mul; |
4899 } | 4918 } |
4900 | 4919 |
4901 HValue* Canonicalize() override; | 4920 HValue* Canonicalize() override; |
4902 | 4921 |
4903 // Only commutative if it is certain that not two objects are multiplicated. | 4922 // Only commutative if it is certain that not two objects are multiplicated. |
4904 bool IsCommutative() const override { return !representation().IsTagged(); } | 4923 bool IsCommutative() const override { return !representation().IsTagged(); } |
4905 | 4924 |
4906 virtual void UpdateRepresentation(Representation new_rep, | 4925 virtual void UpdateRepresentation(Representation new_rep, |
4907 HInferRepresentationPhase* h_infer, | 4926 HInferRepresentationPhase* h_infer, |
4908 const char* reason) override { | 4927 const char* reason) override { |
4909 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4928 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
4910 } | 4929 } |
4911 | 4930 |
4912 bool MulMinusOne(); | 4931 bool MulMinusOne(); |
4913 | 4932 |
4914 DECLARE_CONCRETE_INSTRUCTION(Mul) | 4933 DECLARE_CONCRETE_INSTRUCTION(Mul) |
4915 | 4934 |
4916 protected: | 4935 protected: |
4917 bool DataEquals(HValue* other) override { return true; } | 4936 bool DataEquals(HValue* other) override { return true; } |
4918 | 4937 |
4919 Range* InferRange(Zone* zone) override; | 4938 Range* InferRange(Zone* zone) override; |
4920 | 4939 |
4921 private: | 4940 private: |
4922 HMul(HValue* context, HValue* left, HValue* right) | 4941 HMul(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) |
4923 : HArithmeticBinaryOperation(context, left, right) { | 4942 : HArithmeticBinaryOperation(context, left, right, language_mode) { |
4924 SetFlag(kCanOverflow); | 4943 SetFlag(kCanOverflow); |
4925 } | 4944 } |
4926 }; | 4945 }; |
4927 | 4946 |
4928 | 4947 |
4929 class HMod final : public HArithmeticBinaryOperation { | 4948 class HMod final : public HArithmeticBinaryOperation { |
4930 public: | 4949 public: |
4931 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 4950 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
4932 HValue* left, HValue* right); | 4951 HValue* left, HValue* right, |
| 4952 LanguageMode language_mode = SLOPPY); |
4933 | 4953 |
4934 HValue* Canonicalize() override; | 4954 HValue* Canonicalize() override; |
4935 | 4955 |
4936 virtual void UpdateRepresentation(Representation new_rep, | 4956 virtual void UpdateRepresentation(Representation new_rep, |
4937 HInferRepresentationPhase* h_infer, | 4957 HInferRepresentationPhase* h_infer, |
4938 const char* reason) override { | 4958 const char* reason) override { |
4939 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 4959 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
4940 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4960 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
4941 } | 4961 } |
4942 | 4962 |
4943 DECLARE_CONCRETE_INSTRUCTION(Mod) | 4963 DECLARE_CONCRETE_INSTRUCTION(Mod) |
4944 | 4964 |
4945 protected: | 4965 protected: |
4946 bool DataEquals(HValue* other) override { return true; } | 4966 bool DataEquals(HValue* other) override { return true; } |
4947 | 4967 |
4948 Range* InferRange(Zone* zone) override; | 4968 Range* InferRange(Zone* zone) override; |
4949 | 4969 |
4950 private: | 4970 private: |
4951 HMod(HValue* context, | 4971 HMod(HValue* context, |
4952 HValue* left, | 4972 HValue* left, |
4953 HValue* right) : HArithmeticBinaryOperation(context, left, right) { | 4973 HValue* right, |
| 4974 LanguageMode language_mode) : HArithmeticBinaryOperation(context, left, |
| 4975 right, |
| 4976 language_mode) { |
4954 SetFlag(kCanBeDivByZero); | 4977 SetFlag(kCanBeDivByZero); |
4955 SetFlag(kCanOverflow); | 4978 SetFlag(kCanOverflow); |
4956 SetFlag(kLeftCanBeNegative); | 4979 SetFlag(kLeftCanBeNegative); |
4957 } | 4980 } |
4958 }; | 4981 }; |
4959 | 4982 |
4960 | 4983 |
4961 class HDiv final : public HArithmeticBinaryOperation { | 4984 class HDiv final : public HArithmeticBinaryOperation { |
4962 public: | 4985 public: |
4963 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 4986 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
4964 HValue* left, HValue* right); | 4987 HValue* left, HValue* right, |
| 4988 LanguageMode language_mode = SLOPPY); |
4965 | 4989 |
4966 HValue* Canonicalize() override; | 4990 HValue* Canonicalize() override; |
4967 | 4991 |
4968 virtual void UpdateRepresentation(Representation new_rep, | 4992 virtual void UpdateRepresentation(Representation new_rep, |
4969 HInferRepresentationPhase* h_infer, | 4993 HInferRepresentationPhase* h_infer, |
4970 const char* reason) override { | 4994 const char* reason) override { |
4971 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 4995 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
4972 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4996 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
4973 } | 4997 } |
4974 | 4998 |
4975 DECLARE_CONCRETE_INSTRUCTION(Div) | 4999 DECLARE_CONCRETE_INSTRUCTION(Div) |
4976 | 5000 |
4977 protected: | 5001 protected: |
4978 bool DataEquals(HValue* other) override { return true; } | 5002 bool DataEquals(HValue* other) override { return true; } |
4979 | 5003 |
4980 Range* InferRange(Zone* zone) override; | 5004 Range* InferRange(Zone* zone) override; |
4981 | 5005 |
4982 private: | 5006 private: |
4983 HDiv(HValue* context, HValue* left, HValue* right) | 5007 HDiv(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) |
4984 : HArithmeticBinaryOperation(context, left, right) { | 5008 : HArithmeticBinaryOperation(context, left, right, language_mode) { |
4985 SetFlag(kCanBeDivByZero); | 5009 SetFlag(kCanBeDivByZero); |
4986 SetFlag(kCanOverflow); | 5010 SetFlag(kCanOverflow); |
4987 } | 5011 } |
4988 }; | 5012 }; |
4989 | 5013 |
4990 | 5014 |
4991 class HMathMinMax final : public HArithmeticBinaryOperation { | 5015 class HMathMinMax final : public HArithmeticBinaryOperation { |
4992 public: | 5016 public: |
4993 enum Operation { kMathMin, kMathMax }; | 5017 enum Operation { kMathMin, kMathMax }; |
4994 | 5018 |
(...skipping 25 matching lines...) Expand all Loading... |
5020 protected: | 5044 protected: |
5021 bool DataEquals(HValue* other) override { | 5045 bool DataEquals(HValue* other) override { |
5022 return other->IsMathMinMax() && | 5046 return other->IsMathMinMax() && |
5023 HMathMinMax::cast(other)->operation_ == operation_; | 5047 HMathMinMax::cast(other)->operation_ == operation_; |
5024 } | 5048 } |
5025 | 5049 |
5026 Range* InferRange(Zone* zone) override; | 5050 Range* InferRange(Zone* zone) override; |
5027 | 5051 |
5028 private: | 5052 private: |
5029 HMathMinMax(HValue* context, HValue* left, HValue* right, Operation op) | 5053 HMathMinMax(HValue* context, HValue* left, HValue* right, Operation op) |
5030 : HArithmeticBinaryOperation(context, left, right), | 5054 : HArithmeticBinaryOperation(context, left, right, SLOPPY), |
5031 operation_(op) { } | 5055 operation_(op) { } |
5032 | 5056 |
5033 Operation operation_; | 5057 Operation operation_; |
5034 }; | 5058 }; |
5035 | 5059 |
5036 | 5060 |
5037 class HBitwise final : public HBitwiseBinaryOperation { | 5061 class HBitwise final : public HBitwiseBinaryOperation { |
5038 public: | 5062 public: |
5039 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5063 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
5040 Token::Value op, HValue* left, HValue* right); | 5064 Token::Value op, HValue* left, HValue* right, |
| 5065 LanguageMode language_mode = SLOPPY); |
5041 | 5066 |
5042 Token::Value op() const { return op_; } | 5067 Token::Value op() const { return op_; } |
5043 | 5068 |
5044 bool IsCommutative() const override { return true; } | 5069 bool IsCommutative() const override { return true; } |
5045 | 5070 |
5046 HValue* Canonicalize() override; | 5071 HValue* Canonicalize() override; |
5047 | 5072 |
5048 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT | 5073 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
5049 | 5074 |
5050 DECLARE_CONCRETE_INSTRUCTION(Bitwise) | 5075 DECLARE_CONCRETE_INSTRUCTION(Bitwise) |
5051 | 5076 |
5052 protected: | 5077 protected: |
5053 bool DataEquals(HValue* other) override { | 5078 bool DataEquals(HValue* other) override { |
5054 return op() == HBitwise::cast(other)->op(); | 5079 return op() == HBitwise::cast(other)->op(); |
5055 } | 5080 } |
5056 | 5081 |
5057 Range* InferRange(Zone* zone) override; | 5082 Range* InferRange(Zone* zone) override; |
5058 | 5083 |
5059 private: | 5084 private: |
5060 HBitwise(HValue* context, | 5085 HBitwise(HValue* context, |
5061 Token::Value op, | 5086 Token::Value op, |
5062 HValue* left, | 5087 HValue* left, |
5063 HValue* right) | 5088 HValue* right, |
5064 : HBitwiseBinaryOperation(context, left, right), | 5089 LanguageMode language_mode) |
| 5090 : HBitwiseBinaryOperation(context, left, right, language_mode), |
5065 op_(op) { | 5091 op_(op) { |
5066 DCHECK(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR); | 5092 DCHECK(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR); |
5067 // BIT_AND with a smi-range positive value will always unset the | 5093 // BIT_AND with a smi-range positive value will always unset the |
5068 // entire sign-extension of the smi-sign. | 5094 // entire sign-extension of the smi-sign. |
5069 if (op == Token::BIT_AND && | 5095 if (op == Token::BIT_AND && |
5070 ((left->IsConstant() && | 5096 ((left->IsConstant() && |
5071 left->representation().IsSmi() && | 5097 left->representation().IsSmi() && |
5072 HConstant::cast(left)->Integer32Value() >= 0) || | 5098 HConstant::cast(left)->Integer32Value() >= 0) || |
5073 (right->IsConstant() && | 5099 (right->IsConstant() && |
5074 right->representation().IsSmi() && | 5100 right->representation().IsSmi() && |
(...skipping 14 matching lines...) Expand all Loading... |
5089 } | 5115 } |
5090 } | 5116 } |
5091 | 5117 |
5092 Token::Value op_; | 5118 Token::Value op_; |
5093 }; | 5119 }; |
5094 | 5120 |
5095 | 5121 |
5096 class HShl final : public HBitwiseBinaryOperation { | 5122 class HShl final : public HBitwiseBinaryOperation { |
5097 public: | 5123 public: |
5098 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5124 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
5099 HValue* left, HValue* right); | 5125 HValue* left, HValue* right, |
| 5126 LanguageMode language_mode = SLOPPY); |
5100 | 5127 |
5101 Range* InferRange(Zone* zone) override; | 5128 Range* InferRange(Zone* zone) override; |
5102 | 5129 |
5103 virtual void UpdateRepresentation(Representation new_rep, | 5130 virtual void UpdateRepresentation(Representation new_rep, |
5104 HInferRepresentationPhase* h_infer, | 5131 HInferRepresentationPhase* h_infer, |
5105 const char* reason) override { | 5132 const char* reason) override { |
5106 if (new_rep.IsSmi() && | 5133 if (new_rep.IsSmi() && |
5107 !(right()->IsInteger32Constant() && | 5134 !(right()->IsInteger32Constant() && |
5108 right()->GetInteger32Constant() >= 0)) { | 5135 right()->GetInteger32Constant() >= 0)) { |
5109 new_rep = Representation::Integer32(); | 5136 new_rep = Representation::Integer32(); |
5110 } | 5137 } |
5111 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5138 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
5112 } | 5139 } |
5113 | 5140 |
5114 DECLARE_CONCRETE_INSTRUCTION(Shl) | 5141 DECLARE_CONCRETE_INSTRUCTION(Shl) |
5115 | 5142 |
5116 protected: | 5143 protected: |
5117 bool DataEquals(HValue* other) override { return true; } | 5144 bool DataEquals(HValue* other) override { return true; } |
5118 | 5145 |
5119 private: | 5146 private: |
5120 HShl(HValue* context, HValue* left, HValue* right) | 5147 HShl(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) |
5121 : HBitwiseBinaryOperation(context, left, right) { } | 5148 : HBitwiseBinaryOperation(context, left, right, language_mode) { } |
5122 }; | 5149 }; |
5123 | 5150 |
5124 | 5151 |
5125 class HShr final : public HBitwiseBinaryOperation { | 5152 class HShr final : public HBitwiseBinaryOperation { |
5126 public: | 5153 public: |
5127 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5154 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
5128 HValue* left, HValue* right); | 5155 HValue* left, HValue* right, |
| 5156 LanguageMode language_mode = SLOPPY); |
5129 | 5157 |
5130 bool TryDecompose(DecompositionResult* decomposition) override { | 5158 bool TryDecompose(DecompositionResult* decomposition) override { |
5131 if (right()->IsInteger32Constant()) { | 5159 if (right()->IsInteger32Constant()) { |
5132 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { | 5160 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { |
5133 // This is intended to look for HAdd and HSub, to handle compounds | 5161 // This is intended to look for HAdd and HSub, to handle compounds |
5134 // like ((base + offset) >> scale) with one single decomposition. | 5162 // like ((base + offset) >> scale) with one single decomposition. |
5135 left()->TryDecompose(decomposition); | 5163 left()->TryDecompose(decomposition); |
5136 return true; | 5164 return true; |
5137 } | 5165 } |
5138 } | 5166 } |
5139 return false; | 5167 return false; |
5140 } | 5168 } |
5141 | 5169 |
5142 Range* InferRange(Zone* zone) override; | 5170 Range* InferRange(Zone* zone) override; |
5143 | 5171 |
5144 virtual void UpdateRepresentation(Representation new_rep, | 5172 virtual void UpdateRepresentation(Representation new_rep, |
5145 HInferRepresentationPhase* h_infer, | 5173 HInferRepresentationPhase* h_infer, |
5146 const char* reason) override { | 5174 const char* reason) override { |
5147 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 5175 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
5148 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5176 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
5149 } | 5177 } |
5150 | 5178 |
5151 DECLARE_CONCRETE_INSTRUCTION(Shr) | 5179 DECLARE_CONCRETE_INSTRUCTION(Shr) |
5152 | 5180 |
5153 protected: | 5181 protected: |
5154 bool DataEquals(HValue* other) override { return true; } | 5182 bool DataEquals(HValue* other) override { return true; } |
5155 | 5183 |
5156 private: | 5184 private: |
5157 HShr(HValue* context, HValue* left, HValue* right) | 5185 HShr(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) |
5158 : HBitwiseBinaryOperation(context, left, right) { } | 5186 : HBitwiseBinaryOperation(context, left, right, language_mode) { } |
5159 }; | 5187 }; |
5160 | 5188 |
5161 | 5189 |
5162 class HSar final : public HBitwiseBinaryOperation { | 5190 class HSar final : public HBitwiseBinaryOperation { |
5163 public: | 5191 public: |
5164 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5192 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
5165 HValue* left, HValue* right); | 5193 HValue* left, HValue* right, |
| 5194 LanguageMode language_mode = SLOPPY); |
5166 | 5195 |
5167 bool TryDecompose(DecompositionResult* decomposition) override { | 5196 bool TryDecompose(DecompositionResult* decomposition) override { |
5168 if (right()->IsInteger32Constant()) { | 5197 if (right()->IsInteger32Constant()) { |
5169 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { | 5198 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { |
5170 // This is intended to look for HAdd and HSub, to handle compounds | 5199 // This is intended to look for HAdd and HSub, to handle compounds |
5171 // like ((base + offset) >> scale) with one single decomposition. | 5200 // like ((base + offset) >> scale) with one single decomposition. |
5172 left()->TryDecompose(decomposition); | 5201 left()->TryDecompose(decomposition); |
5173 return true; | 5202 return true; |
5174 } | 5203 } |
5175 } | 5204 } |
5176 return false; | 5205 return false; |
5177 } | 5206 } |
5178 | 5207 |
5179 Range* InferRange(Zone* zone) override; | 5208 Range* InferRange(Zone* zone) override; |
5180 | 5209 |
5181 virtual void UpdateRepresentation(Representation new_rep, | 5210 virtual void UpdateRepresentation(Representation new_rep, |
5182 HInferRepresentationPhase* h_infer, | 5211 HInferRepresentationPhase* h_infer, |
5183 const char* reason) override { | 5212 const char* reason) override { |
5184 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 5213 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
5185 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5214 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
5186 } | 5215 } |
5187 | 5216 |
5188 DECLARE_CONCRETE_INSTRUCTION(Sar) | 5217 DECLARE_CONCRETE_INSTRUCTION(Sar) |
5189 | 5218 |
5190 protected: | 5219 protected: |
5191 bool DataEquals(HValue* other) override { return true; } | 5220 bool DataEquals(HValue* other) override { return true; } |
5192 | 5221 |
5193 private: | 5222 private: |
5194 HSar(HValue* context, HValue* left, HValue* right) | 5223 HSar(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) |
5195 : HBitwiseBinaryOperation(context, left, right) { } | 5224 : HBitwiseBinaryOperation(context, left, right, language_mode) { } |
5196 }; | 5225 }; |
5197 | 5226 |
5198 | 5227 |
5199 class HRor final : public HBitwiseBinaryOperation { | 5228 class HRor final : public HBitwiseBinaryOperation { |
5200 public: | 5229 public: |
5201 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5230 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
5202 HValue* left, HValue* right) { | 5231 HValue* left, HValue* right, |
5203 return new(zone) HRor(context, left, right); | 5232 LanguageMode language_mode = SLOPPY) { |
| 5233 return new(zone) HRor(context, left, right, language_mode); |
5204 } | 5234 } |
5205 | 5235 |
5206 virtual void UpdateRepresentation(Representation new_rep, | 5236 virtual void UpdateRepresentation(Representation new_rep, |
5207 HInferRepresentationPhase* h_infer, | 5237 HInferRepresentationPhase* h_infer, |
5208 const char* reason) override { | 5238 const char* reason) override { |
5209 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 5239 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
5210 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5240 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
5211 } | 5241 } |
5212 | 5242 |
5213 DECLARE_CONCRETE_INSTRUCTION(Ror) | 5243 DECLARE_CONCRETE_INSTRUCTION(Ror) |
5214 | 5244 |
5215 protected: | 5245 protected: |
5216 bool DataEquals(HValue* other) override { return true; } | 5246 bool DataEquals(HValue* other) override { return true; } |
5217 | 5247 |
5218 private: | 5248 private: |
5219 HRor(HValue* context, HValue* left, HValue* right) | 5249 HRor(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) |
5220 : HBitwiseBinaryOperation(context, left, right) { | 5250 : HBitwiseBinaryOperation(context, left, right, language_mode) { |
5221 ChangeRepresentation(Representation::Integer32()); | 5251 ChangeRepresentation(Representation::Integer32()); |
5222 } | 5252 } |
5223 }; | 5253 }; |
5224 | 5254 |
5225 | 5255 |
5226 class HOsrEntry final : public HTemplateInstruction<0> { | 5256 class HOsrEntry final : public HTemplateInstruction<0> { |
5227 public: | 5257 public: |
5228 DECLARE_INSTRUCTION_FACTORY_P1(HOsrEntry, BailoutId); | 5258 DECLARE_INSTRUCTION_FACTORY_P1(HOsrEntry, BailoutId); |
5229 | 5259 |
5230 BailoutId ast_id() const { return ast_id_; } | 5260 BailoutId ast_id() const { return ast_id_; } |
(...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7227 Unique<Map> original_map_; | 7257 Unique<Map> original_map_; |
7228 Unique<Map> transitioned_map_; | 7258 Unique<Map> transitioned_map_; |
7229 uint32_t bit_field_; | 7259 uint32_t bit_field_; |
7230 }; | 7260 }; |
7231 | 7261 |
7232 | 7262 |
7233 class HStringAdd final : public HBinaryOperation { | 7263 class HStringAdd final : public HBinaryOperation { |
7234 public: | 7264 public: |
7235 static HInstruction* New( | 7265 static HInstruction* New( |
7236 Isolate* isolate, Zone* zone, HValue* context, HValue* left, | 7266 Isolate* isolate, Zone* zone, HValue* context, HValue* left, |
7237 HValue* right, PretenureFlag pretenure_flag = NOT_TENURED, | 7267 HValue* right, LanguageMode language_mode = SLOPPY, |
| 7268 PretenureFlag pretenure_flag = NOT_TENURED, |
7238 StringAddFlags flags = STRING_ADD_CHECK_BOTH, | 7269 StringAddFlags flags = STRING_ADD_CHECK_BOTH, |
7239 Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()); | 7270 Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()); |
7240 | 7271 |
7241 StringAddFlags flags() const { return flags_; } | 7272 StringAddFlags flags() const { return flags_; } |
7242 PretenureFlag pretenure_flag() const { return pretenure_flag_; } | 7273 PretenureFlag pretenure_flag() const { return pretenure_flag_; } |
7243 | 7274 |
7244 Representation RequiredInputRepresentation(int index) override { | 7275 Representation RequiredInputRepresentation(int index) override { |
7245 return Representation::Tagged(); | 7276 return Representation::Tagged(); |
7246 } | 7277 } |
7247 | 7278 |
7248 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT | 7279 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
7249 | 7280 |
7250 DECLARE_CONCRETE_INSTRUCTION(StringAdd) | 7281 DECLARE_CONCRETE_INSTRUCTION(StringAdd) |
7251 | 7282 |
7252 protected: | 7283 protected: |
7253 bool DataEquals(HValue* other) override { | 7284 bool DataEquals(HValue* other) override { |
7254 return flags_ == HStringAdd::cast(other)->flags_ && | 7285 return flags_ == HStringAdd::cast(other)->flags_ && |
7255 pretenure_flag_ == HStringAdd::cast(other)->pretenure_flag_; | 7286 pretenure_flag_ == HStringAdd::cast(other)->pretenure_flag_; |
7256 } | 7287 } |
7257 | 7288 |
7258 private: | 7289 private: |
7259 HStringAdd(HValue* context, | 7290 HStringAdd(HValue* context, |
7260 HValue* left, | 7291 HValue* left, |
7261 HValue* right, | 7292 HValue* right, |
| 7293 LanguageMode language_mode, |
7262 PretenureFlag pretenure_flag, | 7294 PretenureFlag pretenure_flag, |
7263 StringAddFlags flags, | 7295 StringAddFlags flags, |
7264 Handle<AllocationSite> allocation_site) | 7296 Handle<AllocationSite> allocation_site) |
7265 : HBinaryOperation(context, left, right, HType::String()), | 7297 : HBinaryOperation(context, left, right, language_mode, HType::String()), |
7266 flags_(flags), pretenure_flag_(pretenure_flag) { | 7298 flags_(flags), pretenure_flag_(pretenure_flag) { |
7267 set_representation(Representation::Tagged()); | 7299 set_representation(Representation::Tagged()); |
7268 SetFlag(kUseGVN); | 7300 SetFlag(kUseGVN); |
7269 SetDependsOnFlag(kMaps); | 7301 SetDependsOnFlag(kMaps); |
7270 SetChangesFlag(kNewSpacePromotion); | 7302 SetChangesFlag(kNewSpacePromotion); |
7271 if (FLAG_trace_pretenuring) { | 7303 if (FLAG_trace_pretenuring) { |
7272 PrintF("HStringAdd with AllocationSite %p %s\n", | 7304 PrintF("HStringAdd with AllocationSite %p %s\n", |
7273 allocation_site.is_null() | 7305 allocation_site.is_null() |
7274 ? static_cast<void*>(NULL) | 7306 ? static_cast<void*>(NULL) |
7275 : static_cast<void*>(*allocation_site), | 7307 : static_cast<void*>(*allocation_site), |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7854 }; | 7886 }; |
7855 | 7887 |
7856 | 7888 |
7857 | 7889 |
7858 #undef DECLARE_INSTRUCTION | 7890 #undef DECLARE_INSTRUCTION |
7859 #undef DECLARE_CONCRETE_INSTRUCTION | 7891 #undef DECLARE_CONCRETE_INSTRUCTION |
7860 | 7892 |
7861 } } // namespace v8::internal | 7893 } } // namespace v8::internal |
7862 | 7894 |
7863 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7895 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |