| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 bool is_truncating_to_smi, | 1524 bool is_truncating_to_smi, |
| 1525 bool is_truncating_to_int32, | 1525 bool is_truncating_to_int32, |
| 1526 bool allow_undefined_as_nan) | 1526 bool allow_undefined_as_nan) |
| 1527 : HUnaryOperation(value) { | 1527 : HUnaryOperation(value) { |
| 1528 ASSERT(!value->representation().IsNone()); | 1528 ASSERT(!value->representation().IsNone()); |
| 1529 ASSERT(!to.IsNone()); | 1529 ASSERT(!to.IsNone()); |
| 1530 ASSERT(!value->representation().Equals(to)); | 1530 ASSERT(!value->representation().Equals(to)); |
| 1531 set_representation(to); | 1531 set_representation(to); |
| 1532 SetFlag(kUseGVN); | 1532 SetFlag(kUseGVN); |
| 1533 if (allow_undefined_as_nan) SetFlag(kAllowUndefinedAsNaN); | 1533 if (allow_undefined_as_nan) SetFlag(kAllowUndefinedAsNaN); |
| 1534 if (is_truncating_to_smi) SetFlag(kTruncatingToSmi); | 1534 if (is_truncating_to_smi) { |
| 1535 SetFlag(kTruncatingToSmi); |
| 1536 SetFlag(kTruncatingToInt32); |
| 1537 } |
| 1538 |
| 1535 if (is_truncating_to_int32) SetFlag(kTruncatingToInt32); | 1539 if (is_truncating_to_int32) SetFlag(kTruncatingToInt32); |
| 1536 if (value->representation().IsSmi() || value->type().IsSmi()) { | 1540 if (value->representation().IsSmi() || value->type().IsSmi()) { |
| 1537 set_type(HType::Smi()); | 1541 set_type(HType::Smi()); |
| 1538 } else { | 1542 } else { |
| 1539 set_type(HType::TaggedNumber()); | 1543 set_type(HType::TaggedNumber()); |
| 1540 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion); | 1544 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion); |
| 1541 } | 1545 } |
| 1542 } | 1546 } |
| 1543 | 1547 |
| 1544 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 1548 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| (...skipping 2879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4424 virtual HValue* Canonicalize(); | 4428 virtual HValue* Canonicalize(); |
| 4425 | 4429 |
| 4426 // Only commutative if it is certain that not two objects are multiplicated. | 4430 // Only commutative if it is certain that not two objects are multiplicated. |
| 4427 virtual bool IsCommutative() const { | 4431 virtual bool IsCommutative() const { |
| 4428 return !representation().IsTagged(); | 4432 return !representation().IsTagged(); |
| 4429 } | 4433 } |
| 4430 | 4434 |
| 4431 virtual void UpdateRepresentation(Representation new_rep, | 4435 virtual void UpdateRepresentation(Representation new_rep, |
| 4432 HInferRepresentationPhase* h_infer, | 4436 HInferRepresentationPhase* h_infer, |
| 4433 const char* reason) { | 4437 const char* reason) { |
| 4434 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | |
| 4435 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4438 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
| 4436 } | 4439 } |
| 4437 | 4440 |
| 4438 DECLARE_CONCRETE_INSTRUCTION(Mul) | 4441 DECLARE_CONCRETE_INSTRUCTION(Mul) |
| 4439 | 4442 |
| 4440 protected: | 4443 protected: |
| 4441 virtual bool DataEquals(HValue* other) { return true; } | 4444 virtual bool DataEquals(HValue* other) { return true; } |
| 4442 | 4445 |
| 4443 virtual Range* InferRange(Zone* zone); | 4446 virtual Range* InferRange(Zone* zone); |
| 4444 | 4447 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4636 // BIT_AND with a smi-range positive value will always unset the | 4639 // BIT_AND with a smi-range positive value will always unset the |
| 4637 // entire sign-extension of the smi-sign. | 4640 // entire sign-extension of the smi-sign. |
| 4638 if (op == Token::BIT_AND && | 4641 if (op == Token::BIT_AND && |
| 4639 ((left->IsConstant() && | 4642 ((left->IsConstant() && |
| 4640 left->representation().IsSmi() && | 4643 left->representation().IsSmi() && |
| 4641 HConstant::cast(left)->Integer32Value() >= 0) || | 4644 HConstant::cast(left)->Integer32Value() >= 0) || |
| 4642 (right->IsConstant() && | 4645 (right->IsConstant() && |
| 4643 right->representation().IsSmi() && | 4646 right->representation().IsSmi() && |
| 4644 HConstant::cast(right)->Integer32Value() >= 0))) { | 4647 HConstant::cast(right)->Integer32Value() >= 0))) { |
| 4645 SetFlag(kTruncatingToSmi); | 4648 SetFlag(kTruncatingToSmi); |
| 4649 SetFlag(kTruncatingToInt32); |
| 4646 // BIT_OR with a smi-range negative value will always set the entire | 4650 // BIT_OR with a smi-range negative value will always set the entire |
| 4647 // sign-extension of the smi-sign. | 4651 // sign-extension of the smi-sign. |
| 4648 } else if (op == Token::BIT_OR && | 4652 } else if (op == Token::BIT_OR && |
| 4649 ((left->IsConstant() && | 4653 ((left->IsConstant() && |
| 4650 left->representation().IsSmi() && | 4654 left->representation().IsSmi() && |
| 4651 HConstant::cast(left)->Integer32Value() < 0) || | 4655 HConstant::cast(left)->Integer32Value() < 0) || |
| 4652 (right->IsConstant() && | 4656 (right->IsConstant() && |
| 4653 right->representation().IsSmi() && | 4657 right->representation().IsSmi() && |
| 4654 HConstant::cast(right)->Integer32Value() < 0))) { | 4658 HConstant::cast(right)->Integer32Value() < 0))) { |
| 4655 SetFlag(kTruncatingToSmi); | 4659 SetFlag(kTruncatingToSmi); |
| 4660 SetFlag(kTruncatingToInt32); |
| 4656 } | 4661 } |
| 4657 } | 4662 } |
| 4658 | 4663 |
| 4659 Token::Value op_; | 4664 Token::Value op_; |
| 4660 }; | 4665 }; |
| 4661 | 4666 |
| 4662 | 4667 |
| 4663 class HShl: public HBitwiseBinaryOperation { | 4668 class HShl: public HBitwiseBinaryOperation { |
| 4664 public: | 4669 public: |
| 4665 static HInstruction* New(Zone* zone, | 4670 static HInstruction* New(Zone* zone, |
| (...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6801 virtual bool IsDeletable() const { return true; } | 6806 virtual bool IsDeletable() const { return true; } |
| 6802 }; | 6807 }; |
| 6803 | 6808 |
| 6804 | 6809 |
| 6805 #undef DECLARE_INSTRUCTION | 6810 #undef DECLARE_INSTRUCTION |
| 6806 #undef DECLARE_CONCRETE_INSTRUCTION | 6811 #undef DECLARE_CONCRETE_INSTRUCTION |
| 6807 | 6812 |
| 6808 } } // namespace v8::internal | 6813 } } // namespace v8::internal |
| 6809 | 6814 |
| 6810 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6815 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |