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_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ | 5 #ifndef V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ |
6 #define V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ | 6 #define V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ |
7 | 7 |
8 #include <cstring> | 8 #include <cstring> |
9 #include <iosfwd> | 9 #include <iosfwd> |
10 | 10 |
(...skipping 3251 matching lines...) Loading... |
3262 HPhi(int merged_index, Zone* zone) | 3262 HPhi(int merged_index, Zone* zone) |
3263 : inputs_(2, zone), merged_index_(merged_index) { | 3263 : inputs_(2, zone), merged_index_(merged_index) { |
3264 DCHECK(merged_index >= 0 || merged_index == kInvalidMergedIndex); | 3264 DCHECK(merged_index >= 0 || merged_index == kInvalidMergedIndex); |
3265 SetFlag(kFlexibleRepresentation); | 3265 SetFlag(kFlexibleRepresentation); |
3266 SetFlag(kAllowUndefinedAsNaN); | 3266 SetFlag(kAllowUndefinedAsNaN); |
3267 } | 3267 } |
3268 | 3268 |
3269 Representation RepresentationFromInputs() override; | 3269 Representation RepresentationFromInputs() override; |
3270 | 3270 |
3271 Range* InferRange(Zone* zone) override; | 3271 Range* InferRange(Zone* zone) override; |
3272 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; | 3272 void InferRepresentation(HInferRepresentationPhase* h_infer) override; |
3273 Representation RequiredInputRepresentation(int index) override { | 3273 Representation RequiredInputRepresentation(int index) override { |
3274 return representation(); | 3274 return representation(); |
3275 } | 3275 } |
3276 Representation KnownOptimalRepresentation() override { | 3276 Representation KnownOptimalRepresentation() override { |
3277 return representation(); | 3277 return representation(); |
3278 } | 3278 } |
3279 HType CalculateInferredType() override; | 3279 HType CalculateInferredType() override; |
3280 int OperandCount() const override { return inputs_.length(); } | 3280 int OperandCount() const override { return inputs_.length(); } |
3281 HValue* OperandAt(int index) const override { return inputs_[index]; } | 3281 HValue* OperandAt(int index) const override { return inputs_[index]; } |
3282 HValue* GetRedundantReplacement(); | 3282 HValue* GetRedundantReplacement(); |
(...skipping 535 matching lines...) Loading... |
3818 | 3818 |
3819 virtual void initialize_output_representation(Representation observed) { | 3819 virtual void initialize_output_representation(Representation observed) { |
3820 observed_output_representation_ = observed; | 3820 observed_output_representation_ = observed; |
3821 } | 3821 } |
3822 | 3822 |
3823 Representation observed_input_representation(int index) override { | 3823 Representation observed_input_representation(int index) override { |
3824 if (index == 0) return Representation::Tagged(); | 3824 if (index == 0) return Representation::Tagged(); |
3825 return observed_input_representation_[index - 1]; | 3825 return observed_input_representation_[index - 1]; |
3826 } | 3826 } |
3827 | 3827 |
3828 virtual void UpdateRepresentation(Representation new_rep, | 3828 void UpdateRepresentation(Representation new_rep, |
3829 HInferRepresentationPhase* h_infer, | 3829 HInferRepresentationPhase* h_infer, |
3830 const char* reason) override { | 3830 const char* reason) override { |
3831 Representation rep = !FLAG_smi_binop && new_rep.IsSmi() | 3831 Representation rep = !FLAG_smi_binop && new_rep.IsSmi() |
3832 ? Representation::Integer32() : new_rep; | 3832 ? Representation::Integer32() : new_rep; |
3833 HValue::UpdateRepresentation(rep, h_infer, reason); | 3833 HValue::UpdateRepresentation(rep, h_infer, reason); |
3834 } | 3834 } |
3835 | 3835 |
3836 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; | 3836 void InferRepresentation(HInferRepresentationPhase* h_infer) override; |
3837 Representation RepresentationFromInputs() override; | 3837 Representation RepresentationFromInputs() override; |
3838 Representation RepresentationFromOutput(); | 3838 Representation RepresentationFromOutput(); |
3839 void AssumeRepresentation(Representation r) override; | 3839 void AssumeRepresentation(Representation r) override; |
3840 | 3840 |
3841 virtual bool IsCommutative() const { return false; } | 3841 virtual bool IsCommutative() const { return false; } |
3842 | 3842 |
3843 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT | 3843 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
3844 | 3844 |
3845 Representation RequiredInputRepresentation(int index) override { | 3845 Representation RequiredInputRepresentation(int index) override { |
3846 if (index == 0) return Representation::Tagged(); | 3846 if (index == 0) return Representation::Tagged(); |
(...skipping 210 matching lines...) Loading... |
4057 scale_ = 0; | 4057 scale_ = 0; |
4058 return false; | 4058 return false; |
4059 } | 4059 } |
4060 } | 4060 } |
4061 | 4061 |
4062 Representation RequiredInputRepresentation(int index) override { | 4062 Representation RequiredInputRepresentation(int index) override { |
4063 return representation(); | 4063 return representation(); |
4064 } | 4064 } |
4065 | 4065 |
4066 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT | 4066 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
4067 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; | 4067 void InferRepresentation(HInferRepresentationPhase* h_infer) override; |
4068 | 4068 |
4069 HValue* index() const { return OperandAt(0); } | 4069 HValue* index() const { return OperandAt(0); } |
4070 HValue* length() const { return OperandAt(1); } | 4070 HValue* length() const { return OperandAt(1); } |
4071 bool allow_equality() const { return allow_equality_; } | 4071 bool allow_equality() const { return allow_equality_; } |
4072 void set_allow_equality(bool v) { allow_equality_ = v; } | 4072 void set_allow_equality(bool v) { allow_equality_ = v; } |
4073 | 4073 |
4074 int RedefinedOperandIndex() override { return 0; } | 4074 int RedefinedOperandIndex() override { return 0; } |
4075 bool IsPurelyInformativeDefinition() override { return skip_check(); } | 4075 bool IsPurelyInformativeDefinition() override { return skip_check(); } |
4076 | 4076 |
4077 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) | 4077 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) |
(...skipping 73 matching lines...) Loading... |
4151 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { | 4151 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { |
4152 SetAllSideEffects(); | 4152 SetAllSideEffects(); |
4153 ClearFlag(kUseGVN); | 4153 ClearFlag(kUseGVN); |
4154 } else { | 4154 } else { |
4155 ClearAllSideEffects(); | 4155 ClearAllSideEffects(); |
4156 SetFlag(kUseGVN); | 4156 SetFlag(kUseGVN); |
4157 } | 4157 } |
4158 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); | 4158 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); |
4159 } | 4159 } |
4160 | 4160 |
4161 virtual void UpdateRepresentation(Representation new_rep, | 4161 void UpdateRepresentation(Representation new_rep, |
4162 HInferRepresentationPhase* h_infer, | 4162 HInferRepresentationPhase* h_infer, |
4163 const char* reason) override { | 4163 const char* reason) override { |
4164 // We only generate either int32 or generic tagged bitwise operations. | 4164 // We only generate either int32 or generic tagged bitwise operations. |
4165 if (new_rep.IsDouble()) new_rep = Representation::Integer32(); | 4165 if (new_rep.IsDouble()) new_rep = Representation::Integer32(); |
4166 HBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4166 HBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
4167 } | 4167 } |
4168 | 4168 |
4169 Representation observed_input_representation(int index) override { | 4169 Representation observed_input_representation(int index) override { |
4170 Representation r = HBinaryOperation::observed_input_representation(index); | 4170 Representation r = HBinaryOperation::observed_input_representation(index); |
4171 if (r.IsDouble()) return Representation::Integer32(); | 4171 if (r.IsDouble()) return Representation::Integer32(); |
4172 return r; | 4172 return r; |
4173 } | 4173 } |
4174 | 4174 |
4175 virtual void initialize_output_representation( | 4175 void initialize_output_representation(Representation observed) override { |
4176 Representation observed) override { | |
4177 if (observed.IsDouble()) observed = Representation::Integer32(); | 4176 if (observed.IsDouble()) observed = Representation::Integer32(); |
4178 HBinaryOperation::initialize_output_representation(observed); | 4177 HBinaryOperation::initialize_output_representation(observed); |
4179 } | 4178 } |
4180 | 4179 |
4181 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) | 4180 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) |
4182 | 4181 |
4183 private: | 4182 private: |
4184 bool IsDeletable() const override { return true; } | 4183 bool IsDeletable() const override { return true; } |
4185 }; | 4184 }; |
4186 | 4185 |
(...skipping 113 matching lines...) Loading... |
4300 HValue* left() const { return OperandAt(0); } | 4299 HValue* left() const { return OperandAt(0); } |
4301 HValue* right() const { return OperandAt(1); } | 4300 HValue* right() const { return OperandAt(1); } |
4302 Token::Value token() const { return token_; } | 4301 Token::Value token() const { return token_; } |
4303 | 4302 |
4304 void set_observed_input_representation(Representation left, | 4303 void set_observed_input_representation(Representation left, |
4305 Representation right) { | 4304 Representation right) { |
4306 observed_input_representation_[0] = left; | 4305 observed_input_representation_[0] = left; |
4307 observed_input_representation_[1] = right; | 4306 observed_input_representation_[1] = right; |
4308 } | 4307 } |
4309 | 4308 |
4310 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; | 4309 void InferRepresentation(HInferRepresentationPhase* h_infer) override; |
4311 | 4310 |
4312 Representation RequiredInputRepresentation(int index) override { | 4311 Representation RequiredInputRepresentation(int index) override { |
4313 return representation(); | 4312 return representation(); |
4314 } | 4313 } |
4315 Representation observed_input_representation(int index) override { | 4314 Representation observed_input_representation(int index) override { |
4316 return observed_input_representation_[index]; | 4315 return observed_input_representation_[index]; |
4317 } | 4316 } |
4318 | 4317 |
4319 bool KnownSuccessorBlock(HBasicBlock** block) override; | 4318 bool KnownSuccessorBlock(HBasicBlock** block) override; |
4320 | 4319 |
(...skipping 27 matching lines...) Loading... |
4348 Strength strength_; | 4347 Strength strength_; |
4349 }; | 4348 }; |
4350 | 4349 |
4351 | 4350 |
4352 class HCompareHoleAndBranch final : public HUnaryControlInstruction { | 4351 class HCompareHoleAndBranch final : public HUnaryControlInstruction { |
4353 public: | 4352 public: |
4354 DECLARE_INSTRUCTION_FACTORY_P1(HCompareHoleAndBranch, HValue*); | 4353 DECLARE_INSTRUCTION_FACTORY_P1(HCompareHoleAndBranch, HValue*); |
4355 DECLARE_INSTRUCTION_FACTORY_P3(HCompareHoleAndBranch, HValue*, | 4354 DECLARE_INSTRUCTION_FACTORY_P3(HCompareHoleAndBranch, HValue*, |
4356 HBasicBlock*, HBasicBlock*); | 4355 HBasicBlock*, HBasicBlock*); |
4357 | 4356 |
4358 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; | 4357 void InferRepresentation(HInferRepresentationPhase* h_infer) override; |
4359 | 4358 |
4360 Representation RequiredInputRepresentation(int index) override { | 4359 Representation RequiredInputRepresentation(int index) override { |
4361 return representation(); | 4360 return representation(); |
4362 } | 4361 } |
4363 | 4362 |
4364 DECLARE_CONCRETE_INSTRUCTION(CompareHoleAndBranch) | 4363 DECLARE_CONCRETE_INSTRUCTION(CompareHoleAndBranch) |
4365 | 4364 |
4366 private: | 4365 private: |
4367 HCompareHoleAndBranch(HValue* value, | 4366 HCompareHoleAndBranch(HValue* value, |
4368 HBasicBlock* true_target = NULL, | 4367 HBasicBlock* true_target = NULL, |
4369 HBasicBlock* false_target = NULL) | 4368 HBasicBlock* false_target = NULL) |
4370 : HUnaryControlInstruction(value, true_target, false_target) { | 4369 : HUnaryControlInstruction(value, true_target, false_target) { |
4371 SetFlag(kFlexibleRepresentation); | 4370 SetFlag(kFlexibleRepresentation); |
4372 SetFlag(kAllowUndefinedAsNaN); | 4371 SetFlag(kAllowUndefinedAsNaN); |
4373 } | 4372 } |
4374 }; | 4373 }; |
4375 | 4374 |
4376 | 4375 |
4377 class HCompareMinusZeroAndBranch final : public HUnaryControlInstruction { | 4376 class HCompareMinusZeroAndBranch final : public HUnaryControlInstruction { |
4378 public: | 4377 public: |
4379 DECLARE_INSTRUCTION_FACTORY_P1(HCompareMinusZeroAndBranch, HValue*); | 4378 DECLARE_INSTRUCTION_FACTORY_P1(HCompareMinusZeroAndBranch, HValue*); |
4380 | 4379 |
4381 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; | 4380 void InferRepresentation(HInferRepresentationPhase* h_infer) override; |
4382 | 4381 |
4383 Representation RequiredInputRepresentation(int index) override { | 4382 Representation RequiredInputRepresentation(int index) override { |
4384 return representation(); | 4383 return representation(); |
4385 } | 4384 } |
4386 | 4385 |
4387 bool KnownSuccessorBlock(HBasicBlock** block) override; | 4386 bool KnownSuccessorBlock(HBasicBlock** block) override; |
4388 | 4387 |
4389 DECLARE_CONCRETE_INSTRUCTION(CompareMinusZeroAndBranch) | 4388 DECLARE_CONCRETE_INSTRUCTION(CompareMinusZeroAndBranch) |
4390 | 4389 |
4391 private: | 4390 private: |
(...skipping 552 matching lines...) Loading... |
4944 mul->AssumeRepresentation(Representation::Integer32()); | 4943 mul->AssumeRepresentation(Representation::Integer32()); |
4945 mul->ClearFlag(HValue::kCanOverflow); | 4944 mul->ClearFlag(HValue::kCanOverflow); |
4946 return mul; | 4945 return mul; |
4947 } | 4946 } |
4948 | 4947 |
4949 HValue* Canonicalize() override; | 4948 HValue* Canonicalize() override; |
4950 | 4949 |
4951 // Only commutative if it is certain that not two objects are multiplicated. | 4950 // Only commutative if it is certain that not two objects are multiplicated. |
4952 bool IsCommutative() const override { return !representation().IsTagged(); } | 4951 bool IsCommutative() const override { return !representation().IsTagged(); } |
4953 | 4952 |
4954 virtual void UpdateRepresentation(Representation new_rep, | 4953 void UpdateRepresentation(Representation new_rep, |
4955 HInferRepresentationPhase* h_infer, | 4954 HInferRepresentationPhase* h_infer, |
4956 const char* reason) override { | 4955 const char* reason) override { |
4957 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4956 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
4958 } | 4957 } |
4959 | 4958 |
4960 bool MulMinusOne(); | 4959 bool MulMinusOne(); |
4961 | 4960 |
4962 DECLARE_CONCRETE_INSTRUCTION(Mul) | 4961 DECLARE_CONCRETE_INSTRUCTION(Mul) |
4963 | 4962 |
4964 protected: | 4963 protected: |
4965 bool DataEquals(HValue* other) override { return true; } | 4964 bool DataEquals(HValue* other) override { return true; } |
4966 | 4965 |
4967 Range* InferRange(Zone* zone) override; | 4966 Range* InferRange(Zone* zone) override; |
4968 | 4967 |
4969 private: | 4968 private: |
4970 HMul(HValue* context, HValue* left, HValue* right, Strength strength) | 4969 HMul(HValue* context, HValue* left, HValue* right, Strength strength) |
4971 : HArithmeticBinaryOperation(context, left, right, strength) { | 4970 : HArithmeticBinaryOperation(context, left, right, strength) { |
4972 SetFlag(kCanOverflow); | 4971 SetFlag(kCanOverflow); |
4973 } | 4972 } |
4974 }; | 4973 }; |
4975 | 4974 |
4976 | 4975 |
4977 class HMod final : public HArithmeticBinaryOperation { | 4976 class HMod final : public HArithmeticBinaryOperation { |
4978 public: | 4977 public: |
4979 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 4978 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
4980 HValue* left, HValue* right, | 4979 HValue* left, HValue* right, |
4981 Strength strength = Strength::WEAK); | 4980 Strength strength = Strength::WEAK); |
4982 | 4981 |
4983 HValue* Canonicalize() override; | 4982 HValue* Canonicalize() override; |
4984 | 4983 |
4985 virtual void UpdateRepresentation(Representation new_rep, | 4984 void UpdateRepresentation(Representation new_rep, |
4986 HInferRepresentationPhase* h_infer, | 4985 HInferRepresentationPhase* h_infer, |
4987 const char* reason) override { | 4986 const char* reason) override { |
4988 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 4987 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
4989 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4988 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
4990 } | 4989 } |
4991 | 4990 |
4992 DECLARE_CONCRETE_INSTRUCTION(Mod) | 4991 DECLARE_CONCRETE_INSTRUCTION(Mod) |
4993 | 4992 |
4994 protected: | 4993 protected: |
4995 bool DataEquals(HValue* other) override { return true; } | 4994 bool DataEquals(HValue* other) override { return true; } |
4996 | 4995 |
4997 Range* InferRange(Zone* zone) override; | 4996 Range* InferRange(Zone* zone) override; |
4998 | 4997 |
4999 private: | 4998 private: |
5000 HMod(HValue* context, HValue* left, HValue* right, Strength strength) | 4999 HMod(HValue* context, HValue* left, HValue* right, Strength strength) |
5001 : HArithmeticBinaryOperation(context, left, right, strength) { | 5000 : HArithmeticBinaryOperation(context, left, right, strength) { |
5002 SetFlag(kCanBeDivByZero); | 5001 SetFlag(kCanBeDivByZero); |
5003 SetFlag(kCanOverflow); | 5002 SetFlag(kCanOverflow); |
5004 SetFlag(kLeftCanBeNegative); | 5003 SetFlag(kLeftCanBeNegative); |
5005 } | 5004 } |
5006 }; | 5005 }; |
5007 | 5006 |
5008 | 5007 |
5009 class HDiv final : public HArithmeticBinaryOperation { | 5008 class HDiv final : public HArithmeticBinaryOperation { |
5010 public: | 5009 public: |
5011 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5010 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
5012 HValue* left, HValue* right, | 5011 HValue* left, HValue* right, |
5013 Strength strength = Strength::WEAK); | 5012 Strength strength = Strength::WEAK); |
5014 | 5013 |
5015 HValue* Canonicalize() override; | 5014 HValue* Canonicalize() override; |
5016 | 5015 |
5017 virtual void UpdateRepresentation(Representation new_rep, | 5016 void UpdateRepresentation(Representation new_rep, |
5018 HInferRepresentationPhase* h_infer, | 5017 HInferRepresentationPhase* h_infer, |
5019 const char* reason) override { | 5018 const char* reason) override { |
5020 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 5019 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
5021 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5020 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
5022 } | 5021 } |
5023 | 5022 |
5024 DECLARE_CONCRETE_INSTRUCTION(Div) | 5023 DECLARE_CONCRETE_INSTRUCTION(Div) |
5025 | 5024 |
5026 protected: | 5025 protected: |
5027 bool DataEquals(HValue* other) override { return true; } | 5026 bool DataEquals(HValue* other) override { return true; } |
5028 | 5027 |
5029 Range* InferRange(Zone* zone) override; | 5028 Range* InferRange(Zone* zone) override; |
(...skipping 11 matching lines...) Loading... |
5041 public: | 5040 public: |
5042 enum Operation { kMathMin, kMathMax }; | 5041 enum Operation { kMathMin, kMathMax }; |
5043 | 5042 |
5044 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5043 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
5045 HValue* left, HValue* right, Operation op); | 5044 HValue* left, HValue* right, Operation op); |
5046 | 5045 |
5047 Representation observed_input_representation(int index) override { | 5046 Representation observed_input_representation(int index) override { |
5048 return RequiredInputRepresentation(index); | 5047 return RequiredInputRepresentation(index); |
5049 } | 5048 } |
5050 | 5049 |
5051 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; | 5050 void InferRepresentation(HInferRepresentationPhase* h_infer) override; |
5052 | 5051 |
5053 Representation RepresentationFromInputs() override { | 5052 Representation RepresentationFromInputs() override { |
5054 Representation left_rep = left()->representation(); | 5053 Representation left_rep = left()->representation(); |
5055 Representation right_rep = right()->representation(); | 5054 Representation right_rep = right()->representation(); |
5056 Representation result = Representation::Smi(); | 5055 Representation result = Representation::Smi(); |
5057 result = result.generalize(left_rep); | 5056 result = result.generalize(left_rep); |
5058 result = result.generalize(right_rep); | 5057 result = result.generalize(right_rep); |
5059 if (result.IsTagged()) return Representation::Double(); | 5058 if (result.IsTagged()) return Representation::Double(); |
5060 return result; | 5059 return result; |
5061 } | 5060 } |
(...skipping 79 matching lines...) Loading... |
5141 | 5140 |
5142 | 5141 |
5143 class HShl final : public HBitwiseBinaryOperation { | 5142 class HShl final : public HBitwiseBinaryOperation { |
5144 public: | 5143 public: |
5145 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5144 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
5146 HValue* left, HValue* right, | 5145 HValue* left, HValue* right, |
5147 Strength strength = Strength::WEAK); | 5146 Strength strength = Strength::WEAK); |
5148 | 5147 |
5149 Range* InferRange(Zone* zone) override; | 5148 Range* InferRange(Zone* zone) override; |
5150 | 5149 |
5151 virtual void UpdateRepresentation(Representation new_rep, | 5150 void UpdateRepresentation(Representation new_rep, |
5152 HInferRepresentationPhase* h_infer, | 5151 HInferRepresentationPhase* h_infer, |
5153 const char* reason) override { | 5152 const char* reason) override { |
5154 if (new_rep.IsSmi() && | 5153 if (new_rep.IsSmi() && |
5155 !(right()->IsInteger32Constant() && | 5154 !(right()->IsInteger32Constant() && |
5156 right()->GetInteger32Constant() >= 0)) { | 5155 right()->GetInteger32Constant() >= 0)) { |
5157 new_rep = Representation::Integer32(); | 5156 new_rep = Representation::Integer32(); |
5158 } | 5157 } |
5159 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5158 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
5160 } | 5159 } |
5161 | 5160 |
5162 DECLARE_CONCRETE_INSTRUCTION(Shl) | 5161 DECLARE_CONCRETE_INSTRUCTION(Shl) |
5163 | 5162 |
(...skipping 19 matching lines...) Loading... |
5183 // like ((base + offset) >> scale) with one single decomposition. | 5182 // like ((base + offset) >> scale) with one single decomposition. |
5184 left()->TryDecompose(decomposition); | 5183 left()->TryDecompose(decomposition); |
5185 return true; | 5184 return true; |
5186 } | 5185 } |
5187 } | 5186 } |
5188 return false; | 5187 return false; |
5189 } | 5188 } |
5190 | 5189 |
5191 Range* InferRange(Zone* zone) override; | 5190 Range* InferRange(Zone* zone) override; |
5192 | 5191 |
5193 virtual void UpdateRepresentation(Representation new_rep, | 5192 void UpdateRepresentation(Representation new_rep, |
5194 HInferRepresentationPhase* h_infer, | 5193 HInferRepresentationPhase* h_infer, |
5195 const char* reason) override { | 5194 const char* reason) override { |
5196 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 5195 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
5197 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5196 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
5198 } | 5197 } |
5199 | 5198 |
5200 DECLARE_CONCRETE_INSTRUCTION(Shr) | 5199 DECLARE_CONCRETE_INSTRUCTION(Shr) |
5201 | 5200 |
5202 protected: | 5201 protected: |
5203 bool DataEquals(HValue* other) override { return true; } | 5202 bool DataEquals(HValue* other) override { return true; } |
5204 | 5203 |
5205 private: | 5204 private: |
(...skipping 15 matching lines...) Loading... |
5221 // like ((base + offset) >> scale) with one single decomposition. | 5220 // like ((base + offset) >> scale) with one single decomposition. |
5222 left()->TryDecompose(decomposition); | 5221 left()->TryDecompose(decomposition); |
5223 return true; | 5222 return true; |
5224 } | 5223 } |
5225 } | 5224 } |
5226 return false; | 5225 return false; |
5227 } | 5226 } |
5228 | 5227 |
5229 Range* InferRange(Zone* zone) override; | 5228 Range* InferRange(Zone* zone) override; |
5230 | 5229 |
5231 virtual void UpdateRepresentation(Representation new_rep, | 5230 void UpdateRepresentation(Representation new_rep, |
5232 HInferRepresentationPhase* h_infer, | 5231 HInferRepresentationPhase* h_infer, |
5233 const char* reason) override { | 5232 const char* reason) override { |
5234 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 5233 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
5235 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5234 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
5236 } | 5235 } |
5237 | 5236 |
5238 DECLARE_CONCRETE_INSTRUCTION(Sar) | 5237 DECLARE_CONCRETE_INSTRUCTION(Sar) |
5239 | 5238 |
5240 protected: | 5239 protected: |
5241 bool DataEquals(HValue* other) override { return true; } | 5240 bool DataEquals(HValue* other) override { return true; } |
5242 | 5241 |
5243 private: | 5242 private: |
5244 HSar(HValue* context, HValue* left, HValue* right, Strength strength) | 5243 HSar(HValue* context, HValue* left, HValue* right, Strength strength) |
5245 : HBitwiseBinaryOperation(context, left, right, strength) {} | 5244 : HBitwiseBinaryOperation(context, left, right, strength) {} |
5246 }; | 5245 }; |
5247 | 5246 |
5248 | 5247 |
5249 class HRor final : public HBitwiseBinaryOperation { | 5248 class HRor final : public HBitwiseBinaryOperation { |
5250 public: | 5249 public: |
5251 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5250 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
5252 HValue* left, HValue* right, | 5251 HValue* left, HValue* right, |
5253 Strength strength = Strength::WEAK) { | 5252 Strength strength = Strength::WEAK) { |
5254 return new (zone) HRor(context, left, right, strength); | 5253 return new (zone) HRor(context, left, right, strength); |
5255 } | 5254 } |
5256 | 5255 |
5257 virtual void UpdateRepresentation(Representation new_rep, | 5256 void UpdateRepresentation(Representation new_rep, |
5258 HInferRepresentationPhase* h_infer, | 5257 HInferRepresentationPhase* h_infer, |
5259 const char* reason) override { | 5258 const char* reason) override { |
5260 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 5259 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
5261 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5260 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
5262 } | 5261 } |
5263 | 5262 |
5264 DECLARE_CONCRETE_INSTRUCTION(Ror) | 5263 DECLARE_CONCRETE_INSTRUCTION(Ror) |
5265 | 5264 |
5266 protected: | 5265 protected: |
5267 bool DataEquals(HValue* other) override { return true; } | 5266 bool DataEquals(HValue* other) override { return true; } |
5268 | 5267 |
5269 private: | 5268 private: |
(...skipping 244 matching lines...) Loading... |
5514 } | 5513 } |
5515 | 5514 |
5516 bool MustClearNextMapWord() const { | 5515 bool MustClearNextMapWord() const { |
5517 return (flags_ & CLEAR_NEXT_MAP_WORD) != 0; | 5516 return (flags_ & CLEAR_NEXT_MAP_WORD) != 0; |
5518 } | 5517 } |
5519 | 5518 |
5520 void MakeDoubleAligned() { | 5519 void MakeDoubleAligned() { |
5521 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); | 5520 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); |
5522 } | 5521 } |
5523 | 5522 |
5524 virtual bool HandleSideEffectDominator(GVNFlag side_effect, | 5523 bool HandleSideEffectDominator(GVNFlag side_effect, |
5525 HValue* dominator) override; | 5524 HValue* dominator) override; |
5526 | 5525 |
5527 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT | 5526 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
5528 | 5527 |
5529 DECLARE_CONCRETE_INSTRUCTION(Allocate) | 5528 DECLARE_CONCRETE_INSTRUCTION(Allocate) |
5530 | 5529 |
5531 private: | 5530 private: |
5532 enum Flags { | 5531 enum Flags { |
5533 ALLOCATE_IN_NEW_SPACE = 1 << 0, | 5532 ALLOCATE_IN_NEW_SPACE = 1 << 0, |
5534 ALLOCATE_IN_OLD_SPACE = 1 << 2, | 5533 ALLOCATE_IN_OLD_SPACE = 1 << 2, |
5535 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, | 5534 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, |
(...skipping 1271 matching lines...) Loading... |
6807 store_mode() == STORE_TO_INITIALIZED_ENTRY) { | 6806 store_mode() == STORE_TO_INITIALIZED_ENTRY) { |
6808 return Representation::Integer32(); | 6807 return Representation::Integer32(); |
6809 } | 6808 } |
6810 return field_representation(); | 6809 return field_representation(); |
6811 } else if (field_representation().IsExternal()) { | 6810 } else if (field_representation().IsExternal()) { |
6812 return Representation::External(); | 6811 return Representation::External(); |
6813 } | 6812 } |
6814 } | 6813 } |
6815 return Representation::Tagged(); | 6814 return Representation::Tagged(); |
6816 } | 6815 } |
6817 virtual bool HandleSideEffectDominator(GVNFlag side_effect, | 6816 bool HandleSideEffectDominator(GVNFlag side_effect, |
6818 HValue* dominator) override { | 6817 HValue* dominator) override { |
6819 DCHECK(side_effect == kNewSpacePromotion); | 6818 DCHECK(side_effect == kNewSpacePromotion); |
6820 if (!FLAG_use_write_barrier_elimination) return false; | 6819 if (!FLAG_use_write_barrier_elimination) return false; |
6821 dominator_ = dominator; | 6820 dominator_ = dominator; |
6822 return false; | 6821 return false; |
6823 } | 6822 } |
6824 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT | 6823 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
6825 | 6824 |
6826 HValue* object() const { return OperandAt(0); } | 6825 HValue* object() const { return OperandAt(0); } |
6827 HValue* value() const { return OperandAt(1); } | 6826 HValue* value() const { return OperandAt(1); } |
6828 HValue* transition() const { return OperandAt(2); } | 6827 HValue* transition() const { return OperandAt(2); } |
(...skipping 236 matching lines...) Loading... |
7065 } | 7064 } |
7066 bool IsUninitialized() { return IsUninitializedField::decode(bit_field_); } | 7065 bool IsUninitialized() { return IsUninitializedField::decode(bit_field_); } |
7067 void SetUninitialized(bool is_uninitialized) { | 7066 void SetUninitialized(bool is_uninitialized) { |
7068 bit_field_ = IsUninitializedField::update(bit_field_, is_uninitialized); | 7067 bit_field_ = IsUninitializedField::update(bit_field_, is_uninitialized); |
7069 } | 7068 } |
7070 | 7069 |
7071 bool IsConstantHoleStore() { | 7070 bool IsConstantHoleStore() { |
7072 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); | 7071 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); |
7073 } | 7072 } |
7074 | 7073 |
7075 virtual bool HandleSideEffectDominator(GVNFlag side_effect, | 7074 bool HandleSideEffectDominator(GVNFlag side_effect, |
7076 HValue* dominator) override { | 7075 HValue* dominator) override { |
7077 DCHECK(side_effect == kNewSpacePromotion); | 7076 DCHECK(side_effect == kNewSpacePromotion); |
7078 dominator_ = dominator; | 7077 dominator_ = dominator; |
7079 return false; | 7078 return false; |
7080 } | 7079 } |
7081 | 7080 |
7082 HValue* dominator() const { return dominator_; } | 7081 HValue* dominator() const { return dominator_; } |
7083 | 7082 |
7084 bool NeedsWriteBarrier() { | 7083 bool NeedsWriteBarrier() { |
7085 if (value_is_smi()) { | 7084 if (value_is_smi()) { |
7086 return false; | 7085 return false; |
(...skipping 822 matching lines...) Loading... |
7909 | 7908 |
7910 | 7909 |
7911 | 7910 |
7912 #undef DECLARE_INSTRUCTION | 7911 #undef DECLARE_INSTRUCTION |
7913 #undef DECLARE_CONCRETE_INSTRUCTION | 7912 #undef DECLARE_CONCRETE_INSTRUCTION |
7914 | 7913 |
7915 } // namespace internal | 7914 } // namespace internal |
7916 } // namespace v8 | 7915 } // namespace v8 |
7917 | 7916 |
7918 #endif // V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ | 7917 #endif // V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |