| 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 6748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6759 // kind_external: external[int32] = (double | int32) | 6759 // kind_external: external[int32] = (double | int32) |
| 6760 if (index == 0) { | 6760 if (index == 0) { |
| 6761 return is_external() ? Representation::External() | 6761 return is_external() ? Representation::External() |
| 6762 : Representation::Tagged(); | 6762 : Representation::Tagged(); |
| 6763 } else if (index == 1) { | 6763 } else if (index == 1) { |
| 6764 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 6764 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
| 6765 OperandAt(1)->representation()); | 6765 OperandAt(1)->representation()); |
| 6766 } | 6766 } |
| 6767 | 6767 |
| 6768 ASSERT_EQ(index, 2); | 6768 ASSERT_EQ(index, 2); |
| 6769 if (IsDoubleOrFloatElementsKind(elements_kind())) { | 6769 return RequiredValueRepresentation(elements_kind_, store_mode_); |
| 6770 } |
| 6771 |
| 6772 static Representation RequiredValueRepresentation( |
| 6773 ElementsKind kind, StoreFieldOrKeyedMode mode) { |
| 6774 if (IsDoubleOrFloatElementsKind(kind)) { |
| 6770 return Representation::Double(); | 6775 return Representation::Double(); |
| 6771 } | 6776 } |
| 6772 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) { | 6777 |
| 6778 if (kind == FAST_SMI_ELEMENTS && SmiValuesAre32Bits() && |
| 6779 mode == STORE_TO_INITIALIZED_ENTRY) { |
| 6773 return Representation::Integer32(); | 6780 return Representation::Integer32(); |
| 6774 } | 6781 } |
| 6775 if (IsFastSmiElementsKind(elements_kind())) { | 6782 |
| 6783 if (IsFastSmiElementsKind(kind)) { |
| 6776 return Representation::Smi(); | 6784 return Representation::Smi(); |
| 6777 } | 6785 } |
| 6778 | 6786 |
| 6779 return is_external() || is_fixed_typed_array() | 6787 return IsExternalArrayElementsKind(kind) || |
| 6780 ? Representation::Integer32() | 6788 IsFixedTypedArrayElementsKind(kind) |
| 6781 : Representation::Tagged(); | 6789 ? Representation::Integer32() |
| 6790 : Representation::Tagged(); |
| 6782 } | 6791 } |
| 6783 | 6792 |
| 6784 bool is_external() const { | 6793 bool is_external() const { |
| 6785 return IsExternalArrayElementsKind(elements_kind()); | 6794 return IsExternalArrayElementsKind(elements_kind()); |
| 6786 } | 6795 } |
| 6787 | 6796 |
| 6788 bool is_fixed_typed_array() const { | 6797 bool is_fixed_typed_array() const { |
| 6789 return IsFixedTypedArrayElementsKind(elements_kind()); | 6798 return IsFixedTypedArrayElementsKind(elements_kind()); |
| 6790 } | 6799 } |
| 6791 | 6800 |
| 6792 bool is_typed_elements() const { | 6801 bool is_typed_elements() const { |
| 6793 return is_external() || is_fixed_typed_array(); | 6802 return is_external() || is_fixed_typed_array(); |
| 6794 } | 6803 } |
| 6795 | 6804 |
| 6796 virtual Representation observed_input_representation(int index) V8_OVERRIDE { | 6805 virtual Representation observed_input_representation(int index) V8_OVERRIDE { |
| 6797 if (index < 2) return RequiredInputRepresentation(index); | 6806 if (index < 2) return RequiredInputRepresentation(index); |
| 6798 if (IsUninitialized()) { | 6807 if (IsUninitialized()) { |
| 6799 return Representation::None(); | 6808 return Representation::None(); |
| 6800 } | 6809 } |
| 6801 if (IsDoubleOrFloatElementsKind(elements_kind())) { | 6810 Representation r = RequiredValueRepresentation(elements_kind_, store_mode_); |
| 6802 return Representation::Double(); | 6811 if (r.IsTagged()) return Representation::None(); |
| 6803 } | 6812 return r; |
| 6804 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) { | |
| 6805 return Representation::Integer32(); | |
| 6806 } | |
| 6807 if (IsFastSmiElementsKind(elements_kind())) { | |
| 6808 return Representation::Smi(); | |
| 6809 } | |
| 6810 if (is_typed_elements()) { | |
| 6811 return Representation::Integer32(); | |
| 6812 } | |
| 6813 // For fast object elements kinds, don't assume anything. | |
| 6814 return Representation::None(); | |
| 6815 } | 6813 } |
| 6816 | 6814 |
| 6817 HValue* elements() { return OperandAt(0); } | 6815 HValue* elements() { return OperandAt(0); } |
| 6818 HValue* key() { return OperandAt(1); } | 6816 HValue* key() { return OperandAt(1); } |
| 6819 HValue* value() { return OperandAt(2); } | 6817 HValue* value() { return OperandAt(2); } |
| 6820 bool value_is_smi() const { | 6818 bool value_is_smi() const { |
| 6821 return IsFastSmiElementsKind(elements_kind_); | 6819 return IsFastSmiElementsKind(elements_kind_); |
| 6822 } | 6820 } |
| 6823 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } | 6821 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } |
| 6824 ElementsKind elements_kind() const { return elements_kind_; } | 6822 ElementsKind elements_kind() const { return elements_kind_; } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6872 : elements_kind_(elements_kind), | 6870 : elements_kind_(elements_kind), |
| 6873 index_offset_(0), | 6871 index_offset_(0), |
| 6874 is_dehoisted_(false), | 6872 is_dehoisted_(false), |
| 6875 is_uninitialized_(false), | 6873 is_uninitialized_(false), |
| 6876 store_mode_(store_mode), | 6874 store_mode_(store_mode), |
| 6877 new_space_dominator_(NULL) { | 6875 new_space_dominator_(NULL) { |
| 6878 SetOperandAt(0, obj); | 6876 SetOperandAt(0, obj); |
| 6879 SetOperandAt(1, key); | 6877 SetOperandAt(1, key); |
| 6880 SetOperandAt(2, val); | 6878 SetOperandAt(2, val); |
| 6881 | 6879 |
| 6882 ASSERT(store_mode != STORE_TO_INITIALIZED_ENTRY || | |
| 6883 elements_kind == FAST_SMI_ELEMENTS); | |
| 6884 | |
| 6885 if (IsFastObjectElementsKind(elements_kind)) { | 6880 if (IsFastObjectElementsKind(elements_kind)) { |
| 6886 SetFlag(kTrackSideEffectDominators); | 6881 SetFlag(kTrackSideEffectDominators); |
| 6887 SetDependsOnFlag(kNewSpacePromotion); | 6882 SetDependsOnFlag(kNewSpacePromotion); |
| 6888 } | 6883 } |
| 6889 if (is_external()) { | 6884 if (is_external()) { |
| 6890 SetChangesFlag(kExternalMemory); | 6885 SetChangesFlag(kExternalMemory); |
| 6891 SetFlag(kAllowUndefinedAsNaN); | 6886 SetFlag(kAllowUndefinedAsNaN); |
| 6892 } else if (IsFastDoubleElementsKind(elements_kind)) { | 6887 } else if (IsFastDoubleElementsKind(elements_kind)) { |
| 6893 SetChangesFlag(kDoubleArrayElements); | 6888 SetChangesFlag(kDoubleArrayElements); |
| 6894 } else if (IsFastSmiElementsKind(elements_kind)) { | 6889 } else if (IsFastSmiElementsKind(elements_kind)) { |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7590 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7585 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7591 }; | 7586 }; |
| 7592 | 7587 |
| 7593 | 7588 |
| 7594 #undef DECLARE_INSTRUCTION | 7589 #undef DECLARE_INSTRUCTION |
| 7595 #undef DECLARE_CONCRETE_INSTRUCTION | 7590 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7596 | 7591 |
| 7597 } } // namespace v8::internal | 7592 } } // namespace v8::internal |
| 7598 | 7593 |
| 7599 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7594 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |