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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 } | 408 } |
409 | 409 |
410 friend class Api; | 410 friend class Api; |
411 friend class Array; | 411 friend class Array; |
412 friend class FreeListElement; | 412 friend class FreeListElement; |
413 friend class GCMarker; | 413 friend class GCMarker; |
414 friend class ExternalTypedData; | 414 friend class ExternalTypedData; |
415 friend class Heap; | 415 friend class Heap; |
416 friend class HeapProfiler; | 416 friend class HeapProfiler; |
417 friend class HeapProfilerRootVisitor; | 417 friend class HeapProfilerRootVisitor; |
418 friend class HeapTrace; | |
419 friend class HeapTraceDebugObjectVisitor; | |
420 friend class HeapTraceHandleVisitor; | |
421 friend class HeapTraceVisitor; | |
422 friend class MarkingVisitor; | 418 friend class MarkingVisitor; |
423 friend class Object; | 419 friend class Object; |
424 friend class RawExternalTypedData; | 420 friend class RawExternalTypedData; |
425 friend class RawInstructions; | 421 friend class RawInstructions; |
426 friend class RawInstance; | 422 friend class RawInstance; |
427 friend class RawTypedData; | 423 friend class RawTypedData; |
428 friend class Scavenger; | 424 friend class Scavenger; |
429 friend class SnapshotReader; | 425 friend class SnapshotReader; |
430 friend class SnapshotWriter; | 426 friend class SnapshotWriter; |
431 friend class String; | 427 friend class String; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 | 466 |
471 cpp_vtable handle_vtable_; | 467 cpp_vtable handle_vtable_; |
472 intptr_t instance_size_in_words_; // Size if fixed len or 0 if variable len. | 468 intptr_t instance_size_in_words_; // Size if fixed len or 0 if variable len. |
473 intptr_t id_; // Class Id, also index in the class table. | 469 intptr_t id_; // Class Id, also index in the class table. |
474 intptr_t type_arguments_field_offset_in_words_; // Offset of type args fld. | 470 intptr_t type_arguments_field_offset_in_words_; // Offset of type args fld. |
475 intptr_t next_field_offset_in_words_; // Offset of the next instance field. | 471 intptr_t next_field_offset_in_words_; // Offset of the next instance field. |
476 intptr_t num_native_fields_; // Number of native fields in class. | 472 intptr_t num_native_fields_; // Number of native fields in class. |
477 intptr_t token_pos_; | 473 intptr_t token_pos_; |
478 uint8_t state_bits_; // state, is_const, is_implemented. | 474 uint8_t state_bits_; // state, is_const, is_implemented. |
479 | 475 |
480 friend class HeapTrace; | |
481 friend class Instance; | 476 friend class Instance; |
482 friend class Object; | 477 friend class Object; |
483 friend class RawInstance; | 478 friend class RawInstance; |
484 friend class RawInstructions; | 479 friend class RawInstructions; |
485 friend class RawType; // TODO(regis): To temporarily print unfinalized types. | 480 friend class RawType; // TODO(regis): To temporarily print unfinalized types. |
486 friend class RawTypeParameter; // To temporarily print unfinalized types. | 481 friend class RawTypeParameter; // To temporarily print unfinalized types. |
487 friend class SnapshotReader; | 482 friend class SnapshotReader; |
488 }; | 483 }; |
489 | 484 |
490 | 485 |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 | 1228 |
1234 | 1229 |
1235 class RawString : public RawInstance { | 1230 class RawString : public RawInstance { |
1236 RAW_HEAP_OBJECT_IMPLEMENTATION(String); | 1231 RAW_HEAP_OBJECT_IMPLEMENTATION(String); |
1237 | 1232 |
1238 protected: | 1233 protected: |
1239 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } | 1234 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } |
1240 RawSmi* length_; | 1235 RawSmi* length_; |
1241 RawSmi* hash_; | 1236 RawSmi* hash_; |
1242 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); } | 1237 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); } |
1243 | |
1244 friend class HeapTrace; | |
1245 }; | 1238 }; |
1246 | 1239 |
1247 | 1240 |
1248 class RawOneByteString : public RawString { | 1241 class RawOneByteString : public RawString { |
1249 RAW_HEAP_OBJECT_IMPLEMENTATION(OneByteString); | 1242 RAW_HEAP_OBJECT_IMPLEMENTATION(OneByteString); |
1250 | 1243 |
1251 // Variable length data follows here. | 1244 // Variable length data follows here. |
1252 uint8_t data_[0]; | 1245 uint8_t data_[0]; |
1253 | 1246 |
1254 friend class ApiMessageReader; | 1247 friend class ApiMessageReader; |
1255 friend class HeapTrace; | |
1256 friend class SnapshotReader; | 1248 friend class SnapshotReader; |
1257 }; | 1249 }; |
1258 | 1250 |
1259 | 1251 |
1260 class RawTwoByteString : public RawString { | 1252 class RawTwoByteString : public RawString { |
1261 RAW_HEAP_OBJECT_IMPLEMENTATION(TwoByteString); | 1253 RAW_HEAP_OBJECT_IMPLEMENTATION(TwoByteString); |
1262 | 1254 |
1263 // Variable length data follows here. | 1255 // Variable length data follows here. |
1264 uint16_t data_[0]; | 1256 uint16_t data_[0]; |
1265 | 1257 |
1266 friend class HeapTrace; | |
1267 friend class SnapshotReader; | 1258 friend class SnapshotReader; |
1268 }; | 1259 }; |
1269 | 1260 |
1270 | 1261 |
1271 template<typename T> | 1262 template<typename T> |
1272 class ExternalStringData { | 1263 class ExternalStringData { |
1273 public: | 1264 public: |
1274 ExternalStringData(const T* data, void* peer, Dart_PeerFinalizer callback) : | 1265 ExternalStringData(const T* data, void* peer, Dart_PeerFinalizer callback) : |
1275 data_(data), peer_(peer), callback_(callback) { | 1266 data_(data), peer_(peer), callback_(callback) { |
1276 } | 1267 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 friend class RawImmutableArray; | 1327 friend class RawImmutableArray; |
1337 friend class SnapshotReader; | 1328 friend class SnapshotReader; |
1338 friend class GrowableObjectArray; | 1329 friend class GrowableObjectArray; |
1339 friend class Object; | 1330 friend class Object; |
1340 }; | 1331 }; |
1341 | 1332 |
1342 | 1333 |
1343 class RawImmutableArray : public RawArray { | 1334 class RawImmutableArray : public RawArray { |
1344 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray); | 1335 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray); |
1345 | 1336 |
1346 friend class HeapTrace; | |
1347 friend class SnapshotReader; | 1337 friend class SnapshotReader; |
1348 }; | 1338 }; |
1349 | 1339 |
1350 | 1340 |
1351 class RawGrowableObjectArray : public RawInstance { | 1341 class RawGrowableObjectArray : public RawInstance { |
1352 RAW_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray); | 1342 RAW_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray); |
1353 | 1343 |
1354 RawObject** from() { | 1344 RawObject** from() { |
1355 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); | 1345 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); |
1356 } | 1346 } |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 // Make sure this is updated when new TypedData types are added. | 1658 // Make sure this is updated when new TypedData types are added. |
1669 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 12); | 1659 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 12); |
1670 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 13); | 1660 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 13); |
1671 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 12); | 1661 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 12); |
1672 return (kNullCid - kTypedDataInt8ArrayCid); | 1662 return (kNullCid - kTypedDataInt8ArrayCid); |
1673 } | 1663 } |
1674 | 1664 |
1675 } // namespace dart | 1665 } // namespace dart |
1676 | 1666 |
1677 #endif // VM_RAW_OBJECT_H_ | 1667 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |