| 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 "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 6663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6674 } else if (field_representation().IsExternal()) { | 6674 } else if (field_representation().IsExternal()) { |
| 6675 return Representation::External(); | 6675 return Representation::External(); |
| 6676 } | 6676 } |
| 6677 } | 6677 } |
| 6678 return Representation::Tagged(); | 6678 return Representation::Tagged(); |
| 6679 } | 6679 } |
| 6680 virtual bool HandleSideEffectDominator(GVNFlag side_effect, | 6680 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
| 6681 HValue* dominator) V8_OVERRIDE { | 6681 HValue* dominator) V8_OVERRIDE { |
| 6682 ASSERT(side_effect == kNewSpacePromotion); | 6682 ASSERT(side_effect == kNewSpacePromotion); |
| 6683 if (!FLAG_use_write_barrier_elimination) return false; | 6683 if (!FLAG_use_write_barrier_elimination) return false; |
| 6684 new_space_dominator_ = dominator; | 6684 dominator_ = dominator; |
| 6685 return false; | 6685 return false; |
| 6686 } | 6686 } |
| 6687 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6687 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 6688 | 6688 |
| 6689 HValue* object() const { return OperandAt(0); } | 6689 HValue* object() const { return OperandAt(0); } |
| 6690 HValue* value() const { return OperandAt(1); } | 6690 HValue* value() const { return OperandAt(1); } |
| 6691 HValue* transition() const { return OperandAt(2); } | 6691 HValue* transition() const { return OperandAt(2); } |
| 6692 | 6692 |
| 6693 HObjectAccess access() const { return access_; } | 6693 HObjectAccess access() const { return access_; } |
| 6694 HValue* new_space_dominator() const { return new_space_dominator_; } | 6694 HValue* dominator() const { return dominator_; } |
| 6695 bool has_transition() const { return has_transition_; } | 6695 bool has_transition() const { return has_transition_; } |
| 6696 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } | 6696 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } |
| 6697 | 6697 |
| 6698 Handle<Map> transition_map() const { | 6698 Handle<Map> transition_map() const { |
| 6699 if (has_transition()) { | 6699 if (has_transition()) { |
| 6700 return Handle<Map>::cast( | 6700 return Handle<Map>::cast( |
| 6701 HConstant::cast(transition())->handle(Isolate::Current())); | 6701 HConstant::cast(transition())->handle(Isolate::Current())); |
| 6702 } else { | 6702 } else { |
| 6703 return Handle<Map>(); | 6703 return Handle<Map>(); |
| 6704 } | 6704 } |
| 6705 } | 6705 } |
| 6706 | 6706 |
| 6707 void SetTransition(HConstant* transition) { | 6707 void SetTransition(HConstant* transition) { |
| 6708 ASSERT(!has_transition()); // Only set once. | 6708 ASSERT(!has_transition()); // Only set once. |
| 6709 SetOperandAt(2, transition); | 6709 SetOperandAt(2, transition); |
| 6710 has_transition_ = true; | 6710 has_transition_ = true; |
| 6711 SetChangesFlag(kMaps); | 6711 SetChangesFlag(kMaps); |
| 6712 } | 6712 } |
| 6713 | 6713 |
| 6714 bool NeedsWriteBarrier() { | 6714 bool NeedsWriteBarrier() { |
| 6715 ASSERT(!field_representation().IsDouble() || !has_transition()); | 6715 ASSERT(!field_representation().IsDouble() || !has_transition()); |
| 6716 if (field_representation().IsDouble()) return false; | 6716 if (field_representation().IsDouble()) return false; |
| 6717 if (field_representation().IsSmi()) return false; | 6717 if (field_representation().IsSmi()) return false; |
| 6718 if (field_representation().IsInteger32()) return false; | 6718 if (field_representation().IsInteger32()) return false; |
| 6719 if (field_representation().IsExternal()) return false; | 6719 if (field_representation().IsExternal()) return false; |
| 6720 return StoringValueNeedsWriteBarrier(value()) && | 6720 return StoringValueNeedsWriteBarrier(value()) && |
| 6721 ReceiverObjectNeedsWriteBarrier(object(), value(), | 6721 ReceiverObjectNeedsWriteBarrier(object(), value(), dominator()); |
| 6722 new_space_dominator()); | |
| 6723 } | 6722 } |
| 6724 | 6723 |
| 6725 bool NeedsWriteBarrierForMap() { | 6724 bool NeedsWriteBarrierForMap() { |
| 6726 return ReceiverObjectNeedsWriteBarrier(object(), transition(), | 6725 return ReceiverObjectNeedsWriteBarrier(object(), transition(), |
| 6727 new_space_dominator()); | 6726 dominator()); |
| 6728 } | 6727 } |
| 6729 | 6728 |
| 6730 SmiCheck SmiCheckForWriteBarrier() const { | 6729 SmiCheck SmiCheckForWriteBarrier() const { |
| 6731 if (field_representation().IsHeapObject()) return OMIT_SMI_CHECK; | 6730 if (field_representation().IsHeapObject()) return OMIT_SMI_CHECK; |
| 6732 if (value()->type().IsHeapObject()) return OMIT_SMI_CHECK; | 6731 if (value()->type().IsHeapObject()) return OMIT_SMI_CHECK; |
| 6733 return INLINE_SMI_CHECK; | 6732 return INLINE_SMI_CHECK; |
| 6734 } | 6733 } |
| 6735 | 6734 |
| 6736 Representation field_representation() const { | 6735 Representation field_representation() const { |
| 6737 return access_.representation(); | 6736 return access_.representation(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 6753 } | 6752 } |
| 6754 return true; | 6753 return true; |
| 6755 } | 6754 } |
| 6756 | 6755 |
| 6757 private: | 6756 private: |
| 6758 HStoreNamedField(HValue* obj, | 6757 HStoreNamedField(HValue* obj, |
| 6759 HObjectAccess access, | 6758 HObjectAccess access, |
| 6760 HValue* val, | 6759 HValue* val, |
| 6761 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE) | 6760 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE) |
| 6762 : access_(access), | 6761 : access_(access), |
| 6763 new_space_dominator_(NULL), | 6762 dominator_(NULL), |
| 6764 has_transition_(false), | 6763 has_transition_(false), |
| 6765 store_mode_(store_mode) { | 6764 store_mode_(store_mode) { |
| 6766 // Stores to a non existing in-object property are allowed only to the | 6765 // Stores to a non existing in-object property are allowed only to the |
| 6767 // newly allocated objects (via HAllocate or HInnerAllocatedObject). | 6766 // newly allocated objects (via HAllocate or HInnerAllocatedObject). |
| 6768 ASSERT(!access.IsInobject() || access.existing_inobject_property() || | 6767 ASSERT(!access.IsInobject() || access.existing_inobject_property() || |
| 6769 obj->IsAllocate() || obj->IsInnerAllocatedObject()); | 6768 obj->IsAllocate() || obj->IsInnerAllocatedObject()); |
| 6770 SetOperandAt(0, obj); | 6769 SetOperandAt(0, obj); |
| 6771 SetOperandAt(1, val); | 6770 SetOperandAt(1, val); |
| 6772 SetOperandAt(2, obj); | 6771 SetOperandAt(2, obj); |
| 6773 access.SetGVNFlags(this, STORE); | 6772 access.SetGVNFlags(this, STORE); |
| 6774 } | 6773 } |
| 6775 | 6774 |
| 6776 HObjectAccess access_; | 6775 HObjectAccess access_; |
| 6777 HValue* new_space_dominator_; | 6776 HValue* dominator_; |
| 6778 bool has_transition_ : 1; | 6777 bool has_transition_ : 1; |
| 6779 StoreFieldOrKeyedMode store_mode_ : 1; | 6778 StoreFieldOrKeyedMode store_mode_ : 1; |
| 6780 }; | 6779 }; |
| 6781 | 6780 |
| 6782 | 6781 |
| 6783 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { | 6782 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { |
| 6784 public: | 6783 public: |
| 6785 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, | 6784 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, |
| 6786 Handle<String>, HValue*, | 6785 Handle<String>, HValue*, |
| 6787 StrictMode); | 6786 StrictMode); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6915 is_uninitialized_ = is_uninitialized; | 6914 is_uninitialized_ = is_uninitialized; |
| 6916 } | 6915 } |
| 6917 | 6916 |
| 6918 bool IsConstantHoleStore() { | 6917 bool IsConstantHoleStore() { |
| 6919 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); | 6918 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); |
| 6920 } | 6919 } |
| 6921 | 6920 |
| 6922 virtual bool HandleSideEffectDominator(GVNFlag side_effect, | 6921 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
| 6923 HValue* dominator) V8_OVERRIDE { | 6922 HValue* dominator) V8_OVERRIDE { |
| 6924 ASSERT(side_effect == kNewSpacePromotion); | 6923 ASSERT(side_effect == kNewSpacePromotion); |
| 6925 new_space_dominator_ = dominator; | 6924 dominator_ = dominator; |
| 6926 return false; | 6925 return false; |
| 6927 } | 6926 } |
| 6928 | 6927 |
| 6929 HValue* new_space_dominator() const { return new_space_dominator_; } | 6928 HValue* dominator() const { return dominator_; } |
| 6930 | 6929 |
| 6931 bool NeedsWriteBarrier() { | 6930 bool NeedsWriteBarrier() { |
| 6932 if (value_is_smi()) { | 6931 if (value_is_smi()) { |
| 6933 return false; | 6932 return false; |
| 6934 } else { | 6933 } else { |
| 6935 return StoringValueNeedsWriteBarrier(value()) && | 6934 return StoringValueNeedsWriteBarrier(value()) && |
| 6936 ReceiverObjectNeedsWriteBarrier(elements(), value(), | 6935 ReceiverObjectNeedsWriteBarrier(elements(), value(), dominator()); |
| 6937 new_space_dominator()); | |
| 6938 } | 6936 } |
| 6939 } | 6937 } |
| 6940 | 6938 |
| 6941 bool NeedsCanonicalization(); | 6939 bool NeedsCanonicalization(); |
| 6942 | 6940 |
| 6943 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6941 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 6944 | 6942 |
| 6945 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) | 6943 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) |
| 6946 | 6944 |
| 6947 private: | 6945 private: |
| 6948 HStoreKeyed(HValue* obj, HValue* key, HValue* val, | 6946 HStoreKeyed(HValue* obj, HValue* key, HValue* val, |
| 6949 ElementsKind elements_kind, | 6947 ElementsKind elements_kind, |
| 6950 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE, | 6948 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE, |
| 6951 int offset = kDefaultKeyedHeaderOffsetSentinel) | 6949 int offset = kDefaultKeyedHeaderOffsetSentinel) |
| 6952 : elements_kind_(elements_kind), | 6950 : elements_kind_(elements_kind), |
| 6953 base_offset_(offset == kDefaultKeyedHeaderOffsetSentinel | 6951 base_offset_(offset == kDefaultKeyedHeaderOffsetSentinel |
| 6954 ? GetDefaultHeaderSizeForElementsKind(elements_kind) | 6952 ? GetDefaultHeaderSizeForElementsKind(elements_kind) |
| 6955 : offset), | 6953 : offset), |
| 6956 is_dehoisted_(false), | 6954 is_dehoisted_(false), |
| 6957 is_uninitialized_(false), | 6955 is_uninitialized_(false), |
| 6958 store_mode_(store_mode), | 6956 store_mode_(store_mode), |
| 6959 new_space_dominator_(NULL) { | 6957 dominator_(NULL) { |
| 6960 SetOperandAt(0, obj); | 6958 SetOperandAt(0, obj); |
| 6961 SetOperandAt(1, key); | 6959 SetOperandAt(1, key); |
| 6962 SetOperandAt(2, val); | 6960 SetOperandAt(2, val); |
| 6963 | 6961 |
| 6964 ASSERT(store_mode != STORE_TO_INITIALIZED_ENTRY || | 6962 ASSERT(store_mode != STORE_TO_INITIALIZED_ENTRY || |
| 6965 elements_kind == FAST_SMI_ELEMENTS); | 6963 elements_kind == FAST_SMI_ELEMENTS); |
| 6966 | 6964 |
| 6967 if (IsFastObjectElementsKind(elements_kind)) { | 6965 if (IsFastObjectElementsKind(elements_kind)) { |
| 6968 SetFlag(kTrackSideEffectDominators); | 6966 SetFlag(kTrackSideEffectDominators); |
| 6969 SetDependsOnFlag(kNewSpacePromotion); | 6967 SetDependsOnFlag(kNewSpacePromotion); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 6989 elements_kind <= INT32_ELEMENTS)) { | 6987 elements_kind <= INT32_ELEMENTS)) { |
| 6990 SetFlag(kTruncatingToInt32); | 6988 SetFlag(kTruncatingToInt32); |
| 6991 } | 6989 } |
| 6992 } | 6990 } |
| 6993 | 6991 |
| 6994 ElementsKind elements_kind_; | 6992 ElementsKind elements_kind_; |
| 6995 uint32_t base_offset_; | 6993 uint32_t base_offset_; |
| 6996 bool is_dehoisted_ : 1; | 6994 bool is_dehoisted_ : 1; |
| 6997 bool is_uninitialized_ : 1; | 6995 bool is_uninitialized_ : 1; |
| 6998 StoreFieldOrKeyedMode store_mode_: 1; | 6996 StoreFieldOrKeyedMode store_mode_: 1; |
| 6999 HValue* new_space_dominator_; | 6997 HValue* dominator_; |
| 7000 }; | 6998 }; |
| 7001 | 6999 |
| 7002 | 7000 |
| 7003 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { | 7001 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { |
| 7004 public: | 7002 public: |
| 7005 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, | 7003 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, |
| 7006 HValue*, HValue*, StrictMode); | 7004 HValue*, HValue*, StrictMode); |
| 7007 | 7005 |
| 7008 HValue* object() { return OperandAt(0); } | 7006 HValue* object() { return OperandAt(0); } |
| 7009 HValue* key() { return OperandAt(1); } | 7007 HValue* key() { return OperandAt(1); } |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7681 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7679 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7682 }; | 7680 }; |
| 7683 | 7681 |
| 7684 | 7682 |
| 7685 #undef DECLARE_INSTRUCTION | 7683 #undef DECLARE_INSTRUCTION |
| 7686 #undef DECLARE_CONCRETE_INSTRUCTION | 7684 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7687 | 7685 |
| 7688 } } // namespace v8::internal | 7686 } } // namespace v8::internal |
| 7689 | 7687 |
| 7690 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7688 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |