OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 6675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6686 : Representation::Tagged(); | 6686 : Representation::Tagged(); |
6687 } else if (index == 1) { | 6687 } else if (index == 1) { |
6688 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 6688 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
6689 OperandAt(1)->representation()); | 6689 OperandAt(1)->representation()); |
6690 } | 6690 } |
6691 | 6691 |
6692 ASSERT_EQ(index, 2); | 6692 ASSERT_EQ(index, 2); |
6693 if (IsDoubleOrFloatElementsKind(elements_kind())) { | 6693 if (IsDoubleOrFloatElementsKind(elements_kind())) { |
6694 return Representation::Double(); | 6694 return Representation::Double(); |
6695 } | 6695 } |
6696 | 6696 if (SmiValuesAre32Bits() && IsFastPackedSmiElementsKind(elements_kind())) { |
| 6697 return Representation::Integer32(); |
| 6698 } |
6697 if (IsFastSmiElementsKind(elements_kind())) { | 6699 if (IsFastSmiElementsKind(elements_kind())) { |
6698 return Representation::Smi(); | 6700 return Representation::Smi(); |
6699 } | 6701 } |
6700 | 6702 |
6701 return is_external() ? Representation::Integer32() | 6703 return is_external() ? Representation::Integer32() |
6702 : Representation::Tagged(); | 6704 : Representation::Tagged(); |
6703 } | 6705 } |
6704 | 6706 |
6705 bool is_external() const { | 6707 bool is_external() const { |
6706 return IsExternalArrayElementsKind(elements_kind()); | 6708 return IsExternalArrayElementsKind(elements_kind()); |
6707 } | 6709 } |
6708 | 6710 |
6709 virtual Representation observed_input_representation(int index) V8_OVERRIDE { | 6711 virtual Representation observed_input_representation(int index) V8_OVERRIDE { |
6710 if (index < 2) return RequiredInputRepresentation(index); | 6712 if (index < 2) return RequiredInputRepresentation(index); |
6711 if (IsUninitialized()) { | 6713 if (IsUninitialized()) { |
6712 return Representation::None(); | 6714 return Representation::None(); |
6713 } | 6715 } |
| 6716 if (IsDoubleOrFloatElementsKind(elements_kind())) { |
| 6717 return Representation::Double(); |
| 6718 } |
| 6719 if (SmiValuesAre32Bits() && IsFastPackedSmiElementsKind(elements_kind())) { |
| 6720 return Representation::Integer32(); |
| 6721 } |
6714 if (IsFastSmiElementsKind(elements_kind())) { | 6722 if (IsFastSmiElementsKind(elements_kind())) { |
6715 return Representation::Smi(); | 6723 return Representation::Smi(); |
6716 } | 6724 } |
6717 if (IsDoubleOrFloatElementsKind(elements_kind())) { | |
6718 return Representation::Double(); | |
6719 } | |
6720 if (is_external()) { | 6725 if (is_external()) { |
6721 return Representation::Integer32(); | 6726 return Representation::Integer32(); |
6722 } | 6727 } |
6723 // For fast object elements kinds, don't assume anything. | 6728 // For fast object elements kinds, don't assume anything. |
6724 return Representation::None(); | 6729 return Representation::None(); |
6725 } | 6730 } |
6726 | 6731 |
6727 HValue* elements() { return OperandAt(0); } | 6732 HValue* elements() { return OperandAt(0); } |
6728 HValue* key() { return OperandAt(1); } | 6733 HValue* key() { return OperandAt(1); } |
6729 HValue* value() { return OperandAt(2); } | 6734 HValue* value() { return OperandAt(2); } |
6730 bool value_is_smi() const { | 6735 bool value_is_smi() const { |
6731 return IsFastSmiElementsKind(elements_kind_); | 6736 return IsFastSmiElementsKind(elements_kind_); |
6732 } | 6737 } |
| 6738 // Indicates whether this is a store to a item that was previously |
| 6739 // initialized. |
| 6740 bool store_to_initialized_element() const { |
| 6741 return store_to_initialized_element_; |
| 6742 } |
| 6743 void set_store_to_initialized_element(bool v) { |
| 6744 store_to_initialized_element_ = v; |
| 6745 } |
6733 ElementsKind elements_kind() const { return elements_kind_; } | 6746 ElementsKind elements_kind() const { return elements_kind_; } |
6734 uint32_t index_offset() { return index_offset_; } | 6747 uint32_t index_offset() { return index_offset_; } |
6735 void SetIndexOffset(uint32_t index_offset) { index_offset_ = index_offset; } | 6748 void SetIndexOffset(uint32_t index_offset) { index_offset_ = index_offset; } |
6736 virtual int MaxIndexOffsetBits() { | 6749 virtual int MaxIndexOffsetBits() { |
6737 return 31 - ElementsKindToShiftSize(elements_kind_); | 6750 return 31 - ElementsKindToShiftSize(elements_kind_); |
6738 } | 6751 } |
6739 HValue* GetKey() { return key(); } | 6752 HValue* GetKey() { return key(); } |
6740 void SetKey(HValue* key) { SetOperandAt(1, key); } | 6753 void SetKey(HValue* key) { SetOperandAt(1, key); } |
6741 bool IsDehoisted() { return is_dehoisted_; } | 6754 bool IsDehoisted() { return is_dehoisted_; } |
6742 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } | 6755 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } |
(...skipping 30 matching lines...) Expand all Loading... |
6773 | 6786 |
6774 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) | 6787 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) |
6775 | 6788 |
6776 private: | 6789 private: |
6777 HStoreKeyed(HValue* obj, HValue* key, HValue* val, | 6790 HStoreKeyed(HValue* obj, HValue* key, HValue* val, |
6778 ElementsKind elements_kind) | 6791 ElementsKind elements_kind) |
6779 : elements_kind_(elements_kind), | 6792 : elements_kind_(elements_kind), |
6780 index_offset_(0), | 6793 index_offset_(0), |
6781 is_dehoisted_(false), | 6794 is_dehoisted_(false), |
6782 is_uninitialized_(false), | 6795 is_uninitialized_(false), |
| 6796 store_to_initialized_element_(false), |
6783 new_space_dominator_(NULL) { | 6797 new_space_dominator_(NULL) { |
6784 SetOperandAt(0, obj); | 6798 SetOperandAt(0, obj); |
6785 SetOperandAt(1, key); | 6799 SetOperandAt(1, key); |
6786 SetOperandAt(2, val); | 6800 SetOperandAt(2, val); |
6787 | 6801 |
6788 if (IsFastObjectElementsKind(elements_kind)) { | 6802 if (IsFastObjectElementsKind(elements_kind)) { |
6789 SetFlag(kTrackSideEffectDominators); | 6803 SetFlag(kTrackSideEffectDominators); |
6790 SetGVNFlag(kDependsOnNewSpacePromotion); | 6804 SetGVNFlag(kDependsOnNewSpacePromotion); |
6791 } | 6805 } |
6792 if (is_external()) { | 6806 if (is_external()) { |
(...skipping 11 matching lines...) Expand all Loading... |
6804 if (elements_kind >= EXTERNAL_BYTE_ELEMENTS && | 6818 if (elements_kind >= EXTERNAL_BYTE_ELEMENTS && |
6805 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) { | 6819 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) { |
6806 SetFlag(kTruncatingToInt32); | 6820 SetFlag(kTruncatingToInt32); |
6807 } | 6821 } |
6808 } | 6822 } |
6809 | 6823 |
6810 ElementsKind elements_kind_; | 6824 ElementsKind elements_kind_; |
6811 uint32_t index_offset_; | 6825 uint32_t index_offset_; |
6812 bool is_dehoisted_ : 1; | 6826 bool is_dehoisted_ : 1; |
6813 bool is_uninitialized_ : 1; | 6827 bool is_uninitialized_ : 1; |
| 6828 bool store_to_initialized_element_: 1; |
6814 HValue* new_space_dominator_; | 6829 HValue* new_space_dominator_; |
6815 }; | 6830 }; |
6816 | 6831 |
6817 | 6832 |
6818 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { | 6833 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { |
6819 public: | 6834 public: |
6820 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, | 6835 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, |
6821 HValue*, HValue*, StrictModeFlag); | 6836 HValue*, HValue*, StrictModeFlag); |
6822 | 6837 |
6823 HValue* object() { return OperandAt(0); } | 6838 HValue* object() { return OperandAt(0); } |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7493 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7508 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7494 }; | 7509 }; |
7495 | 7510 |
7496 | 7511 |
7497 #undef DECLARE_INSTRUCTION | 7512 #undef DECLARE_INSTRUCTION |
7498 #undef DECLARE_CONCRETE_INSTRUCTION | 7513 #undef DECLARE_CONCRETE_INSTRUCTION |
7499 | 7514 |
7500 } } // namespace v8::internal | 7515 } } // namespace v8::internal |
7501 | 7516 |
7502 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7517 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |