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 4729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4740 SetOperandAt(0, global_object); | 4740 SetOperandAt(0, global_object); |
4741 set_representation(Representation::Double()); | 4741 set_representation(Representation::Double()); |
4742 } | 4742 } |
4743 | 4743 |
4744 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 4744 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
4745 }; | 4745 }; |
4746 | 4746 |
4747 | 4747 |
4748 class HAdd V8_FINAL : public HArithmeticBinaryOperation { | 4748 class HAdd V8_FINAL : public HArithmeticBinaryOperation { |
4749 public: | 4749 public: |
4750 static HInstruction* New(Zone* zone, | 4750 static HInstruction* New( |
4751 HValue* context, | 4751 Zone* zone, |
4752 HValue* left, | 4752 HValue* context, |
4753 HValue* right); | 4753 HValue* left, |
| 4754 HValue* right, |
| 4755 Representation forced_representation = Representation::None()); |
4754 | 4756 |
4755 // Add is only commutative if two integer values are added and not if two | 4757 // Add is only commutative if two integer values are added and not if two |
4756 // tagged values are added (because it might be a String concatenation). | 4758 // tagged values are added (because it might be a String concatenation). |
| 4759 // We also do not commute (pointer + offset). |
4757 virtual bool IsCommutative() const V8_OVERRIDE { | 4760 virtual bool IsCommutative() const V8_OVERRIDE { |
4758 return !representation().IsTagged(); | 4761 return !representation().IsTagged() && !representation().IsExternal(); |
4759 } | 4762 } |
4760 | 4763 |
4761 virtual HValue* EnsureAndPropagateNotMinusZero( | 4764 virtual HValue* EnsureAndPropagateNotMinusZero( |
4762 BitVector* visited) V8_OVERRIDE; | 4765 BitVector* visited) V8_OVERRIDE; |
4763 | 4766 |
4764 virtual HValue* Canonicalize() V8_OVERRIDE; | 4767 virtual HValue* Canonicalize() V8_OVERRIDE; |
4765 | 4768 |
4766 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { | 4769 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { |
4767 if (left()->IsInteger32Constant()) { | 4770 if (left()->IsInteger32Constant()) { |
4768 decomposition->Apply(right(), left()->GetInteger32Constant()); | 4771 decomposition->Apply(right(), left()->GetInteger32Constant()); |
(...skipping 15 matching lines...) Expand all Loading... |
4784 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || | 4787 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || |
4785 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { | 4788 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { |
4786 SetAllSideEffects(); | 4789 SetAllSideEffects(); |
4787 ClearFlag(kUseGVN); | 4790 ClearFlag(kUseGVN); |
4788 } else { | 4791 } else { |
4789 ClearAllSideEffects(); | 4792 ClearAllSideEffects(); |
4790 SetFlag(kUseGVN); | 4793 SetFlag(kUseGVN); |
4791 } | 4794 } |
4792 } | 4795 } |
4793 | 4796 |
| 4797 virtual Representation RepresentationFromInputs() V8_OVERRIDE; |
| 4798 |
| 4799 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE; |
| 4800 |
4794 DECLARE_CONCRETE_INSTRUCTION(Add) | 4801 DECLARE_CONCRETE_INSTRUCTION(Add) |
4795 | 4802 |
4796 protected: | 4803 protected: |
4797 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4804 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } |
4798 | 4805 |
4799 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 4806 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; |
4800 | 4807 |
4801 private: | 4808 private: |
4802 HAdd(HValue* context, HValue* left, HValue* right) | 4809 HAdd(HValue* context, HValue* left, HValue* right) |
4803 : HArithmeticBinaryOperation(context, left, right) { | 4810 : HArithmeticBinaryOperation(context, left, right) { |
(...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6501 } else if (index == 1) { | 6508 } else if (index == 1) { |
6502 if (field_representation().IsInteger8() || | 6509 if (field_representation().IsInteger8() || |
6503 field_representation().IsUInteger8() || | 6510 field_representation().IsUInteger8() || |
6504 field_representation().IsInteger16() || | 6511 field_representation().IsInteger16() || |
6505 field_representation().IsUInteger16() || | 6512 field_representation().IsUInteger16() || |
6506 field_representation().IsInteger32()) { | 6513 field_representation().IsInteger32()) { |
6507 return Representation::Integer32(); | 6514 return Representation::Integer32(); |
6508 } else if (field_representation().IsDouble() || | 6515 } else if (field_representation().IsDouble() || |
6509 field_representation().IsSmi()) { | 6516 field_representation().IsSmi()) { |
6510 return field_representation(); | 6517 return field_representation(); |
| 6518 } else if (field_representation().IsExternal()) { |
| 6519 return Representation::External(); |
6511 } | 6520 } |
6512 } | 6521 } |
6513 return Representation::Tagged(); | 6522 return Representation::Tagged(); |
6514 } | 6523 } |
6515 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 6524 virtual void HandleSideEffectDominator(GVNFlag side_effect, |
6516 HValue* dominator) V8_OVERRIDE { | 6525 HValue* dominator) V8_OVERRIDE { |
6517 ASSERT(side_effect == kChangesNewSpacePromotion); | 6526 ASSERT(side_effect == kChangesNewSpacePromotion); |
6518 new_space_dominator_ = dominator; | 6527 new_space_dominator_ = dominator; |
6519 } | 6528 } |
6520 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6529 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7453 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7462 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7454 }; | 7463 }; |
7455 | 7464 |
7456 | 7465 |
7457 #undef DECLARE_INSTRUCTION | 7466 #undef DECLARE_INSTRUCTION |
7458 #undef DECLARE_CONCRETE_INSTRUCTION | 7467 #undef DECLARE_CONCRETE_INSTRUCTION |
7459 | 7468 |
7460 } } // namespace v8::internal | 7469 } } // namespace v8::internal |
7461 | 7470 |
7462 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7471 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |