| 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 <cstring> | 8 #include <cstring> |
| 9 #include <iosfwd> | 9 #include <iosfwd> |
| 10 | 10 |
| (...skipping 4877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4888 Representation RequiredInputRepresentation(int index) override; | 4888 Representation RequiredInputRepresentation(int index) override; |
| 4889 | 4889 |
| 4890 bool IsConsistentExternalRepresentation() { | 4890 bool IsConsistentExternalRepresentation() { |
| 4891 return left()->representation().IsExternal() && | 4891 return left()->representation().IsExternal() && |
| 4892 ((external_add_type_ == AddOfExternalAndInt32 && | 4892 ((external_add_type_ == AddOfExternalAndInt32 && |
| 4893 right()->representation().IsInteger32()) || | 4893 right()->representation().IsInteger32()) || |
| 4894 (external_add_type_ == AddOfExternalAndTagged && | 4894 (external_add_type_ == AddOfExternalAndTagged && |
| 4895 right()->representation().IsTagged())); | 4895 right()->representation().IsTagged())); |
| 4896 } | 4896 } |
| 4897 | 4897 |
| 4898 ExternalAddType external_add_type() const { return external_add_type_; } |
| 4899 |
| 4898 DECLARE_CONCRETE_INSTRUCTION(Add) | 4900 DECLARE_CONCRETE_INSTRUCTION(Add) |
| 4899 | 4901 |
| 4900 protected: | 4902 protected: |
| 4901 bool DataEquals(HValue* other) override { return true; } | 4903 bool DataEquals(HValue* other) override { return true; } |
| 4902 | 4904 |
| 4903 Range* InferRange(Zone* zone) override; | 4905 Range* InferRange(Zone* zone) override; |
| 4904 | 4906 |
| 4905 private: | 4907 private: |
| 4906 HAdd(HValue* context, HValue* left, HValue* right, Strength strength, | 4908 HAdd(HValue* context, HValue* left, HValue* right, Strength strength, |
| 4907 ExternalAddType external_add_type = NoExternalAdd) | 4909 ExternalAddType external_add_type = NoExternalAdd) |
| 4908 : HArithmeticBinaryOperation(context, left, right, strength), | 4910 : HArithmeticBinaryOperation(context, left, right, strength), |
| 4909 external_add_type_(external_add_type) { | 4911 external_add_type_(external_add_type) { |
| 4910 SetFlag(kCanOverflow); | 4912 SetFlag(kCanOverflow); |
| 4911 switch (external_add_type_) { | 4913 switch (external_add_type_) { |
| 4912 case AddOfExternalAndTagged: | 4914 case AddOfExternalAndTagged: |
| 4913 DCHECK(left->representation().IsExternal()); | 4915 DCHECK(left->representation().IsExternal()); |
| 4914 DCHECK(right->representation().IsTagged()); | 4916 DCHECK(right->representation().IsTagged()); |
| 4915 SetDependsOnFlag(kNewSpacePromotion); | 4917 SetDependsOnFlag(kNewSpacePromotion); |
| 4918 ClearFlag(HValue::kCanOverflow); |
| 4919 SetFlag(kHasNoObservableSideEffects); |
| 4916 break; | 4920 break; |
| 4917 | 4921 |
| 4918 case NoExternalAdd: | 4922 case NoExternalAdd: |
| 4919 // This is a bit of a hack: The call to this constructor is generated | 4923 // This is a bit of a hack: The call to this constructor is generated |
| 4920 // by a macro that also supports sub and mul, so it doesn't pass in | 4924 // by a macro that also supports sub and mul, so it doesn't pass in |
| 4921 // a value for external_add_type but uses the default. | 4925 // a value for external_add_type but uses the default. |
| 4922 if (left->representation().IsExternal()) { | 4926 if (left->representation().IsExternal()) { |
| 4923 external_add_type_ = AddOfExternalAndInt32; | 4927 external_add_type_ = AddOfExternalAndInt32; |
| 4924 } | 4928 } |
| 4925 break; | 4929 break; |
| (...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6021 kArrayLengths, | 6025 kArrayLengths, |
| 6022 FixedArray::kLengthOffset, | 6026 FixedArray::kLengthOffset, |
| 6023 Representation::Smi()); | 6027 Representation::Smi()); |
| 6024 } | 6028 } |
| 6025 | 6029 |
| 6026 static HObjectAccess ForFixedTypedArrayBaseBasePointer() { | 6030 static HObjectAccess ForFixedTypedArrayBaseBasePointer() { |
| 6027 return HObjectAccess(kInobject, FixedTypedArrayBase::kBasePointerOffset, | 6031 return HObjectAccess(kInobject, FixedTypedArrayBase::kBasePointerOffset, |
| 6028 Representation::Tagged()); | 6032 Representation::Tagged()); |
| 6029 } | 6033 } |
| 6030 | 6034 |
| 6035 static HObjectAccess ForFixedTypedArrayBaseExternalPointer() { |
| 6036 return HObjectAccess::ForObservableJSObjectOffset( |
| 6037 FixedTypedArrayBase::kExternalPointerOffset, |
| 6038 Representation::External()); |
| 6039 } |
| 6040 |
| 6031 static HObjectAccess ForStringHashField() { | 6041 static HObjectAccess ForStringHashField() { |
| 6032 return HObjectAccess(kInobject, | 6042 return HObjectAccess(kInobject, |
| 6033 String::kHashFieldOffset, | 6043 String::kHashFieldOffset, |
| 6034 Representation::Integer32()); | 6044 Representation::Integer32()); |
| 6035 } | 6045 } |
| 6036 | 6046 |
| 6037 static HObjectAccess ForStringLength() { | 6047 static HObjectAccess ForStringLength() { |
| 6038 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); | 6048 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); |
| 6039 return HObjectAccess( | 6049 return HObjectAccess( |
| 6040 kStringLengths, | 6050 kStringLengths, |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6641 ElementsKind elements_kind() const override { | 6651 ElementsKind elements_kind() const override { |
| 6642 return ElementsKindField::decode(bit_field_); | 6652 return ElementsKindField::decode(bit_field_); |
| 6643 } | 6653 } |
| 6644 LoadKeyedHoleMode hole_mode() const { | 6654 LoadKeyedHoleMode hole_mode() const { |
| 6645 return HoleModeField::decode(bit_field_); | 6655 return HoleModeField::decode(bit_field_); |
| 6646 } | 6656 } |
| 6647 | 6657 |
| 6648 Representation RequiredInputRepresentation(int index) override { | 6658 Representation RequiredInputRepresentation(int index) override { |
| 6649 // kind_fast: tagged[int32] (none) | 6659 // kind_fast: tagged[int32] (none) |
| 6650 // kind_double: tagged[int32] (none) | 6660 // kind_double: tagged[int32] (none) |
| 6651 // kind_fixed_typed_array: tagged[int32] (none) | 6661 // kind_fixed_typed_array: external[int32] (none) |
| 6652 // kind_external: external[int32] (none) | 6662 // kind_external: external[int32] (none) |
| 6653 if (index == 0) { | 6663 if (index == 0) { |
| 6654 return is_external() ? Representation::External() | 6664 return is_typed_elements() ? Representation::External() |
| 6655 : Representation::Tagged(); | 6665 : Representation::Tagged(); |
| 6656 } | 6666 } |
| 6657 if (index == 1) { | 6667 if (index == 1) { |
| 6658 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 6668 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
| 6659 OperandAt(1)->representation()); | 6669 OperandAt(1)->representation()); |
| 6660 } | 6670 } |
| 6661 return Representation::None(); | 6671 return Representation::None(); |
| 6662 } | 6672 } |
| 6663 | 6673 |
| 6664 Representation observed_input_representation(int index) override { | 6674 Representation observed_input_representation(int index) override { |
| 6665 return RequiredInputRepresentation(index); | 6675 return RequiredInputRepresentation(index); |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7106 DECLARE_INSTRUCTION_FACTORY_P6(HStoreKeyed, HValue*, HValue*, HValue*, | 7116 DECLARE_INSTRUCTION_FACTORY_P6(HStoreKeyed, HValue*, HValue*, HValue*, |
| 7107 ElementsKind, StoreFieldOrKeyedMode, int); | 7117 ElementsKind, StoreFieldOrKeyedMode, int); |
| 7108 | 7118 |
| 7109 Representation RequiredInputRepresentation(int index) override { | 7119 Representation RequiredInputRepresentation(int index) override { |
| 7110 // kind_fast: tagged[int32] = tagged | 7120 // kind_fast: tagged[int32] = tagged |
| 7111 // kind_double: tagged[int32] = double | 7121 // kind_double: tagged[int32] = double |
| 7112 // kind_smi : tagged[int32] = smi | 7122 // kind_smi : tagged[int32] = smi |
| 7113 // kind_fixed_typed_array: tagged[int32] = (double | int32) | 7123 // kind_fixed_typed_array: tagged[int32] = (double | int32) |
| 7114 // kind_external: external[int32] = (double | int32) | 7124 // kind_external: external[int32] = (double | int32) |
| 7115 if (index == 0) { | 7125 if (index == 0) { |
| 7116 return is_external() ? Representation::External() | 7126 return is_typed_elements() ? Representation::External() |
| 7117 : Representation::Tagged(); | 7127 : Representation::Tagged(); |
| 7118 } else if (index == 1) { | 7128 } else if (index == 1) { |
| 7119 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 7129 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
| 7120 OperandAt(1)->representation()); | 7130 OperandAt(1)->representation()); |
| 7121 } | 7131 } |
| 7122 | 7132 |
| 7123 DCHECK_EQ(index, 2); | 7133 DCHECK_EQ(index, 2); |
| 7124 return RequiredValueRepresentation(elements_kind(), store_mode()); | 7134 return RequiredValueRepresentation(elements_kind(), store_mode()); |
| 7125 } | 7135 } |
| 7126 | 7136 |
| 7127 static Representation RequiredValueRepresentation( | 7137 static Representation RequiredValueRepresentation( |
| (...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8085 }; | 8095 }; |
| 8086 | 8096 |
| 8087 | 8097 |
| 8088 | 8098 |
| 8089 #undef DECLARE_INSTRUCTION | 8099 #undef DECLARE_INSTRUCTION |
| 8090 #undef DECLARE_CONCRETE_INSTRUCTION | 8100 #undef DECLARE_CONCRETE_INSTRUCTION |
| 8091 | 8101 |
| 8092 } } // namespace v8::internal | 8102 } } // namespace v8::internal |
| 8093 | 8103 |
| 8094 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 8104 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |