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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 return ClassIdTag::decode(tags); | 382 return ClassIdTag::decode(tags); |
383 } | 383 } |
384 | 384 |
385 friend class Api; | 385 friend class Api; |
386 friend class Array; | 386 friend class Array; |
387 friend class FreeListElement; | 387 friend class FreeListElement; |
388 friend class GCMarker; | 388 friend class GCMarker; |
389 friend class Heap; | 389 friend class Heap; |
390 friend class HeapProfiler; | 390 friend class HeapProfiler; |
391 friend class HeapProfilerRootVisitor; | 391 friend class HeapProfilerRootVisitor; |
| 392 friend class HeapTrace; |
| 393 friend class HeapTraceDebugObjectVisitor; |
| 394 friend class HeapTraceHandleVisitor; |
| 395 friend class HeapTraceVisitor; |
392 friend class MarkingVisitor; | 396 friend class MarkingVisitor; |
393 friend class Object; | 397 friend class Object; |
394 friend class RawInstructions; | 398 friend class RawInstructions; |
395 friend class RawInstance; | 399 friend class RawInstance; |
396 friend class Scavenger; | 400 friend class Scavenger; |
397 friend class SnapshotReader; | 401 friend class SnapshotReader; |
398 friend class SnapshotWriter; | 402 friend class SnapshotWriter; |
399 friend class String; | 403 friend class String; |
400 | 404 |
401 DISALLOW_ALLOCATION(); | 405 DISALLOW_ALLOCATION(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 439 |
436 cpp_vtable handle_vtable_; | 440 cpp_vtable handle_vtable_; |
437 intptr_t instance_size_in_words_; // Size if fixed len or 0 if variable len. | 441 intptr_t instance_size_in_words_; // Size if fixed len or 0 if variable len. |
438 intptr_t id_; // Class Id, also index in the class table. | 442 intptr_t id_; // Class Id, also index in the class table. |
439 intptr_t type_arguments_field_offset_in_words_; // Offset of type args fld. | 443 intptr_t type_arguments_field_offset_in_words_; // Offset of type args fld. |
440 intptr_t next_field_offset_in_words_; // Offset of the next instance field. | 444 intptr_t next_field_offset_in_words_; // Offset of the next instance field. |
441 intptr_t num_native_fields_; // Number of native fields in class. | 445 intptr_t num_native_fields_; // Number of native fields in class. |
442 intptr_t token_pos_; | 446 intptr_t token_pos_; |
443 uint8_t state_bits_; // state, is_const, is_implemented. | 447 uint8_t state_bits_; // state, is_const, is_implemented. |
444 | 448 |
| 449 friend class HeapTrace; |
445 friend class Instance; | 450 friend class Instance; |
446 friend class Object; | 451 friend class Object; |
447 friend class RawInstance; | 452 friend class RawInstance; |
448 friend class RawInstructions; | 453 friend class RawInstructions; |
449 friend class SnapshotReader; | 454 friend class SnapshotReader; |
450 }; | 455 }; |
451 | 456 |
452 | 457 |
453 class RawUnresolvedClass : public RawObject { | 458 class RawUnresolvedClass : public RawObject { |
454 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass); | 459 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass); |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 | 1116 |
1112 | 1117 |
1113 class RawString : public RawInstance { | 1118 class RawString : public RawInstance { |
1114 RAW_HEAP_OBJECT_IMPLEMENTATION(String); | 1119 RAW_HEAP_OBJECT_IMPLEMENTATION(String); |
1115 | 1120 |
1116 protected: | 1121 protected: |
1117 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } | 1122 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } |
1118 RawSmi* length_; | 1123 RawSmi* length_; |
1119 RawSmi* hash_; | 1124 RawSmi* hash_; |
1120 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); } | 1125 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); } |
| 1126 |
| 1127 friend class HeapTrace; |
1121 }; | 1128 }; |
1122 | 1129 |
1123 | 1130 |
1124 class RawOneByteString : public RawString { | 1131 class RawOneByteString : public RawString { |
1125 RAW_HEAP_OBJECT_IMPLEMENTATION(OneByteString); | 1132 RAW_HEAP_OBJECT_IMPLEMENTATION(OneByteString); |
1126 | 1133 |
1127 // Variable length data follows here. | 1134 // Variable length data follows here. |
1128 uint8_t data_[0]; | 1135 uint8_t data_[0]; |
1129 | 1136 |
| 1137 friend class ApiMessageReader; |
| 1138 friend class HeapTrace; |
1130 friend class SnapshotReader; | 1139 friend class SnapshotReader; |
1131 friend class ApiMessageReader; | |
1132 }; | 1140 }; |
1133 | 1141 |
1134 | 1142 |
1135 class RawTwoByteString : public RawString { | 1143 class RawTwoByteString : public RawString { |
1136 RAW_HEAP_OBJECT_IMPLEMENTATION(TwoByteString); | 1144 RAW_HEAP_OBJECT_IMPLEMENTATION(TwoByteString); |
1137 | 1145 |
1138 // Variable length data follows here. | 1146 // Variable length data follows here. |
1139 uint16_t data_[0]; | 1147 uint16_t data_[0]; |
1140 | 1148 |
| 1149 friend class HeapTrace; |
1141 friend class SnapshotReader; | 1150 friend class SnapshotReader; |
1142 }; | 1151 }; |
1143 | 1152 |
1144 | 1153 |
1145 template<typename T> | 1154 template<typename T> |
1146 class ExternalStringData { | 1155 class ExternalStringData { |
1147 public: | 1156 public: |
1148 ExternalStringData(const T* data, void* peer, Dart_PeerFinalizer callback) : | 1157 ExternalStringData(const T* data, void* peer, Dart_PeerFinalizer callback) : |
1149 data_(data), peer_(peer), callback_(callback) { | 1158 data_(data), peer_(peer), callback_(callback) { |
1150 } | 1159 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 friend class RawImmutableArray; | 1219 friend class RawImmutableArray; |
1211 friend class SnapshotReader; | 1220 friend class SnapshotReader; |
1212 friend class GrowableObjectArray; | 1221 friend class GrowableObjectArray; |
1213 friend class Object; | 1222 friend class Object; |
1214 }; | 1223 }; |
1215 | 1224 |
1216 | 1225 |
1217 class RawImmutableArray : public RawArray { | 1226 class RawImmutableArray : public RawArray { |
1218 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray); | 1227 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray); |
1219 | 1228 |
| 1229 friend class HeapTrace; |
1220 friend class SnapshotReader; | 1230 friend class SnapshotReader; |
1221 }; | 1231 }; |
1222 | 1232 |
1223 | 1233 |
1224 class RawGrowableObjectArray : public RawInstance { | 1234 class RawGrowableObjectArray : public RawInstance { |
1225 RAW_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray); | 1235 RAW_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray); |
1226 | 1236 |
1227 RawObject** from() { | 1237 RawObject** from() { |
1228 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); | 1238 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); |
1229 } | 1239 } |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1656 kExternalUint64ArrayCid == kExternalInt8ArrayCid + 8 && | 1666 kExternalUint64ArrayCid == kExternalInt8ArrayCid + 8 && |
1657 kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 9 && | 1667 kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 9 && |
1658 kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 10 && | 1668 kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 10 && |
1659 kStacktraceCid == kExternalInt8ArrayCid + 11); | 1669 kStacktraceCid == kExternalInt8ArrayCid + 11); |
1660 return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid); | 1670 return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid); |
1661 } | 1671 } |
1662 | 1672 |
1663 } // namespace dart | 1673 } // namespace dart |
1664 | 1674 |
1665 #endif // VM_RAW_OBJECT_H_ | 1675 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |