| 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 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1228 RawSmi* length_; | 1228 RawSmi* length_; |
| 1229 RawArray* data_; | 1229 RawArray* data_; |
| 1230 RawObject** to() { | 1230 RawObject** to() { |
| 1231 return reinterpret_cast<RawObject**>(&ptr()->data_); | 1231 return reinterpret_cast<RawObject**>(&ptr()->data_); |
| 1232 } | 1232 } |
| 1233 | 1233 |
| 1234 friend class SnapshotReader; | 1234 friend class SnapshotReader; |
| 1235 }; | 1235 }; |
| 1236 | 1236 |
| 1237 | 1237 |
| 1238 // Define an aliases for intptr_t. |
| 1239 #if defined(ARCH_IS_32_BIT) |
| 1240 #define RawIntPtrArray RawInt32Array |
| 1241 #define IntPtrArray Int32Array |
| 1242 #elif defined(ARCH_IS_64_BIT) |
| 1243 #define RawIntPtrArray RawInt64Array |
| 1244 #define IntPtrArray Int64Array |
| 1245 #else |
| 1246 #error Architecture is not 32-bit or 64-bit. |
| 1247 #endif // ARCH_IS_32_BIT |
| 1248 |
| 1249 |
| 1238 class RawByteArray : public RawInstance { | 1250 class RawByteArray : public RawInstance { |
| 1239 RAW_HEAP_OBJECT_IMPLEMENTATION(ByteArray); | 1251 RAW_HEAP_OBJECT_IMPLEMENTATION(ByteArray); |
| 1240 | 1252 |
| 1241 protected: | 1253 protected: |
| 1242 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } | 1254 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } |
| 1243 RawSmi* length_; | 1255 RawSmi* length_; |
| 1244 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); } | 1256 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); } |
| 1245 }; | 1257 }; |
| 1246 | 1258 |
| 1247 | 1259 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1275 // Variable length data follows here. | 1287 // Variable length data follows here. |
| 1276 uint16_t data_[0]; | 1288 uint16_t data_[0]; |
| 1277 }; | 1289 }; |
| 1278 | 1290 |
| 1279 | 1291 |
| 1280 class RawInt32Array : public RawByteArray { | 1292 class RawInt32Array : public RawByteArray { |
| 1281 RAW_HEAP_OBJECT_IMPLEMENTATION(Int32Array); | 1293 RAW_HEAP_OBJECT_IMPLEMENTATION(Int32Array); |
| 1282 | 1294 |
| 1283 // Variable length data follows here. | 1295 // Variable length data follows here. |
| 1284 int32_t data_[0]; | 1296 int32_t data_[0]; |
| 1297 |
| 1298 friend class Instance; |
| 1285 }; | 1299 }; |
| 1286 | 1300 |
| 1287 | 1301 |
| 1288 class RawUint32Array : public RawByteArray { | 1302 class RawUint32Array : public RawByteArray { |
| 1289 RAW_HEAP_OBJECT_IMPLEMENTATION(Uint32Array); | 1303 RAW_HEAP_OBJECT_IMPLEMENTATION(Uint32Array); |
| 1290 | 1304 |
| 1291 // Variable length data follows here. | 1305 // Variable length data follows here. |
| 1292 uint32_t data_[0]; | 1306 uint32_t data_[0]; |
| 1293 }; | 1307 }; |
| 1294 | 1308 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1614 kExternalUint64ArrayCid == kExternalInt8ArrayCid + 7 && | 1628 kExternalUint64ArrayCid == kExternalInt8ArrayCid + 7 && |
| 1615 kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 8 && | 1629 kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 8 && |
| 1616 kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 9 && | 1630 kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 9 && |
| 1617 kStacktraceCid == kExternalInt8ArrayCid + 10); | 1631 kStacktraceCid == kExternalInt8ArrayCid + 10); |
| 1618 return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid); | 1632 return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid); |
| 1619 } | 1633 } |
| 1620 | 1634 |
| 1621 } // namespace dart | 1635 } // namespace dart |
| 1622 | 1636 |
| 1623 #endif // VM_RAW_OBJECT_H_ | 1637 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |