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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 } | 163 } |
164 | 164 |
165 | 165 |
166 bool Object::IsHeapObject() const { | 166 bool Object::IsHeapObject() const { |
167 return Internals::HasHeapObjectTag(this); | 167 return Internals::HasHeapObjectTag(this); |
168 } | 168 } |
169 | 169 |
170 | 170 |
171 TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE) | 171 TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE) |
172 TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE) | 172 TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE) |
173 TYPE_CHECKER(Float32x4, FLOAT32X4_TYPE) | |
173 TYPE_CHECKER(Symbol, SYMBOL_TYPE) | 174 TYPE_CHECKER(Symbol, SYMBOL_TYPE) |
174 | 175 |
175 | 176 |
176 bool Object::IsString() const { | 177 bool Object::IsString() const { |
177 return Object::IsHeapObject() | 178 return Object::IsHeapObject() |
178 && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE; | 179 && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE; |
179 } | 180 } |
180 | 181 |
181 | 182 |
182 bool Object::IsName() const { | 183 bool Object::IsName() const { |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1313 | 1314 |
1314 #define WRITE_UINT32_FIELD(p, offset, value) \ | 1315 #define WRITE_UINT32_FIELD(p, offset, value) \ |
1315 (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset)) = value) | 1316 (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset)) = value) |
1316 | 1317 |
1317 #define READ_INT32_FIELD(p, offset) \ | 1318 #define READ_INT32_FIELD(p, offset) \ |
1318 (*reinterpret_cast<const int32_t*>(FIELD_ADDR_CONST(p, offset))) | 1319 (*reinterpret_cast<const int32_t*>(FIELD_ADDR_CONST(p, offset))) |
1319 | 1320 |
1320 #define WRITE_INT32_FIELD(p, offset, value) \ | 1321 #define WRITE_INT32_FIELD(p, offset, value) \ |
1321 (*reinterpret_cast<int32_t*>(FIELD_ADDR(p, offset)) = value) | 1322 (*reinterpret_cast<int32_t*>(FIELD_ADDR(p, offset)) = value) |
1322 | 1323 |
1324 #define READ_FLOAT_FIELD(p, offset) \ | |
1325 (*reinterpret_cast<const float*>(FIELD_ADDR_CONST(p, offset))) | |
1326 | |
1327 #define WRITE_FLOAT_FIELD(p, offset, value) \ | |
1328 (*reinterpret_cast<float*>(FIELD_ADDR(p, offset)) = value) | |
1329 | |
1323 #define READ_UINT64_FIELD(p, offset) \ | 1330 #define READ_UINT64_FIELD(p, offset) \ |
1324 (*reinterpret_cast<const uint64_t*>(FIELD_ADDR_CONST(p, offset))) | 1331 (*reinterpret_cast<const uint64_t*>(FIELD_ADDR_CONST(p, offset))) |
1325 | 1332 |
1326 #define WRITE_UINT64_FIELD(p, offset, value) \ | 1333 #define WRITE_UINT64_FIELD(p, offset, value) \ |
1327 (*reinterpret_cast<uint64_t*>(FIELD_ADDR(p, offset)) = value) | 1334 (*reinterpret_cast<uint64_t*>(FIELD_ADDR(p, offset)) = value) |
1328 | 1335 |
1329 #define READ_INT64_FIELD(p, offset) \ | 1336 #define READ_INT64_FIELD(p, offset) \ |
1330 (*reinterpret_cast<const int64_t*>(FIELD_ADDR_CONST(p, offset))) | 1337 (*reinterpret_cast<const int64_t*>(FIELD_ADDR_CONST(p, offset))) |
1331 | 1338 |
1332 #define WRITE_INT64_FIELD(p, offset, value) \ | 1339 #define WRITE_INT64_FIELD(p, offset, value) \ |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1569 return ((READ_INT_FIELD(this, kExponentOffset) & kExponentMask) >> | 1576 return ((READ_INT_FIELD(this, kExponentOffset) & kExponentMask) >> |
1570 kExponentShift) - kExponentBias; | 1577 kExponentShift) - kExponentBias; |
1571 } | 1578 } |
1572 | 1579 |
1573 | 1580 |
1574 int HeapNumber::get_sign() { | 1581 int HeapNumber::get_sign() { |
1575 return READ_INT_FIELD(this, kExponentOffset) & kSignMask; | 1582 return READ_INT_FIELD(this, kExponentOffset) & kSignMask; |
1576 } | 1583 } |
1577 | 1584 |
1578 | 1585 |
1586 double Float32x4::get_lane(int lane) const { | |
1587 DCHECK(lane < 4 && lane >= 0); | |
titzer
2015/06/03 13:27:15
Looks like we are only supporting little endian fo
bbudge
2015/06/03 20:31:48
I guess there aren't any big-endian media instruct
| |
1588 return READ_FLOAT_FIELD(this, kValueOffset + lane * 4); | |
1589 } | |
1590 | |
1591 | |
1592 void Float32x4::set_lane(int lane, double value) { | |
1593 DCHECK(lane < 4 && lane >= 0); | |
1594 WRITE_FLOAT_FIELD(this, kValueOffset + lane * 4, DoubleToFloat32(value)); | |
1595 } | |
1596 | |
1597 | |
1579 ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset) | 1598 ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset) |
1580 | 1599 |
1581 | 1600 |
1582 Object** FixedArray::GetFirstElementAddress() { | 1601 Object** FixedArray::GetFirstElementAddress() { |
1583 return reinterpret_cast<Object**>(FIELD_ADDR(this, OffsetOfElementAt(0))); | 1602 return reinterpret_cast<Object**>(FIELD_ADDR(this, OffsetOfElementAt(0))); |
1584 } | 1603 } |
1585 | 1604 |
1586 | 1605 |
1587 bool FixedArray::ContainsOnlySmisOrHoles() { | 1606 bool FixedArray::ContainsOnlySmisOrHoles() { |
1588 Object* the_hole = GetHeap()->the_hole_value(); | 1607 Object* the_hole = GetHeap()->the_hole_value(); |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2426 } | 2445 } |
2427 | 2446 |
2428 | 2447 |
2429 AllocationAlignment HeapObject::RequiredAlignment() { | 2448 AllocationAlignment HeapObject::RequiredAlignment() { |
2430 #ifdef V8_HOST_ARCH_32_BIT | 2449 #ifdef V8_HOST_ARCH_32_BIT |
2431 if ((IsFixedFloat64Array() || IsFixedDoubleArray()) && | 2450 if ((IsFixedFloat64Array() || IsFixedDoubleArray()) && |
2432 FixedArrayBase::cast(this)->length() != 0) { | 2451 FixedArrayBase::cast(this)->length() != 0) { |
2433 return kDoubleAligned; | 2452 return kDoubleAligned; |
2434 } | 2453 } |
2435 if (IsHeapNumber()) return kDoubleUnaligned; | 2454 if (IsHeapNumber()) return kDoubleUnaligned; |
2455 if (IsFloat32x4()) return kSimd128Unaligned; | |
2436 #endif // V8_HOST_ARCH_32_BIT | 2456 #endif // V8_HOST_ARCH_32_BIT |
2437 return kWordAligned; | 2457 return kWordAligned; |
2438 } | 2458 } |
2439 | 2459 |
2440 | 2460 |
2441 void FixedArray::set(int index, | 2461 void FixedArray::set(int index, |
2442 Object* value, | 2462 Object* value, |
2443 WriteBarrierMode mode) { | 2463 WriteBarrierMode mode) { |
2444 DCHECK(map() != GetHeap()->fixed_cow_array_map()); | 2464 DCHECK(map() != GetHeap()->fixed_cow_array_map()); |
2445 DCHECK(index >= 0 && index < this->length()); | 2465 DCHECK(index >= 0 && index < this->length()); |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2966 CAST_ACCESSOR(ExternalString) | 2986 CAST_ACCESSOR(ExternalString) |
2967 CAST_ACCESSOR(ExternalTwoByteString) | 2987 CAST_ACCESSOR(ExternalTwoByteString) |
2968 CAST_ACCESSOR(ExternalUint16Array) | 2988 CAST_ACCESSOR(ExternalUint16Array) |
2969 CAST_ACCESSOR(ExternalUint32Array) | 2989 CAST_ACCESSOR(ExternalUint32Array) |
2970 CAST_ACCESSOR(ExternalUint8Array) | 2990 CAST_ACCESSOR(ExternalUint8Array) |
2971 CAST_ACCESSOR(ExternalUint8ClampedArray) | 2991 CAST_ACCESSOR(ExternalUint8ClampedArray) |
2972 CAST_ACCESSOR(FixedArray) | 2992 CAST_ACCESSOR(FixedArray) |
2973 CAST_ACCESSOR(FixedArrayBase) | 2993 CAST_ACCESSOR(FixedArrayBase) |
2974 CAST_ACCESSOR(FixedDoubleArray) | 2994 CAST_ACCESSOR(FixedDoubleArray) |
2975 CAST_ACCESSOR(FixedTypedArrayBase) | 2995 CAST_ACCESSOR(FixedTypedArrayBase) |
2996 CAST_ACCESSOR(Float32x4) | |
2976 CAST_ACCESSOR(Foreign) | 2997 CAST_ACCESSOR(Foreign) |
2977 CAST_ACCESSOR(GlobalDictionary) | 2998 CAST_ACCESSOR(GlobalDictionary) |
2978 CAST_ACCESSOR(GlobalObject) | 2999 CAST_ACCESSOR(GlobalObject) |
2979 CAST_ACCESSOR(HandlerTable) | 3000 CAST_ACCESSOR(HandlerTable) |
2980 CAST_ACCESSOR(HeapObject) | 3001 CAST_ACCESSOR(HeapObject) |
2981 CAST_ACCESSOR(JSArray) | 3002 CAST_ACCESSOR(JSArray) |
2982 CAST_ACCESSOR(JSArrayBuffer) | 3003 CAST_ACCESSOR(JSArrayBuffer) |
2983 CAST_ACCESSOR(JSArrayBufferView) | 3004 CAST_ACCESSOR(JSArrayBufferView) |
2984 CAST_ACCESSOR(JSBuiltinsObject) | 3005 CAST_ACCESSOR(JSBuiltinsObject) |
2985 CAST_ACCESSOR(JSDataView) | 3006 CAST_ACCESSOR(JSDataView) |
(...skipping 4340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7326 #undef READ_SHORT_FIELD | 7347 #undef READ_SHORT_FIELD |
7327 #undef WRITE_SHORT_FIELD | 7348 #undef WRITE_SHORT_FIELD |
7328 #undef READ_BYTE_FIELD | 7349 #undef READ_BYTE_FIELD |
7329 #undef WRITE_BYTE_FIELD | 7350 #undef WRITE_BYTE_FIELD |
7330 #undef NOBARRIER_READ_BYTE_FIELD | 7351 #undef NOBARRIER_READ_BYTE_FIELD |
7331 #undef NOBARRIER_WRITE_BYTE_FIELD | 7352 #undef NOBARRIER_WRITE_BYTE_FIELD |
7332 | 7353 |
7333 } } // namespace v8::internal | 7354 } } // namespace v8::internal |
7334 | 7355 |
7335 #endif // V8_OBJECTS_INL_H_ | 7356 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |