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 RUNTIME_VM_RAW_OBJECT_H_ | 5 #ifndef RUNTIME_VM_RAW_OBJECT_H_ |
6 #define RUNTIME_VM_RAW_OBJECT_H_ | 6 #define RUNTIME_VM_RAW_OBJECT_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/atomic.h" | 9 #include "vm/atomic.h" |
10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 class Isolate; | 143 class Isolate; |
144 #define DEFINE_FORWARD_DECLARATION(clazz) class Raw##clazz; | 144 #define DEFINE_FORWARD_DECLARATION(clazz) class Raw##clazz; |
145 CLASS_LIST(DEFINE_FORWARD_DECLARATION) | 145 CLASS_LIST(DEFINE_FORWARD_DECLARATION) |
146 #undef DEFINE_FORWARD_DECLARATION | 146 #undef DEFINE_FORWARD_DECLARATION |
147 | 147 |
148 | 148 |
149 enum ClassId { | 149 enum ClassId { |
150 // Illegal class id. | 150 // Illegal class id. |
151 kIllegalCid = 0, | 151 kIllegalCid = 0, |
152 | 152 |
| 153 // A sentinel used by the vm service's heap snapshots to represent references |
| 154 // from the stack. |
| 155 kStackCid = 1, |
| 156 |
153 // The following entries describes classes for pseudo-objects in the heap | 157 // The following entries describes classes for pseudo-objects in the heap |
154 // that should never be reachable from live objects. Free list elements | 158 // that should never be reachable from live objects. Free list elements |
155 // maintain the free list for old space, and forwarding corpses are used to | 159 // maintain the free list for old space, and forwarding corpses are used to |
156 // implement one-way become. | 160 // implement one-way become. |
157 kFreeListElement, | 161 kFreeListElement, |
158 kForwardingCorpse, | 162 kForwardingCorpse, |
159 | 163 |
160 // List of Ids for predefined classes. | 164 // List of Ids for predefined classes. |
161 #define DEFINE_OBJECT_KIND(clazz) k##clazz##Cid, | 165 #define DEFINE_OBJECT_KIND(clazz) k##clazz##Cid, |
162 CLASS_LIST(DEFINE_OBJECT_KIND) | 166 CLASS_LIST(DEFINE_OBJECT_KIND) |
163 #undef DEFINE_OBJECT_KIND | 167 #undef DEFINE_OBJECT_KIND |
164 | 168 |
165 #define DEFINE_OBJECT_KIND(clazz) kTypedData##clazz##Cid, | 169 #define DEFINE_OBJECT_KIND(clazz) kTypedData##clazz##Cid, |
166 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) | 170 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) |
167 #undef DEFINE_OBJECT_KIND | 171 #undef DEFINE_OBJECT_KIND |
168 | 172 |
169 #define DEFINE_OBJECT_KIND(clazz) kTypedData##clazz##ViewCid, | 173 #define DEFINE_OBJECT_KIND(clazz) kTypedData##clazz##ViewCid, |
170 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) | 174 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) |
171 #undef DEFINE_OBJECT_KIND | 175 #undef DEFINE_OBJECT_KIND |
172 | 176 |
173 kByteDataViewCid, | 177 kByteDataViewCid, |
174 | 178 |
175 #define DEFINE_OBJECT_KIND(clazz) kExternalTypedData##clazz##Cid, | 179 #define DEFINE_OBJECT_KIND(clazz) kExternalTypedData##clazz##Cid, |
176 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) | 180 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) |
177 #undef DEFINE_OBJECT_KIND | 181 #undef DEFINE_OBJECT_KIND |
178 | 182 |
179 kByteBufferCid, | 183 kByteBufferCid, |
180 | 184 |
181 // The following entries do not describe a predefined class, but instead | 185 // The following entries do not describe a predefined class, but instead |
182 // are class indexes for pre-allocated instance (Null, dynamic and Void). | 186 // are class indexes for pre-allocated instances (Null, dynamic and Void). |
183 kNullCid, | 187 kNullCid, |
184 kDynamicCid, | 188 kDynamicCid, |
185 kVoidCid, | 189 kVoidCid, |
186 | 190 |
187 kNumPredefinedCids, | 191 kNumPredefinedCids, |
188 }; | 192 }; |
189 | 193 |
190 enum ObjectAlignment { | 194 enum ObjectAlignment { |
191 // Alignment offsets are used to determine object age. | 195 // Alignment offsets are used to determine object age. |
192 kNewObjectAlignmentOffset = kWordSize, | 196 kNewObjectAlignmentOffset = kWordSize, |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 friend class SnapshotWriter; | 615 friend class SnapshotWriter; |
612 friend class String; | 616 friend class String; |
613 friend class Type; // GetClassId | 617 friend class Type; // GetClassId |
614 friend class TypedData; | 618 friend class TypedData; |
615 friend class TypedDataView; | 619 friend class TypedDataView; |
616 friend class WeakProperty; // StorePointer | 620 friend class WeakProperty; // StorePointer |
617 friend class Instance; // StorePointer | 621 friend class Instance; // StorePointer |
618 friend class StackFrame; // GetCodeObject assertion. | 622 friend class StackFrame; // GetCodeObject assertion. |
619 friend class CodeLookupTableBuilder; // profiler | 623 friend class CodeLookupTableBuilder; // profiler |
620 friend class NativeEntry; // GetClassId | 624 friend class NativeEntry; // GetClassId |
| 625 friend class WritePointerVisitor; // GetClassId |
621 friend class Simulator; | 626 friend class Simulator; |
622 friend class SimulatorHelpers; | 627 friend class SimulatorHelpers; |
623 friend class ObjectLocator; | 628 friend class ObjectLocator; |
624 friend class InstanceMorpher; // GetClassId | 629 friend class InstanceMorpher; // GetClassId |
625 friend class VerifyCanonicalVisitor; | 630 friend class VerifyCanonicalVisitor; |
626 | 631 |
627 DISALLOW_ALLOCATION(); | 632 DISALLOW_ALLOCATION(); |
628 DISALLOW_IMPLICIT_CONSTRUCTORS(RawObject); | 633 DISALLOW_IMPLICIT_CONSTRUCTORS(RawObject); |
629 }; | 634 }; |
630 | 635 |
(...skipping 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2394 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2399 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
2395 kTypedDataInt8ArrayViewCid + 15); | 2400 kTypedDataInt8ArrayViewCid + 15); |
2396 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2401 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
2397 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2402 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
2398 return (kNullCid - kTypedDataInt8ArrayCid); | 2403 return (kNullCid - kTypedDataInt8ArrayCid); |
2399 } | 2404 } |
2400 | 2405 |
2401 } // namespace dart | 2406 } // namespace dart |
2402 | 2407 |
2403 #endif // RUNTIME_VM_RAW_OBJECT_H_ | 2408 #endif // RUNTIME_VM_RAW_OBJECT_H_ |
OLD | NEW |