OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ | 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ |
6 #define V8_HYDROGEN_INSTRUCTIONS_H_ | 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ |
7 | 7 |
8 #include "v8.h" | 8 #include "v8.h" |
9 | 9 |
10 #include "allocation.h" | 10 #include "allocation.h" |
(...skipping 5684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5695 | 5695 |
5696 inline bool StoringValueNeedsWriteBarrier(HValue* value) { | 5696 inline bool StoringValueNeedsWriteBarrier(HValue* value) { |
5697 return !value->type().IsBoolean() | 5697 return !value->type().IsBoolean() |
5698 && !value->type().IsSmi() | 5698 && !value->type().IsSmi() |
5699 && !(value->IsConstant() && HConstant::cast(value)->ImmortalImmovable()); | 5699 && !(value->IsConstant() && HConstant::cast(value)->ImmortalImmovable()); |
5700 } | 5700 } |
5701 | 5701 |
5702 | 5702 |
5703 inline bool ReceiverObjectNeedsWriteBarrier(HValue* object, | 5703 inline bool ReceiverObjectNeedsWriteBarrier(HValue* object, |
5704 HValue* value, | 5704 HValue* value, |
5705 HValue* new_space_dominator) { | 5705 HValue* dominator) { |
5706 while (object->IsInnerAllocatedObject()) { | 5706 while (object->IsInnerAllocatedObject()) { |
5707 object = HInnerAllocatedObject::cast(object)->base_object(); | 5707 object = HInnerAllocatedObject::cast(object)->base_object(); |
5708 } | 5708 } |
5709 if (object->IsConstant() && HConstant::cast(object)->IsCell()) { | 5709 if (object->IsConstant() && HConstant::cast(object)->IsCell()) { |
5710 return false; | 5710 return false; |
5711 } | 5711 } |
5712 if (object->IsConstant() && | 5712 if (object->IsConstant() && |
5713 HConstant::cast(object)->HasExternalReferenceValue()) { | 5713 HConstant::cast(object)->HasExternalReferenceValue()) { |
5714 // Stores to external references require no write barriers | 5714 // Stores to external references require no write barriers |
5715 return false; | 5715 return false; |
5716 } | 5716 } |
5717 if (object != new_space_dominator) return true; | 5717 // We definitely need a write barrier unless the object is the allocation |
5718 if (object->IsAllocate()) { | 5718 // dominator. |
5719 // Stores to new space allocations require no write barriers if the object | 5719 if (object == dominator && object->IsAllocate()) { |
5720 // is the new space dominator. | 5720 // Stores to new space allocations require no write barriers. |
5721 if (HAllocate::cast(object)->IsNewSpaceAllocation()) { | 5721 if (HAllocate::cast(object)->IsNewSpaceAllocation()) { |
5722 return false; | 5722 return false; |
5723 } | 5723 } |
5724 // Storing a map or an immortal immovable object requires no write barriers | 5724 // Stores to old space allocations require no write barriers if the value is |
5725 // if the object is the new space dominator. | 5725 // a constant provably not in new space. |
5726 if (value->IsConstant() && | 5726 if (value->IsConstant() && HConstant::cast(value)->NotInNewSpace()) { |
5727 (HConstant::cast(value)->IsMap() || | |
5728 HConstant::cast(value)->ImmortalImmovable())) { | |
5729 return false; | 5727 return false; |
5730 } | 5728 } |
5731 // Likewise we don't need a write barrier if we store a value that | 5729 // Stores to old space allocations require no write barriers if the value is |
5732 // originates from the same allocation (via allocation folding). | 5730 // an old space allocation. |
5733 while (value->IsInnerAllocatedObject()) { | 5731 while (value->IsInnerAllocatedObject()) { |
5734 value = HInnerAllocatedObject::cast(value)->base_object(); | 5732 value = HInnerAllocatedObject::cast(value)->base_object(); |
5735 } | 5733 } |
5736 return object != value; | 5734 if (value->IsAllocate() && |
| 5735 !HAllocate::cast(value)->IsNewSpaceAllocation()) { |
| 5736 return false; |
| 5737 } |
5737 } | 5738 } |
5738 return true; | 5739 return true; |
5739 } | 5740 } |
5740 | 5741 |
5741 | 5742 |
5742 class HStoreGlobalCell V8_FINAL : public HUnaryOperation { | 5743 class HStoreGlobalCell V8_FINAL : public HUnaryOperation { |
5743 public: | 5744 public: |
5744 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*, | 5745 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*, |
5745 Handle<PropertyCell>, PropertyDetails); | 5746 Handle<PropertyCell>, PropertyDetails); |
5746 | 5747 |
(...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7718 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7719 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7719 }; | 7720 }; |
7720 | 7721 |
7721 | 7722 |
7722 #undef DECLARE_INSTRUCTION | 7723 #undef DECLARE_INSTRUCTION |
7723 #undef DECLARE_CONCRETE_INSTRUCTION | 7724 #undef DECLARE_CONCRETE_INSTRUCTION |
7724 | 7725 |
7725 } } // namespace v8::internal | 7726 } } // namespace v8::internal |
7726 | 7727 |
7727 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7728 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |