| 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 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 class RawByteArray : public RawInstance { | 1226 class RawByteArray : public RawInstance { |
| 1227 RAW_HEAP_OBJECT_IMPLEMENTATION(ByteArray); | 1227 RAW_HEAP_OBJECT_IMPLEMENTATION(ByteArray); |
| 1228 | 1228 |
| 1229 protected: | 1229 protected: |
| 1230 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } | 1230 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } |
| 1231 RawSmi* length_; | 1231 RawSmi* length_; |
| 1232 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); } | 1232 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); } |
| 1233 }; | 1233 }; |
| 1234 | 1234 |
| 1235 | 1235 |
| 1236 class RawInt8Array: public RawByteArray { | 1236 class RawInt8Array : public RawByteArray { |
| 1237 RAW_HEAP_OBJECT_IMPLEMENTATION(Int8Array); | 1237 RAW_HEAP_OBJECT_IMPLEMENTATION(Int8Array); |
| 1238 | 1238 |
| 1239 // Variable length data follows here. | 1239 // Variable length data follows here. |
| 1240 int8_t data_[0]; | 1240 int8_t data_[0]; |
| 1241 }; | 1241 }; |
| 1242 | 1242 |
| 1243 | 1243 |
| 1244 class RawUint8Array: public RawByteArray { | 1244 class RawUint8Array : public RawByteArray { |
| 1245 RAW_HEAP_OBJECT_IMPLEMENTATION(Uint8Array); | 1245 RAW_HEAP_OBJECT_IMPLEMENTATION(Uint8Array); |
| 1246 | 1246 |
| 1247 // Variable length data follows here. | 1247 // Variable length data follows here. |
| 1248 uint8_t data_[0]; | 1248 uint8_t data_[0]; |
| 1249 }; | 1249 }; |
| 1250 | 1250 |
| 1251 | 1251 |
| 1252 class RawInt16Array: public RawByteArray { | 1252 class RawInt16Array : public RawByteArray { |
| 1253 RAW_HEAP_OBJECT_IMPLEMENTATION(Int16Array); | 1253 RAW_HEAP_OBJECT_IMPLEMENTATION(Int16Array); |
| 1254 | 1254 |
| 1255 // Variable length data follows here. | 1255 // Variable length data follows here. |
| 1256 int16_t data_[0]; | 1256 int16_t data_[0]; |
| 1257 }; | 1257 }; |
| 1258 | 1258 |
| 1259 | 1259 |
| 1260 class RawUint16Array: public RawByteArray { | 1260 class RawUint16Array : public RawByteArray { |
| 1261 RAW_HEAP_OBJECT_IMPLEMENTATION(Uint16Array); | 1261 RAW_HEAP_OBJECT_IMPLEMENTATION(Uint16Array); |
| 1262 | 1262 |
| 1263 // Variable length data follows here. | 1263 // Variable length data follows here. |
| 1264 uint16_t data_[0]; | 1264 uint16_t data_[0]; |
| 1265 }; | 1265 }; |
| 1266 | 1266 |
| 1267 | 1267 |
| 1268 class RawInt32Array: public RawByteArray { | 1268 class RawInt32Array : public RawByteArray { |
| 1269 RAW_HEAP_OBJECT_IMPLEMENTATION(Int32Array); | 1269 RAW_HEAP_OBJECT_IMPLEMENTATION(Int32Array); |
| 1270 | 1270 |
| 1271 // Variable length data follows here. | 1271 // Variable length data follows here. |
| 1272 int32_t data_[0]; | 1272 int32_t data_[0]; |
| 1273 }; | 1273 }; |
| 1274 | 1274 |
| 1275 | 1275 |
| 1276 class RawUint32Array: public RawByteArray { | 1276 class RawUint32Array : public RawByteArray { |
| 1277 RAW_HEAP_OBJECT_IMPLEMENTATION(Uint32Array); | 1277 RAW_HEAP_OBJECT_IMPLEMENTATION(Uint32Array); |
| 1278 | 1278 |
| 1279 // Variable length data follows here. | 1279 // Variable length data follows here. |
| 1280 uint32_t data_[0]; | 1280 uint32_t data_[0]; |
| 1281 }; | 1281 }; |
| 1282 | 1282 |
| 1283 | 1283 |
| 1284 class RawInt64Array: public RawByteArray { | 1284 class RawInt64Array : public RawByteArray { |
| 1285 RAW_HEAP_OBJECT_IMPLEMENTATION(Int64Array); | 1285 RAW_HEAP_OBJECT_IMPLEMENTATION(Int64Array); |
| 1286 | 1286 |
| 1287 // Variable length data follows here. | 1287 // Variable length data follows here. |
| 1288 int64_t data_[0]; | 1288 int64_t data_[0]; |
| 1289 }; | 1289 }; |
| 1290 | 1290 |
| 1291 | 1291 |
| 1292 class RawUint64Array: public RawByteArray { | 1292 class RawUint64Array : public RawByteArray { |
| 1293 RAW_HEAP_OBJECT_IMPLEMENTATION(Uint64Array); | 1293 RAW_HEAP_OBJECT_IMPLEMENTATION(Uint64Array); |
| 1294 | 1294 |
| 1295 // Variable length data follows here. | 1295 // Variable length data follows here. |
| 1296 uint64_t data_[0]; | 1296 uint64_t data_[0]; |
| 1297 }; | 1297 }; |
| 1298 | 1298 |
| 1299 | 1299 |
| 1300 class RawFloat32Array: public RawByteArray { | 1300 class RawFloat32Array : public RawByteArray { |
| 1301 RAW_HEAP_OBJECT_IMPLEMENTATION(Float32Array); | 1301 RAW_HEAP_OBJECT_IMPLEMENTATION(Float32Array); |
| 1302 | 1302 |
| 1303 // Variable length data follows here. | 1303 // Variable length data follows here. |
| 1304 float data_[0]; | 1304 float data_[0]; |
| 1305 }; | 1305 }; |
| 1306 | 1306 |
| 1307 | 1307 |
| 1308 class RawFloat64Array: public RawByteArray { | 1308 class RawFloat64Array : public RawByteArray { |
| 1309 RAW_HEAP_OBJECT_IMPLEMENTATION(Float64Array); | 1309 RAW_HEAP_OBJECT_IMPLEMENTATION(Float64Array); |
| 1310 | 1310 |
| 1311 // Variable length data follows here. | 1311 // Variable length data follows here. |
| 1312 double data_[0]; | 1312 double data_[0]; |
| 1313 }; | 1313 }; |
| 1314 | 1314 |
| 1315 | 1315 |
| 1316 template<typename T> | 1316 template<typename T> |
| 1317 class ExternalByteArrayData { | 1317 class ExternalByteArrayData { |
| 1318 public: | 1318 public: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1332 return peer_; | 1332 return peer_; |
| 1333 } | 1333 } |
| 1334 | 1334 |
| 1335 private: | 1335 private: |
| 1336 T* data_; | 1336 T* data_; |
| 1337 void* peer_; | 1337 void* peer_; |
| 1338 Dart_PeerFinalizer callback_; | 1338 Dart_PeerFinalizer callback_; |
| 1339 }; | 1339 }; |
| 1340 | 1340 |
| 1341 | 1341 |
| 1342 class RawExternalInt8Array: public RawByteArray { | 1342 class RawExternalInt8Array : public RawByteArray { |
| 1343 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt8Array); | 1343 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt8Array); |
| 1344 | 1344 |
| 1345 ExternalByteArrayData<int8_t>* external_data_; | 1345 ExternalByteArrayData<int8_t>* external_data_; |
| 1346 }; | 1346 }; |
| 1347 | 1347 |
| 1348 | 1348 |
| 1349 class RawExternalUint8Array: public RawByteArray { | 1349 class RawExternalUint8Array : public RawByteArray { |
| 1350 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalUint8Array); | 1350 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalUint8Array); |
| 1351 | 1351 |
| 1352 ExternalByteArrayData<uint8_t>* external_data_; | 1352 ExternalByteArrayData<uint8_t>* external_data_; |
| 1353 }; | 1353 }; |
| 1354 | 1354 |
| 1355 | 1355 |
| 1356 class RawExternalInt16Array: public RawByteArray { | 1356 class RawExternalInt16Array : public RawByteArray { |
| 1357 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt16Array); | 1357 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt16Array); |
| 1358 | 1358 |
| 1359 ExternalByteArrayData<int16_t>* external_data_; | 1359 ExternalByteArrayData<int16_t>* external_data_; |
| 1360 }; | 1360 }; |
| 1361 | 1361 |
| 1362 | 1362 |
| 1363 class RawExternalUint16Array: public RawByteArray { | 1363 class RawExternalUint16Array : public RawByteArray { |
| 1364 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalUint16Array); | 1364 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalUint16Array); |
| 1365 | 1365 |
| 1366 ExternalByteArrayData<uint16_t>* external_data_; | 1366 ExternalByteArrayData<uint16_t>* external_data_; |
| 1367 }; | 1367 }; |
| 1368 | 1368 |
| 1369 | 1369 |
| 1370 class RawExternalInt32Array: public RawByteArray { | 1370 class RawExternalInt32Array : public RawByteArray { |
| 1371 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt32Array); | 1371 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt32Array); |
| 1372 | 1372 |
| 1373 ExternalByteArrayData<int32_t>* external_data_; | 1373 ExternalByteArrayData<int32_t>* external_data_; |
| 1374 }; | 1374 }; |
| 1375 | 1375 |
| 1376 | 1376 |
| 1377 class RawExternalUint32Array: public RawByteArray { | 1377 class RawExternalUint32Array : public RawByteArray { |
| 1378 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalUint32Array); | 1378 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalUint32Array); |
| 1379 | 1379 |
| 1380 ExternalByteArrayData<uint32_t>* external_data_; | 1380 ExternalByteArrayData<uint32_t>* external_data_; |
| 1381 }; | 1381 }; |
| 1382 | 1382 |
| 1383 | 1383 |
| 1384 class RawExternalInt64Array: public RawByteArray { | 1384 class RawExternalInt64Array : public RawByteArray { |
| 1385 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt64Array); | 1385 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt64Array); |
| 1386 | 1386 |
| 1387 ExternalByteArrayData<int64_t>* external_data_; | 1387 ExternalByteArrayData<int64_t>* external_data_; |
| 1388 }; | 1388 }; |
| 1389 | 1389 |
| 1390 | 1390 |
| 1391 class RawExternalUint64Array: public RawByteArray { | 1391 class RawExternalUint64Array : public RawByteArray { |
| 1392 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalUint64Array); | 1392 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalUint64Array); |
| 1393 | 1393 |
| 1394 ExternalByteArrayData<uint64_t>* external_data_; | 1394 ExternalByteArrayData<uint64_t>* external_data_; |
| 1395 }; | 1395 }; |
| 1396 | 1396 |
| 1397 | 1397 |
| 1398 class RawExternalFloat32Array: public RawByteArray { | 1398 class RawExternalFloat32Array : public RawByteArray { |
| 1399 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalFloat32Array); | 1399 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalFloat32Array); |
| 1400 | 1400 |
| 1401 ExternalByteArrayData<float>* external_data_; | 1401 ExternalByteArrayData<float>* external_data_; |
| 1402 }; | 1402 }; |
| 1403 | 1403 |
| 1404 | 1404 |
| 1405 class RawExternalFloat64Array: public RawByteArray { | 1405 class RawExternalFloat64Array : public RawByteArray { |
| 1406 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalFloat64Array); | 1406 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalFloat64Array); |
| 1407 | 1407 |
| 1408 ExternalByteArrayData<double>* external_data_; | 1408 ExternalByteArrayData<double>* external_data_; |
| 1409 }; | 1409 }; |
| 1410 | 1410 |
| 1411 | 1411 |
| 1412 class RawClosure : public RawInstance { | 1412 class RawClosure : public RawInstance { |
| 1413 RAW_HEAP_OBJECT_IMPLEMENTATION(Closure); | 1413 RAW_HEAP_OBJECT_IMPLEMENTATION(Closure); |
| 1414 | 1414 |
| 1415 RawObject** from() { | 1415 RawObject** from() { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 kExternalUint64Array == kByteArray + 18 && | 1580 kExternalUint64Array == kByteArray + 18 && |
| 1581 kExternalFloat32Array == kByteArray + 19 && | 1581 kExternalFloat32Array == kByteArray + 19 && |
| 1582 kExternalFloat64Array == kByteArray + 20 && | 1582 kExternalFloat64Array == kByteArray + 20 && |
| 1583 kClosure == kByteArray + 21); | 1583 kClosure == kByteArray + 21); |
| 1584 return (index >= kByteArray && index <= kClosure); | 1584 return (index >= kByteArray && index <= kClosure); |
| 1585 } | 1585 } |
| 1586 | 1586 |
| 1587 } // namespace dart | 1587 } // namespace dart |
| 1588 | 1588 |
| 1589 #endif // VM_RAW_OBJECT_H_ | 1589 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |