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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 return ClassIdTag::decode(tags); | 383 return ClassIdTag::decode(tags); |
384 } | 384 } |
385 | 385 |
386 friend class Api; | 386 friend class Api; |
387 friend class Array; | 387 friend class Array; |
388 friend class FreeListElement; | 388 friend class FreeListElement; |
389 friend class GCMarker; | 389 friend class GCMarker; |
390 friend class Heap; | 390 friend class Heap; |
391 friend class HeapProfiler; | 391 friend class HeapProfiler; |
392 friend class HeapProfilerRootVisitor; | 392 friend class HeapProfilerRootVisitor; |
| 393 friend class HeapTrace; |
| 394 friend class HeapTraceDebugObjectVisitor; |
| 395 friend class HeapTraceHandleVisitor; |
| 396 friend class HeapTraceVisitor; |
393 friend class MarkingVisitor; | 397 friend class MarkingVisitor; |
394 friend class Object; | 398 friend class Object; |
395 friend class RawInstructions; | 399 friend class RawInstructions; |
396 friend class RawInstance; | 400 friend class RawInstance; |
397 friend class Scavenger; | 401 friend class Scavenger; |
398 friend class SnapshotReader; | 402 friend class SnapshotReader; |
399 friend class SnapshotWriter; | 403 friend class SnapshotWriter; |
400 friend class String; | 404 friend class String; |
401 | 405 |
402 DISALLOW_ALLOCATION(); | 406 DISALLOW_ALLOCATION(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 440 |
437 cpp_vtable handle_vtable_; | 441 cpp_vtable handle_vtable_; |
438 intptr_t instance_size_in_words_; // Size if fixed len or 0 if variable len. | 442 intptr_t instance_size_in_words_; // Size if fixed len or 0 if variable len. |
439 intptr_t id_; // Class Id, also index in the class table. | 443 intptr_t id_; // Class Id, also index in the class table. |
440 intptr_t type_arguments_field_offset_in_words_; // Offset of type args fld. | 444 intptr_t type_arguments_field_offset_in_words_; // Offset of type args fld. |
441 intptr_t next_field_offset_in_words_; // Offset of the next instance field. | 445 intptr_t next_field_offset_in_words_; // Offset of the next instance field. |
442 intptr_t num_native_fields_; // Number of native fields in class. | 446 intptr_t num_native_fields_; // Number of native fields in class. |
443 intptr_t token_pos_; | 447 intptr_t token_pos_; |
444 uint8_t state_bits_; // state, is_const, is_implemented. | 448 uint8_t state_bits_; // state, is_const, is_implemented. |
445 | 449 |
| 450 friend class HeapTrace; |
446 friend class Instance; | 451 friend class Instance; |
447 friend class Object; | 452 friend class Object; |
448 friend class RawInstance; | 453 friend class RawInstance; |
449 friend class RawInstructions; | 454 friend class RawInstructions; |
450 friend class SnapshotReader; | 455 friend class SnapshotReader; |
451 }; | 456 }; |
452 | 457 |
453 | 458 |
454 class RawUnresolvedClass : public RawObject { | 459 class RawUnresolvedClass : public RawObject { |
455 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass); | 460 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass); |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 | 1133 |
1129 | 1134 |
1130 class RawString : public RawInstance { | 1135 class RawString : public RawInstance { |
1131 RAW_HEAP_OBJECT_IMPLEMENTATION(String); | 1136 RAW_HEAP_OBJECT_IMPLEMENTATION(String); |
1132 | 1137 |
1133 protected: | 1138 protected: |
1134 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } | 1139 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } |
1135 RawSmi* length_; | 1140 RawSmi* length_; |
1136 RawSmi* hash_; | 1141 RawSmi* hash_; |
1137 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); } | 1142 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); } |
| 1143 |
| 1144 friend class HeapTrace; |
1138 }; | 1145 }; |
1139 | 1146 |
1140 | 1147 |
1141 class RawOneByteString : public RawString { | 1148 class RawOneByteString : public RawString { |
1142 RAW_HEAP_OBJECT_IMPLEMENTATION(OneByteString); | 1149 RAW_HEAP_OBJECT_IMPLEMENTATION(OneByteString); |
1143 | 1150 |
1144 // Variable length data follows here. | 1151 // Variable length data follows here. |
1145 uint8_t data_[0]; | 1152 uint8_t data_[0]; |
1146 | 1153 |
| 1154 friend class ApiMessageReader; |
| 1155 friend class HeapTrace; |
1147 friend class SnapshotReader; | 1156 friend class SnapshotReader; |
1148 friend class ApiMessageReader; | |
1149 }; | 1157 }; |
1150 | 1158 |
1151 | 1159 |
1152 class RawTwoByteString : public RawString { | 1160 class RawTwoByteString : public RawString { |
1153 RAW_HEAP_OBJECT_IMPLEMENTATION(TwoByteString); | 1161 RAW_HEAP_OBJECT_IMPLEMENTATION(TwoByteString); |
1154 | 1162 |
1155 // Variable length data follows here. | 1163 // Variable length data follows here. |
1156 uint16_t data_[0]; | 1164 uint16_t data_[0]; |
1157 | 1165 |
| 1166 friend class HeapTrace; |
1158 friend class SnapshotReader; | 1167 friend class SnapshotReader; |
1159 }; | 1168 }; |
1160 | 1169 |
1161 | 1170 |
1162 template<typename T> | 1171 template<typename T> |
1163 class ExternalStringData { | 1172 class ExternalStringData { |
1164 public: | 1173 public: |
1165 ExternalStringData(const T* data, void* peer, Dart_PeerFinalizer callback) : | 1174 ExternalStringData(const T* data, void* peer, Dart_PeerFinalizer callback) : |
1166 data_(data), peer_(peer), callback_(callback) { | 1175 data_(data), peer_(peer), callback_(callback) { |
1167 } | 1176 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 friend class RawImmutableArray; | 1236 friend class RawImmutableArray; |
1228 friend class SnapshotReader; | 1237 friend class SnapshotReader; |
1229 friend class GrowableObjectArray; | 1238 friend class GrowableObjectArray; |
1230 friend class Object; | 1239 friend class Object; |
1231 }; | 1240 }; |
1232 | 1241 |
1233 | 1242 |
1234 class RawImmutableArray : public RawArray { | 1243 class RawImmutableArray : public RawArray { |
1235 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray); | 1244 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray); |
1236 | 1245 |
| 1246 friend class HeapTrace; |
1237 friend class SnapshotReader; | 1247 friend class SnapshotReader; |
1238 }; | 1248 }; |
1239 | 1249 |
1240 | 1250 |
1241 class RawGrowableObjectArray : public RawInstance { | 1251 class RawGrowableObjectArray : public RawInstance { |
1242 RAW_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray); | 1252 RAW_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray); |
1243 | 1253 |
1244 RawObject** from() { | 1254 RawObject** from() { |
1245 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); | 1255 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); |
1246 } | 1256 } |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 kExternalUint64ArrayCid == kExternalInt8ArrayCid + 8 && | 1683 kExternalUint64ArrayCid == kExternalInt8ArrayCid + 8 && |
1674 kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 9 && | 1684 kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 9 && |
1675 kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 10 && | 1685 kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 10 && |
1676 kStacktraceCid == kExternalInt8ArrayCid + 11); | 1686 kStacktraceCid == kExternalInt8ArrayCid + 11); |
1677 return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid); | 1687 return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid); |
1678 } | 1688 } |
1679 | 1689 |
1680 } // namespace dart | 1690 } // namespace dart |
1681 | 1691 |
1682 #endif // VM_RAW_OBJECT_H_ | 1692 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |