| 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 4133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4144 }; | 4144 }; |
| 4145 | 4145 |
| 4146 | 4146 |
| 4147 class HBitwiseBinaryOperation : public HBinaryOperation { | 4147 class HBitwiseBinaryOperation : public HBinaryOperation { |
| 4148 public: | 4148 public: |
| 4149 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, | 4149 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, |
| 4150 Strength strength, HType type = HType::TaggedNumber()) | 4150 Strength strength, HType type = HType::TaggedNumber()) |
| 4151 : HBinaryOperation(context, left, right, strength, type) { | 4151 : HBinaryOperation(context, left, right, strength, type) { |
| 4152 SetFlag(kFlexibleRepresentation); | 4152 SetFlag(kFlexibleRepresentation); |
| 4153 SetFlag(kTruncatingToInt32); | 4153 SetFlag(kTruncatingToInt32); |
| 4154 SetFlag(kAllowUndefinedAsNaN); | 4154 if (!is_strong(strength)) SetFlag(kAllowUndefinedAsNaN); |
| 4155 SetAllSideEffects(); | 4155 SetAllSideEffects(); |
| 4156 } | 4156 } |
| 4157 | 4157 |
| 4158 void RepresentationChanged(Representation to) override { | 4158 void RepresentationChanged(Representation to) override { |
| 4159 if (to.IsTagged() && | 4159 if (to.IsTagged() && |
| 4160 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { | 4160 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { |
| 4161 SetAllSideEffects(); | 4161 SetAllSideEffects(); |
| 4162 ClearFlag(kUseGVN); | 4162 ClearFlag(kUseGVN); |
| 4163 } else { | 4163 } else { |
| 4164 ClearAllSideEffects(); | 4164 ClearAllSideEffects(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4225 | 4225 |
| 4226 | 4226 |
| 4227 class HArithmeticBinaryOperation : public HBinaryOperation { | 4227 class HArithmeticBinaryOperation : public HBinaryOperation { |
| 4228 public: | 4228 public: |
| 4229 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right, | 4229 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right, |
| 4230 Strength strength) | 4230 Strength strength) |
| 4231 : HBinaryOperation(context, left, right, strength, | 4231 : HBinaryOperation(context, left, right, strength, |
| 4232 HType::TaggedNumber()) { | 4232 HType::TaggedNumber()) { |
| 4233 SetAllSideEffects(); | 4233 SetAllSideEffects(); |
| 4234 SetFlag(kFlexibleRepresentation); | 4234 SetFlag(kFlexibleRepresentation); |
| 4235 SetFlag(kAllowUndefinedAsNaN); | 4235 if (!is_strong(strength)) SetFlag(kAllowUndefinedAsNaN); |
| 4236 } | 4236 } |
| 4237 | 4237 |
| 4238 void RepresentationChanged(Representation to) override { | 4238 void RepresentationChanged(Representation to) override { |
| 4239 if (to.IsTagged() && | 4239 if (to.IsTagged() && |
| 4240 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { | 4240 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { |
| 4241 SetAllSideEffects(); | 4241 SetAllSideEffects(); |
| 4242 ClearFlag(kUseGVN); | 4242 ClearFlag(kUseGVN); |
| 4243 } else { | 4243 } else { |
| 4244 ClearAllSideEffects(); | 4244 ClearAllSideEffects(); |
| 4245 SetFlag(kUseGVN); | 4245 SetFlag(kUseGVN); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4282 set_representation(Representation::Tagged()); | 4282 set_representation(Representation::Tagged()); |
| 4283 SetAllSideEffects(); | 4283 SetAllSideEffects(); |
| 4284 } | 4284 } |
| 4285 | 4285 |
| 4286 Token::Value token_; | 4286 Token::Value token_; |
| 4287 }; | 4287 }; |
| 4288 | 4288 |
| 4289 | 4289 |
| 4290 class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> { | 4290 class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> { |
| 4291 public: | 4291 public: |
| 4292 DECLARE_INSTRUCTION_FACTORY_P3(HCompareNumericAndBranch, | 4292 static HCompareNumericAndBranch* New(Isolate* isolate, Zone* zone, |
| 4293 HValue*, HValue*, Token::Value); | 4293 HValue* context, HValue* left, |
| 4294 DECLARE_INSTRUCTION_FACTORY_P5(HCompareNumericAndBranch, | 4294 HValue* right, Token::Value token, |
| 4295 HValue*, HValue*, Token::Value, | 4295 HBasicBlock* true_target = NULL, |
| 4296 HBasicBlock*, HBasicBlock*); | 4296 HBasicBlock* false_target = NULL, |
| 4297 Strength strength = Strength::WEAK) { |
| 4298 return new (zone) HCompareNumericAndBranch(left, right, token, true_target, |
| 4299 false_target, strength); |
| 4300 } |
| 4301 static HCompareNumericAndBranch* New(Isolate* isolate, Zone* zone, |
| 4302 HValue* context, HValue* left, |
| 4303 HValue* right, Token::Value token, |
| 4304 Strength strength) { |
| 4305 return new (zone) |
| 4306 HCompareNumericAndBranch(left, right, token, NULL, NULL, strength); |
| 4307 } |
| 4297 | 4308 |
| 4298 HValue* left() const { return OperandAt(0); } | 4309 HValue* left() const { return OperandAt(0); } |
| 4299 HValue* right() const { return OperandAt(1); } | 4310 HValue* right() const { return OperandAt(1); } |
| 4300 Token::Value token() const { return token_; } | 4311 Token::Value token() const { return token_; } |
| 4301 | 4312 |
| 4302 void set_observed_input_representation(Representation left, | 4313 void set_observed_input_representation(Representation left, |
| 4303 Representation right) { | 4314 Representation right) { |
| 4304 observed_input_representation_[0] = left; | 4315 observed_input_representation_[0] = left; |
| 4305 observed_input_representation_[1] = right; | 4316 observed_input_representation_[1] = right; |
| 4306 } | 4317 } |
| 4307 | 4318 |
| 4308 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; | 4319 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; |
| 4309 | 4320 |
| 4310 Representation RequiredInputRepresentation(int index) override { | 4321 Representation RequiredInputRepresentation(int index) override { |
| 4311 return representation(); | 4322 return representation(); |
| 4312 } | 4323 } |
| 4313 Representation observed_input_representation(int index) override { | 4324 Representation observed_input_representation(int index) override { |
| 4314 return observed_input_representation_[index]; | 4325 return observed_input_representation_[index]; |
| 4315 } | 4326 } |
| 4316 | 4327 |
| 4317 bool KnownSuccessorBlock(HBasicBlock** block) override; | 4328 bool KnownSuccessorBlock(HBasicBlock** block) override; |
| 4318 | 4329 |
| 4330 Strength strength() const { return strength_; } |
| 4331 |
| 4319 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT | 4332 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 4320 | 4333 |
| 4321 void SetOperandPositions(Zone* zone, SourcePosition left_pos, | 4334 void SetOperandPositions(Zone* zone, SourcePosition left_pos, |
| 4322 SourcePosition right_pos) { | 4335 SourcePosition right_pos) { |
| 4323 set_operand_position(zone, 0, left_pos); | 4336 set_operand_position(zone, 0, left_pos); |
| 4324 set_operand_position(zone, 1, right_pos); | 4337 set_operand_position(zone, 1, right_pos); |
| 4325 } | 4338 } |
| 4326 | 4339 |
| 4327 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch) | 4340 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch) |
| 4328 | 4341 |
| 4329 private: | 4342 private: |
| 4330 HCompareNumericAndBranch(HValue* left, | 4343 HCompareNumericAndBranch(HValue* left, HValue* right, Token::Value token, |
| 4331 HValue* right, | 4344 HBasicBlock* true_target, HBasicBlock* false_target, |
| 4332 Token::Value token, | 4345 Strength strength) |
| 4333 HBasicBlock* true_target = NULL, | 4346 : token_(token), strength_(strength) { |
| 4334 HBasicBlock* false_target = NULL) | |
| 4335 : token_(token) { | |
| 4336 SetFlag(kFlexibleRepresentation); | 4347 SetFlag(kFlexibleRepresentation); |
| 4337 DCHECK(Token::IsCompareOp(token)); | 4348 DCHECK(Token::IsCompareOp(token)); |
| 4338 SetOperandAt(0, left); | 4349 SetOperandAt(0, left); |
| 4339 SetOperandAt(1, right); | 4350 SetOperandAt(1, right); |
| 4340 SetSuccessorAt(0, true_target); | 4351 SetSuccessorAt(0, true_target); |
| 4341 SetSuccessorAt(1, false_target); | 4352 SetSuccessorAt(1, false_target); |
| 4342 } | 4353 } |
| 4343 | 4354 |
| 4344 Representation observed_input_representation_[2]; | 4355 Representation observed_input_representation_[2]; |
| 4345 Token::Value token_; | 4356 Token::Value token_; |
| 4357 Strength strength_; |
| 4346 }; | 4358 }; |
| 4347 | 4359 |
| 4348 | 4360 |
| 4349 class HCompareHoleAndBranch final : public HUnaryControlInstruction { | 4361 class HCompareHoleAndBranch final : public HUnaryControlInstruction { |
| 4350 public: | 4362 public: |
| 4351 DECLARE_INSTRUCTION_FACTORY_P1(HCompareHoleAndBranch, HValue*); | 4363 DECLARE_INSTRUCTION_FACTORY_P1(HCompareHoleAndBranch, HValue*); |
| 4352 DECLARE_INSTRUCTION_FACTORY_P3(HCompareHoleAndBranch, HValue*, | 4364 DECLARE_INSTRUCTION_FACTORY_P3(HCompareHoleAndBranch, HValue*, |
| 4353 HBasicBlock*, HBasicBlock*); | 4365 HBasicBlock*, HBasicBlock*); |
| 4354 | 4366 |
| 4355 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; | 4367 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; |
| (...skipping 3578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7934 }; | 7946 }; |
| 7935 | 7947 |
| 7936 | 7948 |
| 7937 | 7949 |
| 7938 #undef DECLARE_INSTRUCTION | 7950 #undef DECLARE_INSTRUCTION |
| 7939 #undef DECLARE_CONCRETE_INSTRUCTION | 7951 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7940 | 7952 |
| 7941 } } // namespace v8::internal | 7953 } } // namespace v8::internal |
| 7942 | 7954 |
| 7943 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7955 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |