OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/compiler/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
6 #include "src/types-inl.h" | 6 #include "src/types-inl.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 namespace compiler { | 10 namespace compiler { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 // static | 68 // static |
69 FieldAccess AccessBuilder::ForValue() { | 69 FieldAccess AccessBuilder::ForValue() { |
70 return {kTaggedBase, JSValue::kValueOffset, Handle<Name>(), Type::Any(), | 70 return {kTaggedBase, JSValue::kValueOffset, Handle<Name>(), Type::Any(), |
71 kMachAnyTagged}; | 71 kMachAnyTagged}; |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 // static | 75 // static |
76 ElementAccess AccessBuilder::ForFixedArrayElement() { | 76 ElementAccess AccessBuilder::ForFixedArrayElement() { |
77 return {kNoBoundsCheck, kTaggedBase, FixedArray::kHeaderSize, Type::Any(), | 77 return {kTaggedBase, FixedArray::kHeaderSize, Type::Any(), kMachAnyTagged}; |
78 kMachAnyTagged}; | |
79 } | 78 } |
80 | 79 |
81 | 80 |
82 // static | 81 // static |
83 ElementAccess AccessBuilder::ForTypedArrayElement(ExternalArrayType type, | 82 ElementAccess AccessBuilder::ForTypedArrayElement(ExternalArrayType type, |
84 bool is_external) { | 83 bool is_external) { |
85 BaseTaggedness taggedness = is_external ? kUntaggedBase : kTaggedBase; | 84 BaseTaggedness taggedness = is_external ? kUntaggedBase : kTaggedBase; |
86 int header_size = is_external ? 0 : FixedTypedArrayBase::kDataOffset; | 85 int header_size = is_external ? 0 : FixedTypedArrayBase::kDataOffset; |
87 switch (type) { | 86 switch (type) { |
88 case kExternalInt8Array: | 87 case kExternalInt8Array: |
89 return {kTypedArrayBoundsCheck, taggedness, header_size, Type::Signed32(), | 88 return {taggedness, header_size, Type::Signed32(), kMachInt8}; |
90 kMachInt8}; | |
91 case kExternalUint8Array: | 89 case kExternalUint8Array: |
92 case kExternalUint8ClampedArray: | 90 case kExternalUint8ClampedArray: |
93 return {kTypedArrayBoundsCheck, taggedness, header_size, | 91 return {taggedness, header_size, Type::Unsigned32(), kMachUint8}; |
94 Type::Unsigned32(), kMachUint8}; | |
95 case kExternalInt16Array: | 92 case kExternalInt16Array: |
96 return {kTypedArrayBoundsCheck, taggedness, header_size, Type::Signed32(), | 93 return {taggedness, header_size, Type::Signed32(), kMachInt16}; |
97 kMachInt16}; | |
98 case kExternalUint16Array: | 94 case kExternalUint16Array: |
99 return {kTypedArrayBoundsCheck, taggedness, header_size, | 95 return {taggedness, header_size, Type::Unsigned32(), kMachUint16}; |
100 Type::Unsigned32(), kMachUint16}; | |
101 case kExternalInt32Array: | 96 case kExternalInt32Array: |
102 return {kTypedArrayBoundsCheck, taggedness, header_size, Type::Signed32(), | 97 return {taggedness, header_size, Type::Signed32(), kMachInt32}; |
103 kMachInt32}; | |
104 case kExternalUint32Array: | 98 case kExternalUint32Array: |
105 return {kTypedArrayBoundsCheck, taggedness, header_size, | 99 return {taggedness, header_size, Type::Unsigned32(), kMachUint32}; |
106 Type::Unsigned32(), kMachUint32}; | |
107 case kExternalFloat32Array: | 100 case kExternalFloat32Array: |
108 return {kTypedArrayBoundsCheck, taggedness, header_size, Type::Number(), | 101 return {taggedness, header_size, Type::Number(), kMachFloat32}; |
109 kMachFloat32}; | |
110 case kExternalFloat64Array: | 102 case kExternalFloat64Array: |
111 return {kTypedArrayBoundsCheck, taggedness, header_size, Type::Number(), | 103 return {taggedness, header_size, Type::Number(), kMachFloat64}; |
112 kMachFloat64}; | |
113 } | 104 } |
114 UNREACHABLE(); | 105 UNREACHABLE(); |
115 return {kTypedArrayBoundsCheck, kUntaggedBase, 0, Type::None(), kMachNone}; | 106 return {kUntaggedBase, 0, Type::None(), kMachNone}; |
116 } | 107 } |
117 | 108 |
118 } // namespace compiler | 109 } // namespace compiler |
119 } // namespace internal | 110 } // namespace internal |
120 } // namespace v8 | 111 } // namespace v8 |
OLD | NEW |