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 6686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6697 } | 6697 } |
6698 virtual bool HandleSideEffectDominator(GVNFlag side_effect, | 6698 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
6699 HValue* dominator) V8_OVERRIDE { | 6699 HValue* dominator) V8_OVERRIDE { |
6700 ASSERT(side_effect == kNewSpacePromotion); | 6700 ASSERT(side_effect == kNewSpacePromotion); |
6701 if (!FLAG_use_write_barrier_elimination) return false; | 6701 if (!FLAG_use_write_barrier_elimination) return false; |
6702 new_space_dominator_ = dominator; | 6702 new_space_dominator_ = dominator; |
6703 return false; | 6703 return false; |
6704 } | 6704 } |
6705 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6705 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
6706 | 6706 |
6707 void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; } | |
6708 bool IsSkipWriteBarrier() const { | |
6709 return write_barrier_mode_ == SKIP_WRITE_BARRIER; | |
6710 } | |
6711 | |
6712 HValue* object() const { return OperandAt(0); } | 6707 HValue* object() const { return OperandAt(0); } |
6713 HValue* value() const { return OperandAt(1); } | 6708 HValue* value() const { return OperandAt(1); } |
6714 | 6709 |
6715 HObjectAccess access() const { return access_; } | 6710 HObjectAccess access() const { return access_; } |
6716 HValue* new_space_dominator() const { return new_space_dominator_; } | 6711 HValue* new_space_dominator() const { return new_space_dominator_; } |
6717 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } | 6712 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } |
6718 | 6713 |
6719 bool NeedsWriteBarrier() { | 6714 bool NeedsWriteBarrier() { |
6720 if (IsSkipWriteBarrier()) return false; | |
6721 if (field_representation().IsDouble()) return false; | 6715 if (field_representation().IsDouble()) return false; |
6722 if (field_representation().IsSmi()) return false; | 6716 if (field_representation().IsSmi()) return false; |
6723 if (field_representation().IsInteger32()) return false; | 6717 if (field_representation().IsInteger32()) return false; |
6724 if (field_representation().IsExternal()) return false; | 6718 if (field_representation().IsExternal()) return false; |
6725 return StoringValueNeedsWriteBarrier(value()) && | 6719 return StoringValueNeedsWriteBarrier(value()) && |
6726 ReceiverObjectNeedsWriteBarrier(object(), value(), | 6720 ReceiverObjectNeedsWriteBarrier(object(), value(), |
6727 new_space_dominator()); | 6721 new_space_dominator()); |
6728 } | 6722 } |
6729 | 6723 |
6730 Representation field_representation() const { | 6724 Representation field_representation() const { |
6731 return access_.representation(); | 6725 return access_.representation(); |
6732 } | 6726 } |
6733 | 6727 |
6734 void UpdateValue(HValue* value) { | 6728 void UpdateValue(HValue* value) { |
6735 SetOperandAt(1, value); | 6729 SetOperandAt(1, value); |
6736 } | 6730 } |
6737 | 6731 |
6738 private: | 6732 private: |
6739 HStoreNamedField(HValue* obj, | 6733 HStoreNamedField(HValue* obj, |
6740 HObjectAccess access, | 6734 HObjectAccess access, |
6741 HValue* val, | 6735 HValue* val, |
6742 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE) | 6736 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE) |
6743 : access_(access), | 6737 : access_(access), |
6744 new_space_dominator_(NULL), | 6738 new_space_dominator_(NULL), |
6745 write_barrier_mode_(UPDATE_WRITE_BARRIER), | |
6746 store_mode_(store_mode) { | 6739 store_mode_(store_mode) { |
6747 // Stores to a non existing in-object property are allowed only to the | 6740 // Stores to a non existing in-object property are allowed only to the |
6748 // newly allocated objects (via HAllocate or HInnerAllocatedObject). | 6741 // newly allocated objects (via HAllocate or HInnerAllocatedObject). |
6749 ASSERT(!access.IsInobject() || access.existing_inobject_property() || | 6742 ASSERT(!access.IsInobject() || access.existing_inobject_property() || |
6750 obj->IsAllocate() || obj->IsInnerAllocatedObject()); | 6743 obj->IsAllocate() || obj->IsInnerAllocatedObject()); |
6751 SetOperandAt(0, obj); | 6744 SetOperandAt(0, obj); |
6752 SetOperandAt(1, val); | 6745 SetOperandAt(1, val); |
6753 access.SetGVNFlags(this, STORE); | 6746 access.SetGVNFlags(this, STORE); |
6754 } | 6747 } |
6755 | 6748 |
6756 HObjectAccess access_; | 6749 HObjectAccess access_; |
6757 HValue* new_space_dominator_; | 6750 HValue* new_space_dominator_; |
6758 WriteBarrierMode write_barrier_mode_ : 1; | |
6759 StoreFieldOrKeyedMode store_mode_ : 1; | 6751 StoreFieldOrKeyedMode store_mode_ : 1; |
6760 }; | 6752 }; |
6761 | 6753 |
6762 | 6754 |
6763 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { | 6755 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { |
6764 public: | 6756 public: |
6765 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, | 6757 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, |
6766 Handle<String>, HValue*, | 6758 Handle<String>, HValue*, |
6767 StrictMode); | 6759 StrictMode); |
6768 HValue* object() { return OperandAt(0); } | 6760 HValue* object() { return OperandAt(0); } |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7692 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7684 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7693 }; | 7685 }; |
7694 | 7686 |
7695 | 7687 |
7696 #undef DECLARE_INSTRUCTION | 7688 #undef DECLARE_INSTRUCTION |
7697 #undef DECLARE_CONCRETE_INSTRUCTION | 7689 #undef DECLARE_CONCRETE_INSTRUCTION |
7698 | 7690 |
7699 } } // namespace v8::internal | 7691 } } // namespace v8::internal |
7700 | 7692 |
7701 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7693 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |