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 // Review notes: | 5 // Review notes: |
6 // | 6 // |
7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
10 // | 10 // |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 | 159 |
160 bool Object::IsHeapObject() const { | 160 bool Object::IsHeapObject() const { |
161 return Internals::HasHeapObjectTag(this); | 161 return Internals::HasHeapObjectTag(this); |
162 } | 162 } |
163 | 163 |
164 | 164 |
165 TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE) | 165 TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE) |
166 TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE) | 166 TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE) |
167 TYPE_CHECKER(Symbol, SYMBOL_TYPE) | 167 TYPE_CHECKER(Symbol, SYMBOL_TYPE) |
| 168 TYPE_CHECKER(Simd128Value, SIMD128_VALUE_TYPE) |
168 | 169 |
169 | 170 |
170 bool Object::IsSimd128Value() const { | 171 #define SIMD128_TYPE_CHECKER(TYPE, Type, type, lane_count, lane_type) \ |
171 if (!Object::IsHeapObject()) return false; | 172 bool Object::Is##Type() const { \ |
172 InstanceType instance_type = HeapObject::cast(this)->map()->instance_type(); | 173 return Object::IsHeapObject() && \ |
173 return (instance_type >= FIRST_SIMD_VALUE_TYPE && | 174 HeapObject::cast(this)->map() == \ |
174 instance_type <= LAST_SIMD_VALUE_TYPE); | 175 HeapObject::cast(this)->GetHeap()->type##_map(); \ |
175 } | 176 } |
176 | 177 SIMD128_TYPES(SIMD128_TYPE_CHECKER) |
177 | 178 #undef SIMD128_TYPE_CHECKER |
178 TYPE_CHECKER(Float32x4, FLOAT32X4_TYPE) | |
179 TYPE_CHECKER(Int32x4, INT32X4_TYPE) | |
180 TYPE_CHECKER(Bool32x4, BOOL32X4_TYPE) | |
181 TYPE_CHECKER(Int16x8, INT16X8_TYPE) | |
182 TYPE_CHECKER(Bool16x8, BOOL16X8_TYPE) | |
183 TYPE_CHECKER(Int8x16, INT8X16_TYPE) | |
184 TYPE_CHECKER(Bool8x16, BOOL8X16_TYPE) | |
185 | 179 |
186 | 180 |
187 bool Object::IsString() const { | 181 bool Object::IsString() const { |
188 return Object::IsHeapObject() | 182 return Object::IsHeapObject() |
189 && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE; | 183 && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE; |
190 } | 184 } |
191 | 185 |
192 | 186 |
193 bool Object::IsName() const { | 187 bool Object::IsName() const { |
194 return IsString() || IsSymbol(); | 188 return IsString() || IsSymbol(); |
(...skipping 7024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7219 #undef READ_INT64_FIELD | 7213 #undef READ_INT64_FIELD |
7220 #undef WRITE_INT64_FIELD | 7214 #undef WRITE_INT64_FIELD |
7221 #undef READ_BYTE_FIELD | 7215 #undef READ_BYTE_FIELD |
7222 #undef WRITE_BYTE_FIELD | 7216 #undef WRITE_BYTE_FIELD |
7223 #undef NOBARRIER_READ_BYTE_FIELD | 7217 #undef NOBARRIER_READ_BYTE_FIELD |
7224 #undef NOBARRIER_WRITE_BYTE_FIELD | 7218 #undef NOBARRIER_WRITE_BYTE_FIELD |
7225 | 7219 |
7226 } } // namespace v8::internal | 7220 } } // namespace v8::internal |
7227 | 7221 |
7228 #endif // V8_OBJECTS_INL_H_ | 7222 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |