| 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 5634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5645 | 5645 |
| 5646 | 5646 |
| 5647 inline bool StoringValueNeedsWriteBarrier(HValue* value) { | 5647 inline bool StoringValueNeedsWriteBarrier(HValue* value) { |
| 5648 return !value->type().IsBoolean() | 5648 return !value->type().IsBoolean() |
| 5649 && !value->type().IsSmi() | 5649 && !value->type().IsSmi() |
| 5650 && !(value->IsConstant() && HConstant::cast(value)->ImmortalImmovable()); | 5650 && !(value->IsConstant() && HConstant::cast(value)->ImmortalImmovable()); |
| 5651 } | 5651 } |
| 5652 | 5652 |
| 5653 | 5653 |
| 5654 inline bool ReceiverObjectNeedsWriteBarrier(HValue* object, | 5654 inline bool ReceiverObjectNeedsWriteBarrier(HValue* object, |
| 5655 HValue* value, |
| 5655 HValue* new_space_dominator) { | 5656 HValue* new_space_dominator) { |
| 5656 if (object->IsInnerAllocatedObject()) { | 5657 while (object->IsInnerAllocatedObject()) { |
| 5657 return ReceiverObjectNeedsWriteBarrier( | 5658 object = HInnerAllocatedObject::cast(object)->base_object(); |
| 5658 HInnerAllocatedObject::cast(object)->base_object(), | |
| 5659 new_space_dominator); | |
| 5660 } | 5659 } |
| 5661 if (object->IsConstant() && HConstant::cast(object)->IsCell()) { | 5660 if (object->IsConstant() && HConstant::cast(object)->IsCell()) { |
| 5662 return false; | 5661 return false; |
| 5663 } | 5662 } |
| 5664 if (object->IsConstant() && | 5663 if (object->IsConstant() && |
| 5665 HConstant::cast(object)->HasExternalReferenceValue()) { | 5664 HConstant::cast(object)->HasExternalReferenceValue()) { |
| 5666 // Stores to external references require no write barriers | 5665 // Stores to external references require no write barriers |
| 5667 return false; | 5666 return false; |
| 5668 } | 5667 } |
| 5669 if (object != new_space_dominator) return true; | 5668 if (object != new_space_dominator) return true; |
| 5670 if (object->IsAllocate()) { | 5669 if (object->IsAllocate()) { |
| 5671 return !HAllocate::cast(object)->IsNewSpaceAllocation(); | 5670 // Stores to new space allocations require no write barriers if the object |
| 5671 // is the new space dominator. |
| 5672 if (HAllocate::cast(object)->IsNewSpaceAllocation()) { |
| 5673 return false; |
| 5674 } |
| 5675 // Likewise we don't need a write barrier if we store a value that |
| 5676 // originates from the same allocation (via allocation folding). |
| 5677 while (value->IsInnerAllocatedObject()) { |
| 5678 value = HInnerAllocatedObject::cast(value)->base_object(); |
| 5679 } |
| 5680 return object != value; |
| 5672 } | 5681 } |
| 5673 return true; | 5682 return true; |
| 5674 } | 5683 } |
| 5675 | 5684 |
| 5676 | 5685 |
| 5677 class HStoreGlobalCell V8_FINAL : public HUnaryOperation { | 5686 class HStoreGlobalCell V8_FINAL : public HUnaryOperation { |
| 5678 public: | 5687 public: |
| 5679 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*, | 5688 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*, |
| 5680 Handle<PropertyCell>, PropertyDetails); | 5689 Handle<PropertyCell>, PropertyDetails); |
| 5681 | 5690 |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6582 | 6591 |
| 6583 bool NeedsWriteBarrier() { | 6592 bool NeedsWriteBarrier() { |
| 6584 ASSERT(!(FLAG_track_double_fields && field_representation().IsDouble()) || | 6593 ASSERT(!(FLAG_track_double_fields && field_representation().IsDouble()) || |
| 6585 !has_transition()); | 6594 !has_transition()); |
| 6586 if (IsSkipWriteBarrier()) return false; | 6595 if (IsSkipWriteBarrier()) return false; |
| 6587 if (field_representation().IsDouble()) return false; | 6596 if (field_representation().IsDouble()) return false; |
| 6588 if (field_representation().IsSmi()) return false; | 6597 if (field_representation().IsSmi()) return false; |
| 6589 if (field_representation().IsInteger32()) return false; | 6598 if (field_representation().IsInteger32()) return false; |
| 6590 if (field_representation().IsExternal()) return false; | 6599 if (field_representation().IsExternal()) return false; |
| 6591 return StoringValueNeedsWriteBarrier(value()) && | 6600 return StoringValueNeedsWriteBarrier(value()) && |
| 6592 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); | 6601 ReceiverObjectNeedsWriteBarrier(object(), value(), |
| 6602 new_space_dominator()); |
| 6593 } | 6603 } |
| 6594 | 6604 |
| 6595 bool NeedsWriteBarrierForMap() { | 6605 bool NeedsWriteBarrierForMap() { |
| 6596 if (IsSkipWriteBarrier()) return false; | 6606 if (IsSkipWriteBarrier()) return false; |
| 6597 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); | 6607 return ReceiverObjectNeedsWriteBarrier(object(), transition(), |
| 6608 new_space_dominator()); |
| 6598 } | 6609 } |
| 6599 | 6610 |
| 6600 Representation field_representation() const { | 6611 Representation field_representation() const { |
| 6601 return access_.representation(); | 6612 return access_.representation(); |
| 6602 } | 6613 } |
| 6603 | 6614 |
| 6604 void UpdateValue(HValue* value) { | 6615 void UpdateValue(HValue* value) { |
| 6605 SetOperandAt(1, value); | 6616 SetOperandAt(1, value); |
| 6606 } | 6617 } |
| 6607 | 6618 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6749 new_space_dominator_ = dominator; | 6760 new_space_dominator_ = dominator; |
| 6750 } | 6761 } |
| 6751 | 6762 |
| 6752 HValue* new_space_dominator() const { return new_space_dominator_; } | 6763 HValue* new_space_dominator() const { return new_space_dominator_; } |
| 6753 | 6764 |
| 6754 bool NeedsWriteBarrier() { | 6765 bool NeedsWriteBarrier() { |
| 6755 if (value_is_smi()) { | 6766 if (value_is_smi()) { |
| 6756 return false; | 6767 return false; |
| 6757 } else { | 6768 } else { |
| 6758 return StoringValueNeedsWriteBarrier(value()) && | 6769 return StoringValueNeedsWriteBarrier(value()) && |
| 6759 ReceiverObjectNeedsWriteBarrier(elements(), new_space_dominator()); | 6770 ReceiverObjectNeedsWriteBarrier(elements(), value(), |
| 6771 new_space_dominator()); |
| 6760 } | 6772 } |
| 6761 } | 6773 } |
| 6762 | 6774 |
| 6763 bool NeedsCanonicalization(); | 6775 bool NeedsCanonicalization(); |
| 6764 | 6776 |
| 6765 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6777 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 6766 | 6778 |
| 6767 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) | 6779 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) |
| 6768 | 6780 |
| 6769 private: | 6781 private: |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7486 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7498 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7487 }; | 7499 }; |
| 7488 | 7500 |
| 7489 | 7501 |
| 7490 #undef DECLARE_INSTRUCTION | 7502 #undef DECLARE_INSTRUCTION |
| 7491 #undef DECLARE_CONCRETE_INSTRUCTION | 7503 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7492 | 7504 |
| 7493 } } // namespace v8::internal | 7505 } } // namespace v8::internal |
| 7494 | 7506 |
| 7495 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7507 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |