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 784 matching lines...) Loading... |
795 // Mark this HValue as dead and to be removed from other HValues' use lists. | 795 // Mark this HValue as dead and to be removed from other HValues' use lists. |
796 void Kill(); | 796 void Kill(); |
797 | 797 |
798 int flags() const { return flags_; } | 798 int flags() const { return flags_; } |
799 void SetFlag(Flag f) { flags_ |= (1 << f); } | 799 void SetFlag(Flag f) { flags_ |= (1 << f); } |
800 void ClearFlag(Flag f) { flags_ &= ~(1 << f); } | 800 void ClearFlag(Flag f) { flags_ &= ~(1 << f); } |
801 bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; } | 801 bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; } |
802 | 802 |
803 // Returns true if the flag specified is set for all uses, false otherwise. | 803 // Returns true if the flag specified is set for all uses, false otherwise. |
804 bool CheckUsesForFlag(Flag f); | 804 bool CheckUsesForFlag(Flag f); |
| 805 // Same as before and the first one without the flag is returned in value. |
| 806 bool CheckUsesForFlag(Flag f, HValue** value); |
805 // Returns true if the flag specified is set for all uses, and this set | 807 // Returns true if the flag specified is set for all uses, and this set |
806 // of uses is non-empty. | 808 // of uses is non-empty. |
807 bool HasAtLeastOneUseWithFlagAndNoneWithout(Flag f); | 809 bool HasAtLeastOneUseWithFlagAndNoneWithout(Flag f); |
808 | 810 |
809 GVNFlagSet gvn_flags() const { return gvn_flags_; } | 811 GVNFlagSet gvn_flags() const { return gvn_flags_; } |
810 void SetGVNFlag(GVNFlag f) { gvn_flags_.Add(f); } | 812 void SetGVNFlag(GVNFlag f) { gvn_flags_.Add(f); } |
811 void ClearGVNFlag(GVNFlag f) { gvn_flags_.Remove(f); } | 813 void ClearGVNFlag(GVNFlag f) { gvn_flags_.Remove(f); } |
812 bool CheckGVNFlag(GVNFlag f) const { return gvn_flags_.Contains(f); } | 814 bool CheckGVNFlag(GVNFlag f) const { return gvn_flags_.Contains(f); } |
813 void SetAllSideEffects() { gvn_flags_.Add(AllSideEffectsFlagSet()); } | 815 void SetAllSideEffects() { gvn_flags_.Add(AllSideEffectsFlagSet()); } |
814 void ClearAllSideEffects() { | 816 void ClearAllSideEffects() { |
(...skipping 708 matching lines...) Loading... |
1523 bool is_truncating_to_smi, | 1525 bool is_truncating_to_smi, |
1524 bool is_truncating_to_int32, | 1526 bool is_truncating_to_int32, |
1525 bool allow_undefined_as_nan) | 1527 bool allow_undefined_as_nan) |
1526 : HUnaryOperation(value) { | 1528 : HUnaryOperation(value) { |
1527 ASSERT(!value->representation().IsNone()); | 1529 ASSERT(!value->representation().IsNone()); |
1528 ASSERT(!to.IsNone()); | 1530 ASSERT(!to.IsNone()); |
1529 ASSERT(!value->representation().Equals(to)); | 1531 ASSERT(!value->representation().Equals(to)); |
1530 set_representation(to); | 1532 set_representation(to); |
1531 SetFlag(kUseGVN); | 1533 SetFlag(kUseGVN); |
1532 if (allow_undefined_as_nan) SetFlag(kAllowUndefinedAsNaN); | 1534 if (allow_undefined_as_nan) SetFlag(kAllowUndefinedAsNaN); |
1533 if (is_truncating_to_smi) SetFlag(kTruncatingToSmi); | 1535 if (is_truncating_to_smi) { |
| 1536 SetFlag(kTruncatingToSmi); |
| 1537 SetFlag(kTruncatingToInt32); |
| 1538 } |
1534 if (is_truncating_to_int32) SetFlag(kTruncatingToInt32); | 1539 if (is_truncating_to_int32) SetFlag(kTruncatingToInt32); |
1535 if (value->representation().IsSmi() || value->type().IsSmi()) { | 1540 if (value->representation().IsSmi() || value->type().IsSmi()) { |
1536 set_type(HType::Smi()); | 1541 set_type(HType::Smi()); |
1537 } else { | 1542 } else { |
1538 set_type(HType::TaggedNumber()); | 1543 set_type(HType::TaggedNumber()); |
1539 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion); | 1544 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion); |
1540 } | 1545 } |
1541 } | 1546 } |
1542 | 1547 |
1543 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 1548 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
(...skipping 2883 matching lines...) Loading... |
4427 virtual HValue* Canonicalize(); | 4432 virtual HValue* Canonicalize(); |
4428 | 4433 |
4429 // Only commutative if it is certain that not two objects are multiplicated. | 4434 // Only commutative if it is certain that not two objects are multiplicated. |
4430 virtual bool IsCommutative() const { | 4435 virtual bool IsCommutative() const { |
4431 return !representation().IsTagged(); | 4436 return !representation().IsTagged(); |
4432 } | 4437 } |
4433 | 4438 |
4434 virtual void UpdateRepresentation(Representation new_rep, | 4439 virtual void UpdateRepresentation(Representation new_rep, |
4435 HInferRepresentationPhase* h_infer, | 4440 HInferRepresentationPhase* h_infer, |
4436 const char* reason) { | 4441 const char* reason) { |
4437 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | |
4438 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4442 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
4439 } | 4443 } |
4440 | 4444 |
4441 DECLARE_CONCRETE_INSTRUCTION(Mul) | 4445 DECLARE_CONCRETE_INSTRUCTION(Mul) |
4442 | 4446 |
4443 protected: | 4447 protected: |
4444 virtual bool DataEquals(HValue* other) { return true; } | 4448 virtual bool DataEquals(HValue* other) { return true; } |
4445 | 4449 |
4446 virtual Range* InferRange(Zone* zone); | 4450 virtual Range* InferRange(Zone* zone); |
4447 | 4451 |
(...skipping 191 matching lines...) Loading... |
4639 // BIT_AND with a smi-range positive value will always unset the | 4643 // BIT_AND with a smi-range positive value will always unset the |
4640 // entire sign-extension of the smi-sign. | 4644 // entire sign-extension of the smi-sign. |
4641 if (op == Token::BIT_AND && | 4645 if (op == Token::BIT_AND && |
4642 ((left->IsConstant() && | 4646 ((left->IsConstant() && |
4643 left->representation().IsSmi() && | 4647 left->representation().IsSmi() && |
4644 HConstant::cast(left)->Integer32Value() >= 0) || | 4648 HConstant::cast(left)->Integer32Value() >= 0) || |
4645 (right->IsConstant() && | 4649 (right->IsConstant() && |
4646 right->representation().IsSmi() && | 4650 right->representation().IsSmi() && |
4647 HConstant::cast(right)->Integer32Value() >= 0))) { | 4651 HConstant::cast(right)->Integer32Value() >= 0))) { |
4648 SetFlag(kTruncatingToSmi); | 4652 SetFlag(kTruncatingToSmi); |
| 4653 SetFlag(kTruncatingToInt32); |
4649 // BIT_OR with a smi-range negative value will always set the entire | 4654 // BIT_OR with a smi-range negative value will always set the entire |
4650 // sign-extension of the smi-sign. | 4655 // sign-extension of the smi-sign. |
4651 } else if (op == Token::BIT_OR && | 4656 } else if (op == Token::BIT_OR && |
4652 ((left->IsConstant() && | 4657 ((left->IsConstant() && |
4653 left->representation().IsSmi() && | 4658 left->representation().IsSmi() && |
4654 HConstant::cast(left)->Integer32Value() < 0) || | 4659 HConstant::cast(left)->Integer32Value() < 0) || |
4655 (right->IsConstant() && | 4660 (right->IsConstant() && |
4656 right->representation().IsSmi() && | 4661 right->representation().IsSmi() && |
4657 HConstant::cast(right)->Integer32Value() < 0))) { | 4662 HConstant::cast(right)->Integer32Value() < 0))) { |
4658 SetFlag(kTruncatingToSmi); | 4663 SetFlag(kTruncatingToSmi); |
| 4664 SetFlag(kTruncatingToInt32); |
4659 } | 4665 } |
4660 } | 4666 } |
4661 | 4667 |
4662 Token::Value op_; | 4668 Token::Value op_; |
4663 }; | 4669 }; |
4664 | 4670 |
4665 | 4671 |
4666 class HShl: public HBitwiseBinaryOperation { | 4672 class HShl: public HBitwiseBinaryOperation { |
4667 public: | 4673 public: |
4668 static HInstruction* New(Zone* zone, | 4674 static HInstruction* New(Zone* zone, |
(...skipping 2096 matching lines...) Loading... |
6765 virtual bool IsDeletable() const { return true; } | 6771 virtual bool IsDeletable() const { return true; } |
6766 }; | 6772 }; |
6767 | 6773 |
6768 | 6774 |
6769 #undef DECLARE_INSTRUCTION | 6775 #undef DECLARE_INSTRUCTION |
6770 #undef DECLARE_CONCRETE_INSTRUCTION | 6776 #undef DECLARE_CONCRETE_INSTRUCTION |
6771 | 6777 |
6772 } } // namespace v8::internal | 6778 } } // namespace v8::internal |
6773 | 6779 |
6774 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6780 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |