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