OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_RAW_OBJECT_H_ | 5 #ifndef VM_RAW_OBJECT_H_ |
6 #define VM_RAW_OBJECT_H_ | 6 #define VM_RAW_OBJECT_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 #include "vm/token.h" | 10 #include "vm/token.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 V(ByteArray) \ | 64 V(ByteArray) \ |
65 V(Int8Array) \ | 65 V(Int8Array) \ |
66 V(Uint8Array) \ | 66 V(Uint8Array) \ |
67 V(Uint8ClampedArray) \ | 67 V(Uint8ClampedArray) \ |
68 V(Int16Array) \ | 68 V(Int16Array) \ |
69 V(Uint16Array) \ | 69 V(Uint16Array) \ |
70 V(Int32Array) \ | 70 V(Int32Array) \ |
71 V(Uint32Array) \ | 71 V(Uint32Array) \ |
72 V(Int64Array) \ | 72 V(Int64Array) \ |
73 V(Uint64Array) \ | 73 V(Uint64Array) \ |
| 74 V(Float32x4Array) \ |
74 V(Float32Array) \ | 75 V(Float32Array) \ |
75 V(Float64Array) \ | 76 V(Float64Array) \ |
76 V(ExternalInt8Array) \ | 77 V(ExternalInt8Array) \ |
77 V(ExternalUint8Array) \ | 78 V(ExternalUint8Array) \ |
78 V(ExternalUint8ClampedArray) \ | 79 V(ExternalUint8ClampedArray) \ |
79 V(ExternalInt16Array) \ | 80 V(ExternalInt16Array) \ |
80 V(ExternalUint16Array) \ | 81 V(ExternalUint16Array) \ |
81 V(ExternalInt32Array) \ | 82 V(ExternalInt32Array) \ |
82 V(ExternalUint32Array) \ | 83 V(ExternalUint32Array) \ |
83 V(ExternalInt64Array) \ | 84 V(ExternalInt64Array) \ |
84 V(ExternalUint64Array) \ | 85 V(ExternalUint64Array) \ |
| 86 V(ExternalFloat32x4Array) \ |
85 V(ExternalFloat32Array) \ | 87 V(ExternalFloat32Array) \ |
86 V(ExternalFloat64Array) \ | 88 V(ExternalFloat64Array) \ |
87 V(Stacktrace) \ | 89 V(Stacktrace) \ |
88 V(JSRegExp) \ | 90 V(JSRegExp) \ |
89 V(WeakProperty) \ | 91 V(WeakProperty) \ |
90 V(DartFunction) \ | 92 V(DartFunction) \ |
| 93 V(Float32x4) \ |
| 94 V(Uint32x4) \ |
| 95 |
91 | 96 |
92 #define CLASS_LIST_STRINGS(V) \ | 97 #define CLASS_LIST_STRINGS(V) \ |
93 V(String) \ | 98 V(String) \ |
94 V(OneByteString) \ | 99 V(OneByteString) \ |
95 V(TwoByteString) \ | 100 V(TwoByteString) \ |
96 V(ExternalOneByteString) \ | 101 V(ExternalOneByteString) \ |
97 V(ExternalTwoByteString) | 102 V(ExternalTwoByteString) |
98 | 103 |
99 #define CLASS_LIST_FOR_HANDLES(V) \ | 104 #define CLASS_LIST_FOR_HANDLES(V) \ |
100 CLASS_LIST_NO_OBJECT_OR_STRING(V) \ | 105 CLASS_LIST_NO_OBJECT_OR_STRING(V) \ |
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 RawSmi* length_; | 1299 RawSmi* length_; |
1295 RawArray* data_; | 1300 RawArray* data_; |
1296 RawObject** to() { | 1301 RawObject** to() { |
1297 return reinterpret_cast<RawObject**>(&ptr()->data_); | 1302 return reinterpret_cast<RawObject**>(&ptr()->data_); |
1298 } | 1303 } |
1299 | 1304 |
1300 friend class SnapshotReader; | 1305 friend class SnapshotReader; |
1301 }; | 1306 }; |
1302 | 1307 |
1303 | 1308 |
| 1309 class RawFloat32x4 : public RawInstance { |
| 1310 RAW_HEAP_OBJECT_IMPLEMENTATION(Float32x4); |
| 1311 |
| 1312 float value_[4]; |
| 1313 |
| 1314 friend class SnapshotReader; |
| 1315 }; |
| 1316 |
| 1317 |
| 1318 class RawUint32x4 : public RawInstance { |
| 1319 RAW_HEAP_OBJECT_IMPLEMENTATION(Uint32x4); |
| 1320 |
| 1321 uint32_t value_[4]; |
| 1322 |
| 1323 friend class SnapshotReader; |
| 1324 }; |
| 1325 |
| 1326 |
1304 // Define an aliases for intptr_t. | 1327 // Define an aliases for intptr_t. |
1305 #if defined(ARCH_IS_32_BIT) | 1328 #if defined(ARCH_IS_32_BIT) |
1306 #define RawIntPtrArray RawInt32Array | 1329 #define RawIntPtrArray RawInt32Array |
1307 #define IntPtrArray Int32Array | 1330 #define IntPtrArray Int32Array |
1308 #elif defined(ARCH_IS_64_BIT) | 1331 #elif defined(ARCH_IS_64_BIT) |
1309 #define RawIntPtrArray RawInt64Array | 1332 #define RawIntPtrArray RawInt64Array |
1310 #define IntPtrArray Int64Array | 1333 #define IntPtrArray Int64Array |
1311 #else | 1334 #else |
1312 #error Architecture is not 32-bit or 64-bit. | 1335 #error Architecture is not 32-bit or 64-bit. |
1313 #endif // ARCH_IS_32_BIT | 1336 #endif // ARCH_IS_32_BIT |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1394 | 1417 |
1395 | 1418 |
1396 class RawUint64Array : public RawByteArray { | 1419 class RawUint64Array : public RawByteArray { |
1397 RAW_HEAP_OBJECT_IMPLEMENTATION(Uint64Array); | 1420 RAW_HEAP_OBJECT_IMPLEMENTATION(Uint64Array); |
1398 | 1421 |
1399 // Variable length data follows here. | 1422 // Variable length data follows here. |
1400 uint64_t data_[0]; | 1423 uint64_t data_[0]; |
1401 }; | 1424 }; |
1402 | 1425 |
1403 | 1426 |
| 1427 class RawFloat32x4Array : public RawByteArray { |
| 1428 RAW_HEAP_OBJECT_IMPLEMENTATION(Float32x4Array); |
| 1429 |
| 1430 // Variable length data follows here. |
| 1431 simd_value_t data_[0]; |
| 1432 }; |
| 1433 |
1404 class RawFloat32Array : public RawByteArray { | 1434 class RawFloat32Array : public RawByteArray { |
1405 RAW_HEAP_OBJECT_IMPLEMENTATION(Float32Array); | 1435 RAW_HEAP_OBJECT_IMPLEMENTATION(Float32Array); |
1406 | 1436 |
1407 // Variable length data follows here. | 1437 // Variable length data follows here. |
1408 float data_[0]; | 1438 float data_[0]; |
1409 }; | 1439 }; |
1410 | 1440 |
1411 | 1441 |
1412 class RawFloat64Array : public RawByteArray { | 1442 class RawFloat64Array : public RawByteArray { |
1413 RAW_HEAP_OBJECT_IMPLEMENTATION(Float64Array); | 1443 RAW_HEAP_OBJECT_IMPLEMENTATION(Float64Array); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1483 | 1513 |
1484 | 1514 |
1485 class RawExternalUint64Array : public RawByteArray { | 1515 class RawExternalUint64Array : public RawByteArray { |
1486 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalUint64Array); | 1516 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalUint64Array); |
1487 | 1517 |
1488 uint64_t* data_; | 1518 uint64_t* data_; |
1489 void* peer_; | 1519 void* peer_; |
1490 }; | 1520 }; |
1491 | 1521 |
1492 | 1522 |
| 1523 class RawExternalFloat32x4Array : public RawByteArray { |
| 1524 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalFloat32x4Array); |
| 1525 |
| 1526 simd_value_t* data_; |
| 1527 void* peer_; |
| 1528 }; |
| 1529 |
| 1530 |
1493 class RawExternalFloat32Array : public RawByteArray { | 1531 class RawExternalFloat32Array : public RawByteArray { |
1494 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalFloat32Array); | 1532 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalFloat32Array); |
1495 | 1533 |
1496 float* data_; | 1534 float* data_; |
1497 void* peer_; | 1535 void* peer_; |
1498 }; | 1536 }; |
1499 | 1537 |
1500 | 1538 |
1501 class RawExternalFloat64Array : public RawByteArray { | 1539 class RawExternalFloat64Array : public RawByteArray { |
1502 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalFloat64Array); | 1540 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalFloat64Array); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 // Make sure this function is updated when new ByteArray types are added. | 1701 // Make sure this function is updated when new ByteArray types are added. |
1664 ASSERT(kInt8ArrayCid == kByteArrayCid + 1 && | 1702 ASSERT(kInt8ArrayCid == kByteArrayCid + 1 && |
1665 kUint8ArrayCid == kByteArrayCid + 2 && | 1703 kUint8ArrayCid == kByteArrayCid + 2 && |
1666 kUint8ClampedArrayCid == kByteArrayCid + 3 && | 1704 kUint8ClampedArrayCid == kByteArrayCid + 3 && |
1667 kInt16ArrayCid == kByteArrayCid + 4 && | 1705 kInt16ArrayCid == kByteArrayCid + 4 && |
1668 kUint16ArrayCid == kByteArrayCid + 5 && | 1706 kUint16ArrayCid == kByteArrayCid + 5 && |
1669 kInt32ArrayCid == kByteArrayCid + 6 && | 1707 kInt32ArrayCid == kByteArrayCid + 6 && |
1670 kUint32ArrayCid == kByteArrayCid + 7 && | 1708 kUint32ArrayCid == kByteArrayCid + 7 && |
1671 kInt64ArrayCid == kByteArrayCid + 8 && | 1709 kInt64ArrayCid == kByteArrayCid + 8 && |
1672 kUint64ArrayCid == kByteArrayCid + 9 && | 1710 kUint64ArrayCid == kByteArrayCid + 9 && |
1673 kFloat32ArrayCid == kByteArrayCid + 10 && | 1711 kFloat32x4ArrayCid == kByteArrayCid + 10 && |
1674 kFloat64ArrayCid == kByteArrayCid + 11 && | 1712 kFloat32ArrayCid == kByteArrayCid + 11 && |
1675 kExternalInt8ArrayCid == kByteArrayCid + 12 && | 1713 kFloat64ArrayCid == kByteArrayCid + 12 && |
1676 kExternalUint8ArrayCid == kByteArrayCid + 13 && | 1714 kExternalInt8ArrayCid == kByteArrayCid + 13 && |
1677 kExternalUint8ClampedArrayCid == kByteArrayCid + 14 && | 1715 kExternalUint8ArrayCid == kByteArrayCid + 14 && |
1678 kExternalInt16ArrayCid == kByteArrayCid + 15 && | 1716 kExternalUint8ClampedArrayCid == kByteArrayCid + 15 && |
1679 kExternalUint16ArrayCid == kByteArrayCid + 16 && | 1717 kExternalInt16ArrayCid == kByteArrayCid + 16 && |
1680 kExternalInt32ArrayCid == kByteArrayCid + 17 && | 1718 kExternalUint16ArrayCid == kByteArrayCid + 17 && |
1681 kExternalUint32ArrayCid == kByteArrayCid + 18 && | 1719 kExternalInt32ArrayCid == kByteArrayCid + 18 && |
1682 kExternalInt64ArrayCid == kByteArrayCid + 19 && | 1720 kExternalUint32ArrayCid == kByteArrayCid + 19 && |
1683 kExternalUint64ArrayCid == kByteArrayCid + 20 && | 1721 kExternalInt64ArrayCid == kByteArrayCid + 20 && |
1684 kExternalFloat32ArrayCid == kByteArrayCid + 21 && | 1722 kExternalUint64ArrayCid == kByteArrayCid + 21 && |
1685 kExternalFloat64ArrayCid == kByteArrayCid + 22 && | 1723 kExternalFloat32x4ArrayCid == kByteArrayCid + 22 && |
1686 kStacktraceCid == kByteArrayCid + 23); | 1724 kExternalFloat32ArrayCid == kByteArrayCid + 23 && |
| 1725 kExternalFloat64ArrayCid == kByteArrayCid + 24 && |
| 1726 kStacktraceCid == kByteArrayCid + 25); |
1687 return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid); | 1727 return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid); |
1688 } | 1728 } |
1689 | 1729 |
1690 inline bool RawObject::IsExternalByteArrayClassId(intptr_t index) { | 1730 inline bool RawObject::IsExternalByteArrayClassId(intptr_t index) { |
1691 // Make sure this function is updated when new ByteArray types are added. | 1731 // Make sure this function is updated when new ByteArray types are added. |
1692 ASSERT(kExternalUint8ArrayCid == kExternalInt8ArrayCid + 1 && | 1732 ASSERT(kExternalUint8ArrayCid == kExternalInt8ArrayCid + 1 && |
1693 kExternalUint8ClampedArrayCid == kExternalInt8ArrayCid + 2 && | 1733 kExternalUint8ClampedArrayCid == kExternalInt8ArrayCid + 2 && |
1694 kExternalInt16ArrayCid == kExternalInt8ArrayCid + 3 && | 1734 kExternalInt16ArrayCid == kExternalInt8ArrayCid + 3 && |
1695 kExternalUint16ArrayCid == kExternalInt8ArrayCid + 4 && | 1735 kExternalUint16ArrayCid == kExternalInt8ArrayCid + 4 && |
1696 kExternalInt32ArrayCid == kExternalInt8ArrayCid + 5 && | 1736 kExternalInt32ArrayCid == kExternalInt8ArrayCid + 5 && |
1697 kExternalUint32ArrayCid == kExternalInt8ArrayCid + 6 && | 1737 kExternalUint32ArrayCid == kExternalInt8ArrayCid + 6 && |
1698 kExternalInt64ArrayCid == kExternalInt8ArrayCid + 7 && | 1738 kExternalInt64ArrayCid == kExternalInt8ArrayCid + 7 && |
1699 kExternalUint64ArrayCid == kExternalInt8ArrayCid + 8 && | 1739 kExternalUint64ArrayCid == kExternalInt8ArrayCid + 8 && |
1700 kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 9 && | 1740 kExternalFloat32x4ArrayCid == kExternalInt8ArrayCid + 9 && |
1701 kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 10 && | 1741 kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 10 && |
1702 kStacktraceCid == kExternalInt8ArrayCid + 11); | 1742 kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 11 && |
| 1743 kStacktraceCid == kExternalInt8ArrayCid + 12); |
1703 return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid); | 1744 return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid); |
1704 } | 1745 } |
1705 | 1746 |
1706 } // namespace dart | 1747 } // namespace dart |
1707 | 1748 |
1708 #endif // VM_RAW_OBJECT_H_ | 1749 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |