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 4730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4741 SetOperandAt(0, global_object); | 4741 SetOperandAt(0, global_object); |
4742 set_representation(Representation::Double()); | 4742 set_representation(Representation::Double()); |
4743 } | 4743 } |
4744 | 4744 |
4745 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 4745 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
4746 }; | 4746 }; |
4747 | 4747 |
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( |
danno
2013/11/20 13:50:50
nit: remove this whitespace change.
Dmitry Lomov (no reviews)
2013/11/20 17:38:56
Done.
| |
4752 HValue* context, | 4752 Zone* zone, |
4753 HValue* left, | 4753 HValue* context, |
4754 HValue* right); | 4754 HValue* left, |
4755 HValue* right); | |
4755 | 4756 |
4756 // 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 |
4757 // 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). | |
4758 virtual bool IsCommutative() const V8_OVERRIDE { | 4760 virtual bool IsCommutative() const V8_OVERRIDE { |
4759 return !representation().IsTagged(); | 4761 return !representation().IsTagged() && !representation().IsExternal(); |
4760 } | 4762 } |
4761 | 4763 |
4762 virtual HValue* EnsureAndPropagateNotMinusZero( | 4764 virtual HValue* EnsureAndPropagateNotMinusZero( |
4763 BitVector* visited) V8_OVERRIDE; | 4765 BitVector* visited) V8_OVERRIDE; |
4764 | 4766 |
4765 virtual HValue* Canonicalize() V8_OVERRIDE; | 4767 virtual HValue* Canonicalize() V8_OVERRIDE; |
4766 | 4768 |
4767 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { | 4769 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { |
4768 if (left()->IsInteger32Constant()) { | 4770 if (left()->IsInteger32Constant()) { |
4769 decomposition->Apply(right(), left()->GetInteger32Constant()); | 4771 decomposition->Apply(right(), left()->GetInteger32Constant()); |
(...skipping 15 matching lines...) Expand all Loading... | |
4785 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || | 4787 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || |
4786 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { | 4788 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { |
4787 SetAllSideEffects(); | 4789 SetAllSideEffects(); |
4788 ClearFlag(kUseGVN); | 4790 ClearFlag(kUseGVN); |
4789 } else { | 4791 } else { |
4790 ClearAllSideEffects(); | 4792 ClearAllSideEffects(); |
4791 SetFlag(kUseGVN); | 4793 SetFlag(kUseGVN); |
4792 } | 4794 } |
4793 } | 4795 } |
4794 | 4796 |
4797 virtual Representation RepresentationFromInputs() V8_OVERRIDE; | |
4798 | |
4799 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE; | |
4800 | |
4795 DECLARE_CONCRETE_INSTRUCTION(Add) | 4801 DECLARE_CONCRETE_INSTRUCTION(Add) |
4796 | 4802 |
4797 protected: | 4803 protected: |
4798 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4804 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } |
4799 | 4805 |
4800 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 4806 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; |
4801 | 4807 |
4802 private: | 4808 private: |
4803 HAdd(HValue* context, HValue* left, HValue* right) | 4809 HAdd(HValue* context, HValue* left, HValue* right) |
4804 : HArithmeticBinaryOperation(context, left, right) { | 4810 : HArithmeticBinaryOperation(context, left, right) { |
(...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6502 } else if (index == 1) { | 6508 } else if (index == 1) { |
6503 if (field_representation().IsInteger8() || | 6509 if (field_representation().IsInteger8() || |
6504 field_representation().IsUInteger8() || | 6510 field_representation().IsUInteger8() || |
6505 field_representation().IsInteger16() || | 6511 field_representation().IsInteger16() || |
6506 field_representation().IsUInteger16() || | 6512 field_representation().IsUInteger16() || |
6507 field_representation().IsInteger32()) { | 6513 field_representation().IsInteger32()) { |
6508 return Representation::Integer32(); | 6514 return Representation::Integer32(); |
6509 } else if (field_representation().IsDouble() || | 6515 } else if (field_representation().IsDouble() || |
6510 field_representation().IsSmi()) { | 6516 field_representation().IsSmi()) { |
6511 return field_representation(); | 6517 return field_representation(); |
6518 } else if (field_representation().IsExternal()) { | |
6519 return Representation::External(); | |
6512 } | 6520 } |
6513 } | 6521 } |
6514 return Representation::Tagged(); | 6522 return Representation::Tagged(); |
6515 } | 6523 } |
6516 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 6524 virtual void HandleSideEffectDominator(GVNFlag side_effect, |
6517 HValue* dominator) V8_OVERRIDE { | 6525 HValue* dominator) V8_OVERRIDE { |
6518 ASSERT(side_effect == kChangesNewSpacePromotion); | 6526 ASSERT(side_effect == kChangesNewSpacePromotion); |
6519 new_space_dominator_ = dominator; | 6527 new_space_dominator_ = dominator; |
6520 } | 6528 } |
6521 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... | |
7454 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7462 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7455 }; | 7463 }; |
7456 | 7464 |
7457 | 7465 |
7458 #undef DECLARE_INSTRUCTION | 7466 #undef DECLARE_INSTRUCTION |
7459 #undef DECLARE_CONCRETE_INSTRUCTION | 7467 #undef DECLARE_CONCRETE_INSTRUCTION |
7460 | 7468 |
7461 } } // namespace v8::internal | 7469 } } // namespace v8::internal |
7462 | 7470 |
7463 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7471 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |