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 6888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6899 // kind_external: external[int32] = (double | int32) | 6899 // kind_external: external[int32] = (double | int32) |
6900 if (index == 0) { | 6900 if (index == 0) { |
6901 return is_external() ? Representation::External() | 6901 return is_external() ? Representation::External() |
6902 : Representation::Tagged(); | 6902 : Representation::Tagged(); |
6903 } else if (index == 1) { | 6903 } else if (index == 1) { |
6904 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 6904 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
6905 OperandAt(1)->representation()); | 6905 OperandAt(1)->representation()); |
6906 } | 6906 } |
6907 | 6907 |
6908 ASSERT_EQ(index, 2); | 6908 ASSERT_EQ(index, 2); |
6909 if (IsDoubleOrFloatElementsKind(elements_kind())) { | 6909 return RequiredValueRepresentation(elements_kind_, store_mode_); |
| 6910 } |
| 6911 |
| 6912 static Representation RequiredValueRepresentation( |
| 6913 ElementsKind kind, StoreFieldOrKeyedMode mode) { |
| 6914 if (IsDoubleOrFloatElementsKind(kind)) { |
6910 return Representation::Double(); | 6915 return Representation::Double(); |
6911 } | 6916 } |
6912 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) { | 6917 |
| 6918 if (kind == FAST_SMI_ELEMENTS && SmiValuesAre32Bits() && |
| 6919 mode == STORE_TO_INITIALIZED_ENTRY) { |
6913 return Representation::Integer32(); | 6920 return Representation::Integer32(); |
6914 } | 6921 } |
6915 if (IsFastSmiElementsKind(elements_kind())) { | 6922 |
| 6923 if (IsFastSmiElementsKind(kind)) { |
6916 return Representation::Smi(); | 6924 return Representation::Smi(); |
6917 } | 6925 } |
6918 | 6926 |
6919 return is_external() || is_fixed_typed_array() | 6927 return IsExternalArrayElementsKind(kind) || |
6920 ? Representation::Integer32() | 6928 IsFixedTypedArrayElementsKind(kind) |
6921 : Representation::Tagged(); | 6929 ? Representation::Integer32() |
| 6930 : Representation::Tagged(); |
6922 } | 6931 } |
6923 | 6932 |
6924 bool is_external() const { | 6933 bool is_external() const { |
6925 return IsExternalArrayElementsKind(elements_kind()); | 6934 return IsExternalArrayElementsKind(elements_kind()); |
6926 } | 6935 } |
6927 | 6936 |
6928 bool is_fixed_typed_array() const { | 6937 bool is_fixed_typed_array() const { |
6929 return IsFixedTypedArrayElementsKind(elements_kind()); | 6938 return IsFixedTypedArrayElementsKind(elements_kind()); |
6930 } | 6939 } |
6931 | 6940 |
6932 bool is_typed_elements() const { | 6941 bool is_typed_elements() const { |
6933 return is_external() || is_fixed_typed_array(); | 6942 return is_external() || is_fixed_typed_array(); |
6934 } | 6943 } |
6935 | 6944 |
6936 virtual Representation observed_input_representation(int index) V8_OVERRIDE { | 6945 virtual Representation observed_input_representation(int index) V8_OVERRIDE { |
6937 if (index < 2) return RequiredInputRepresentation(index); | 6946 if (index < 2) return RequiredInputRepresentation(index); |
6938 if (IsUninitialized()) { | 6947 if (IsUninitialized()) { |
6939 return Representation::None(); | 6948 return Representation::None(); |
6940 } | 6949 } |
6941 if (IsDoubleOrFloatElementsKind(elements_kind())) { | 6950 Representation r = RequiredValueRepresentation(elements_kind_, store_mode_); |
6942 return Representation::Double(); | |
6943 } | |
6944 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) { | |
6945 return Representation::Integer32(); | |
6946 } | |
6947 if (IsFastSmiElementsKind(elements_kind())) { | |
6948 return Representation::Smi(); | |
6949 } | |
6950 if (is_typed_elements()) { | |
6951 return Representation::Integer32(); | |
6952 } | |
6953 // For fast object elements kinds, don't assume anything. | 6951 // For fast object elements kinds, don't assume anything. |
6954 return Representation::None(); | 6952 if (r.IsTagged()) return Representation::None(); |
| 6953 return r; |
6955 } | 6954 } |
6956 | 6955 |
6957 HValue* elements() const { return OperandAt(0); } | 6956 HValue* elements() const { return OperandAt(0); } |
6958 HValue* key() const { return OperandAt(1); } | 6957 HValue* key() const { return OperandAt(1); } |
6959 HValue* value() const { return OperandAt(2); } | 6958 HValue* value() const { return OperandAt(2); } |
6960 bool value_is_smi() const { | 6959 bool value_is_smi() const { |
6961 return IsFastSmiElementsKind(elements_kind_); | 6960 return IsFastSmiElementsKind(elements_kind_); |
6962 } | 6961 } |
6963 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } | 6962 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } |
6964 ElementsKind elements_kind() const { return elements_kind_; } | 6963 ElementsKind elements_kind() const { return elements_kind_; } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7024 ? GetDefaultHeaderSizeForElementsKind(elements_kind) | 7023 ? GetDefaultHeaderSizeForElementsKind(elements_kind) |
7025 : offset), | 7024 : offset), |
7026 is_dehoisted_(false), | 7025 is_dehoisted_(false), |
7027 is_uninitialized_(false), | 7026 is_uninitialized_(false), |
7028 store_mode_(store_mode), | 7027 store_mode_(store_mode), |
7029 dominator_(NULL) { | 7028 dominator_(NULL) { |
7030 SetOperandAt(0, obj); | 7029 SetOperandAt(0, obj); |
7031 SetOperandAt(1, key); | 7030 SetOperandAt(1, key); |
7032 SetOperandAt(2, val); | 7031 SetOperandAt(2, val); |
7033 | 7032 |
7034 ASSERT(store_mode != STORE_TO_INITIALIZED_ENTRY || | |
7035 elements_kind == FAST_SMI_ELEMENTS); | |
7036 | |
7037 if (IsFastObjectElementsKind(elements_kind)) { | 7033 if (IsFastObjectElementsKind(elements_kind)) { |
7038 SetFlag(kTrackSideEffectDominators); | 7034 SetFlag(kTrackSideEffectDominators); |
7039 SetDependsOnFlag(kNewSpacePromotion); | 7035 SetDependsOnFlag(kNewSpacePromotion); |
7040 } | 7036 } |
7041 if (is_external()) { | 7037 if (is_external()) { |
7042 SetChangesFlag(kExternalMemory); | 7038 SetChangesFlag(kExternalMemory); |
7043 SetFlag(kAllowUndefinedAsNaN); | 7039 SetFlag(kAllowUndefinedAsNaN); |
7044 } else if (IsFastDoubleElementsKind(elements_kind)) { | 7040 } else if (IsFastDoubleElementsKind(elements_kind)) { |
7045 SetChangesFlag(kDoubleArrayElements); | 7041 SetChangesFlag(kDoubleArrayElements); |
7046 } else if (IsFastSmiElementsKind(elements_kind)) { | 7042 } else if (IsFastSmiElementsKind(elements_kind)) { |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7802 }; | 7798 }; |
7803 | 7799 |
7804 | 7800 |
7805 | 7801 |
7806 #undef DECLARE_INSTRUCTION | 7802 #undef DECLARE_INSTRUCTION |
7807 #undef DECLARE_CONCRETE_INSTRUCTION | 7803 #undef DECLARE_CONCRETE_INSTRUCTION |
7808 | 7804 |
7809 } } // namespace v8::internal | 7805 } } // namespace v8::internal |
7810 | 7806 |
7811 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7807 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |