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 6666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6677 Handle<String> name_; | 6677 Handle<String> name_; |
6678 StrictModeFlag strict_mode_flag_; | 6678 StrictModeFlag strict_mode_flag_; |
6679 }; | 6679 }; |
6680 | 6680 |
6681 | 6681 |
6682 class HStoreKeyed V8_FINAL | 6682 class HStoreKeyed V8_FINAL |
6683 : public HTemplateInstruction<3>, public ArrayInstructionInterface { | 6683 : public HTemplateInstruction<3>, public ArrayInstructionInterface { |
6684 public: | 6684 public: |
6685 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, | 6685 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, |
6686 ElementsKind); | 6686 ElementsKind); |
| 6687 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*, |
| 6688 ElementsKind, StoreFieldOrKeyedMode); |
6687 | 6689 |
6688 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6690 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
6689 // kind_fast: tagged[int32] = tagged | 6691 // kind_fast: tagged[int32] = tagged |
6690 // kind_double: tagged[int32] = double | 6692 // kind_double: tagged[int32] = double |
6691 // kind_smi : tagged[int32] = smi | 6693 // kind_smi : tagged[int32] = smi |
6692 // kind_external: external[int32] = (double | int32) | 6694 // kind_external: external[int32] = (double | int32) |
6693 if (index == 0) { | 6695 if (index == 0) { |
6694 return is_external() ? Representation::External() | 6696 return is_external() ? Representation::External() |
6695 : Representation::Tagged(); | 6697 : Representation::Tagged(); |
6696 } else if (index == 1) { | 6698 } else if (index == 1) { |
6697 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 6699 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
6698 OperandAt(1)->representation()); | 6700 OperandAt(1)->representation()); |
6699 } | 6701 } |
6700 | 6702 |
6701 ASSERT_EQ(index, 2); | 6703 ASSERT_EQ(index, 2); |
6702 if (IsDoubleOrFloatElementsKind(elements_kind())) { | 6704 if (IsDoubleOrFloatElementsKind(elements_kind())) { |
6703 return Representation::Double(); | 6705 return Representation::Double(); |
6704 } | 6706 } |
6705 | 6707 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) { |
| 6708 return Representation::Integer32(); |
| 6709 } |
6706 if (IsFastSmiElementsKind(elements_kind())) { | 6710 if (IsFastSmiElementsKind(elements_kind())) { |
6707 return Representation::Smi(); | 6711 return Representation::Smi(); |
6708 } | 6712 } |
6709 | 6713 |
6710 return is_external() ? Representation::Integer32() | 6714 return is_external() ? Representation::Integer32() |
6711 : Representation::Tagged(); | 6715 : Representation::Tagged(); |
6712 } | 6716 } |
6713 | 6717 |
6714 bool is_external() const { | 6718 bool is_external() const { |
6715 return IsExternalArrayElementsKind(elements_kind()); | 6719 return IsExternalArrayElementsKind(elements_kind()); |
6716 } | 6720 } |
6717 | 6721 |
6718 virtual Representation observed_input_representation(int index) V8_OVERRIDE { | 6722 virtual Representation observed_input_representation(int index) V8_OVERRIDE { |
6719 if (index < 2) return RequiredInputRepresentation(index); | 6723 if (index < 2) return RequiredInputRepresentation(index); |
6720 if (IsUninitialized()) { | 6724 if (IsUninitialized()) { |
6721 return Representation::None(); | 6725 return Representation::None(); |
6722 } | 6726 } |
| 6727 if (IsDoubleOrFloatElementsKind(elements_kind())) { |
| 6728 return Representation::Double(); |
| 6729 } |
| 6730 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) { |
| 6731 return Representation::Integer32(); |
| 6732 } |
6723 if (IsFastSmiElementsKind(elements_kind())) { | 6733 if (IsFastSmiElementsKind(elements_kind())) { |
6724 return Representation::Smi(); | 6734 return Representation::Smi(); |
6725 } | 6735 } |
6726 if (IsDoubleOrFloatElementsKind(elements_kind())) { | |
6727 return Representation::Double(); | |
6728 } | |
6729 if (is_external()) { | 6736 if (is_external()) { |
6730 return Representation::Integer32(); | 6737 return Representation::Integer32(); |
6731 } | 6738 } |
6732 // For fast object elements kinds, don't assume anything. | 6739 // For fast object elements kinds, don't assume anything. |
6733 return Representation::None(); | 6740 return Representation::None(); |
6734 } | 6741 } |
6735 | 6742 |
6736 HValue* elements() { return OperandAt(0); } | 6743 HValue* elements() { return OperandAt(0); } |
6737 HValue* key() { return OperandAt(1); } | 6744 HValue* key() { return OperandAt(1); } |
6738 HValue* value() { return OperandAt(2); } | 6745 HValue* value() { return OperandAt(2); } |
6739 bool value_is_smi() const { | 6746 bool value_is_smi() const { |
6740 return IsFastSmiElementsKind(elements_kind_); | 6747 return IsFastSmiElementsKind(elements_kind_); |
6741 } | 6748 } |
| 6749 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } |
6742 ElementsKind elements_kind() const { return elements_kind_; } | 6750 ElementsKind elements_kind() const { return elements_kind_; } |
6743 uint32_t index_offset() { return index_offset_; } | 6751 uint32_t index_offset() { return index_offset_; } |
6744 void SetIndexOffset(uint32_t index_offset) { index_offset_ = index_offset; } | 6752 void SetIndexOffset(uint32_t index_offset) { index_offset_ = index_offset; } |
6745 virtual int MaxIndexOffsetBits() { | 6753 virtual int MaxIndexOffsetBits() { |
6746 return 31 - ElementsKindToShiftSize(elements_kind_); | 6754 return 31 - ElementsKindToShiftSize(elements_kind_); |
6747 } | 6755 } |
6748 HValue* GetKey() { return key(); } | 6756 HValue* GetKey() { return key(); } |
6749 void SetKey(HValue* key) { SetOperandAt(1, key); } | 6757 void SetKey(HValue* key) { SetOperandAt(1, key); } |
6750 bool IsDehoisted() { return is_dehoisted_; } | 6758 bool IsDehoisted() { return is_dehoisted_; } |
6751 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } | 6759 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } |
(...skipping 25 matching lines...) Expand all Loading... |
6777 } | 6785 } |
6778 | 6786 |
6779 bool NeedsCanonicalization(); | 6787 bool NeedsCanonicalization(); |
6780 | 6788 |
6781 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6789 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
6782 | 6790 |
6783 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) | 6791 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) |
6784 | 6792 |
6785 private: | 6793 private: |
6786 HStoreKeyed(HValue* obj, HValue* key, HValue* val, | 6794 HStoreKeyed(HValue* obj, HValue* key, HValue* val, |
6787 ElementsKind elements_kind) | 6795 ElementsKind elements_kind, |
| 6796 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE) |
6788 : elements_kind_(elements_kind), | 6797 : elements_kind_(elements_kind), |
6789 index_offset_(0), | 6798 index_offset_(0), |
6790 is_dehoisted_(false), | 6799 is_dehoisted_(false), |
6791 is_uninitialized_(false), | 6800 is_uninitialized_(false), |
| 6801 store_mode_(store_mode), |
6792 new_space_dominator_(NULL) { | 6802 new_space_dominator_(NULL) { |
6793 SetOperandAt(0, obj); | 6803 SetOperandAt(0, obj); |
6794 SetOperandAt(1, key); | 6804 SetOperandAt(1, key); |
6795 SetOperandAt(2, val); | 6805 SetOperandAt(2, val); |
6796 | 6806 |
| 6807 ASSERT(store_mode != STORE_TO_INITIALIZED_ENTRY || |
| 6808 elements_kind == FAST_SMI_ELEMENTS); |
| 6809 |
6797 if (IsFastObjectElementsKind(elements_kind)) { | 6810 if (IsFastObjectElementsKind(elements_kind)) { |
6798 SetFlag(kTrackSideEffectDominators); | 6811 SetFlag(kTrackSideEffectDominators); |
6799 SetGVNFlag(kDependsOnNewSpacePromotion); | 6812 SetGVNFlag(kDependsOnNewSpacePromotion); |
6800 } | 6813 } |
6801 if (is_external()) { | 6814 if (is_external()) { |
6802 SetGVNFlag(kChangesExternalMemory); | 6815 SetGVNFlag(kChangesExternalMemory); |
6803 SetFlag(kAllowUndefinedAsNaN); | 6816 SetFlag(kAllowUndefinedAsNaN); |
6804 } else if (IsFastDoubleElementsKind(elements_kind)) { | 6817 } else if (IsFastDoubleElementsKind(elements_kind)) { |
6805 SetGVNFlag(kChangesDoubleArrayElements); | 6818 SetGVNFlag(kChangesDoubleArrayElements); |
6806 } else if (IsFastSmiElementsKind(elements_kind)) { | 6819 } else if (IsFastSmiElementsKind(elements_kind)) { |
6807 SetGVNFlag(kChangesArrayElements); | 6820 SetGVNFlag(kChangesArrayElements); |
6808 } else { | 6821 } else { |
6809 SetGVNFlag(kChangesArrayElements); | 6822 SetGVNFlag(kChangesArrayElements); |
6810 } | 6823 } |
6811 | 6824 |
6812 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. | 6825 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. |
6813 if (elements_kind >= EXTERNAL_BYTE_ELEMENTS && | 6826 if (elements_kind >= EXTERNAL_BYTE_ELEMENTS && |
6814 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) { | 6827 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) { |
6815 SetFlag(kTruncatingToInt32); | 6828 SetFlag(kTruncatingToInt32); |
6816 } | 6829 } |
6817 } | 6830 } |
6818 | 6831 |
6819 ElementsKind elements_kind_; | 6832 ElementsKind elements_kind_; |
6820 uint32_t index_offset_; | 6833 uint32_t index_offset_; |
6821 bool is_dehoisted_ : 1; | 6834 bool is_dehoisted_ : 1; |
6822 bool is_uninitialized_ : 1; | 6835 bool is_uninitialized_ : 1; |
| 6836 StoreFieldOrKeyedMode store_mode_: 1; |
6823 HValue* new_space_dominator_; | 6837 HValue* new_space_dominator_; |
6824 }; | 6838 }; |
6825 | 6839 |
6826 | 6840 |
6827 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { | 6841 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { |
6828 public: | 6842 public: |
6829 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, | 6843 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, |
6830 HValue*, HValue*, StrictModeFlag); | 6844 HValue*, HValue*, StrictModeFlag); |
6831 | 6845 |
6832 HValue* object() { return OperandAt(0); } | 6846 HValue* object() { return OperandAt(0); } |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7502 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7516 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7503 }; | 7517 }; |
7504 | 7518 |
7505 | 7519 |
7506 #undef DECLARE_INSTRUCTION | 7520 #undef DECLARE_INSTRUCTION |
7507 #undef DECLARE_CONCRETE_INSTRUCTION | 7521 #undef DECLARE_CONCRETE_INSTRUCTION |
7508 | 7522 |
7509 } } // namespace v8::internal | 7523 } } // namespace v8::internal |
7510 | 7524 |
7511 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7525 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |