Chromium Code Reviews| 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 4606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4617 }; | 4617 }; |
| 4618 | 4618 |
| 4619 | 4619 |
| 4620 class HAdd V8_FINAL : public HArithmeticBinaryOperation { | 4620 class HAdd V8_FINAL : public HArithmeticBinaryOperation { |
| 4621 public: | 4621 public: |
| 4622 static HInstruction* New(Zone* zone, | 4622 static HInstruction* New(Zone* zone, |
| 4623 HValue* context, | 4623 HValue* context, |
| 4624 HValue* left, | 4624 HValue* left, |
| 4625 HValue* right); | 4625 HValue* right); |
| 4626 | 4626 |
| 4627 static HAdd* NewExternalPointerOffset( | |
|
danno
2013/11/18 14:26:17
This doesn't really work well the the Add<> templa
Dmitry Lomov (no reviews)
2013/11/18 16:43:54
Done, even though Add<> does not work with HAdd ev
| |
| 4628 Zone* zone, | |
| 4629 HValue* context, | |
| 4630 HValue* base_pointer, | |
| 4631 HValue* offset); | |
| 4632 | |
| 4627 // Add is only commutative if two integer values are added and not if two | 4633 // Add is only commutative if two integer values are added and not if two |
| 4628 // tagged values are added (because it might be a String concatenation). | 4634 // tagged values are added (because it might be a String concatenation). |
| 4635 // We also do not commute (pointer + offset). | |
| 4629 virtual bool IsCommutative() const V8_OVERRIDE { | 4636 virtual bool IsCommutative() const V8_OVERRIDE { |
| 4630 return !representation().IsTagged(); | 4637 return !representation().IsTagged() && !representation().IsExternal(); |
| 4631 } | 4638 } |
| 4632 | 4639 |
| 4633 virtual HValue* EnsureAndPropagateNotMinusZero( | 4640 virtual HValue* EnsureAndPropagateNotMinusZero( |
| 4634 BitVector* visited) V8_OVERRIDE; | 4641 BitVector* visited) V8_OVERRIDE; |
| 4635 | 4642 |
| 4636 virtual HValue* Canonicalize() V8_OVERRIDE; | 4643 virtual HValue* Canonicalize() V8_OVERRIDE; |
| 4637 | 4644 |
| 4638 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { | 4645 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { |
| 4639 if (left()->IsInteger32Constant()) { | 4646 if (left()->IsInteger32Constant()) { |
| 4640 decomposition->Apply(right(), left()->GetInteger32Constant()); | 4647 decomposition->Apply(right(), left()->GetInteger32Constant()); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 4656 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || | 4663 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || |
| 4657 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { | 4664 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { |
| 4658 SetAllSideEffects(); | 4665 SetAllSideEffects(); |
| 4659 ClearFlag(kUseGVN); | 4666 ClearFlag(kUseGVN); |
| 4660 } else { | 4667 } else { |
| 4661 ClearAllSideEffects(); | 4668 ClearAllSideEffects(); |
| 4662 SetFlag(kUseGVN); | 4669 SetFlag(kUseGVN); |
| 4663 } | 4670 } |
| 4664 } | 4671 } |
| 4665 | 4672 |
| 4673 virtual Representation RepresentationFromInputs() V8_OVERRIDE; | |
| 4674 | |
| 4675 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE; | |
| 4676 | |
| 4666 DECLARE_CONCRETE_INSTRUCTION(Add) | 4677 DECLARE_CONCRETE_INSTRUCTION(Add) |
| 4667 | 4678 |
| 4668 protected: | 4679 protected: |
| 4669 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4680 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } |
| 4670 | 4681 |
| 4671 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 4682 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; |
| 4672 | 4683 |
| 4673 private: | 4684 private: |
| 4674 HAdd(HValue* context, HValue* left, HValue* right) | 4685 HAdd(HValue* context, HValue* left, HValue* right) |
| 4675 : HArithmeticBinaryOperation(context, left, right) { | 4686 : HArithmeticBinaryOperation(context, left, right) { |
| (...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6373 } else if (index == 1) { | 6384 } else if (index == 1) { |
| 6374 if (field_representation().IsInteger8() || | 6385 if (field_representation().IsInteger8() || |
| 6375 field_representation().IsUInteger8() || | 6386 field_representation().IsUInteger8() || |
| 6376 field_representation().IsInteger16() || | 6387 field_representation().IsInteger16() || |
| 6377 field_representation().IsUInteger16() || | 6388 field_representation().IsUInteger16() || |
| 6378 field_representation().IsInteger32()) { | 6389 field_representation().IsInteger32()) { |
| 6379 return Representation::Integer32(); | 6390 return Representation::Integer32(); |
| 6380 } else if (field_representation().IsDouble() || | 6391 } else if (field_representation().IsDouble() || |
| 6381 field_representation().IsSmi()) { | 6392 field_representation().IsSmi()) { |
| 6382 return field_representation(); | 6393 return field_representation(); |
| 6394 } else if (field_representation().IsExternal()) { | |
| 6395 return Representation::External(); | |
| 6383 } | 6396 } |
| 6384 } | 6397 } |
| 6385 return Representation::Tagged(); | 6398 return Representation::Tagged(); |
| 6386 } | 6399 } |
| 6387 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 6400 virtual void HandleSideEffectDominator(GVNFlag side_effect, |
| 6388 HValue* dominator) V8_OVERRIDE { | 6401 HValue* dominator) V8_OVERRIDE { |
| 6389 ASSERT(side_effect == kChangesNewSpacePromotion); | 6402 ASSERT(side_effect == kChangesNewSpacePromotion); |
| 6390 new_space_dominator_ = dominator; | 6403 new_space_dominator_ = dominator; |
| 6391 } | 6404 } |
| 6392 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6405 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| (...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7325 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7338 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7326 }; | 7339 }; |
| 7327 | 7340 |
| 7328 | 7341 |
| 7329 #undef DECLARE_INSTRUCTION | 7342 #undef DECLARE_INSTRUCTION |
| 7330 #undef DECLARE_CONCRETE_INSTRUCTION | 7343 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7331 | 7344 |
| 7332 } } // namespace v8::internal | 7345 } } // namespace v8::internal |
| 7333 | 7346 |
| 7334 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7347 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |