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 // 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 | |
5732 // originates from the same allocation (via allocation folding). | |
5733 while (value->IsInnerAllocatedObject()) { | 5729 while (value->IsInnerAllocatedObject()) { |
Hannes Payer (out of office)
2014/05/19 09:43:45
Please add a comment what is going on here.
| |
5734 value = HInnerAllocatedObject::cast(value)->base_object(); | 5730 value = HInnerAllocatedObject::cast(value)->base_object(); |
5735 } | 5731 } |
5736 return object != value; | 5732 if (value->IsAllocate() && |
5733 !HAllocate::cast(value)->IsNewSpaceAllocation()) { | |
5734 return false; | |
5735 } | |
5737 } | 5736 } |
5738 return true; | 5737 return true; |
5739 } | 5738 } |
5740 | 5739 |
5741 | 5740 |
5742 class HStoreGlobalCell V8_FINAL : public HUnaryOperation { | 5741 class HStoreGlobalCell V8_FINAL : public HUnaryOperation { |
5743 public: | 5742 public: |
5744 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*, | 5743 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*, |
5745 Handle<PropertyCell>, PropertyDetails); | 5744 Handle<PropertyCell>, PropertyDetails); |
5746 | 5745 |
(...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7718 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7717 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7719 }; | 7718 }; |
7720 | 7719 |
7721 | 7720 |
7722 #undef DECLARE_INSTRUCTION | 7721 #undef DECLARE_INSTRUCTION |
7723 #undef DECLARE_CONCRETE_INSTRUCTION | 7722 #undef DECLARE_CONCRETE_INSTRUCTION |
7724 | 7723 |
7725 } } // namespace v8::internal | 7724 } } // namespace v8::internal |
7726 | 7725 |
7727 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7726 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |