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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 return ClassIdTag::decode(tags); | 380 return ClassIdTag::decode(tags); |
381 } | 381 } |
382 | 382 |
383 friend class Api; | 383 friend class Api; |
384 friend class Array; | 384 friend class Array; |
385 friend class FreeListElement; | 385 friend class FreeListElement; |
386 friend class GCMarker; | 386 friend class GCMarker; |
387 friend class Heap; | 387 friend class Heap; |
388 friend class HeapProfiler; | 388 friend class HeapProfiler; |
389 friend class HeapProfilerRootVisitor; | 389 friend class HeapProfilerRootVisitor; |
| 390 friend class HeapTrace; |
| 391 friend class HeapTraceDebugObjectVisitor; |
| 392 friend class HeapTraceHandleVisitor; |
| 393 friend class HeapTraceVisitor; |
390 friend class MarkingVisitor; | 394 friend class MarkingVisitor; |
391 friend class Object; | 395 friend class Object; |
392 friend class RawInstructions; | 396 friend class RawInstructions; |
393 friend class RawInstance; | 397 friend class RawInstance; |
394 friend class Scavenger; | 398 friend class Scavenger; |
395 friend class SnapshotReader; | 399 friend class SnapshotReader; |
396 friend class SnapshotWriter; | 400 friend class SnapshotWriter; |
397 friend class String; | 401 friend class String; |
398 | 402 |
399 DISALLOW_ALLOCATION(); | 403 DISALLOW_ALLOCATION(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 | 437 |
434 cpp_vtable handle_vtable_; | 438 cpp_vtable handle_vtable_; |
435 intptr_t instance_size_; // Size if fixed length or 0 if variable length. | 439 intptr_t instance_size_; // Size if fixed length or 0 if variable length. |
436 intptr_t id_; // Class Id, also index in the class table. | 440 intptr_t id_; // Class Id, also index in the class table. |
437 intptr_t type_arguments_field_offset_; // Offset of the type arguments field. | 441 intptr_t type_arguments_field_offset_; // Offset of the type arguments field. |
438 intptr_t next_field_offset_; // Offset of the next instance field. | 442 intptr_t next_field_offset_; // Offset of the next instance field. |
439 intptr_t num_native_fields_; // Number of native fields in class. | 443 intptr_t num_native_fields_; // Number of native fields in class. |
440 intptr_t token_pos_; | 444 intptr_t token_pos_; |
441 uint8_t state_bits_; // state, is_const, is_interface, is_implemented. | 445 uint8_t state_bits_; // state, is_const, is_interface, is_implemented. |
442 | 446 |
| 447 friend class HeapTrace; |
443 friend class Instance; | 448 friend class Instance; |
444 friend class Object; | 449 friend class Object; |
445 friend class RawInstance; | 450 friend class RawInstance; |
446 friend class RawInstructions; | 451 friend class RawInstructions; |
447 friend class SnapshotReader; | 452 friend class SnapshotReader; |
448 }; | 453 }; |
449 | 454 |
450 | 455 |
451 class RawUnresolvedClass : public RawObject { | 456 class RawUnresolvedClass : public RawObject { |
452 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass); | 457 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass); |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 | 1114 |
1110 | 1115 |
1111 class RawString : public RawInstance { | 1116 class RawString : public RawInstance { |
1112 RAW_HEAP_OBJECT_IMPLEMENTATION(String); | 1117 RAW_HEAP_OBJECT_IMPLEMENTATION(String); |
1113 | 1118 |
1114 protected: | 1119 protected: |
1115 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } | 1120 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } |
1116 RawSmi* length_; | 1121 RawSmi* length_; |
1117 RawSmi* hash_; | 1122 RawSmi* hash_; |
1118 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); } | 1123 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); } |
| 1124 |
| 1125 friend class HeapTrace; |
1119 }; | 1126 }; |
1120 | 1127 |
1121 | 1128 |
1122 class RawOneByteString : public RawString { | 1129 class RawOneByteString : public RawString { |
1123 RAW_HEAP_OBJECT_IMPLEMENTATION(OneByteString); | 1130 RAW_HEAP_OBJECT_IMPLEMENTATION(OneByteString); |
1124 | 1131 |
1125 // Variable length data follows here. | 1132 // Variable length data follows here. |
1126 uint8_t data_[0]; | 1133 uint8_t data_[0]; |
1127 | 1134 |
| 1135 friend class ApiMessageReader; |
| 1136 friend class HeapTrace; |
1128 friend class SnapshotReader; | 1137 friend class SnapshotReader; |
1129 friend class ApiMessageReader; | |
1130 }; | 1138 }; |
1131 | 1139 |
1132 | 1140 |
1133 class RawTwoByteString : public RawString { | 1141 class RawTwoByteString : public RawString { |
1134 RAW_HEAP_OBJECT_IMPLEMENTATION(TwoByteString); | 1142 RAW_HEAP_OBJECT_IMPLEMENTATION(TwoByteString); |
1135 | 1143 |
1136 // Variable length data follows here. | 1144 // Variable length data follows here. |
1137 uint16_t data_[0]; | 1145 uint16_t data_[0]; |
1138 | 1146 |
| 1147 friend class HeapTrace; |
1139 friend class SnapshotReader; | 1148 friend class SnapshotReader; |
1140 }; | 1149 }; |
1141 | 1150 |
1142 | 1151 |
1143 template<typename T> | 1152 template<typename T> |
1144 class ExternalStringData { | 1153 class ExternalStringData { |
1145 public: | 1154 public: |
1146 ExternalStringData(const T* data, void* peer, Dart_PeerFinalizer callback) : | 1155 ExternalStringData(const T* data, void* peer, Dart_PeerFinalizer callback) : |
1147 data_(data), peer_(peer), callback_(callback) { | 1156 data_(data), peer_(peer), callback_(callback) { |
1148 } | 1157 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 friend class RawImmutableArray; | 1217 friend class RawImmutableArray; |
1209 friend class SnapshotReader; | 1218 friend class SnapshotReader; |
1210 friend class GrowableObjectArray; | 1219 friend class GrowableObjectArray; |
1211 friend class Object; | 1220 friend class Object; |
1212 }; | 1221 }; |
1213 | 1222 |
1214 | 1223 |
1215 class RawImmutableArray : public RawArray { | 1224 class RawImmutableArray : public RawArray { |
1216 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray); | 1225 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray); |
1217 | 1226 |
| 1227 friend class HeapTrace; |
1218 friend class SnapshotReader; | 1228 friend class SnapshotReader; |
1219 }; | 1229 }; |
1220 | 1230 |
1221 | 1231 |
1222 class RawGrowableObjectArray : public RawInstance { | 1232 class RawGrowableObjectArray : public RawInstance { |
1223 RAW_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray); | 1233 RAW_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray); |
1224 | 1234 |
1225 RawObject** from() { | 1235 RawObject** from() { |
1226 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); | 1236 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); |
1227 } | 1237 } |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1635 kExternalUint64ArrayCid == kExternalInt8ArrayCid + 7 && | 1645 kExternalUint64ArrayCid == kExternalInt8ArrayCid + 7 && |
1636 kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 8 && | 1646 kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 8 && |
1637 kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 9 && | 1647 kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 9 && |
1638 kStacktraceCid == kExternalInt8ArrayCid + 10); | 1648 kStacktraceCid == kExternalInt8ArrayCid + 10); |
1639 return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid); | 1649 return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid); |
1640 } | 1650 } |
1641 | 1651 |
1642 } // namespace dart | 1652 } // namespace dart |
1643 | 1653 |
1644 #endif // VM_RAW_OBJECT_H_ | 1654 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |