| 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 6638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6649 // initialized or not. | 6649 // initialized or not. |
| 6650 enum StoreFieldOrKeyedMode { | 6650 enum StoreFieldOrKeyedMode { |
| 6651 // The entry could be either previously initialized or not. | 6651 // The entry could be either previously initialized or not. |
| 6652 INITIALIZING_STORE, | 6652 INITIALIZING_STORE, |
| 6653 // At the time of this store it is guaranteed that the entry is already | 6653 // At the time of this store it is guaranteed that the entry is already |
| 6654 // initialized. | 6654 // initialized. |
| 6655 STORE_TO_INITIALIZED_ENTRY | 6655 STORE_TO_INITIALIZED_ENTRY |
| 6656 }; | 6656 }; |
| 6657 | 6657 |
| 6658 | 6658 |
| 6659 class HStoreNamedField V8_FINAL : public HTemplateInstruction<2> { | 6659 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> { |
| 6660 public: | 6660 public: |
| 6661 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, | 6661 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, |
| 6662 HObjectAccess, HValue*); | 6662 HObjectAccess, HValue*); |
| 6663 DECLARE_INSTRUCTION_FACTORY_P4(HStoreNamedField, HValue*, | 6663 DECLARE_INSTRUCTION_FACTORY_P4(HStoreNamedField, HValue*, |
| 6664 HObjectAccess, HValue*, StoreFieldOrKeyedMode); | 6664 HObjectAccess, HValue*, StoreFieldOrKeyedMode); |
| 6665 | 6665 |
| 6666 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) | 6666 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) |
| 6667 | 6667 |
| 6668 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { | 6668 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { |
| 6669 return index == 1; | 6669 return index == 1; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 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 HValue* object() const { return OperandAt(0); } | 6707 HValue* object() const { return OperandAt(0); } |
| 6708 HValue* value() const { return OperandAt(1); } | 6708 HValue* value() const { return OperandAt(1); } |
| 6709 HValue* transition() const { return OperandAt(2); } |
| 6709 | 6710 |
| 6710 HObjectAccess access() const { return access_; } | 6711 HObjectAccess access() const { return access_; } |
| 6711 HValue* new_space_dominator() const { return new_space_dominator_; } | 6712 HValue* new_space_dominator() const { return new_space_dominator_; } |
| 6713 bool has_transition() const { return has_transition_; } |
| 6712 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } | 6714 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } |
| 6713 | 6715 |
| 6716 Handle<Map> transition_map() const { |
| 6717 if (has_transition()) { |
| 6718 return Handle<Map>::cast( |
| 6719 HConstant::cast(transition())->handle(Isolate::Current())); |
| 6720 } else { |
| 6721 return Handle<Map>(); |
| 6722 } |
| 6723 } |
| 6724 |
| 6725 void SetTransition(HConstant* transition) { |
| 6726 ASSERT(!has_transition()); // Only set once. |
| 6727 SetOperandAt(2, transition); |
| 6728 has_transition_ = true; |
| 6729 } |
| 6730 |
| 6714 bool NeedsWriteBarrier() { | 6731 bool NeedsWriteBarrier() { |
| 6732 ASSERT(!field_representation().IsDouble() || !has_transition()); |
| 6715 if (field_representation().IsDouble()) return false; | 6733 if (field_representation().IsDouble()) return false; |
| 6716 if (field_representation().IsSmi()) return false; | 6734 if (field_representation().IsSmi()) return false; |
| 6717 if (field_representation().IsInteger32()) return false; | 6735 if (field_representation().IsInteger32()) return false; |
| 6718 if (field_representation().IsExternal()) return false; | 6736 if (field_representation().IsExternal()) return false; |
| 6719 return StoringValueNeedsWriteBarrier(value()) && | 6737 return StoringValueNeedsWriteBarrier(value()) && |
| 6720 ReceiverObjectNeedsWriteBarrier(object(), value(), | 6738 ReceiverObjectNeedsWriteBarrier(object(), value(), |
| 6721 new_space_dominator()); | 6739 new_space_dominator()); |
| 6722 } | 6740 } |
| 6723 | 6741 |
| 6742 bool NeedsWriteBarrierForMap() { |
| 6743 return ReceiverObjectNeedsWriteBarrier(object(), transition(), |
| 6744 new_space_dominator()); |
| 6745 } |
| 6746 |
| 6724 Representation field_representation() const { | 6747 Representation field_representation() const { |
| 6725 return access_.representation(); | 6748 return access_.representation(); |
| 6726 } | 6749 } |
| 6727 | 6750 |
| 6728 void UpdateValue(HValue* value) { | 6751 void UpdateValue(HValue* value) { |
| 6729 SetOperandAt(1, value); | 6752 SetOperandAt(1, value); |
| 6730 } | 6753 } |
| 6731 | 6754 |
| 6732 private: | 6755 private: |
| 6733 HStoreNamedField(HValue* obj, | 6756 HStoreNamedField(HValue* obj, |
| 6734 HObjectAccess access, | 6757 HObjectAccess access, |
| 6735 HValue* val, | 6758 HValue* val, |
| 6736 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE) | 6759 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE) |
| 6737 : access_(access), | 6760 : access_(access), |
| 6738 new_space_dominator_(NULL), | 6761 new_space_dominator_(NULL), |
| 6762 has_transition_(false), |
| 6739 store_mode_(store_mode) { | 6763 store_mode_(store_mode) { |
| 6740 // Stores to a non existing in-object property are allowed only to the | 6764 // Stores to a non existing in-object property are allowed only to the |
| 6741 // newly allocated objects (via HAllocate or HInnerAllocatedObject). | 6765 // newly allocated objects (via HAllocate or HInnerAllocatedObject). |
| 6742 ASSERT(!access.IsInobject() || access.existing_inobject_property() || | 6766 ASSERT(!access.IsInobject() || access.existing_inobject_property() || |
| 6743 obj->IsAllocate() || obj->IsInnerAllocatedObject()); | 6767 obj->IsAllocate() || obj->IsInnerAllocatedObject()); |
| 6744 SetOperandAt(0, obj); | 6768 SetOperandAt(0, obj); |
| 6745 SetOperandAt(1, val); | 6769 SetOperandAt(1, val); |
| 6770 SetOperandAt(2, obj); |
| 6746 access.SetGVNFlags(this, STORE); | 6771 access.SetGVNFlags(this, STORE); |
| 6747 } | 6772 } |
| 6748 | 6773 |
| 6749 HObjectAccess access_; | 6774 HObjectAccess access_; |
| 6750 HValue* new_space_dominator_; | 6775 HValue* new_space_dominator_; |
| 6776 bool has_transition_ : 1; |
| 6751 StoreFieldOrKeyedMode store_mode_ : 1; | 6777 StoreFieldOrKeyedMode store_mode_ : 1; |
| 6752 }; | 6778 }; |
| 6753 | 6779 |
| 6754 | 6780 |
| 6755 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { | 6781 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { |
| 6756 public: | 6782 public: |
| 6757 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, | 6783 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, |
| 6758 Handle<String>, HValue*, | 6784 Handle<String>, HValue*, |
| 6759 StrictMode); | 6785 StrictMode); |
| 6760 HValue* object() { return OperandAt(0); } | 6786 HValue* object() { return OperandAt(0); } |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7684 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7710 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7685 }; | 7711 }; |
| 7686 | 7712 |
| 7687 | 7713 |
| 7688 #undef DECLARE_INSTRUCTION | 7714 #undef DECLARE_INSTRUCTION |
| 7689 #undef DECLARE_CONCRETE_INSTRUCTION | 7715 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7690 | 7716 |
| 7691 } } // namespace v8::internal | 7717 } } // namespace v8::internal |
| 7692 | 7718 |
| 7693 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7719 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |