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 27 matching lines...) Expand all Loading... |
38 V(LocalVarDescriptors) \ | 38 V(LocalVarDescriptors) \ |
39 V(ExceptionHandlers) \ | 39 V(ExceptionHandlers) \ |
40 V(Context) \ | 40 V(Context) \ |
41 V(ContextScope) \ | 41 V(ContextScope) \ |
42 V(SingleTargetCache) \ | 42 V(SingleTargetCache) \ |
43 V(UnlinkedCall) \ | 43 V(UnlinkedCall) \ |
44 V(ICData) \ | 44 V(ICData) \ |
45 V(MegamorphicCache) \ | 45 V(MegamorphicCache) \ |
46 V(SubtypeTestCache) \ | 46 V(SubtypeTestCache) \ |
47 V(Error) \ | 47 V(Error) \ |
48 V(ApiError) \ | 48 V(ApiError) \ |
49 V(LanguageError) \ | 49 V(LanguageError) \ |
50 V(UnhandledException) \ | 50 V(UnhandledException) \ |
51 V(UnwindError) \ | 51 V(UnwindError) \ |
52 V(Instance) \ | 52 V(Instance) \ |
53 V(LibraryPrefix) \ | 53 V(LibraryPrefix) \ |
54 V(AbstractType) \ | 54 V(AbstractType) \ |
55 V(Type) \ | 55 V(Type) \ |
56 V(TypeRef) \ | 56 V(TypeRef) \ |
57 V(TypeParameter) \ | 57 V(TypeParameter) \ |
58 V(BoundedType) \ | 58 V(BoundedType) \ |
59 V(MixinAppType) \ | 59 V(MixinAppType) \ |
60 V(Closure) \ | 60 V(Closure) \ |
61 V(Number) \ | 61 V(Number) \ |
62 V(Integer) \ | 62 V(Integer) \ |
63 V(Smi) \ | 63 V(Smi) \ |
64 V(Mint) \ | 64 V(Mint) \ |
65 V(Bigint) \ | 65 V(Bigint) \ |
66 V(Double) \ | 66 V(Double) \ |
67 V(Bool) \ | 67 V(Bool) \ |
68 V(GrowableObjectArray) \ | 68 V(GrowableObjectArray) \ |
69 V(Float32x4) \ | 69 V(Float32x4) \ |
70 V(Int32x4) \ | 70 V(Int32x4) \ |
71 V(Float64x2) \ | 71 V(Float64x2) \ |
72 V(TypedData) \ | 72 V(TypedData) \ |
73 V(ExternalTypedData) \ | 73 V(ExternalTypedData) \ |
74 V(Capability) \ | 74 V(Capability) \ |
75 V(ReceivePort) \ | 75 V(ReceivePort) \ |
76 V(SendPort) \ | 76 V(SendPort) \ |
77 V(Stacktrace) \ | 77 V(Stacktrace) \ |
78 V(RegExp) \ | 78 V(RegExp) \ |
79 V(WeakProperty) \ | 79 V(WeakProperty) \ |
80 V(MirrorReference) \ | 80 V(MirrorReference) \ |
81 V(LinkedHashMap) \ | 81 V(LinkedHashMap) \ |
82 V(UserTag) \ | 82 V(UserTag) |
83 | 83 |
84 #define CLASS_LIST_ARRAYS(V) \ | 84 #define CLASS_LIST_ARRAYS(V) \ |
85 V(Array) \ | 85 V(Array) \ |
86 V(ImmutableArray) \ | 86 V(ImmutableArray) |
87 | 87 |
88 #define CLASS_LIST_STRINGS(V) \ | 88 #define CLASS_LIST_STRINGS(V) \ |
89 V(String) \ | 89 V(String) \ |
90 V(OneByteString) \ | 90 V(OneByteString) \ |
91 V(TwoByteString) \ | 91 V(TwoByteString) \ |
92 V(ExternalOneByteString) \ | 92 V(ExternalOneByteString) \ |
93 V(ExternalTwoByteString) | 93 V(ExternalTwoByteString) |
94 | 94 |
95 #define CLASS_LIST_TYPED_DATA(V) \ | 95 #define CLASS_LIST_TYPED_DATA(V) \ |
96 V(Int8Array) \ | 96 V(Int8Array) \ |
97 V(Uint8Array) \ | 97 V(Uint8Array) \ |
98 V(Uint8ClampedArray) \ | 98 V(Uint8ClampedArray) \ |
99 V(Int16Array) \ | 99 V(Int16Array) \ |
100 V(Uint16Array) \ | 100 V(Uint16Array) \ |
101 V(Int32Array) \ | 101 V(Int32Array) \ |
102 V(Uint32Array) \ | 102 V(Uint32Array) \ |
103 V(Int64Array) \ | 103 V(Int64Array) \ |
104 V(Uint64Array) \ | 104 V(Uint64Array) \ |
105 V(Float32Array) \ | 105 V(Float32Array) \ |
106 V(Float64Array) \ | 106 V(Float64Array) \ |
107 V(Float32x4Array) \ | 107 V(Float32x4Array) \ |
108 V(Int32x4Array) \ | 108 V(Int32x4Array) \ |
109 V(Float64x2Array) \ | 109 V(Float64x2Array) |
110 | 110 |
111 #define DART_CLASS_LIST_TYPED_DATA(V) \ | 111 #define DART_CLASS_LIST_TYPED_DATA(V) \ |
112 V(Int8) \ | 112 V(Int8) \ |
113 V(Uint8) \ | 113 V(Uint8) \ |
114 V(Uint8Clamped) \ | 114 V(Uint8Clamped) \ |
115 V(Int16) \ | 115 V(Int16) \ |
116 V(Uint16) \ | 116 V(Uint16) \ |
117 V(Int32) \ | 117 V(Int32) \ |
118 V(Uint32) \ | 118 V(Uint32) \ |
119 V(Int64) \ | 119 V(Int64) \ |
(...skipping 14 matching lines...) Expand all Loading... |
134 CLASS_LIST_ARRAYS(V) \ | 134 CLASS_LIST_ARRAYS(V) \ |
135 CLASS_LIST_STRINGS(V) | 135 CLASS_LIST_STRINGS(V) |
136 | 136 |
137 #define CLASS_LIST(V) \ | 137 #define CLASS_LIST(V) \ |
138 V(Object) \ | 138 V(Object) \ |
139 CLASS_LIST_NO_OBJECT(V) | 139 CLASS_LIST_NO_OBJECT(V) |
140 | 140 |
141 | 141 |
142 // Forward declarations. | 142 // Forward declarations. |
143 class Isolate; | 143 class Isolate; |
144 #define DEFINE_FORWARD_DECLARATION(clazz) \ | 144 #define DEFINE_FORWARD_DECLARATION(clazz) class Raw##clazz; |
145 class Raw##clazz; | |
146 CLASS_LIST(DEFINE_FORWARD_DECLARATION) | 145 CLASS_LIST(DEFINE_FORWARD_DECLARATION) |
147 #undef DEFINE_FORWARD_DECLARATION | 146 #undef DEFINE_FORWARD_DECLARATION |
148 | 147 |
149 | 148 |
150 enum ClassId { | 149 enum ClassId { |
151 // Illegal class id. | 150 // Illegal class id. |
152 kIllegalCid = 0, | 151 kIllegalCid = 0, |
153 | 152 |
154 // The following entries describes classes for pseudo-objects in the heap | 153 // The following entries describes classes for pseudo-objects in the heap |
155 // that should never be reachable from live objects. Free list elements | 154 // that should never be reachable from live objects. Free list elements |
156 // maintain the free list for old space, and forwarding corpses are used to | 155 // maintain the free list for old space, and forwarding corpses are used to |
157 // implement one-way become. | 156 // implement one-way become. |
158 kFreeListElement, | 157 kFreeListElement, |
159 kForwardingCorpse, | 158 kForwardingCorpse, |
160 | 159 |
161 // List of Ids for predefined classes. | 160 // List of Ids for predefined classes. |
162 #define DEFINE_OBJECT_KIND(clazz) \ | 161 #define DEFINE_OBJECT_KIND(clazz) k##clazz##Cid, |
163 k##clazz##Cid, | 162 CLASS_LIST(DEFINE_OBJECT_KIND) |
164 CLASS_LIST(DEFINE_OBJECT_KIND) | |
165 #undef DEFINE_OBJECT_KIND | 163 #undef DEFINE_OBJECT_KIND |
166 | 164 |
167 #define DEFINE_OBJECT_KIND(clazz) \ | 165 #define DEFINE_OBJECT_KIND(clazz) kTypedData##clazz##Cid, |
168 kTypedData##clazz##Cid, | 166 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) |
169 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) | |
170 #undef DEFINE_OBJECT_KIND | 167 #undef DEFINE_OBJECT_KIND |
171 | 168 |
172 #define DEFINE_OBJECT_KIND(clazz) \ | 169 #define DEFINE_OBJECT_KIND(clazz) kTypedData##clazz##ViewCid, |
173 kTypedData##clazz##ViewCid, | 170 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) |
174 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) | |
175 #undef DEFINE_OBJECT_KIND | 171 #undef DEFINE_OBJECT_KIND |
176 | 172 |
177 kByteDataViewCid, | 173 kByteDataViewCid, |
178 | 174 |
179 #define DEFINE_OBJECT_KIND(clazz) \ | 175 #define DEFINE_OBJECT_KIND(clazz) kExternalTypedData##clazz##Cid, |
180 kExternalTypedData##clazz##Cid, | 176 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) |
181 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) | |
182 #undef DEFINE_OBJECT_KIND | 177 #undef DEFINE_OBJECT_KIND |
183 | 178 |
184 kByteBufferCid, | 179 kByteBufferCid, |
185 | 180 |
186 // The following entries do not describe a predefined class, but instead | 181 // The following entries do not describe a predefined class, but instead |
187 // are class indexes for pre-allocated instance (Null, dynamic and Void). | 182 // are class indexes for pre-allocated instance (Null, dynamic and Void). |
188 kNullCid, | 183 kNullCid, |
189 kDynamicCid, | 184 kDynamicCid, |
190 kVoidCid, | 185 kVoidCid, |
191 | 186 |
192 kNumPredefinedCids, | 187 kNumPredefinedCids, |
193 }; | 188 }; |
194 | 189 |
(...skipping 10 matching lines...) Expand all Loading... |
205 enum { | 200 enum { |
206 kSmiTag = 0, | 201 kSmiTag = 0, |
207 kHeapObjectTag = 1, | 202 kHeapObjectTag = 1, |
208 kSmiTagSize = 1, | 203 kSmiTagSize = 1, |
209 kSmiTagMask = 1, | 204 kSmiTagMask = 1, |
210 kSmiTagShift = 1, | 205 kSmiTagShift = 1, |
211 }; | 206 }; |
212 | 207 |
213 enum TypedDataElementType { | 208 enum TypedDataElementType { |
214 #define V(name) k##name##Element, | 209 #define V(name) k##name##Element, |
215 CLASS_LIST_TYPED_DATA(V) | 210 CLASS_LIST_TYPED_DATA(V) |
216 #undef V | 211 #undef V |
217 }; | 212 }; |
218 | 213 |
219 #define SNAPSHOT_WRITER_SUPPORT() \ | 214 #define SNAPSHOT_WRITER_SUPPORT() \ |
220 void WriteTo( \ | 215 void WriteTo(SnapshotWriter* writer, intptr_t object_id, \ |
221 SnapshotWriter* writer, intptr_t object_id, \ | 216 Snapshot::Kind kind, bool as_reference); \ |
222 Snapshot::Kind kind, bool as_reference); \ | 217 friend class SnapshotWriter; |
223 friend class SnapshotWriter; \ | |
224 | 218 |
225 #define VISITOR_SUPPORT(object) \ | 219 #define VISITOR_SUPPORT(object) \ |
226 static intptr_t Visit##object##Pointers(Raw##object* raw_obj, \ | 220 static intptr_t Visit##object##Pointers(Raw##object* raw_obj, \ |
227 ObjectPointerVisitor* visitor); | 221 ObjectPointerVisitor* visitor); |
228 | 222 |
229 #define HEAP_PROFILER_SUPPORT() \ | 223 #define HEAP_PROFILER_SUPPORT() friend class HeapProfiler; |
230 friend class HeapProfiler; \ | |
231 | 224 |
232 #define RAW_OBJECT_IMPLEMENTATION(object) \ | 225 #define RAW_OBJECT_IMPLEMENTATION(object) \ |
233 private: /* NOLINT */ \ | 226 private: /* NOLINT */ \ |
234 VISITOR_SUPPORT(object) \ | 227 VISITOR_SUPPORT(object) \ |
235 friend class object; \ | 228 friend class object; \ |
236 friend class RawObject; \ | 229 friend class RawObject; \ |
237 friend class Heap; \ | 230 friend class Heap; \ |
238 friend class Simulator; \ | 231 friend class Simulator; \ |
239 friend class SimulatorHelpers; \ | 232 friend class SimulatorHelpers; \ |
240 DISALLOW_ALLOCATION(); \ | 233 DISALLOW_ALLOCATION(); \ |
241 DISALLOW_IMPLICIT_CONSTRUCTORS(Raw##object) | 234 DISALLOW_IMPLICIT_CONSTRUCTORS(Raw##object) |
242 | 235 |
243 // TODO(koda): Make ptr() return const*, like Object::raw_ptr(). | 236 // TODO(koda): Make ptr() return const*, like Object::raw_ptr(). |
244 #define RAW_HEAP_OBJECT_IMPLEMENTATION(object) \ | 237 #define RAW_HEAP_OBJECT_IMPLEMENTATION(object) \ |
245 private: \ | 238 private: \ |
246 RAW_OBJECT_IMPLEMENTATION(object); \ | 239 RAW_OBJECT_IMPLEMENTATION(object); \ |
247 Raw##object* ptr() const { \ | 240 Raw##object* ptr() const { \ |
248 ASSERT(IsHeapObject()); \ | 241 ASSERT(IsHeapObject()); \ |
249 return reinterpret_cast<Raw##object*>( \ | 242 return reinterpret_cast<Raw##object*>(reinterpret_cast<uword>(this) - \ |
250 reinterpret_cast<uword>(this) - kHeapObjectTag); \ | 243 kHeapObjectTag); \ |
251 } \ | 244 } \ |
252 SNAPSHOT_WRITER_SUPPORT() \ | 245 SNAPSHOT_WRITER_SUPPORT() \ |
253 HEAP_PROFILER_SUPPORT() \ | 246 HEAP_PROFILER_SUPPORT() \ |
254 friend class object##SerializationCluster; \ | 247 friend class object##SerializationCluster; \ |
255 friend class object##DeserializationCluster; \ | 248 friend class object##DeserializationCluster; |
256 | 249 |
257 // RawObject is the base class of all raw objects; even though it carries the | 250 // RawObject is the base class of all raw objects; even though it carries the |
258 // tags_ field not all raw objects are allocated in the heap and thus cannot | 251 // tags_ field not all raw objects are allocated in the heap and thus cannot |
259 // be dereferenced (e.g. RawSmi). | 252 // be dereferenced (e.g. RawSmi). |
260 class RawObject { | 253 class RawObject { |
261 public: | 254 public: |
262 // The tags field which is a part of the object header uses the following | 255 // The tags field which is a part of the object header uses the following |
263 // bit fields for storing tags. | 256 // bit fields for storing tags. |
264 enum TagBits { | 257 enum TagBits { |
265 kMarkBit = 0, | 258 kMarkBit = 0, |
(...skipping 16 matching lines...) Expand all Loading... |
282 #else | 275 #else |
283 #error Unexpected architecture word size | 276 #error Unexpected architecture word size |
284 #endif | 277 #endif |
285 }; | 278 }; |
286 | 279 |
287 COMPILE_ASSERT(kClassIdTagSize == (sizeof(classid_t) * kBitsPerByte)); | 280 COMPILE_ASSERT(kClassIdTagSize == (sizeof(classid_t) * kBitsPerByte)); |
288 | 281 |
289 // Encodes the object size in the tag in units of object alignment. | 282 // Encodes the object size in the tag in units of object alignment. |
290 class SizeTag { | 283 class SizeTag { |
291 public: | 284 public: |
292 static const intptr_t kMaxSizeTag = | 285 static const intptr_t kMaxSizeTag = ((1 << RawObject::kSizeTagSize) - 1) |
293 ((1 << RawObject::kSizeTagSize) - 1) << kObjectAlignmentLog2; | 286 << kObjectAlignmentLog2; |
294 | 287 |
295 static uword encode(intptr_t size) { | 288 static uword encode(intptr_t size) { |
296 return SizeBits::encode(SizeToTagValue(size)); | 289 return SizeBits::encode(SizeToTagValue(size)); |
297 } | 290 } |
298 | 291 |
299 static intptr_t decode(uword tag) { | 292 static intptr_t decode(uword tag) { |
300 return TagValueToSize(SizeBits::decode(tag)); | 293 return TagValueToSize(SizeBits::decode(tag)); |
301 } | 294 } |
302 | 295 |
303 static uword update(intptr_t size, uword tag) { | 296 static uword update(intptr_t size, uword tag) { |
304 return SizeBits::update(SizeToTagValue(size), tag); | 297 return SizeBits::update(SizeToTagValue(size), tag); |
305 } | 298 } |
306 | 299 |
307 private: | 300 private: |
308 // The actual unscaled bit field used within the tag field. | 301 // The actual unscaled bit field used within the tag field. |
309 class SizeBits : | 302 class SizeBits |
310 public BitField<uword, intptr_t, kSizeTagPos, kSizeTagSize> {}; | 303 : public BitField<uword, intptr_t, kSizeTagPos, kSizeTagSize> {}; |
311 | 304 |
312 static intptr_t SizeToTagValue(intptr_t size) { | 305 static intptr_t SizeToTagValue(intptr_t size) { |
313 ASSERT(Utils::IsAligned(size, kObjectAlignment)); | 306 ASSERT(Utils::IsAligned(size, kObjectAlignment)); |
314 return (size > kMaxSizeTag) ? 0 : (size >> kObjectAlignmentLog2); | 307 return (size > kMaxSizeTag) ? 0 : (size >> kObjectAlignmentLog2); |
315 } | 308 } |
316 static intptr_t TagValueToSize(intptr_t value) { | 309 static intptr_t TagValueToSize(intptr_t value) { |
317 return value << kObjectAlignmentLog2; | 310 return value << kObjectAlignmentLog2; |
318 } | 311 } |
319 }; | 312 }; |
320 | 313 |
321 class ClassIdTag : | 314 class ClassIdTag |
322 public BitField<uword, intptr_t, kClassIdTagPos, kClassIdTagSize> {}; | 315 : public BitField<uword, intptr_t, kClassIdTagPos, kClassIdTagSize> {}; |
323 | 316 |
324 bool IsWellFormed() const { | 317 bool IsWellFormed() const { |
325 uword value = reinterpret_cast<uword>(this); | 318 uword value = reinterpret_cast<uword>(this); |
326 return (value & kSmiTagMask) == 0 || | 319 return (value & kSmiTagMask) == 0 || |
327 Utils::IsAligned(value - kHeapObjectTag, kWordSize); | 320 Utils::IsAligned(value - kHeapObjectTag, kWordSize); |
328 } | 321 } |
329 bool IsHeapObject() const { | 322 bool IsHeapObject() const { |
330 ASSERT(IsWellFormed()); | 323 ASSERT(IsWellFormed()); |
331 uword value = reinterpret_cast<uword>(this); | 324 uword value = reinterpret_cast<uword>(this); |
332 return (value & kSmiTagMask) == kHeapObjectTag; | 325 return (value & kSmiTagMask) == kHeapObjectTag; |
333 } | 326 } |
334 // Assumes this is a heap object. | 327 // Assumes this is a heap object. |
335 bool IsNewObject() const { | 328 bool IsNewObject() const { |
336 ASSERT(IsHeapObject()); | 329 ASSERT(IsHeapObject()); |
337 uword addr = reinterpret_cast<uword>(this); | 330 uword addr = reinterpret_cast<uword>(this); |
(...skipping 11 matching lines...) Expand all Loading... |
349 ASSERT(IsWellFormed()); | 342 ASSERT(IsWellFormed()); |
350 COMPILE_ASSERT(kHeapObjectTag == 1); | 343 COMPILE_ASSERT(kHeapObjectTag == 1); |
351 COMPILE_ASSERT(kNewObjectAlignmentOffset == kWordSize); | 344 COMPILE_ASSERT(kNewObjectAlignmentOffset == kWordSize); |
352 static const uword kNewObjectBits = | 345 static const uword kNewObjectBits = |
353 (kNewObjectAlignmentOffset | kHeapObjectTag); | 346 (kNewObjectAlignmentOffset | kHeapObjectTag); |
354 const uword addr = reinterpret_cast<uword>(this); | 347 const uword addr = reinterpret_cast<uword>(this); |
355 return (addr & kNewObjectBits) != kNewObjectBits; | 348 return (addr & kNewObjectBits) != kNewObjectBits; |
356 } | 349 } |
357 | 350 |
358 // Support for GC marking bit. | 351 // Support for GC marking bit. |
359 bool IsMarked() const { | 352 bool IsMarked() const { return MarkBit::decode(ptr()->tags_); } |
360 return MarkBit::decode(ptr()->tags_); | |
361 } | |
362 void SetMarkBit() { | 353 void SetMarkBit() { |
363 ASSERT(!IsMarked()); | 354 ASSERT(!IsMarked()); |
364 UpdateTagBit<MarkBit>(true); | 355 UpdateTagBit<MarkBit>(true); |
365 } | 356 } |
366 void SetMarkBitUnsynchronized() { | 357 void SetMarkBitUnsynchronized() { |
367 ASSERT(!IsMarked()); | 358 ASSERT(!IsMarked()); |
368 uword tags = ptr()->tags_; | 359 uword tags = ptr()->tags_; |
369 ptr()->tags_ = MarkBit::update(true, tags); | 360 ptr()->tags_ = MarkBit::update(true, tags); |
370 } | 361 } |
371 void ClearMarkBit() { | 362 void ClearMarkBit() { |
372 ASSERT(IsMarked()); | 363 ASSERT(IsMarked()); |
373 UpdateTagBit<MarkBit>(false); | 364 UpdateTagBit<MarkBit>(false); |
374 } | 365 } |
375 // Returns false if the bit was already set. | 366 // Returns false if the bit was already set. |
376 // TODO(koda): Add "must use result" annotation here, after we add support. | 367 // TODO(koda): Add "must use result" annotation here, after we add support. |
377 bool TryAcquireMarkBit() { | 368 bool TryAcquireMarkBit() { return TryAcquireTagBit<MarkBit>(); } |
378 return TryAcquireTagBit<MarkBit>(); | |
379 } | |
380 | 369 |
381 // Support for object tags. | 370 // Support for object tags. |
382 bool IsCanonical() const { | 371 bool IsCanonical() const { return CanonicalObjectTag::decode(ptr()->tags_); } |
383 return CanonicalObjectTag::decode(ptr()->tags_); | 372 void SetCanonical() { UpdateTagBit<CanonicalObjectTag>(true); } |
384 } | 373 void ClearCanonical() { UpdateTagBit<CanonicalObjectTag>(false); } |
385 void SetCanonical() { | 374 bool IsVMHeapObject() const { return VMHeapObjectTag::decode(ptr()->tags_); } |
386 UpdateTagBit<CanonicalObjectTag>(true); | 375 void SetVMHeapObject() { UpdateTagBit<VMHeapObjectTag>(true); } |
387 } | |
388 void ClearCanonical() { | |
389 UpdateTagBit<CanonicalObjectTag>(false); | |
390 } | |
391 bool IsVMHeapObject() const { | |
392 return VMHeapObjectTag::decode(ptr()->tags_); | |
393 } | |
394 void SetVMHeapObject() { | |
395 UpdateTagBit<VMHeapObjectTag>(true); | |
396 } | |
397 | 376 |
398 // Support for GC remembered bit. | 377 // Support for GC remembered bit. |
399 bool IsRemembered() const { | 378 bool IsRemembered() const { return RememberedBit::decode(ptr()->tags_); } |
400 return RememberedBit::decode(ptr()->tags_); | |
401 } | |
402 void SetRememberedBit() { | 379 void SetRememberedBit() { |
403 ASSERT(!IsRemembered()); | 380 ASSERT(!IsRemembered()); |
404 UpdateTagBit<RememberedBit>(true); | 381 UpdateTagBit<RememberedBit>(true); |
405 } | 382 } |
406 void SetRememberedBitUnsynchronized() { | 383 void SetRememberedBitUnsynchronized() { |
407 ASSERT(!IsRemembered()); | 384 ASSERT(!IsRemembered()); |
408 uword tags = ptr()->tags_; | 385 uword tags = ptr()->tags_; |
409 ptr()->tags_ = RememberedBit::update(true, tags); | 386 ptr()->tags_ = RememberedBit::update(true, tags); |
410 } | 387 } |
411 void ClearRememberedBit() { | 388 void ClearRememberedBit() { UpdateTagBit<RememberedBit>(false); } |
412 UpdateTagBit<RememberedBit>(false); | |
413 } | |
414 void ClearRememberedBitUnsynchronized() { | 389 void ClearRememberedBitUnsynchronized() { |
415 uword tags = ptr()->tags_; | 390 uword tags = ptr()->tags_; |
416 ptr()->tags_ = RememberedBit::update(false, tags); | 391 ptr()->tags_ = RememberedBit::update(false, tags); |
417 } | 392 } |
418 // Returns false if the bit was already set. | 393 // Returns false if the bit was already set. |
419 // TODO(koda): Add "must use result" annotation here, after we add support. | 394 // TODO(koda): Add "must use result" annotation here, after we add support. |
420 bool TryAcquireRememberedBit() { | 395 bool TryAcquireRememberedBit() { return TryAcquireTagBit<RememberedBit>(); } |
421 return TryAcquireTagBit<RememberedBit>(); | |
422 } | |
423 | 396 |
424 #define DEFINE_IS_CID(clazz) \ | 397 #define DEFINE_IS_CID(clazz) \ |
425 bool Is##clazz() const { return ((GetClassId() == k##clazz##Cid)); } | 398 bool Is##clazz() const { return ((GetClassId() == k##clazz##Cid)); } |
426 CLASS_LIST(DEFINE_IS_CID) | 399 CLASS_LIST(DEFINE_IS_CID) |
427 #undef DEFINE_IS_CID | 400 #undef DEFINE_IS_CID |
428 | 401 |
429 #define DEFINE_IS_CID(clazz) \ | 402 #define DEFINE_IS_CID(clazz) \ |
430 bool IsTypedData##clazz() const { \ | 403 bool IsTypedData##clazz() const { \ |
431 return ((GetClassId() == kTypedData##clazz##Cid)); \ | 404 return ((GetClassId() == kTypedData##clazz##Cid)); \ |
432 } \ | 405 } \ |
433 bool IsTypedDataView##clazz() const { \ | 406 bool IsTypedDataView##clazz() const { \ |
434 return ((GetClassId() == kTypedData##clazz##ViewCid)); \ | 407 return ((GetClassId() == kTypedData##clazz##ViewCid)); \ |
435 } \ | 408 } \ |
436 bool IsExternalTypedData##clazz() const { \ | 409 bool IsExternalTypedData##clazz() const { \ |
437 return ((GetClassId() == kExternalTypedData##clazz##Cid)); \ | 410 return ((GetClassId() == kExternalTypedData##clazz##Cid)); \ |
438 } | 411 } |
439 CLASS_LIST_TYPED_DATA(DEFINE_IS_CID) | 412 CLASS_LIST_TYPED_DATA(DEFINE_IS_CID) |
440 #undef DEFINE_IS_CID | 413 #undef DEFINE_IS_CID |
441 | 414 |
442 bool IsStringInstance() const { | 415 bool IsStringInstance() const { return IsStringClassId(GetClassId()); } |
443 return IsStringClassId(GetClassId()); | |
444 } | |
445 bool IsDartInstance() const { | 416 bool IsDartInstance() const { |
446 return (!IsHeapObject() || (GetClassId() >= kInstanceCid)); | 417 return (!IsHeapObject() || (GetClassId() >= kInstanceCid)); |
447 } | 418 } |
448 bool IsFreeListElement() const { | 419 bool IsFreeListElement() const { |
449 return ((GetClassId() == kFreeListElement)); | 420 return ((GetClassId() == kFreeListElement)); |
450 } | 421 } |
451 bool IsForwardingCorpse() const { | 422 bool IsForwardingCorpse() const { |
452 return ((GetClassId() == kForwardingCorpse)); | 423 return ((GetClassId() == kForwardingCorpse)); |
453 } | 424 } |
454 bool IsPseudoObject() const { | 425 bool IsPseudoObject() const { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 uword tags_; // Various object tags (bits). | 488 uword tags_; // Various object tags (bits). |
518 | 489 |
519 class MarkBit : public BitField<uword, bool, kMarkBit, 1> {}; | 490 class MarkBit : public BitField<uword, bool, kMarkBit, 1> {}; |
520 | 491 |
521 class RememberedBit : public BitField<uword, bool, kRememberedBit, 1> {}; | 492 class RememberedBit : public BitField<uword, bool, kRememberedBit, 1> {}; |
522 | 493 |
523 class CanonicalObjectTag : public BitField<uword, bool, kCanonicalBit, 1> {}; | 494 class CanonicalObjectTag : public BitField<uword, bool, kCanonicalBit, 1> {}; |
524 | 495 |
525 class VMHeapObjectTag : public BitField<uword, bool, kVMHeapObjectBit, 1> {}; | 496 class VMHeapObjectTag : public BitField<uword, bool, kVMHeapObjectBit, 1> {}; |
526 | 497 |
527 class ReservedBits : public | 498 class ReservedBits |
528 BitField<uword, intptr_t, kReservedTagPos, kReservedTagSize> {}; | 499 : public BitField<uword, intptr_t, kReservedTagPos, kReservedTagSize> {}; |
529 | 500 |
530 // TODO(koda): After handling tags_, return const*, like Object::raw_ptr(). | 501 // TODO(koda): After handling tags_, return const*, like Object::raw_ptr(). |
531 RawObject* ptr() const { | 502 RawObject* ptr() const { |
532 ASSERT(IsHeapObject()); | 503 ASSERT(IsHeapObject()); |
533 return reinterpret_cast<RawObject*>( | 504 return reinterpret_cast<RawObject*>(reinterpret_cast<uword>(this) - |
534 reinterpret_cast<uword>(this) - kHeapObjectTag); | 505 kHeapObjectTag); |
535 } | 506 } |
536 | 507 |
537 intptr_t SizeFromClass() const; | 508 intptr_t SizeFromClass() const; |
538 | 509 |
539 intptr_t GetClassId() const { | 510 intptr_t GetClassId() const { |
540 uword tags = ptr()->tags_; | 511 uword tags = ptr()->tags_; |
541 return ClassIdTag::decode(tags); | 512 return ClassIdTag::decode(tags); |
542 } | 513 } |
543 | 514 |
544 void SetClassId(intptr_t new_cid) { | 515 void SetClassId(intptr_t new_cid) { |
545 uword tags = ptr()->tags_; | 516 uword tags = ptr()->tags_; |
546 ptr()->tags_ = ClassIdTag::update(new_cid, tags); | 517 ptr()->tags_ = ClassIdTag::update(new_cid, tags); |
547 } | 518 } |
548 | 519 |
549 template<class TagBitField> | 520 template <class TagBitField> |
550 void UpdateTagBit(bool value) { | 521 void UpdateTagBit(bool value) { |
551 uword tags = ptr()->tags_; | 522 uword tags = ptr()->tags_; |
552 uword old_tags; | 523 uword old_tags; |
553 do { | 524 do { |
554 old_tags = tags; | 525 old_tags = tags; |
555 uword new_tags = TagBitField::update(value, old_tags); | 526 uword new_tags = TagBitField::update(value, old_tags); |
556 tags = AtomicOperations::CompareAndSwapWord( | 527 tags = AtomicOperations::CompareAndSwapWord(&ptr()->tags_, old_tags, |
557 &ptr()->tags_, old_tags, new_tags); | 528 new_tags); |
558 } while (tags != old_tags); | 529 } while (tags != old_tags); |
559 } | 530 } |
560 | 531 |
561 template<class TagBitField> | 532 template <class TagBitField> |
562 bool TryAcquireTagBit() { | 533 bool TryAcquireTagBit() { |
563 uword tags = ptr()->tags_; | 534 uword tags = ptr()->tags_; |
564 uword old_tags; | 535 uword old_tags; |
565 do { | 536 do { |
566 old_tags = tags; | 537 old_tags = tags; |
567 if (TagBitField::decode(tags)) return false; | 538 if (TagBitField::decode(tags)) return false; |
568 uword new_tags = TagBitField::update(true, old_tags); | 539 uword new_tags = TagBitField::update(true, old_tags); |
569 tags = AtomicOperations::CompareAndSwapWord( | 540 tags = AtomicOperations::CompareAndSwapWord(&ptr()->tags_, old_tags, |
570 &ptr()->tags_, old_tags, new_tags); | 541 new_tags); |
571 } while (tags != old_tags); | 542 } while (tags != old_tags); |
572 return true; | 543 return true; |
573 } | 544 } |
574 | 545 |
575 // All writes to heap objects should ultimately pass through one of the | 546 // All writes to heap objects should ultimately pass through one of the |
576 // methods below or their counterparts in Object, to ensure that the | 547 // methods below or their counterparts in Object, to ensure that the |
577 // write barrier is correctly applied. | 548 // write barrier is correctly applied. |
578 | 549 |
579 template<typename type> | 550 template <typename type> |
580 void StorePointer(type const* addr, type value) { | 551 void StorePointer(type const* addr, type value) { |
581 *const_cast<type*>(addr) = value; | 552 *const_cast<type*>(addr) = value; |
582 // Filter stores based on source and target. | 553 // Filter stores based on source and target. |
583 if (!value->IsHeapObject()) return; | 554 if (!value->IsHeapObject()) return; |
584 if (value->IsNewObject() && this->IsOldObject() && | 555 if (value->IsNewObject() && this->IsOldObject() && !this->IsRemembered()) { |
585 !this->IsRemembered()) { | |
586 this->SetRememberedBit(); | 556 this->SetRememberedBit(); |
587 Thread::Current()->StoreBufferAddObject(this); | 557 Thread::Current()->StoreBufferAddObject(this); |
588 } | 558 } |
589 } | 559 } |
590 | 560 |
591 // Use for storing into an explicitly Smi-typed field of an object | 561 // Use for storing into an explicitly Smi-typed field of an object |
592 // (i.e., both the previous and new value are Smis). | 562 // (i.e., both the previous and new value are Smis). |
593 void StoreSmi(RawSmi* const* addr, RawSmi* value) { | 563 void StoreSmi(RawSmi* const* addr, RawSmi* value) { |
594 // Can't use Contains, as array length is initialized through this method. | 564 // Can't use Contains, as array length is initialized through this method. |
595 ASSERT(reinterpret_cast<uword>(addr) >= RawObject::ToAddr(this)); | 565 ASSERT(reinterpret_cast<uword>(addr) >= RawObject::ToAddr(this)); |
596 *const_cast<RawSmi**>(addr) = value; | 566 *const_cast<RawSmi**>(addr) = value; |
597 } | 567 } |
598 | 568 |
599 friend class Api; | 569 friend class Api; |
600 friend class ApiMessageReader; // GetClassId | 570 friend class ApiMessageReader; // GetClassId |
601 friend class Serializer; // GetClassId | 571 friend class Serializer; // GetClassId |
602 friend class Array; | 572 friend class Array; |
603 friend class Become; // GetClassId | 573 friend class Become; // GetClassId |
604 friend class Bigint; | 574 friend class Bigint; |
605 friend class ByteBuffer; | 575 friend class ByteBuffer; |
606 friend class CidRewriteVisitor; | 576 friend class CidRewriteVisitor; |
607 friend class Closure; | 577 friend class Closure; |
608 friend class Code; | 578 friend class Code; |
609 friend class Double; | 579 friend class Double; |
610 friend class ForwardPointersVisitor; // StorePointer | 580 friend class ForwardPointersVisitor; // StorePointer |
611 friend class FreeListElement; | 581 friend class FreeListElement; |
612 friend class Function; | 582 friend class Function; |
613 friend class GCMarker; | 583 friend class GCMarker; |
614 friend class ExternalTypedData; | 584 friend class ExternalTypedData; |
615 friend class ForwardList; | 585 friend class ForwardList; |
616 friend class GrowableObjectArray; // StorePointer | 586 friend class GrowableObjectArray; // StorePointer |
617 friend class Heap; | 587 friend class Heap; |
618 friend class HeapMapAsJSONVisitor; | 588 friend class HeapMapAsJSONVisitor; |
619 friend class ClassStatsVisitor; | 589 friend class ClassStatsVisitor; |
620 template<bool> friend class MarkingVisitorBase; | 590 template <bool> |
| 591 friend class MarkingVisitorBase; |
621 friend class Mint; | 592 friend class Mint; |
622 friend class Object; | 593 friend class Object; |
623 friend class OneByteString; // StoreSmi | 594 friend class OneByteString; // StoreSmi |
624 friend class RawCode; | 595 friend class RawCode; |
625 friend class RawExternalTypedData; | 596 friend class RawExternalTypedData; |
626 friend class RawInstructions; | 597 friend class RawInstructions; |
627 friend class RawInstance; | 598 friend class RawInstance; |
628 friend class RawTypedData; | 599 friend class RawTypedData; |
629 friend class Scavenger; | 600 friend class Scavenger; |
630 friend class ScavengerVisitor; | 601 friend class ScavengerVisitor; |
631 friend class SizeExcludingClassVisitor; // GetClassId | 602 friend class SizeExcludingClassVisitor; // GetClassId |
632 friend class InstanceAccumulator; // GetClassId | 603 friend class InstanceAccumulator; // GetClassId |
633 friend class RetainingPathVisitor; // GetClassId | 604 friend class RetainingPathVisitor; // GetClassId |
634 friend class SkippedCodeFunctions; // StorePointer | 605 friend class SkippedCodeFunctions; // StorePointer |
635 friend class InstructionsReader; // tags_ check | 606 friend class InstructionsReader; // tags_ check |
636 friend class AssemblyInstructionsWriter; | 607 friend class AssemblyInstructionsWriter; |
637 friend class BlobInstructionsWriter; | 608 friend class BlobInstructionsWriter; |
638 friend class SnapshotReader; | 609 friend class SnapshotReader; |
639 friend class Deserializer; | 610 friend class Deserializer; |
640 friend class SnapshotWriter; | 611 friend class SnapshotWriter; |
641 friend class String; | 612 friend class String; |
642 friend class Type; // GetClassId | 613 friend class Type; // GetClassId |
643 friend class TypedData; | 614 friend class TypedData; |
644 friend class TypedDataView; | 615 friend class TypedDataView; |
645 friend class WeakProperty; // StorePointer | 616 friend class WeakProperty; // StorePointer |
646 friend class Instance; // StorePointer | 617 friend class Instance; // StorePointer |
647 friend class StackFrame; // GetCodeObject assertion. | 618 friend class StackFrame; // GetCodeObject assertion. |
648 friend class CodeLookupTableBuilder; // profiler | 619 friend class CodeLookupTableBuilder; // profiler |
649 friend class NativeEntry; // GetClassId | 620 friend class NativeEntry; // GetClassId |
650 friend class Simulator; | 621 friend class Simulator; |
651 friend class SimulatorHelpers; | 622 friend class SimulatorHelpers; |
652 friend class ObjectLocator; | 623 friend class ObjectLocator; |
653 friend class InstanceMorpher; // GetClassId | 624 friend class InstanceMorpher; // GetClassId |
654 friend class VerifyCanonicalVisitor; | 625 friend class VerifyCanonicalVisitor; |
655 | 626 |
656 DISALLOW_ALLOCATION(); | 627 DISALLOW_ALLOCATION(); |
657 DISALLOW_IMPLICIT_CONSTRUCTORS(RawObject); | 628 DISALLOW_IMPLICIT_CONSTRUCTORS(RawObject); |
658 }; | 629 }; |
659 | 630 |
660 | 631 |
661 class RawClass : public RawObject { | 632 class RawClass : public RawObject { |
662 public: | 633 public: |
663 enum ClassFinalizedState { | 634 enum ClassFinalizedState { |
664 kAllocated = 0, // Initial state. | 635 kAllocated = 0, // Initial state. |
665 kPreFinalized, // VM classes: size precomputed, but no checks done. | 636 kPreFinalized, // VM classes: size precomputed, but no checks done. |
666 kFinalized, // Class parsed, finalized and ready for use. | 637 kFinalized, // Class parsed, finalized and ready for use. |
667 kRefinalizeAfterPatch, // Class needs to be refinalized (patched). | 638 kRefinalizeAfterPatch, // Class needs to be refinalized (patched). |
668 }; | 639 }; |
669 | 640 |
670 private: | 641 private: |
671 RAW_HEAP_OBJECT_IMPLEMENTATION(Class); | 642 RAW_HEAP_OBJECT_IMPLEMENTATION(Class); |
672 | 643 |
673 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } | 644 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
674 RawString* name_; | 645 RawString* name_; |
675 NOT_IN_PRODUCT(RawString* user_name_); | 646 NOT_IN_PRODUCT(RawString* user_name_); |
676 RawArray* functions_; | 647 RawArray* functions_; |
677 RawArray* functions_hash_table_; | 648 RawArray* functions_hash_table_; |
678 RawArray* fields_; | 649 RawArray* fields_; |
679 RawArray* offset_in_words_to_field_; | 650 RawArray* offset_in_words_to_field_; |
680 RawArray* interfaces_; // Array of AbstractType. | 651 RawArray* interfaces_; // Array of AbstractType. |
681 RawScript* script_; | 652 RawScript* script_; |
682 RawLibrary* library_; | 653 RawLibrary* library_; |
683 RawTypeArguments* type_parameters_; // Array of TypeParameter. | 654 RawTypeArguments* type_parameters_; // Array of TypeParameter. |
684 RawAbstractType* super_type_; | 655 RawAbstractType* super_type_; |
685 RawType* mixin_; // Generic mixin type, e.g. M<T>, not M<int>. | 656 RawType* mixin_; // Generic mixin type, e.g. M<T>, not M<int>. |
686 RawFunction* signature_function_; // Associated function for typedef class. | 657 RawFunction* signature_function_; // Associated function for typedef class. |
687 RawArray* constants_; // Canonicalized const instances of this class. | 658 RawArray* constants_; // Canonicalized const instances of this class. |
688 RawType* canonical_type_; // Canonical type for this class. | 659 RawType* canonical_type_; // Canonical type for this class. |
689 RawArray* invocation_dispatcher_cache_; // Cache for dispatcher functions. | 660 RawArray* invocation_dispatcher_cache_; // Cache for dispatcher functions. |
690 RawCode* allocation_stub_; // Stub code for allocation of instances. | 661 RawCode* allocation_stub_; // Stub code for allocation of instances. |
691 RawGrowableObjectArray* direct_subclasses_; // Array of Class. | 662 RawGrowableObjectArray* direct_subclasses_; // Array of Class. |
692 RawArray* dependent_code_; // CHA optimized codes. | 663 RawArray* dependent_code_; // CHA optimized codes. |
693 RawObject** to() { | 664 RawObject** to() { |
694 return reinterpret_cast<RawObject**>(&ptr()->dependent_code_); | 665 return reinterpret_cast<RawObject**>(&ptr()->dependent_code_); |
695 } | 666 } |
696 RawObject** to_snapshot(Snapshot::Kind kind) { | 667 RawObject** to_snapshot(Snapshot::Kind kind) { |
697 switch (kind) { | 668 switch (kind) { |
698 case Snapshot::kCore: | 669 case Snapshot::kCore: |
699 case Snapshot::kScript: | 670 case Snapshot::kScript: |
700 case Snapshot::kAppWithJIT: | 671 case Snapshot::kAppWithJIT: |
701 case Snapshot::kAppNoJIT: | 672 case Snapshot::kAppNoJIT: |
702 return reinterpret_cast<RawObject**>(&ptr()->direct_subclasses_); | 673 return reinterpret_cast<RawObject**>(&ptr()->direct_subclasses_); |
703 case Snapshot::kMessage: | 674 case Snapshot::kMessage: |
704 case Snapshot::kNone: | 675 case Snapshot::kNone: |
705 case Snapshot::kInvalid: | 676 case Snapshot::kInvalid: |
706 break; | 677 break; |
707 } | 678 } |
708 UNREACHABLE(); | 679 UNREACHABLE(); |
709 return NULL; | 680 return NULL; |
710 } | 681 } |
711 | 682 |
712 cpp_vtable handle_vtable_; | 683 cpp_vtable handle_vtable_; |
713 TokenPosition token_pos_; | 684 TokenPosition token_pos_; |
714 int32_t instance_size_in_words_; // Size if fixed len or 0 if variable len. | 685 int32_t instance_size_in_words_; // Size if fixed len or 0 if variable len. |
715 int32_t type_arguments_field_offset_in_words_; // Offset of type args fld. | 686 int32_t type_arguments_field_offset_in_words_; // Offset of type args fld. |
716 int32_t next_field_offset_in_words_; // Offset of the next instance field. | 687 int32_t next_field_offset_in_words_; // Offset of the next instance field. |
717 classid_t id_; // Class Id, also index in the class table. | 688 classid_t id_; // Class Id, also index in the class table. |
718 int16_t num_type_arguments_; // Number of type arguments in flattened vector. | 689 int16_t num_type_arguments_; // Number of type arguments in flattened vector. |
719 int16_t num_own_type_arguments_; // Number of non-overlapping type arguments. | 690 int16_t num_own_type_arguments_; // Number of non-overlapping type arguments. |
720 uint16_t num_native_fields_; // Number of native fields in class. | 691 uint16_t num_native_fields_; // Number of native fields in class. |
721 uint16_t state_bits_; | 692 uint16_t state_bits_; |
722 | 693 |
723 friend class Instance; | 694 friend class Instance; |
724 friend class Isolate; | 695 friend class Isolate; |
725 friend class Object; | 696 friend class Object; |
726 friend class RawInstance; | 697 friend class RawInstance; |
727 friend class RawInstructions; | 698 friend class RawInstructions; |
728 friend class SnapshotReader; | 699 friend class SnapshotReader; |
729 friend class InstanceSerializationCluster; | 700 friend class InstanceSerializationCluster; |
730 friend class CidRewriteVisitor; | 701 friend class CidRewriteVisitor; |
731 }; | 702 }; |
732 | 703 |
733 | 704 |
734 class RawUnresolvedClass : public RawObject { | 705 class RawUnresolvedClass : public RawObject { |
735 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass); | 706 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass); |
736 | 707 |
737 RawObject** from() { | 708 RawObject** from() { |
738 return reinterpret_cast<RawObject**>(&ptr()->library_prefix_); | 709 return reinterpret_cast<RawObject**>(&ptr()->library_prefix_); |
739 } | 710 } |
740 RawLibraryPrefix* library_prefix_; // Library prefix qualifier for the ident. | 711 RawLibraryPrefix* library_prefix_; // Library prefix qualifier for the ident. |
741 RawString* ident_; // Name of the unresolved identifier. | 712 RawString* ident_; // Name of the unresolved identifier. |
742 RawObject** to() { | 713 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->ident_); } |
743 return reinterpret_cast<RawObject**>(&ptr()->ident_); | |
744 } | |
745 TokenPosition token_pos_; | 714 TokenPosition token_pos_; |
746 }; | 715 }; |
747 | 716 |
748 | 717 |
749 class RawTypeArguments : public RawObject { | 718 class RawTypeArguments : public RawObject { |
750 private: | 719 private: |
751 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeArguments); | 720 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeArguments); |
752 | 721 |
753 RawObject** from() { | 722 RawObject** from() { |
754 return reinterpret_cast<RawObject**>(&ptr()->instantiations_); | 723 return reinterpret_cast<RawObject**>(&ptr()->instantiations_); |
(...skipping 25 matching lines...) Expand all Loading... |
780 class RawPatchClass : public RawObject { | 749 class RawPatchClass : public RawObject { |
781 private: | 750 private: |
782 RAW_HEAP_OBJECT_IMPLEMENTATION(PatchClass); | 751 RAW_HEAP_OBJECT_IMPLEMENTATION(PatchClass); |
783 | 752 |
784 RawObject** from() { | 753 RawObject** from() { |
785 return reinterpret_cast<RawObject**>(&ptr()->patched_class_); | 754 return reinterpret_cast<RawObject**>(&ptr()->patched_class_); |
786 } | 755 } |
787 RawClass* patched_class_; | 756 RawClass* patched_class_; |
788 RawClass* origin_class_; | 757 RawClass* origin_class_; |
789 RawScript* script_; | 758 RawScript* script_; |
790 RawObject** to() { | 759 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->script_); } |
791 return reinterpret_cast<RawObject**>(&ptr()->script_); | |
792 } | |
793 | 760 |
794 friend class Function; | 761 friend class Function; |
795 }; | 762 }; |
796 | 763 |
797 | 764 |
798 class RawFunction : public RawObject { | 765 class RawFunction : public RawObject { |
799 public: | 766 public: |
800 enum Kind { | 767 enum Kind { |
801 kRegularFunction, | 768 kRegularFunction, |
802 kClosureFunction, | 769 kClosureFunction, |
803 kSignatureFunction, // represents a signature only without actual code. | 770 kSignatureFunction, // represents a signature only without actual code. |
804 kGetterFunction, // represents getter functions e.g: get foo() { .. }. | 771 kGetterFunction, // represents getter functions e.g: get foo() { .. }. |
805 kSetterFunction, // represents setter functions e.g: set foo(..) { .. }. | 772 kSetterFunction, // represents setter functions e.g: set foo(..) { .. }. |
806 kConstructor, | 773 kConstructor, |
807 kImplicitGetter, // represents an implicit getter for fields. | 774 kImplicitGetter, // represents an implicit getter for fields. |
808 kImplicitSetter, // represents an implicit setter for fields. | 775 kImplicitSetter, // represents an implicit setter for fields. |
809 kImplicitStaticFinalGetter, // represents an implicit getter for static | 776 kImplicitStaticFinalGetter, // represents an implicit getter for static |
810 // final fields (incl. static const fields). | 777 // final fields (incl. static const fields). |
811 kMethodExtractor, // converts method into implicit closure on the receiver. | 778 kMethodExtractor, // converts method into implicit closure on the receiver. |
812 kNoSuchMethodDispatcher, // invokes noSuchMethod. | 779 kNoSuchMethodDispatcher, // invokes noSuchMethod. |
813 kInvokeFieldDispatcher, // invokes a field as a closure. | 780 kInvokeFieldDispatcher, // invokes a field as a closure. |
814 kIrregexpFunction, // represents a generated irregexp matcher function. | 781 kIrregexpFunction, // represents a generated irregexp matcher function. |
815 }; | 782 }; |
816 | 783 |
817 enum AsyncModifier { | 784 enum AsyncModifier { |
818 kNoModifier = 0x0, | 785 kNoModifier = 0x0, |
819 kAsyncBit = 0x1, | 786 kAsyncBit = 0x1, |
820 kGeneratorBit = 0x2, | 787 kGeneratorBit = 0x2, |
821 kAsync = kAsyncBit, | 788 kAsync = kAsyncBit, |
822 kSyncGen = kGeneratorBit, | 789 kSyncGen = kGeneratorBit, |
823 kAsyncGen = kAsyncBit | kGeneratorBit, | 790 kAsyncGen = kAsyncBit | kGeneratorBit, |
824 }; | 791 }; |
825 | 792 |
826 private: | 793 private: |
827 // So that the SkippedCodeFunctions::DetachCode can null out the code fields. | 794 // So that the SkippedCodeFunctions::DetachCode can null out the code fields. |
828 friend class SkippedCodeFunctions; | 795 friend class SkippedCodeFunctions; |
829 friend class Class; | 796 friend class Class; |
830 | 797 |
831 RAW_HEAP_OBJECT_IMPLEMENTATION(Function); | 798 RAW_HEAP_OBJECT_IMPLEMENTATION(Function); |
832 | 799 |
833 static bool ShouldVisitCode(RawCode* raw_code); | 800 static bool ShouldVisitCode(RawCode* raw_code); |
(...skipping 25 matching lines...) Expand all Loading... |
859 return reinterpret_cast<RawObject**>(&ptr()->code_); | 826 return reinterpret_cast<RawObject**>(&ptr()->code_); |
860 #else | 827 #else |
861 return reinterpret_cast<RawObject**>(&ptr()->unoptimized_code_); | 828 return reinterpret_cast<RawObject**>(&ptr()->unoptimized_code_); |
862 #endif | 829 #endif |
863 } | 830 } |
864 | 831 |
865 NOT_IN_PRECOMPILED(TokenPosition token_pos_); | 832 NOT_IN_PRECOMPILED(TokenPosition token_pos_); |
866 NOT_IN_PRECOMPILED(TokenPosition end_token_pos_); | 833 NOT_IN_PRECOMPILED(TokenPosition end_token_pos_); |
867 NOT_IN_PRECOMPILED(int32_t usage_counter_); // Accessed from generated code | 834 NOT_IN_PRECOMPILED(int32_t usage_counter_); // Accessed from generated code |
868 // (JIT only). | 835 // (JIT only). |
869 uint32_t kind_tag_; // See Function::KindTagBits. | 836 uint32_t kind_tag_; // See Function::KindTagBits. |
870 int16_t num_fixed_parameters_; | 837 int16_t num_fixed_parameters_; |
871 int16_t num_optional_parameters_; // > 0: positional; < 0: named. | 838 int16_t num_optional_parameters_; // > 0: positional; < 0: named. |
872 NOT_IN_PRECOMPILED(void* kernel_function_); | 839 NOT_IN_PRECOMPILED(void* kernel_function_); |
873 NOT_IN_PRECOMPILED(uint16_t optimized_instruction_count_); | 840 NOT_IN_PRECOMPILED(uint16_t optimized_instruction_count_); |
874 NOT_IN_PRECOMPILED(uint16_t optimized_call_site_count_); | 841 NOT_IN_PRECOMPILED(uint16_t optimized_call_site_count_); |
875 NOT_IN_PRECOMPILED(int8_t deoptimization_counter_); | 842 NOT_IN_PRECOMPILED(int8_t deoptimization_counter_); |
876 NOT_IN_PRECOMPILED(int8_t was_compiled_); | 843 NOT_IN_PRECOMPILED(int8_t was_compiled_); |
877 }; | 844 }; |
878 | 845 |
879 | 846 |
880 class RawClosureData : public RawObject { | 847 class RawClosureData : public RawObject { |
881 private: | 848 private: |
882 RAW_HEAP_OBJECT_IMPLEMENTATION(ClosureData); | 849 RAW_HEAP_OBJECT_IMPLEMENTATION(ClosureData); |
883 | 850 |
884 RawObject** from() { | 851 RawObject** from() { |
885 return reinterpret_cast<RawObject**>(&ptr()->context_scope_); | 852 return reinterpret_cast<RawObject**>(&ptr()->context_scope_); |
886 } | 853 } |
887 RawContextScope* context_scope_; | 854 RawContextScope* context_scope_; |
888 RawFunction* parent_function_; // Enclosing function of this local function. | 855 RawFunction* parent_function_; // Enclosing function of this local function. |
889 RawType* signature_type_; | 856 RawType* signature_type_; |
890 RawInstance* closure_; // Closure object for static implicit closures. | 857 RawInstance* closure_; // Closure object for static implicit closures. |
891 RawObject** to() { | 858 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->closure_); } |
892 return reinterpret_cast<RawObject**>(&ptr()->closure_); | |
893 } | |
894 | 859 |
895 friend class Function; | 860 friend class Function; |
896 }; | 861 }; |
897 | 862 |
898 | 863 |
899 class RawRedirectionData : public RawObject { | 864 class RawRedirectionData : public RawObject { |
900 private: | 865 private: |
901 RAW_HEAP_OBJECT_IMPLEMENTATION(RedirectionData); | 866 RAW_HEAP_OBJECT_IMPLEMENTATION(RedirectionData); |
902 | 867 |
903 RawObject** from() { | 868 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->type_); } |
904 return reinterpret_cast<RawObject**>(&ptr()->type_); | |
905 } | |
906 RawType* type_; | 869 RawType* type_; |
907 RawString* identifier_; | 870 RawString* identifier_; |
908 RawFunction* target_; | 871 RawFunction* target_; |
909 RawObject** to() { | 872 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->target_); } |
910 return reinterpret_cast<RawObject**>(&ptr()->target_); | |
911 } | |
912 }; | 873 }; |
913 | 874 |
914 | 875 |
915 class RawField : public RawObject { | 876 class RawField : public RawObject { |
916 RAW_HEAP_OBJECT_IMPLEMENTATION(Field); | 877 RAW_HEAP_OBJECT_IMPLEMENTATION(Field); |
917 | 878 |
918 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } | 879 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
919 RawString* name_; | 880 RawString* name_; |
920 RawObject* owner_; // Class or patch class or mixin class | 881 RawObject* owner_; // Class or patch class or mixin class |
921 // where this field is defined or original field. | 882 // where this field is defined or original field. |
922 RawAbstractType* type_; | 883 RawAbstractType* type_; |
923 union { | 884 union { |
924 RawInstance* static_value_; // Value for static fields. | 885 RawInstance* static_value_; // Value for static fields. |
925 RawSmi* offset_; // Offset in words for instance fields. | 886 RawSmi* offset_; // Offset in words for instance fields. |
926 } value_; | 887 } value_; |
927 union { | 888 union { |
928 // When precompiling we need to save the static initializer function here | 889 // When precompiling we need to save the static initializer function here |
929 // so that code for it can be generated. | 890 // so that code for it can be generated. |
930 RawFunction* precompiled_; // Static initializer function - precompiling. | 891 RawFunction* precompiled_; // Static initializer function - precompiling. |
931 // When generating script snapshots after running the application it is | 892 // When generating script snapshots after running the application it is |
932 // necessary to save the initial value of static fields so that we can | 893 // necessary to save the initial value of static fields so that we can |
933 // restore the value back to the original initial value. | 894 // restore the value back to the original initial value. |
934 RawInstance* saved_value_; // Saved initial value - static fields. | 895 RawInstance* saved_value_; // Saved initial value - static fields. |
935 } initializer_; | 896 } initializer_; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 uint8_t kind_bits_; // static, final, const, has initializer.... | 929 uint8_t kind_bits_; // static, final, const, has initializer.... |
969 NOT_IN_PRECOMPILED(void* kernel_field_); | 930 NOT_IN_PRECOMPILED(void* kernel_field_); |
970 | 931 |
971 friend class CidRewriteVisitor; | 932 friend class CidRewriteVisitor; |
972 }; | 933 }; |
973 | 934 |
974 | 935 |
975 class RawLiteralToken : public RawObject { | 936 class RawLiteralToken : public RawObject { |
976 RAW_HEAP_OBJECT_IMPLEMENTATION(LiteralToken); | 937 RAW_HEAP_OBJECT_IMPLEMENTATION(LiteralToken); |
977 | 938 |
978 RawObject** from() { | 939 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->literal_); } |
979 return reinterpret_cast<RawObject**>(&ptr()->literal_); | |
980 } | |
981 RawString* literal_; // Literal characters as they appear in source text. | 940 RawString* literal_; // Literal characters as they appear in source text. |
982 RawObject* value_; // The actual object corresponding to the token. | 941 RawObject* value_; // The actual object corresponding to the token. |
983 RawObject** to() { | 942 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->value_); } |
984 return reinterpret_cast<RawObject**>(&ptr()->value_); | |
985 } | |
986 Token::Kind kind_; // The literal kind (string, integer, double). | 943 Token::Kind kind_; // The literal kind (string, integer, double). |
987 | 944 |
988 friend class SnapshotReader; | 945 friend class SnapshotReader; |
989 }; | 946 }; |
990 | 947 |
991 | 948 |
992 class RawTokenStream : public RawObject { | 949 class RawTokenStream : public RawObject { |
993 RAW_HEAP_OBJECT_IMPLEMENTATION(TokenStream); | 950 RAW_HEAP_OBJECT_IMPLEMENTATION(TokenStream); |
994 | 951 |
995 RawObject** from() { | 952 RawObject** from() { |
996 return reinterpret_cast<RawObject**>(&ptr()->private_key_); | 953 return reinterpret_cast<RawObject**>(&ptr()->private_key_); |
997 } | 954 } |
998 RawString* private_key_; // Key used for private identifiers. | 955 RawString* private_key_; // Key used for private identifiers. |
999 RawGrowableObjectArray* token_objects_; | 956 RawGrowableObjectArray* token_objects_; |
1000 RawExternalTypedData* stream_; | 957 RawExternalTypedData* stream_; |
1001 RawObject** to() { | 958 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->stream_); } |
1002 return reinterpret_cast<RawObject**>(&ptr()->stream_); | |
1003 } | |
1004 | 959 |
1005 friend class SnapshotReader; | 960 friend class SnapshotReader; |
1006 }; | 961 }; |
1007 | 962 |
1008 | 963 |
1009 class RawScript : public RawObject { | 964 class RawScript : public RawObject { |
1010 public: | 965 public: |
1011 enum Kind { | 966 enum Kind { |
1012 kScriptTag = 0, | 967 kScriptTag = 0, |
1013 kLibraryTag, | 968 kLibraryTag, |
1014 kSourceTag, | 969 kSourceTag, |
1015 kPatchTag, | 970 kPatchTag, |
1016 kEvaluateTag, | 971 kEvaluateTag, |
1017 }; | 972 }; |
1018 | 973 |
1019 private: | 974 private: |
1020 RAW_HEAP_OBJECT_IMPLEMENTATION(Script); | 975 RAW_HEAP_OBJECT_IMPLEMENTATION(Script); |
1021 | 976 |
1022 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->url_); } | 977 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->url_); } |
1023 RawString* url_; | 978 RawString* url_; |
1024 RawString* resolved_url_; | 979 RawString* resolved_url_; |
1025 RawArray* compile_time_constants_; | 980 RawArray* compile_time_constants_; |
1026 RawTokenStream* tokens_; | 981 RawTokenStream* tokens_; |
1027 RawString* source_; | 982 RawString* source_; |
1028 RawObject** to() {return reinterpret_cast<RawObject**>(&ptr()->source_); } | 983 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->source_); } |
1029 RawObject** to_snapshot(Snapshot::Kind kind) { | 984 RawObject** to_snapshot(Snapshot::Kind kind) { |
1030 switch (kind) { | 985 switch (kind) { |
1031 case Snapshot::kAppNoJIT: | 986 case Snapshot::kAppNoJIT: |
1032 return reinterpret_cast<RawObject**>(&ptr()->url_); | 987 return reinterpret_cast<RawObject**>(&ptr()->url_); |
1033 case Snapshot::kCore: | 988 case Snapshot::kCore: |
1034 case Snapshot::kAppWithJIT: | 989 case Snapshot::kAppWithJIT: |
1035 case Snapshot::kScript: | 990 case Snapshot::kScript: |
1036 return reinterpret_cast<RawObject**>(&ptr()->tokens_); | 991 return reinterpret_cast<RawObject**>(&ptr()->tokens_); |
1037 case Snapshot::kMessage: | 992 case Snapshot::kMessage: |
1038 case Snapshot::kNone: | 993 case Snapshot::kNone: |
(...skipping 19 matching lines...) Expand all Loading... |
1058 kLoaded, // Library is loaded. | 1013 kLoaded, // Library is loaded. |
1059 kLoadError, // Error occurred during load of the Library. | 1014 kLoadError, // Error occurred during load of the Library. |
1060 }; | 1015 }; |
1061 | 1016 |
1062 RAW_HEAP_OBJECT_IMPLEMENTATION(Library); | 1017 RAW_HEAP_OBJECT_IMPLEMENTATION(Library); |
1063 | 1018 |
1064 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } | 1019 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
1065 RawString* name_; | 1020 RawString* name_; |
1066 RawString* url_; | 1021 RawString* url_; |
1067 RawString* private_key_; | 1022 RawString* private_key_; |
1068 RawArray* dictionary_; // Top-level names in this library. | 1023 RawArray* dictionary_; // Top-level names in this library. |
1069 RawGrowableObjectArray* metadata_; // Metadata on classes, methods etc. | 1024 RawGrowableObjectArray* metadata_; // Metadata on classes, methods etc. |
1070 RawClass* toplevel_class_; // Class containing top-level elements. | 1025 RawClass* toplevel_class_; // Class containing top-level elements. |
1071 RawGrowableObjectArray* patch_classes_; | 1026 RawGrowableObjectArray* patch_classes_; |
1072 RawArray* imports_; // List of Namespaces imported without prefix. | 1027 RawArray* imports_; // List of Namespaces imported without prefix. |
1073 RawArray* exports_; // List of re-exported Namespaces. | 1028 RawArray* exports_; // List of re-exported Namespaces. |
1074 RawInstance* load_error_; // Error iff load_state_ == kLoadError. | 1029 RawInstance* load_error_; // Error iff load_state_ == kLoadError. |
1075 RawObject** to_snapshot() { | 1030 RawObject** to_snapshot() { |
1076 return reinterpret_cast<RawObject**>(&ptr()->load_error_); | 1031 return reinterpret_cast<RawObject**>(&ptr()->load_error_); |
1077 } | 1032 } |
1078 RawArray* resolved_names_; // Cache of resolved names in library scope. | 1033 RawArray* resolved_names_; // Cache of resolved names in library scope. |
1079 RawArray* exported_names_; // Cache of exported names by library. | 1034 RawArray* exported_names_; // Cache of exported names by library. |
1080 RawArray* loaded_scripts_; // Array of scripts loaded in this library. | 1035 RawArray* loaded_scripts_; // Array of scripts loaded in this library. |
1081 RawObject** to() { | 1036 RawObject** to() { |
1082 return reinterpret_cast<RawObject**>(&ptr()->loaded_scripts_); | 1037 return reinterpret_cast<RawObject**>(&ptr()->loaded_scripts_); |
1083 } | 1038 } |
1084 | 1039 |
1085 Dart_NativeEntryResolver native_entry_resolver_; // Resolves natives. | 1040 Dart_NativeEntryResolver native_entry_resolver_; // Resolves natives. |
1086 Dart_NativeEntrySymbol native_entry_symbol_resolver_; | 1041 Dart_NativeEntrySymbol native_entry_symbol_resolver_; |
1087 classid_t index_; // Library id number. | 1042 classid_t index_; // Library id number. |
1088 uint16_t num_imports_; // Number of entries in imports_. | 1043 uint16_t num_imports_; // Number of entries in imports_. |
1089 int8_t load_state_; // Of type LibraryState. | 1044 int8_t load_state_; // Of type LibraryState. |
1090 bool corelib_imported_; | 1045 bool corelib_imported_; |
1091 bool is_dart_scheme_; | 1046 bool is_dart_scheme_; |
1092 bool debuggable_; // True if debugger can stop in library. | 1047 bool debuggable_; // True if debugger can stop in library. |
1093 bool is_in_fullsnapshot_; // True if library is in a full snapshot. | 1048 bool is_in_fullsnapshot_; // True if library is in a full snapshot. |
1094 | 1049 |
1095 friend class Class; | 1050 friend class Class; |
1096 friend class Isolate; | 1051 friend class Isolate; |
1097 }; | 1052 }; |
1098 | 1053 |
1099 | 1054 |
1100 class RawNamespace : public RawObject { | 1055 class RawNamespace : public RawObject { |
1101 RAW_HEAP_OBJECT_IMPLEMENTATION(Namespace); | 1056 RAW_HEAP_OBJECT_IMPLEMENTATION(Namespace); |
1102 | 1057 |
1103 RawObject** from() { | 1058 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->library_); } |
1104 return reinterpret_cast<RawObject**>(&ptr()->library_); | 1059 RawLibrary* library_; // library with name dictionary. |
1105 } | 1060 RawArray* show_names_; // list of names that are exported. |
1106 RawLibrary* library_; // library with name dictionary. | 1061 RawArray* hide_names_; // blacklist of names that are not exported. |
1107 RawArray* show_names_; // list of names that are exported. | 1062 RawField* metadata_field_; // remembers the token pos of metadata if any, |
1108 RawArray* hide_names_; // blacklist of names that are not exported. | 1063 // and the metadata values if computed. |
1109 RawField* metadata_field_; // remembers the token pos of metadata if any, | |
1110 // and the metadata values if computed. | |
1111 RawObject** to() { | 1064 RawObject** to() { |
1112 return reinterpret_cast<RawObject**>(&ptr()->metadata_field_); | 1065 return reinterpret_cast<RawObject**>(&ptr()->metadata_field_); |
1113 } | 1066 } |
1114 }; | 1067 }; |
1115 | 1068 |
1116 | 1069 |
1117 class RawCode : public RawObject { | 1070 class RawCode : public RawObject { |
1118 enum InlinedMetadataIndex { | 1071 enum InlinedMetadataIndex { |
1119 kInlinedIntervalsIndex = 0, | 1072 kInlinedIntervalsIndex = 0, |
1120 kInlinedIdToFunctionIndex = 1, | 1073 kInlinedIdToFunctionIndex = 1, |
1121 kInlinedCallerIdMapIndex = 2, | 1074 kInlinedCallerIdMapIndex = 2, |
1122 kInlinedIdToTokenPosIndex = 3, | 1075 kInlinedIdToTokenPosIndex = 3, |
1123 kInlinedMetadataSize = 4, | 1076 kInlinedMetadataSize = 4, |
1124 }; | 1077 }; |
1125 | 1078 |
1126 RAW_HEAP_OBJECT_IMPLEMENTATION(Code); | 1079 RAW_HEAP_OBJECT_IMPLEMENTATION(Code); |
1127 | 1080 |
1128 uword entry_point_; // Accessed from generated code. | 1081 uword entry_point_; // Accessed from generated code. |
1129 uword checked_entry_point_; // Accessed from generated code (AOT only). | 1082 uword checked_entry_point_; // Accessed from generated code (AOT only). |
1130 | 1083 |
1131 RawObject** from() { | 1084 RawObject** from() { |
1132 return reinterpret_cast<RawObject**>(&ptr()->object_pool_); | 1085 return reinterpret_cast<RawObject**>(&ptr()->object_pool_); |
1133 } | 1086 } |
1134 RawObjectPool* object_pool_; // Accessed from generated code. | 1087 RawObjectPool* object_pool_; // Accessed from generated code. |
1135 RawInstructions* instructions_; // Accessed from generated code. | 1088 RawInstructions* instructions_; // Accessed from generated code. |
1136 // If owner_ is Function::null() the owner is a regular stub. | 1089 // If owner_ is Function::null() the owner is a regular stub. |
1137 // If owner_ is a Class the owner is the allocation stub for that class. | 1090 // If owner_ is a Class the owner is the allocation stub for that class. |
1138 // Else, owner_ is a regular Dart Function. | 1091 // Else, owner_ is a regular Dart Function. |
1139 RawObject* owner_; // Function, Null, or a Class. | 1092 RawObject* owner_; // Function, Null, or a Class. |
1140 RawExceptionHandlers* exception_handlers_; | 1093 RawExceptionHandlers* exception_handlers_; |
1141 RawPcDescriptors* pc_descriptors_; | 1094 RawPcDescriptors* pc_descriptors_; |
1142 RawArray* stackmaps_; | 1095 RawArray* stackmaps_; |
1143 NOT_IN_PRECOMPILED(RawInstructions* active_instructions_); | 1096 NOT_IN_PRECOMPILED(RawInstructions* active_instructions_); |
1144 NOT_IN_PRECOMPILED(RawArray* deopt_info_array_); | 1097 NOT_IN_PRECOMPILED(RawArray* deopt_info_array_); |
(...skipping 23 matching lines...) Expand all Loading... |
1168 // Alive: If true, the embedded object pointers will be visited during GC. | 1121 // Alive: If true, the embedded object pointers will be visited during GC. |
1169 int32_t state_bits_; | 1122 int32_t state_bits_; |
1170 | 1123 |
1171 // Variable length data follows here. | 1124 // Variable length data follows here. |
1172 int32_t* data() { OPEN_ARRAY_START(int32_t, int32_t); } | 1125 int32_t* data() { OPEN_ARRAY_START(int32_t, int32_t); } |
1173 const int32_t* data() const { OPEN_ARRAY_START(int32_t, int32_t); } | 1126 const int32_t* data() const { OPEN_ARRAY_START(int32_t, int32_t); } |
1174 | 1127 |
1175 static bool ContainsPC(RawObject* raw_obj, uword pc); | 1128 static bool ContainsPC(RawObject* raw_obj, uword pc); |
1176 | 1129 |
1177 friend class Function; | 1130 friend class Function; |
1178 template<bool> friend class MarkingVisitorBase; | 1131 template <bool> |
| 1132 friend class MarkingVisitorBase; |
1179 friend class SkippedCodeFunctions; | 1133 friend class SkippedCodeFunctions; |
1180 friend class StackFrame; | 1134 friend class StackFrame; |
1181 friend class Profiler; | 1135 friend class Profiler; |
1182 friend class FunctionDeserializationCluster; | 1136 friend class FunctionDeserializationCluster; |
1183 }; | 1137 }; |
1184 | 1138 |
1185 | 1139 |
1186 class RawObjectPool : public RawObject { | 1140 class RawObjectPool : public RawObject { |
1187 RAW_HEAP_OBJECT_IMPLEMENTATION(ObjectPool); | 1141 RAW_HEAP_OBJECT_IMPLEMENTATION(ObjectPool); |
1188 | 1142 |
(...skipping 25 matching lines...) Expand all Loading... |
1214 | 1168 |
1215 // Private helper function used while visiting stack frames. The | 1169 // Private helper function used while visiting stack frames. The |
1216 // code which iterates over dart frames is also called during GC and | 1170 // code which iterates over dart frames is also called during GC and |
1217 // is not allowed to create handles. | 1171 // is not allowed to create handles. |
1218 static bool ContainsPC(RawInstructions* raw_instr, uword pc); | 1172 static bool ContainsPC(RawInstructions* raw_instr, uword pc); |
1219 | 1173 |
1220 friend class RawCode; | 1174 friend class RawCode; |
1221 friend class RawFunction; | 1175 friend class RawFunction; |
1222 friend class Code; | 1176 friend class Code; |
1223 friend class StackFrame; | 1177 friend class StackFrame; |
1224 template<bool> friend class MarkingVisitorBase; | 1178 template <bool> |
| 1179 friend class MarkingVisitorBase; |
1225 friend class SkippedCodeFunctions; | 1180 friend class SkippedCodeFunctions; |
1226 friend class Function; | 1181 friend class Function; |
1227 friend class InstructionsReader; | 1182 friend class InstructionsReader; |
1228 friend class InstructionsWriter; | 1183 friend class InstructionsWriter; |
1229 }; | 1184 }; |
1230 | 1185 |
1231 | 1186 |
1232 class RawPcDescriptors : public RawObject { | 1187 class RawPcDescriptors : public RawObject { |
1233 public: | 1188 public: |
1234 enum Kind { | 1189 enum Kind { |
1235 kDeopt = 1, // Deoptimization continuation point. | 1190 kDeopt = 1, // Deoptimization continuation point. |
1236 kIcCall = kDeopt << 1, // IC call. | 1191 kIcCall = kDeopt << 1, // IC call. |
1237 kUnoptStaticCall = kIcCall << 1, // Call to a known target via stub. | 1192 kUnoptStaticCall = kIcCall << 1, // Call to a known target via stub. |
1238 kRuntimeCall = kUnoptStaticCall << 1, // Runtime call. | 1193 kRuntimeCall = kUnoptStaticCall << 1, // Runtime call. |
1239 kOsrEntry = kRuntimeCall << 1, // OSR entry point in unopt. code. | 1194 kOsrEntry = kRuntimeCall << 1, // OSR entry point in unopt. code. |
1240 kOther = kOsrEntry << 1, | 1195 kOther = kOsrEntry << 1, |
1241 kLastKind = kOther, | 1196 kLastKind = kOther, |
1242 kAnyKind = -1 | 1197 kAnyKind = -1 |
1243 }; | 1198 }; |
1244 | 1199 |
1245 class MergedKindTry { | 1200 class MergedKindTry { |
1246 public: | 1201 public: |
1247 // Most of the time try_index will be small and merged field will fit into | 1202 // Most of the time try_index will be small and merged field will fit into |
1248 // one byte. | 1203 // one byte. |
1249 static intptr_t Encode(intptr_t kind, intptr_t try_index) { | 1204 static intptr_t Encode(intptr_t kind, intptr_t try_index) { |
1250 intptr_t kind_shift = Utils::ShiftForPowerOfTwo(kind); | 1205 intptr_t kind_shift = Utils::ShiftForPowerOfTwo(kind); |
1251 ASSERT(Utils::IsUint(kKindShiftSize, kind_shift)); | 1206 ASSERT(Utils::IsUint(kKindShiftSize, kind_shift)); |
1252 ASSERT(Utils::IsInt(kTryIndexSize, try_index)); | 1207 ASSERT(Utils::IsInt(kTryIndexSize, try_index)); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 // | 1263 // |
1309 // The bit map representation is optimized for dense and small bit maps, without | 1264 // The bit map representation is optimized for dense and small bit maps, without |
1310 // any upper bound. | 1265 // any upper bound. |
1311 class RawStackmap : public RawObject { | 1266 class RawStackmap : public RawObject { |
1312 RAW_HEAP_OBJECT_IMPLEMENTATION(Stackmap); | 1267 RAW_HEAP_OBJECT_IMPLEMENTATION(Stackmap); |
1313 | 1268 |
1314 // Regarding changing this to a bitfield: ARM64 requires register_bit_count_ | 1269 // Regarding changing this to a bitfield: ARM64 requires register_bit_count_ |
1315 // to be as large as 96, meaning 7 bits, leaving 25 bits for the length, or | 1270 // to be as large as 96, meaning 7 bits, leaving 25 bits for the length, or |
1316 // as large as ~33 million entries. If that is sufficient, then these two | 1271 // as large as ~33 million entries. If that is sufficient, then these two |
1317 // fields can be merged into a BitField. | 1272 // fields can be merged into a BitField. |
1318 int32_t length_; // Length of payload, in bits. | 1273 int32_t length_; // Length of payload, in bits. |
1319 int32_t slow_path_bit_count_; // Slow path live values, included in length_. | 1274 int32_t slow_path_bit_count_; // Slow path live values, included in length_. |
1320 | 1275 |
1321 // Offset from code entry point corresponding to this stack map | 1276 // Offset from code entry point corresponding to this stack map |
1322 // representation. | 1277 // representation. |
1323 uint32_t pc_offset_; | 1278 uint32_t pc_offset_; |
1324 | 1279 |
1325 // Variable length data follows here (bitmap of the stack layout). | 1280 // Variable length data follows here (bitmap of the stack layout). |
1326 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } | 1281 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } |
1327 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); } | 1282 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); } |
1328 }; | 1283 }; |
(...skipping 14 matching lines...) Expand all Loading... |
1343 kIndexPos = kKindPos + kKindSize, | 1298 kIndexPos = kKindPos + kKindSize, |
1344 // Since there are 24 bits for the stack slot index, Functions can have | 1299 // Since there are 24 bits for the stack slot index, Functions can have |
1345 // only ~16.7 million stack slots. | 1300 // only ~16.7 million stack slots. |
1346 kPayloadSize = sizeof(int32_t) * kBitsPerByte, | 1301 kPayloadSize = sizeof(int32_t) * kBitsPerByte, |
1347 kIndexSize = kPayloadSize - kIndexPos, | 1302 kIndexSize = kPayloadSize - kIndexPos, |
1348 kIndexBias = 1 << (kIndexSize - 1), | 1303 kIndexBias = 1 << (kIndexSize - 1), |
1349 kMaxIndex = (1 << (kIndexSize - 1)) - 1, | 1304 kMaxIndex = (1 << (kIndexSize - 1)) - 1, |
1350 }; | 1305 }; |
1351 | 1306 |
1352 class IndexBits : public BitField<int32_t, int32_t, kIndexPos, kIndexSize> {}; | 1307 class IndexBits : public BitField<int32_t, int32_t, kIndexPos, kIndexSize> {}; |
1353 class KindBits : public BitField<int32_t, int8_t, kKindPos, kKindSize>{}; | 1308 class KindBits : public BitField<int32_t, int8_t, kKindPos, kKindSize> {}; |
1354 | 1309 |
1355 struct VarInfo { | 1310 struct VarInfo { |
1356 int32_t index_kind; // Bitfield for slot index on stack or in context, | 1311 int32_t index_kind; // Bitfield for slot index on stack or in context, |
1357 // and Entry kind of type VarInfoKind. | 1312 // and Entry kind of type VarInfoKind. |
1358 TokenPosition declaration_pos; // Token position of declaration. | 1313 TokenPosition declaration_pos; // Token position of declaration. |
1359 TokenPosition begin_pos; // Token position of scope start. | 1314 TokenPosition begin_pos; // Token position of scope start. |
1360 TokenPosition end_pos; // Token position of scope end. | 1315 TokenPosition end_pos; // Token position of scope end. |
1361 int16_t scope_id; // Scope to which the variable belongs. | 1316 int16_t scope_id; // Scope to which the variable belongs. |
1362 | 1317 |
1363 VarInfoKind kind() const { | 1318 VarInfoKind kind() const { |
1364 return static_cast<VarInfoKind>(KindBits::decode(index_kind)); | 1319 return static_cast<VarInfoKind>(KindBits::decode(index_kind)); |
1365 } | 1320 } |
1366 void set_kind(VarInfoKind kind) { | 1321 void set_kind(VarInfoKind kind) { |
1367 index_kind = KindBits::update(kind, index_kind); | 1322 index_kind = KindBits::update(kind, index_kind); |
1368 } | 1323 } |
1369 int32_t index() const { | 1324 int32_t index() const { return IndexBits::decode(index_kind) - kIndexBias; } |
1370 return IndexBits::decode(index_kind) - kIndexBias; | |
1371 } | |
1372 void set_index(int32_t index) { | 1325 void set_index(int32_t index) { |
1373 index_kind = IndexBits::update(index + kIndexBias, index_kind); | 1326 index_kind = IndexBits::update(index + kIndexBias, index_kind); |
1374 } | 1327 } |
1375 }; | 1328 }; |
1376 | 1329 |
1377 private: | 1330 private: |
1378 RAW_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors); | 1331 RAW_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors); |
1379 int32_t num_entries_; // Number of descriptors. | 1332 int32_t num_entries_; // Number of descriptors. |
1380 | 1333 |
1381 RawObject** from() { | 1334 RawObject** from() { |
1382 return reinterpret_cast<RawObject**>(&ptr()->names()[0]); | 1335 return reinterpret_cast<RawObject**>(&ptr()->names()[0]); |
1383 } | 1336 } |
1384 RawString** names() { | 1337 RawString** names() { |
1385 // Array of [num_entries_] variable names. | 1338 // Array of [num_entries_] variable names. |
1386 OPEN_ARRAY_START(RawString*, RawString*); | 1339 OPEN_ARRAY_START(RawString*, RawString*); |
1387 } | 1340 } |
1388 RawString** nameAddrAt(intptr_t i) { | 1341 RawString** nameAddrAt(intptr_t i) { return &(ptr()->names()[i]); } |
1389 return &(ptr()->names()[i]); | |
1390 } | |
1391 | 1342 |
1392 RawObject** to(intptr_t num_entries) { | 1343 RawObject** to(intptr_t num_entries) { |
1393 return reinterpret_cast<RawObject**>(nameAddrAt(num_entries - 1)); | 1344 return reinterpret_cast<RawObject**>(nameAddrAt(num_entries - 1)); |
1394 } | 1345 } |
1395 | 1346 |
1396 // Variable info with [num_entries_] entries. | 1347 // Variable info with [num_entries_] entries. |
1397 VarInfo* data() { | 1348 VarInfo* data() { |
1398 return reinterpret_cast<VarInfo*>(nameAddrAt(ptr()->num_entries_)); | 1349 return reinterpret_cast<VarInfo*>(nameAddrAt(ptr()->num_entries_)); |
1399 } | 1350 } |
1400 | 1351 |
1401 friend class Object; | 1352 friend class Object; |
1402 }; | 1353 }; |
1403 | 1354 |
1404 | 1355 |
1405 class RawExceptionHandlers : public RawObject { | 1356 class RawExceptionHandlers : public RawObject { |
1406 public: | 1357 public: |
1407 // The index into the ExceptionHandlers table corresponds to | 1358 // The index into the ExceptionHandlers table corresponds to |
1408 // the try_index of the handler. | 1359 // the try_index of the handler. |
1409 struct HandlerInfo { | 1360 struct HandlerInfo { |
1410 uint32_t handler_pc_offset; // PC offset value of handler. | 1361 uint32_t handler_pc_offset; // PC offset value of handler. |
1411 int16_t outer_try_index; // Try block index of enclosing try block. | 1362 int16_t outer_try_index; // Try block index of enclosing try block. |
1412 int8_t needs_stacktrace; // True if a stacktrace is needed. | 1363 int8_t needs_stacktrace; // True if a stacktrace is needed. |
1413 int8_t has_catch_all; // Catches all exceptions. | 1364 int8_t has_catch_all; // Catches all exceptions. |
1414 }; | 1365 }; |
1415 | 1366 |
1416 private: | 1367 private: |
1417 RAW_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers); | 1368 RAW_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers); |
1418 | 1369 |
1419 // Number of exception handler entries. | 1370 // Number of exception handler entries. |
1420 int32_t num_entries_; | 1371 int32_t num_entries_; |
1421 | 1372 |
1422 // Array with [num_entries_] entries. Each entry is an array of all handled | 1373 // Array with [num_entries_] entries. Each entry is an array of all handled |
1423 // exception types. | 1374 // exception types. |
(...skipping 10 matching lines...) Expand all Loading... |
1434 class RawContext : public RawObject { | 1385 class RawContext : public RawObject { |
1435 RAW_HEAP_OBJECT_IMPLEMENTATION(Context); | 1386 RAW_HEAP_OBJECT_IMPLEMENTATION(Context); |
1436 | 1387 |
1437 int32_t num_variables_; | 1388 int32_t num_variables_; |
1438 | 1389 |
1439 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->parent_); } | 1390 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->parent_); } |
1440 RawContext* parent_; | 1391 RawContext* parent_; |
1441 | 1392 |
1442 // Variable length data follows here. | 1393 // Variable length data follows here. |
1443 RawObject** data() { OPEN_ARRAY_START(RawObject*, RawObject*); } | 1394 RawObject** data() { OPEN_ARRAY_START(RawObject*, RawObject*); } |
1444 RawObject* const* data() const { | 1395 RawObject* const* data() const { OPEN_ARRAY_START(RawObject*, RawObject*); } |
1445 OPEN_ARRAY_START(RawObject*, RawObject*); | |
1446 } | |
1447 RawObject** to(intptr_t num_vars) { | 1396 RawObject** to(intptr_t num_vars) { |
1448 return reinterpret_cast<RawObject**>(&ptr()->data()[num_vars - 1]); | 1397 return reinterpret_cast<RawObject**>(&ptr()->data()[num_vars - 1]); |
1449 } | 1398 } |
1450 | 1399 |
1451 friend class SnapshotReader; | 1400 friend class SnapshotReader; |
1452 }; | 1401 }; |
1453 | 1402 |
1454 | 1403 |
1455 class RawContextScope : public RawObject { | 1404 class RawContextScope : public RawObject { |
1456 RAW_HEAP_OBJECT_IMPLEMENTATION(ContextScope); | 1405 RAW_HEAP_OBJECT_IMPLEMENTATION(ContextScope); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 } | 1441 } |
1493 | 1442 |
1494 friend class Object; | 1443 friend class Object; |
1495 friend class RawClosureData; | 1444 friend class RawClosureData; |
1496 friend class SnapshotReader; | 1445 friend class SnapshotReader; |
1497 }; | 1446 }; |
1498 | 1447 |
1499 | 1448 |
1500 class RawSingleTargetCache : public RawObject { | 1449 class RawSingleTargetCache : public RawObject { |
1501 RAW_HEAP_OBJECT_IMPLEMENTATION(SingleTargetCache); | 1450 RAW_HEAP_OBJECT_IMPLEMENTATION(SingleTargetCache); |
1502 RawObject** from() { | 1451 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->target_); } |
1503 return reinterpret_cast<RawObject**>(&ptr()->target_); | |
1504 } | |
1505 RawCode* target_; | 1452 RawCode* target_; |
1506 RawObject** to() { | 1453 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->target_); } |
1507 return reinterpret_cast<RawObject**>(&ptr()->target_); | |
1508 } | |
1509 uword entry_point_; | 1454 uword entry_point_; |
1510 classid_t lower_limit_; | 1455 classid_t lower_limit_; |
1511 classid_t upper_limit_; | 1456 classid_t upper_limit_; |
1512 }; | 1457 }; |
1513 | 1458 |
1514 | 1459 |
1515 class RawUnlinkedCall : public RawObject { | 1460 class RawUnlinkedCall : public RawObject { |
1516 RAW_HEAP_OBJECT_IMPLEMENTATION(UnlinkedCall); | 1461 RAW_HEAP_OBJECT_IMPLEMENTATION(UnlinkedCall); |
1517 RawObject** from() { | 1462 RawObject** from() { |
1518 return reinterpret_cast<RawObject**>(&ptr()->target_name_); | 1463 return reinterpret_cast<RawObject**>(&ptr()->target_name_); |
1519 } | 1464 } |
1520 RawString* target_name_; | 1465 RawString* target_name_; |
1521 RawArray* args_descriptor_; | 1466 RawArray* args_descriptor_; |
1522 RawObject** to() { | 1467 RawObject** to() { |
1523 return reinterpret_cast<RawObject**>(&ptr()->args_descriptor_); | 1468 return reinterpret_cast<RawObject**>(&ptr()->args_descriptor_); |
1524 } | 1469 } |
1525 }; | 1470 }; |
1526 | 1471 |
1527 | 1472 |
1528 class RawICData : public RawObject { | 1473 class RawICData : public RawObject { |
1529 RAW_HEAP_OBJECT_IMPLEMENTATION(ICData); | 1474 RAW_HEAP_OBJECT_IMPLEMENTATION(ICData); |
1530 | 1475 |
1531 RawObject** from() { | 1476 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->ic_data_); } |
1532 return reinterpret_cast<RawObject**>(&ptr()->ic_data_); | 1477 RawArray* ic_data_; // Contains class-ids, target and count. |
1533 } | 1478 RawString* target_name_; // Name of target function. |
1534 RawArray* ic_data_; // Contains class-ids, target and count. | |
1535 RawString* target_name_; // Name of target function. | |
1536 RawArray* args_descriptor_; // Arguments descriptor. | 1479 RawArray* args_descriptor_; // Arguments descriptor. |
1537 RawObject* owner_; // Parent/calling function or original IC of cloned IC. | 1480 RawObject* owner_; // Parent/calling function or original IC of cloned IC. |
1538 RawObject** to() { | 1481 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->owner_); } |
1539 return reinterpret_cast<RawObject**>(&ptr()->owner_); | |
1540 } | |
1541 RawObject** to_snapshot(Snapshot::Kind kind) { | 1482 RawObject** to_snapshot(Snapshot::Kind kind) { |
1542 switch (kind) { | 1483 switch (kind) { |
1543 case Snapshot::kAppNoJIT: | 1484 case Snapshot::kAppNoJIT: |
1544 return reinterpret_cast<RawObject**>(&ptr()->args_descriptor_); | 1485 return reinterpret_cast<RawObject**>(&ptr()->args_descriptor_); |
1545 case Snapshot::kCore: | 1486 case Snapshot::kCore: |
1546 case Snapshot::kScript: | 1487 case Snapshot::kScript: |
1547 case Snapshot::kAppWithJIT: | 1488 case Snapshot::kAppWithJIT: |
1548 return to(); | 1489 return to(); |
1549 case Snapshot::kMessage: | 1490 case Snapshot::kMessage: |
1550 case Snapshot::kNone: | 1491 case Snapshot::kNone: |
1551 case Snapshot::kInvalid: | 1492 case Snapshot::kInvalid: |
1552 break; | 1493 break; |
1553 } | 1494 } |
1554 UNREACHABLE(); | 1495 UNREACHABLE(); |
1555 return NULL; | 1496 return NULL; |
1556 } | 1497 } |
1557 NOT_IN_PRECOMPILED(int32_t deopt_id_); | 1498 NOT_IN_PRECOMPILED(int32_t deopt_id_); |
1558 uint32_t state_bits_; // Number of arguments tested in IC, deopt reasons. | 1499 uint32_t state_bits_; // Number of arguments tested in IC, deopt reasons. |
1559 #if defined(TAG_IC_DATA) | 1500 #if defined(TAG_IC_DATA) |
1560 intptr_t tag_; // Debugging, verifying that the icdata is assigned to the | 1501 intptr_t tag_; // Debugging, verifying that the icdata is assigned to the |
1561 // same instruction again. Store -1 or Instruction::Tag. | 1502 // same instruction again. Store -1 or Instruction::Tag. |
1562 #endif | 1503 #endif |
1563 }; | 1504 }; |
1564 | 1505 |
1565 | 1506 |
1566 class RawMegamorphicCache : public RawObject { | 1507 class RawMegamorphicCache : public RawObject { |
1567 RAW_HEAP_OBJECT_IMPLEMENTATION(MegamorphicCache); | 1508 RAW_HEAP_OBJECT_IMPLEMENTATION(MegamorphicCache); |
1568 | 1509 |
1569 RawObject** from() { | 1510 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->buckets_); } |
1570 return reinterpret_cast<RawObject**>(&ptr()->buckets_); | |
1571 } | |
1572 RawArray* buckets_; | 1511 RawArray* buckets_; |
1573 RawSmi* mask_; | 1512 RawSmi* mask_; |
1574 RawString* target_name_; // Name of target function. | 1513 RawString* target_name_; // Name of target function. |
1575 RawArray* args_descriptor_; // Arguments descriptor. | 1514 RawArray* args_descriptor_; // Arguments descriptor. |
1576 RawObject** to() { | 1515 RawObject** to() { |
1577 return reinterpret_cast<RawObject**>(&ptr()->args_descriptor_); | 1516 return reinterpret_cast<RawObject**>(&ptr()->args_descriptor_); |
1578 } | 1517 } |
1579 | 1518 |
1580 int32_t filled_entry_count_; | 1519 int32_t filled_entry_count_; |
1581 }; | 1520 }; |
1582 | 1521 |
1583 | 1522 |
1584 class RawSubtypeTestCache : public RawObject { | 1523 class RawSubtypeTestCache : public RawObject { |
1585 RAW_HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache); | 1524 RAW_HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache); |
1586 RawArray* cache_; | 1525 RawArray* cache_; |
1587 }; | 1526 }; |
1588 | 1527 |
1589 | 1528 |
1590 class RawError : public RawObject { | 1529 class RawError : public RawObject { |
1591 RAW_HEAP_OBJECT_IMPLEMENTATION(Error); | 1530 RAW_HEAP_OBJECT_IMPLEMENTATION(Error); |
1592 }; | 1531 }; |
1593 | 1532 |
1594 | 1533 |
1595 class RawApiError : public RawError { | 1534 class RawApiError : public RawError { |
1596 RAW_HEAP_OBJECT_IMPLEMENTATION(ApiError); | 1535 RAW_HEAP_OBJECT_IMPLEMENTATION(ApiError); |
1597 | 1536 |
1598 RawObject** from() { | 1537 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->message_); } |
1599 return reinterpret_cast<RawObject**>(&ptr()->message_); | |
1600 } | |
1601 RawString* message_; | 1538 RawString* message_; |
1602 RawObject** to() { | 1539 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->message_); } |
1603 return reinterpret_cast<RawObject**>(&ptr()->message_); | |
1604 } | |
1605 }; | 1540 }; |
1606 | 1541 |
1607 | 1542 |
1608 class RawLanguageError : public RawError { | 1543 class RawLanguageError : public RawError { |
1609 RAW_HEAP_OBJECT_IMPLEMENTATION(LanguageError); | 1544 RAW_HEAP_OBJECT_IMPLEMENTATION(LanguageError); |
1610 | 1545 |
1611 RawObject** from() { | 1546 RawObject** from() { |
1612 return reinterpret_cast<RawObject**>(&ptr()->previous_error_); | 1547 return reinterpret_cast<RawObject**>(&ptr()->previous_error_); |
1613 } | 1548 } |
1614 RawError* previous_error_; // May be null. | 1549 RawError* previous_error_; // May be null. |
1615 RawScript* script_; | 1550 RawScript* script_; |
1616 RawString* message_; | 1551 RawString* message_; |
1617 RawString* formatted_message_; // Incl. previous error's formatted message. | 1552 RawString* formatted_message_; // Incl. previous error's formatted message. |
1618 RawObject** to() { | 1553 RawObject** to() { |
1619 return reinterpret_cast<RawObject**>(&ptr()->formatted_message_); | 1554 return reinterpret_cast<RawObject**>(&ptr()->formatted_message_); |
1620 } | 1555 } |
1621 TokenPosition token_pos_; // Source position in script_. | 1556 TokenPosition token_pos_; // Source position in script_. |
1622 bool report_after_token_; // Report message at or after the token. | 1557 bool report_after_token_; // Report message at or after the token. |
1623 int8_t kind_; // Of type Report::Kind. | 1558 int8_t kind_; // Of type Report::Kind. |
1624 }; | 1559 }; |
1625 | 1560 |
1626 | 1561 |
1627 class RawUnhandledException : public RawError { | 1562 class RawUnhandledException : public RawError { |
1628 RAW_HEAP_OBJECT_IMPLEMENTATION(UnhandledException); | 1563 RAW_HEAP_OBJECT_IMPLEMENTATION(UnhandledException); |
1629 | 1564 |
1630 RawObject** from() { | 1565 RawObject** from() { |
1631 return reinterpret_cast<RawObject**>(&ptr()->exception_); | 1566 return reinterpret_cast<RawObject**>(&ptr()->exception_); |
1632 } | 1567 } |
1633 RawInstance* exception_; | 1568 RawInstance* exception_; |
1634 RawInstance* stacktrace_; | 1569 RawInstance* stacktrace_; |
1635 RawObject** to() { | 1570 RawObject** to() { |
1636 return reinterpret_cast<RawObject**>(&ptr()->stacktrace_); | 1571 return reinterpret_cast<RawObject**>(&ptr()->stacktrace_); |
1637 } | 1572 } |
1638 }; | 1573 }; |
1639 | 1574 |
1640 | 1575 |
1641 class RawUnwindError : public RawError { | 1576 class RawUnwindError : public RawError { |
1642 RAW_HEAP_OBJECT_IMPLEMENTATION(UnwindError); | 1577 RAW_HEAP_OBJECT_IMPLEMENTATION(UnwindError); |
1643 | 1578 |
1644 RawObject** from() { | 1579 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->message_); } |
1645 return reinterpret_cast<RawObject**>(&ptr()->message_); | |
1646 } | |
1647 RawString* message_; | 1580 RawString* message_; |
1648 RawObject** to() { | 1581 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->message_); } |
1649 return reinterpret_cast<RawObject**>(&ptr()->message_); | |
1650 } | |
1651 bool is_user_initiated_; | 1582 bool is_user_initiated_; |
1652 bool is_vm_restart_; | 1583 bool is_vm_restart_; |
1653 }; | 1584 }; |
1654 | 1585 |
1655 | 1586 |
1656 class RawInstance : public RawObject { | 1587 class RawInstance : public RawObject { |
1657 RAW_HEAP_OBJECT_IMPLEMENTATION(Instance); | 1588 RAW_HEAP_OBJECT_IMPLEMENTATION(Instance); |
1658 }; | 1589 }; |
1659 | 1590 |
1660 | 1591 |
1661 class RawLibraryPrefix : public RawInstance { | 1592 class RawLibraryPrefix : public RawInstance { |
1662 RAW_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix); | 1593 RAW_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix); |
1663 | 1594 |
1664 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } | 1595 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
1665 RawString* name_; // Library prefix name. | 1596 RawString* name_; // Library prefix name. |
1666 RawLibrary* importer_; // Library which declares this prefix. | 1597 RawLibrary* importer_; // Library which declares this prefix. |
1667 RawArray* imports_; // Libraries imported with this prefix. | 1598 RawArray* imports_; // Libraries imported with this prefix. |
1668 RawArray* dependent_code_; // Code that refers to deferred, unloaded | 1599 RawArray* dependent_code_; // Code that refers to deferred, unloaded |
1669 // library prefix. | 1600 // library prefix. |
1670 RawObject** to() { | 1601 RawObject** to() { |
1671 return reinterpret_cast<RawObject**>(&ptr()->dependent_code_); | 1602 return reinterpret_cast<RawObject**>(&ptr()->dependent_code_); |
1672 } | 1603 } |
1673 RawObject** to_snapshot(Snapshot::Kind kind) { | 1604 RawObject** to_snapshot(Snapshot::Kind kind) { |
1674 switch (kind) { | 1605 switch (kind) { |
1675 case Snapshot::kCore: | 1606 case Snapshot::kCore: |
1676 case Snapshot::kScript: | 1607 case Snapshot::kScript: |
1677 case Snapshot::kAppWithJIT: | 1608 case Snapshot::kAppWithJIT: |
1678 return reinterpret_cast<RawObject**>(&ptr()->imports_); | 1609 return reinterpret_cast<RawObject**>(&ptr()->imports_); |
1679 case Snapshot::kAppNoJIT: | 1610 case Snapshot::kAppNoJIT: |
1680 return reinterpret_cast<RawObject**>(&ptr()->importer_); | 1611 return reinterpret_cast<RawObject**>(&ptr()->importer_); |
1681 case Snapshot::kMessage: | 1612 case Snapshot::kMessage: |
1682 case Snapshot::kNone: | 1613 case Snapshot::kNone: |
1683 case Snapshot::kInvalid: | 1614 case Snapshot::kInvalid: |
1684 break; | 1615 break; |
1685 } | 1616 } |
1686 UNREACHABLE(); | 1617 UNREACHABLE(); |
1687 return NULL; | 1618 return NULL; |
1688 } | 1619 } |
1689 uint16_t num_imports_; // Number of library entries in libraries_. | 1620 uint16_t num_imports_; // Number of library entries in libraries_. |
1690 bool is_deferred_load_; | 1621 bool is_deferred_load_; |
1691 bool is_loaded_; | 1622 bool is_loaded_; |
1692 }; | 1623 }; |
1693 | 1624 |
1694 | 1625 |
1695 class RawAbstractType : public RawInstance { | 1626 class RawAbstractType : public RawInstance { |
1696 protected: | 1627 protected: |
1697 enum TypeState { | 1628 enum TypeState { |
1698 kAllocated, // Initial state. | 1629 kAllocated, // Initial state. |
1699 kResolved, // Type class and type arguments resolved. | 1630 kResolved, // Type class and type arguments resolved. |
1700 kBeingFinalized, // In the process of being finalized. | 1631 kBeingFinalized, // In the process of being finalized. |
1701 kFinalizedInstantiated, // Instantiated type ready for use. | 1632 kFinalizedInstantiated, // Instantiated type ready for use. |
1702 kFinalizedUninstantiated, // Uninstantiated type ready for use. | 1633 kFinalizedUninstantiated, // Uninstantiated type ready for use. |
1703 }; | 1634 }; |
1704 | 1635 |
1705 private: | 1636 private: |
1706 RAW_HEAP_OBJECT_IMPLEMENTATION(AbstractType); | 1637 RAW_HEAP_OBJECT_IMPLEMENTATION(AbstractType); |
1707 | 1638 |
1708 friend class ObjectStore; | 1639 friend class ObjectStore; |
1709 }; | 1640 }; |
1710 | 1641 |
1711 | 1642 |
1712 class RawType : public RawAbstractType { | 1643 class RawType : public RawAbstractType { |
1713 private: | 1644 private: |
1714 RAW_HEAP_OBJECT_IMPLEMENTATION(Type); | 1645 RAW_HEAP_OBJECT_IMPLEMENTATION(Type); |
1715 | 1646 |
1716 RawObject** from() { | 1647 RawObject** from() { |
1717 return reinterpret_cast<RawObject**>(&ptr()->type_class_id_); | 1648 return reinterpret_cast<RawObject**>(&ptr()->type_class_id_); |
1718 } | 1649 } |
1719 // Either the id of the resolved class as a Smi or an UnresolvedClass. | 1650 // Either the id of the resolved class as a Smi or an UnresolvedClass. |
1720 RawObject* type_class_id_; | 1651 RawObject* type_class_id_; |
1721 RawTypeArguments* arguments_; | 1652 RawTypeArguments* arguments_; |
1722 RawSmi* hash_; | 1653 RawSmi* hash_; |
1723 // This type object represents a function type if its signature field is a | 1654 // This type object represents a function type if its signature field is a |
1724 // non-null function object. | 1655 // non-null function object. |
1725 // If this type is malformed or malbounded, the signature field gets | 1656 // If this type is malformed or malbounded, the signature field gets |
1726 // overwritten by the error object in order to save space. If the type is a | 1657 // overwritten by the error object in order to save space. If the type is a |
1727 // function type, its signature is lost, but the message in the error object | 1658 // function type, its signature is lost, but the message in the error object |
1728 // can describe the issue without needing the signature. | 1659 // can describe the issue without needing the signature. |
1729 union { | 1660 union { |
1730 RawFunction* signature_; // If not null, this type is a function type. | 1661 RawFunction* signature_; // If not null, this type is a function type. |
1731 RawLanguageError* error_; // If not null, type is malformed or malbounded. | 1662 RawLanguageError* error_; // If not null, type is malformed or malbounded. |
1732 } sig_or_err_; | 1663 } sig_or_err_; |
1733 RawObject** to() { | 1664 RawObject** to() { |
1734 return reinterpret_cast<RawObject**>(&ptr()->sig_or_err_.error_); | 1665 return reinterpret_cast<RawObject**>(&ptr()->sig_or_err_.error_); |
1735 } | 1666 } |
1736 TokenPosition token_pos_; | 1667 TokenPosition token_pos_; |
1737 int8_t type_state_; | 1668 int8_t type_state_; |
1738 | 1669 |
1739 friend class CidRewriteVisitor; | 1670 friend class CidRewriteVisitor; |
1740 }; | 1671 }; |
1741 | 1672 |
1742 | 1673 |
1743 class RawTypeRef : public RawAbstractType { | 1674 class RawTypeRef : public RawAbstractType { |
1744 private: | 1675 private: |
1745 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeRef); | 1676 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeRef); |
1746 | 1677 |
1747 RawObject** from() { | 1678 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->type_); } |
1748 return reinterpret_cast<RawObject**>(&ptr()->type_); | |
1749 } | |
1750 RawAbstractType* type_; // The referenced type. | 1679 RawAbstractType* type_; // The referenced type. |
1751 RawObject** to() { | 1680 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->type_); } |
1752 return reinterpret_cast<RawObject**>(&ptr()->type_); | |
1753 } | |
1754 }; | 1681 }; |
1755 | 1682 |
1756 | 1683 |
1757 class RawTypeParameter : public RawAbstractType { | 1684 class RawTypeParameter : public RawAbstractType { |
1758 private: | 1685 private: |
1759 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter); | 1686 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter); |
1760 | 1687 |
1761 RawObject** from() { | 1688 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
1762 return reinterpret_cast<RawObject**>(&ptr()->name_); | |
1763 } | |
1764 RawString* name_; | 1689 RawString* name_; |
1765 RawSmi* hash_; | 1690 RawSmi* hash_; |
1766 RawAbstractType* bound_; // ObjectType if no explicit bound specified. | 1691 RawAbstractType* bound_; // ObjectType if no explicit bound specified. |
1767 RawFunction* parameterized_function_; | 1692 RawFunction* parameterized_function_; |
1768 RawObject** to() { | 1693 RawObject** to() { |
1769 return reinterpret_cast<RawObject**>(&ptr()->parameterized_function_); | 1694 return reinterpret_cast<RawObject**>(&ptr()->parameterized_function_); |
1770 } | 1695 } |
1771 classid_t parameterized_class_id_; | 1696 classid_t parameterized_class_id_; |
1772 TokenPosition token_pos_; | 1697 TokenPosition token_pos_; |
1773 int16_t index_; | 1698 int16_t index_; |
1774 uint8_t parent_level_; // Max 255 levels of nested generic functions is OK. | 1699 uint8_t parent_level_; // Max 255 levels of nested generic functions is OK. |
1775 int8_t type_state_; | 1700 int8_t type_state_; |
1776 | 1701 |
1777 friend class CidRewriteVisitor; | 1702 friend class CidRewriteVisitor; |
1778 }; | 1703 }; |
1779 | 1704 |
1780 | 1705 |
1781 class RawBoundedType : public RawAbstractType { | 1706 class RawBoundedType : public RawAbstractType { |
1782 private: | 1707 private: |
1783 RAW_HEAP_OBJECT_IMPLEMENTATION(BoundedType); | 1708 RAW_HEAP_OBJECT_IMPLEMENTATION(BoundedType); |
1784 | 1709 |
1785 RawObject** from() { | 1710 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->type_); } |
1786 return reinterpret_cast<RawObject**>(&ptr()->type_); | |
1787 } | |
1788 RawAbstractType* type_; | 1711 RawAbstractType* type_; |
1789 RawAbstractType* bound_; | 1712 RawAbstractType* bound_; |
1790 RawSmi* hash_; | 1713 RawSmi* hash_; |
1791 RawTypeParameter* type_parameter_; // For more detailed error reporting. | 1714 RawTypeParameter* type_parameter_; // For more detailed error reporting. |
1792 RawObject** to() { | 1715 RawObject** to() { |
1793 return reinterpret_cast<RawObject**>(&ptr()->type_parameter_); | 1716 return reinterpret_cast<RawObject**>(&ptr()->type_parameter_); |
1794 } | 1717 } |
1795 }; | 1718 }; |
1796 | 1719 |
1797 | 1720 |
(...skipping 18 matching lines...) Expand all Loading... |
1816 RAW_HEAP_OBJECT_IMPLEMENTATION(Closure); | 1739 RAW_HEAP_OBJECT_IMPLEMENTATION(Closure); |
1817 | 1740 |
1818 RawObject** from() { | 1741 RawObject** from() { |
1819 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); | 1742 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); |
1820 } | 1743 } |
1821 | 1744 |
1822 RawTypeArguments* type_arguments_; | 1745 RawTypeArguments* type_arguments_; |
1823 RawFunction* function_; | 1746 RawFunction* function_; |
1824 RawContext* context_; | 1747 RawContext* context_; |
1825 | 1748 |
1826 RawObject** to() { | 1749 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->context_); } |
1827 return reinterpret_cast<RawObject**>(&ptr()->context_); | |
1828 } | |
1829 }; | 1750 }; |
1830 | 1751 |
1831 | 1752 |
1832 class RawNumber : public RawInstance { | 1753 class RawNumber : public RawInstance { |
1833 RAW_OBJECT_IMPLEMENTATION(Number); | 1754 RAW_OBJECT_IMPLEMENTATION(Number); |
1834 }; | 1755 }; |
1835 | 1756 |
1836 | 1757 |
1837 class RawInteger : public RawNumber { | 1758 class RawInteger : public RawNumber { |
1838 RAW_OBJECT_IMPLEMENTATION(Integer); | 1759 RAW_OBJECT_IMPLEMENTATION(Integer); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1908 | 1829 |
1909 // Variable length data follows here. | 1830 // Variable length data follows here. |
1910 uint16_t* data() { OPEN_ARRAY_START(uint16_t, uint16_t); } | 1831 uint16_t* data() { OPEN_ARRAY_START(uint16_t, uint16_t); } |
1911 const uint16_t* data() const { OPEN_ARRAY_START(uint16_t, uint16_t); } | 1832 const uint16_t* data() const { OPEN_ARRAY_START(uint16_t, uint16_t); } |
1912 | 1833 |
1913 friend class SnapshotReader; | 1834 friend class SnapshotReader; |
1914 friend class RODataSerializationCluster; | 1835 friend class RODataSerializationCluster; |
1915 }; | 1836 }; |
1916 | 1837 |
1917 | 1838 |
1918 template<typename T> | 1839 template <typename T> |
1919 class ExternalStringData { | 1840 class ExternalStringData { |
1920 public: | 1841 public: |
1921 ExternalStringData(const T* data, void* peer, Dart_PeerFinalizer callback) : | 1842 ExternalStringData(const T* data, void* peer, Dart_PeerFinalizer callback) |
1922 data_(data), peer_(peer), callback_(callback) { | 1843 : data_(data), peer_(peer), callback_(callback) {} |
1923 } | |
1924 ~ExternalStringData() { | 1844 ~ExternalStringData() { |
1925 if (callback_ != NULL) (*callback_)(peer_); | 1845 if (callback_ != NULL) (*callback_)(peer_); |
1926 } | 1846 } |
1927 | 1847 |
1928 const T* data() { | 1848 const T* data() { return data_; } |
1929 return data_; | 1849 void* peer() { return peer_; } |
1930 } | |
1931 void* peer() { | |
1932 return peer_; | |
1933 } | |
1934 | 1850 |
1935 static intptr_t data_offset() { | 1851 static intptr_t data_offset() { |
1936 return OFFSET_OF(ExternalStringData<T>, data_); | 1852 return OFFSET_OF(ExternalStringData<T>, data_); |
1937 } | 1853 } |
1938 | 1854 |
1939 private: | 1855 private: |
1940 const T* data_; | 1856 const T* data_; |
1941 void* peer_; | 1857 void* peer_; |
1942 Dart_PeerFinalizer callback_; | 1858 Dart_PeerFinalizer callback_; |
1943 }; | 1859 }; |
1944 | 1860 |
1945 | 1861 |
1946 class RawExternalOneByteString : public RawString { | 1862 class RawExternalOneByteString : public RawString { |
1947 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalOneByteString); | 1863 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalOneByteString); |
| 1864 |
1948 public: | 1865 public: |
1949 typedef ExternalStringData<uint8_t> ExternalData; | 1866 typedef ExternalStringData<uint8_t> ExternalData; |
1950 | 1867 |
1951 private: | 1868 private: |
1952 ExternalData* external_data_; | 1869 ExternalData* external_data_; |
1953 friend class Api; | 1870 friend class Api; |
1954 }; | 1871 }; |
1955 | 1872 |
1956 | 1873 |
1957 class RawExternalTwoByteString : public RawString { | 1874 class RawExternalTwoByteString : public RawString { |
1958 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTwoByteString); | 1875 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTwoByteString); |
| 1876 |
1959 public: | 1877 public: |
1960 typedef ExternalStringData<uint16_t> ExternalData; | 1878 typedef ExternalStringData<uint16_t> ExternalData; |
1961 | 1879 |
1962 private: | 1880 private: |
1963 ExternalData* external_data_; | 1881 ExternalData* external_data_; |
1964 friend class Api; | 1882 friend class Api; |
1965 }; | 1883 }; |
1966 | 1884 |
1967 | 1885 |
1968 class RawBool : public RawInstance { | 1886 class RawBool : public RawInstance { |
(...skipping 21 matching lines...) Expand all Loading... |
1990 friend class LinkedHashMapSerializationCluster; | 1908 friend class LinkedHashMapSerializationCluster; |
1991 friend class LinkedHashMapDeserializationCluster; | 1909 friend class LinkedHashMapDeserializationCluster; |
1992 friend class Deserializer; | 1910 friend class Deserializer; |
1993 friend class RawCode; | 1911 friend class RawCode; |
1994 friend class RawImmutableArray; | 1912 friend class RawImmutableArray; |
1995 friend class SnapshotReader; | 1913 friend class SnapshotReader; |
1996 friend class GrowableObjectArray; | 1914 friend class GrowableObjectArray; |
1997 friend class LinkedHashMap; | 1915 friend class LinkedHashMap; |
1998 friend class RawLinkedHashMap; | 1916 friend class RawLinkedHashMap; |
1999 friend class Object; | 1917 friend class Object; |
2000 friend class ICData; // For high performance access. | 1918 friend class ICData; // For high performance access. |
2001 friend class SubtypeTestCache; // For high performance access. | 1919 friend class SubtypeTestCache; // For high performance access. |
2002 }; | 1920 }; |
2003 | 1921 |
2004 | 1922 |
2005 class RawImmutableArray : public RawArray { | 1923 class RawImmutableArray : public RawArray { |
2006 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray); | 1924 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray); |
2007 | 1925 |
2008 friend class SnapshotReader; | 1926 friend class SnapshotReader; |
2009 }; | 1927 }; |
2010 | 1928 |
2011 | 1929 |
2012 class RawGrowableObjectArray : public RawInstance { | 1930 class RawGrowableObjectArray : public RawInstance { |
2013 RAW_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray); | 1931 RAW_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray); |
2014 | 1932 |
2015 RawObject** from() { | 1933 RawObject** from() { |
2016 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); | 1934 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); |
2017 } | 1935 } |
2018 RawTypeArguments* type_arguments_; | 1936 RawTypeArguments* type_arguments_; |
2019 RawSmi* length_; | 1937 RawSmi* length_; |
2020 RawArray* data_; | 1938 RawArray* data_; |
2021 RawObject** to() { | 1939 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->data_); } |
2022 return reinterpret_cast<RawObject**>(&ptr()->data_); | |
2023 } | |
2024 | 1940 |
2025 friend class SnapshotReader; | 1941 friend class SnapshotReader; |
2026 }; | 1942 }; |
2027 | 1943 |
2028 | 1944 |
2029 class RawLinkedHashMap : public RawInstance { | 1945 class RawLinkedHashMap : public RawInstance { |
2030 RAW_HEAP_OBJECT_IMPLEMENTATION(LinkedHashMap); | 1946 RAW_HEAP_OBJECT_IMPLEMENTATION(LinkedHashMap); |
2031 | 1947 |
2032 RawObject** from() { | 1948 RawObject** from() { |
2033 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); | 1949 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2157 | 2073 |
2158 | 2074 |
2159 class RawReceivePort : public RawInstance { | 2075 class RawReceivePort : public RawInstance { |
2160 RAW_HEAP_OBJECT_IMPLEMENTATION(ReceivePort); | 2076 RAW_HEAP_OBJECT_IMPLEMENTATION(ReceivePort); |
2161 | 2077 |
2162 RawObject** from() { | 2078 RawObject** from() { |
2163 return reinterpret_cast<RawObject**>(&ptr()->send_port_); | 2079 return reinterpret_cast<RawObject**>(&ptr()->send_port_); |
2164 } | 2080 } |
2165 RawSendPort* send_port_; | 2081 RawSendPort* send_port_; |
2166 RawInstance* handler_; | 2082 RawInstance* handler_; |
2167 RawObject** to() { | 2083 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->handler_); } |
2168 return reinterpret_cast<RawObject**>(&ptr()->handler_); | |
2169 } | |
2170 }; | 2084 }; |
2171 | 2085 |
2172 | 2086 |
2173 // VM type for capturing stacktraces when exceptions are thrown, | 2087 // VM type for capturing stacktraces when exceptions are thrown, |
2174 // Currently we don't have any interface that this object is supposed | 2088 // Currently we don't have any interface that this object is supposed |
2175 // to implement so we just support the 'toString' method which | 2089 // to implement so we just support the 'toString' method which |
2176 // converts the stack trace into a string. | 2090 // converts the stack trace into a string. |
2177 class RawStacktrace : public RawInstance { | 2091 class RawStacktrace : public RawInstance { |
2178 RAW_HEAP_OBJECT_IMPLEMENTATION(Stacktrace); | 2092 RAW_HEAP_OBJECT_IMPLEMENTATION(Stacktrace); |
2179 | 2093 |
2180 RawObject** from() { | 2094 RawObject** from() { |
2181 return reinterpret_cast<RawObject**>(&ptr()->code_array_); | 2095 return reinterpret_cast<RawObject**>(&ptr()->code_array_); |
2182 } | 2096 } |
2183 RawArray* code_array_; // Code object for each frame in the stack trace. | 2097 RawArray* code_array_; // Code object for each frame in the stack trace. |
2184 RawArray* pc_offset_array_; // Offset of PC for each frame. | 2098 RawArray* pc_offset_array_; // Offset of PC for each frame. |
2185 RawObject** to() { | 2099 RawObject** to() { |
2186 return reinterpret_cast<RawObject**>(&ptr()->pc_offset_array_); | 2100 return reinterpret_cast<RawObject**>(&ptr()->pc_offset_array_); |
2187 } | 2101 } |
2188 // False for pre-allocated stack trace (used in OOM and Stack overflow). | 2102 // False for pre-allocated stack trace (used in OOM and Stack overflow). |
2189 bool expand_inlined_; | 2103 bool expand_inlined_; |
2190 }; | 2104 }; |
2191 | 2105 |
2192 | 2106 |
2193 // VM type for capturing JS regular expressions. | 2107 // VM type for capturing JS regular expressions. |
(...skipping 20 matching lines...) Expand all Loading... |
2214 // A bitfield with two fields: | 2128 // A bitfield with two fields: |
2215 // type: Uninitialized, simple or complex. | 2129 // type: Uninitialized, simple or complex. |
2216 // flags: Represents global/local, case insensitive, multiline. | 2130 // flags: Represents global/local, case insensitive, multiline. |
2217 int8_t type_flags_; | 2131 int8_t type_flags_; |
2218 }; | 2132 }; |
2219 | 2133 |
2220 | 2134 |
2221 class RawWeakProperty : public RawInstance { | 2135 class RawWeakProperty : public RawInstance { |
2222 RAW_HEAP_OBJECT_IMPLEMENTATION(WeakProperty); | 2136 RAW_HEAP_OBJECT_IMPLEMENTATION(WeakProperty); |
2223 | 2137 |
2224 RawObject** from() { | 2138 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->key_); } |
2225 return reinterpret_cast<RawObject**>(&ptr()->key_); | |
2226 } | |
2227 RawObject* key_; | 2139 RawObject* key_; |
2228 RawObject* value_; | 2140 RawObject* value_; |
2229 RawObject** to() { | 2141 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->value_); } |
2230 return reinterpret_cast<RawObject**>(&ptr()->value_); | |
2231 } | |
2232 | 2142 |
2233 // Linked list is chaining all pending weak properties. | 2143 // Linked list is chaining all pending weak properties. |
2234 // Untyped to make it clear that it is not to be visited by GC. | 2144 // Untyped to make it clear that it is not to be visited by GC. |
2235 uword next_; | 2145 uword next_; |
2236 | 2146 |
2237 friend class GCMarker; | 2147 friend class GCMarker; |
2238 template<bool> friend class MarkingVisitorBase; | 2148 template <bool> |
| 2149 friend class MarkingVisitorBase; |
2239 friend class Scavenger; | 2150 friend class Scavenger; |
2240 friend class ScavengerVisitor; | 2151 friend class ScavengerVisitor; |
2241 }; | 2152 }; |
2242 | 2153 |
2243 // MirrorReferences are used by mirrors to hold reflectees that are VM | 2154 // MirrorReferences are used by mirrors to hold reflectees that are VM |
2244 // internal objects, such as libraries, classes, functions or types. | 2155 // internal objects, such as libraries, classes, functions or types. |
2245 class RawMirrorReference : public RawInstance { | 2156 class RawMirrorReference : public RawInstance { |
2246 RAW_HEAP_OBJECT_IMPLEMENTATION(MirrorReference); | 2157 RAW_HEAP_OBJECT_IMPLEMENTATION(MirrorReference); |
2247 | 2158 |
2248 RawObject** from() { | 2159 RawObject** from() { |
2249 return reinterpret_cast<RawObject**>(&ptr()->referent_); | 2160 return reinterpret_cast<RawObject**>(&ptr()->referent_); |
2250 } | 2161 } |
2251 RawObject* referent_; | 2162 RawObject* referent_; |
2252 RawObject** to() { | 2163 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->referent_); } |
2253 return reinterpret_cast<RawObject**>(&ptr()->referent_); | |
2254 } | |
2255 }; | 2164 }; |
2256 | 2165 |
2257 | 2166 |
2258 // UserTag are used by the profiler to track Dart script state. | 2167 // UserTag are used by the profiler to track Dart script state. |
2259 class RawUserTag : public RawInstance { | 2168 class RawUserTag : public RawInstance { |
2260 RAW_HEAP_OBJECT_IMPLEMENTATION(UserTag); | 2169 RAW_HEAP_OBJECT_IMPLEMENTATION(UserTag); |
2261 | 2170 |
2262 RawObject** from() { | 2171 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->label_); } |
2263 return reinterpret_cast<RawObject**>(&ptr()->label_); | |
2264 } | |
2265 | 2172 |
2266 RawString* label_; | 2173 RawString* label_; |
2267 | 2174 |
2268 RawObject** to() { | 2175 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->label_); } |
2269 return reinterpret_cast<RawObject**>(&ptr()->label_); | |
2270 } | |
2271 | 2176 |
2272 // Isolate unique tag. | 2177 // Isolate unique tag. |
2273 uword tag_; | 2178 uword tag_; |
2274 | 2179 |
2275 friend class SnapshotReader; | 2180 friend class SnapshotReader; |
2276 friend class Object; | 2181 friend class Object; |
2277 | 2182 |
2278 public: | 2183 public: |
2279 uword tag() const { return tag_; } | 2184 uword tag() const { return tag_; } |
2280 }; | 2185 }; |
2281 | 2186 |
2282 // Class Id predicates. | 2187 // Class Id predicates. |
2283 | 2188 |
2284 inline bool RawObject::IsErrorClassId(intptr_t index) { | 2189 inline bool RawObject::IsErrorClassId(intptr_t index) { |
2285 // Make sure this function is updated when new Error types are added. | 2190 // Make sure this function is updated when new Error types are added. |
2286 COMPILE_ASSERT(kApiErrorCid == kErrorCid + 1 && | 2191 COMPILE_ASSERT( |
2287 kLanguageErrorCid == kErrorCid + 2 && | 2192 kApiErrorCid == kErrorCid + 1 && kLanguageErrorCid == kErrorCid + 2 && |
2288 kUnhandledExceptionCid == kErrorCid + 3 && | 2193 kUnhandledExceptionCid == kErrorCid + 3 && |
2289 kUnwindErrorCid == kErrorCid + 4 && | 2194 kUnwindErrorCid == kErrorCid + 4 && kInstanceCid == kErrorCid + 5); |
2290 kInstanceCid == kErrorCid + 5); | |
2291 return (index >= kErrorCid && index < kInstanceCid); | 2195 return (index >= kErrorCid && index < kInstanceCid); |
2292 } | 2196 } |
2293 | 2197 |
2294 | 2198 |
2295 inline bool RawObject::IsNumberClassId(intptr_t index) { | 2199 inline bool RawObject::IsNumberClassId(intptr_t index) { |
2296 // Make sure this function is updated when new Number types are added. | 2200 // Make sure this function is updated when new Number types are added. |
2297 COMPILE_ASSERT(kIntegerCid == kNumberCid + 1 && | 2201 COMPILE_ASSERT(kIntegerCid == kNumberCid + 1 && kSmiCid == kNumberCid + 2 && |
2298 kSmiCid == kNumberCid + 2 && | 2202 kMintCid == kNumberCid + 3 && kBigintCid == kNumberCid + 4 && |
2299 kMintCid == kNumberCid + 3 && | |
2300 kBigintCid == kNumberCid + 4 && | |
2301 kDoubleCid == kNumberCid + 5); | 2203 kDoubleCid == kNumberCid + 5); |
2302 return (index >= kNumberCid && index < kBoolCid); | 2204 return (index >= kNumberCid && index < kBoolCid); |
2303 } | 2205 } |
2304 | 2206 |
2305 | 2207 |
2306 inline bool RawObject::IsIntegerClassId(intptr_t index) { | 2208 inline bool RawObject::IsIntegerClassId(intptr_t index) { |
2307 // Make sure this function is updated when new Integer types are added. | 2209 // Make sure this function is updated when new Integer types are added. |
2308 COMPILE_ASSERT(kSmiCid == kIntegerCid + 1 && | 2210 COMPILE_ASSERT(kSmiCid == kIntegerCid + 1 && kMintCid == kIntegerCid + 2 && |
2309 kMintCid == kIntegerCid + 2 && | |
2310 kBigintCid == kIntegerCid + 3 && | 2211 kBigintCid == kIntegerCid + 3 && |
2311 kDoubleCid == kIntegerCid + 4); | 2212 kDoubleCid == kIntegerCid + 4); |
2312 return (index >= kIntegerCid && index < kDoubleCid); | 2213 return (index >= kIntegerCid && index < kDoubleCid); |
2313 } | 2214 } |
2314 | 2215 |
2315 | 2216 |
2316 inline bool RawObject::IsStringClassId(intptr_t index) { | 2217 inline bool RawObject::IsStringClassId(intptr_t index) { |
2317 // Make sure this function is updated when new StringCid types are added. | 2218 // Make sure this function is updated when new StringCid types are added. |
2318 COMPILE_ASSERT(kOneByteStringCid == kStringCid + 1 && | 2219 COMPILE_ASSERT(kOneByteStringCid == kStringCid + 1 && |
2319 kTwoByteStringCid == kStringCid + 2 && | 2220 kTwoByteStringCid == kStringCid + 2 && |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2351 kExternalTwoByteStringCid == kStringCid + 4); | 2252 kExternalTwoByteStringCid == kStringCid + 4); |
2352 return (index == kExternalOneByteStringCid || | 2253 return (index == kExternalOneByteStringCid || |
2353 index == kExternalTwoByteStringCid); | 2254 index == kExternalTwoByteStringCid); |
2354 } | 2255 } |
2355 | 2256 |
2356 | 2257 |
2357 inline bool RawObject::IsBuiltinListClassId(intptr_t index) { | 2258 inline bool RawObject::IsBuiltinListClassId(intptr_t index) { |
2358 // Make sure this function is updated when new builtin List types are added. | 2259 // Make sure this function is updated when new builtin List types are added. |
2359 COMPILE_ASSERT(kImmutableArrayCid == kArrayCid + 1); | 2260 COMPILE_ASSERT(kImmutableArrayCid == kArrayCid + 1); |
2360 return ((index >= kArrayCid && index <= kImmutableArrayCid) || | 2261 return ((index >= kArrayCid && index <= kImmutableArrayCid) || |
2361 (index == kGrowableObjectArrayCid) || | 2262 (index == kGrowableObjectArrayCid) || IsTypedDataClassId(index) || |
2362 IsTypedDataClassId(index) || | 2263 IsTypedDataViewClassId(index) || IsExternalTypedDataClassId(index) || |
2363 IsTypedDataViewClassId(index) || | |
2364 IsExternalTypedDataClassId(index) || | |
2365 (index == kByteBufferCid)); | 2264 (index == kByteBufferCid)); |
2366 } | 2265 } |
2367 | 2266 |
2368 | 2267 |
2369 inline bool RawObject::IsTypedDataClassId(intptr_t index) { | 2268 inline bool RawObject::IsTypedDataClassId(intptr_t index) { |
2370 // Make sure this is updated when new TypedData types are added. | 2269 // Make sure this is updated when new TypedData types are added. |
2371 COMPILE_ASSERT(kTypedDataUint8ArrayCid == kTypedDataInt8ArrayCid + 1 && | 2270 COMPILE_ASSERT(kTypedDataUint8ArrayCid == kTypedDataInt8ArrayCid + 1 && |
2372 kTypedDataUint8ClampedArrayCid == kTypedDataInt8ArrayCid + 2 && | 2271 kTypedDataUint8ClampedArrayCid == kTypedDataInt8ArrayCid + 2 && |
2373 kTypedDataInt16ArrayCid == kTypedDataInt8ArrayCid + 3 && | 2272 kTypedDataInt16ArrayCid == kTypedDataInt8ArrayCid + 3 && |
2374 kTypedDataUint16ArrayCid == kTypedDataInt8ArrayCid + 4 && | 2273 kTypedDataUint16ArrayCid == kTypedDataInt8ArrayCid + 4 && |
(...skipping 23 matching lines...) Expand all Loading... |
2398 kTypedDataUint32ArrayViewCid == kTypedDataInt8ArrayViewCid + 6 && | 2297 kTypedDataUint32ArrayViewCid == kTypedDataInt8ArrayViewCid + 6 && |
2399 kTypedDataInt64ArrayViewCid == kTypedDataInt8ArrayViewCid + 7 && | 2298 kTypedDataInt64ArrayViewCid == kTypedDataInt8ArrayViewCid + 7 && |
2400 kTypedDataUint64ArrayViewCid == kTypedDataInt8ArrayViewCid + 8 && | 2299 kTypedDataUint64ArrayViewCid == kTypedDataInt8ArrayViewCid + 8 && |
2401 kTypedDataFloat32ArrayViewCid == kTypedDataInt8ArrayViewCid + 9 && | 2300 kTypedDataFloat32ArrayViewCid == kTypedDataInt8ArrayViewCid + 9 && |
2402 kTypedDataFloat64ArrayViewCid == kTypedDataInt8ArrayViewCid + 10 && | 2301 kTypedDataFloat64ArrayViewCid == kTypedDataInt8ArrayViewCid + 10 && |
2403 kTypedDataFloat32x4ArrayViewCid == kTypedDataInt8ArrayViewCid + 11 && | 2302 kTypedDataFloat32x4ArrayViewCid == kTypedDataInt8ArrayViewCid + 11 && |
2404 kTypedDataInt32x4ArrayViewCid == kTypedDataInt8ArrayViewCid + 12 && | 2303 kTypedDataInt32x4ArrayViewCid == kTypedDataInt8ArrayViewCid + 12 && |
2405 kTypedDataFloat64x2ArrayViewCid == kTypedDataInt8ArrayViewCid + 13 && | 2304 kTypedDataFloat64x2ArrayViewCid == kTypedDataInt8ArrayViewCid + 13 && |
2406 kByteDataViewCid == kTypedDataInt8ArrayViewCid + 14 && | 2305 kByteDataViewCid == kTypedDataInt8ArrayViewCid + 14 && |
2407 kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 15); | 2306 kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 15); |
2408 return (index >= kTypedDataInt8ArrayViewCid && | 2307 return (index >= kTypedDataInt8ArrayViewCid && index <= kByteDataViewCid); |
2409 index <= kByteDataViewCid); | |
2410 } | 2308 } |
2411 | 2309 |
2412 | 2310 |
2413 inline bool RawObject::IsExternalTypedDataClassId(intptr_t index) { | 2311 inline bool RawObject::IsExternalTypedDataClassId(intptr_t index) { |
2414 // Make sure this is updated when new ExternalTypedData types are added. | 2312 // Make sure this is updated when new ExternalTypedData types are added. |
2415 COMPILE_ASSERT( | 2313 COMPILE_ASSERT( |
2416 (kExternalTypedDataUint8ArrayCid == | 2314 (kExternalTypedDataUint8ArrayCid == kExternalTypedDataInt8ArrayCid + 1) && |
2417 kExternalTypedDataInt8ArrayCid + 1) && | |
2418 (kExternalTypedDataUint8ClampedArrayCid == | 2315 (kExternalTypedDataUint8ClampedArrayCid == |
2419 kExternalTypedDataInt8ArrayCid + 2) && | 2316 kExternalTypedDataInt8ArrayCid + 2) && |
2420 (kExternalTypedDataInt16ArrayCid == | 2317 (kExternalTypedDataInt16ArrayCid == kExternalTypedDataInt8ArrayCid + 3) && |
2421 kExternalTypedDataInt8ArrayCid + 3) && | |
2422 (kExternalTypedDataUint16ArrayCid == | 2318 (kExternalTypedDataUint16ArrayCid == |
2423 kExternalTypedDataInt8ArrayCid + 4) && | 2319 kExternalTypedDataInt8ArrayCid + 4) && |
2424 (kExternalTypedDataInt32ArrayCid == | 2320 (kExternalTypedDataInt32ArrayCid == kExternalTypedDataInt8ArrayCid + 5) && |
2425 kExternalTypedDataInt8ArrayCid + 5) && | |
2426 (kExternalTypedDataUint32ArrayCid == | 2321 (kExternalTypedDataUint32ArrayCid == |
2427 kExternalTypedDataInt8ArrayCid + 6) && | 2322 kExternalTypedDataInt8ArrayCid + 6) && |
2428 (kExternalTypedDataInt64ArrayCid == | 2323 (kExternalTypedDataInt64ArrayCid == kExternalTypedDataInt8ArrayCid + 7) && |
2429 kExternalTypedDataInt8ArrayCid + 7) && | |
2430 (kExternalTypedDataUint64ArrayCid == | 2324 (kExternalTypedDataUint64ArrayCid == |
2431 kExternalTypedDataInt8ArrayCid + 8) && | 2325 kExternalTypedDataInt8ArrayCid + 8) && |
2432 (kExternalTypedDataFloat32ArrayCid == | 2326 (kExternalTypedDataFloat32ArrayCid == |
2433 kExternalTypedDataInt8ArrayCid + 9) && | 2327 kExternalTypedDataInt8ArrayCid + 9) && |
2434 (kExternalTypedDataFloat64ArrayCid == | 2328 (kExternalTypedDataFloat64ArrayCid == |
2435 kExternalTypedDataInt8ArrayCid + 10) && | 2329 kExternalTypedDataInt8ArrayCid + 10) && |
2436 (kExternalTypedDataFloat32x4ArrayCid == | 2330 (kExternalTypedDataFloat32x4ArrayCid == |
2437 kExternalTypedDataInt8ArrayCid + 11) && | 2331 kExternalTypedDataInt8ArrayCid + 11) && |
2438 (kExternalTypedDataInt32x4ArrayCid == | 2332 (kExternalTypedDataInt32x4ArrayCid == |
2439 kExternalTypedDataInt8ArrayCid + 12) && | 2333 kExternalTypedDataInt8ArrayCid + 12) && |
2440 (kExternalTypedDataFloat64x2ArrayCid == | 2334 (kExternalTypedDataFloat64x2ArrayCid == |
2441 kExternalTypedDataInt8ArrayCid + 13) && | 2335 kExternalTypedDataInt8ArrayCid + 13) && |
2442 (kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14)); | 2336 (kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14)); |
2443 return (index >= kExternalTypedDataInt8ArrayCid && | 2337 return (index >= kExternalTypedDataInt8ArrayCid && |
2444 index <= kExternalTypedDataFloat64x2ArrayCid); | 2338 index <= kExternalTypedDataFloat64x2ArrayCid); |
2445 } | 2339 } |
2446 | 2340 |
2447 | 2341 |
2448 inline bool RawObject::IsInternalVMdefinedClassId(intptr_t index) { | 2342 inline bool RawObject::IsInternalVMdefinedClassId(intptr_t index) { |
2449 return ((index < kNumPredefinedCids) && | 2343 return ((index < kNumPredefinedCids) && |
2450 !RawObject::IsImplicitFieldClassId(index)); | 2344 !RawObject::IsImplicitFieldClassId(index)); |
2451 } | 2345 } |
2452 | 2346 |
2453 | 2347 |
2454 inline bool RawObject::IsVariableSizeClassId(intptr_t index) { | 2348 inline bool RawObject::IsVariableSizeClassId(intptr_t index) { |
2455 return (index == kArrayCid) || | 2349 return (index == kArrayCid) || (index == kImmutableArrayCid) || |
2456 (index == kImmutableArrayCid) || | |
2457 RawObject::IsOneByteStringClassId(index) || | 2350 RawObject::IsOneByteStringClassId(index) || |
2458 RawObject::IsTwoByteStringClassId(index) || | 2351 RawObject::IsTwoByteStringClassId(index) || |
2459 RawObject::IsTypedDataClassId(index) || | 2352 RawObject::IsTypedDataClassId(index) || (index == kContextCid) || |
2460 (index == kContextCid) || | 2353 (index == kTypeArgumentsCid) || (index == kInstructionsCid) || |
2461 (index == kTypeArgumentsCid) || | 2354 (index == kObjectPoolCid) || (index == kPcDescriptorsCid) || |
2462 (index == kInstructionsCid) || | 2355 (index == kCodeSourceMapCid) || (index == kStackmapCid) || |
2463 (index == kObjectPoolCid) || | |
2464 (index == kPcDescriptorsCid) || | |
2465 (index == kCodeSourceMapCid) || | |
2466 (index == kStackmapCid) || | |
2467 (index == kLocalVarDescriptorsCid) || | 2356 (index == kLocalVarDescriptorsCid) || |
2468 (index == kExceptionHandlersCid) || | 2357 (index == kExceptionHandlersCid) || (index == kCodeCid) || |
2469 (index == kCodeCid) || | 2358 (index == kContextScopeCid) || (index == kInstanceCid) || |
2470 (index == kContextScopeCid) || | |
2471 (index == kInstanceCid) || | |
2472 (index == kRegExpCid); | 2359 (index == kRegExpCid); |
2473 } | 2360 } |
2474 | 2361 |
2475 | 2362 |
2476 // This is a set of classes that are not Dart classes whose representation | 2363 // This is a set of classes that are not Dart classes whose representation |
2477 // is defined by the VM but are used in the VM code by computing the | 2364 // is defined by the VM but are used in the VM code by computing the |
2478 // implicit field offsets of the various fields in the dart object. | 2365 // implicit field offsets of the various fields in the dart object. |
2479 inline bool RawObject::IsImplicitFieldClassId(intptr_t index) { | 2366 inline bool RawObject::IsImplicitFieldClassId(intptr_t index) { |
2480 return (IsTypedDataViewClassId(index) || index == kByteBufferCid); | 2367 return (IsTypedDataViewClassId(index) || index == kByteBufferCid); |
2481 } | 2368 } |
2482 | 2369 |
2483 | 2370 |
2484 inline intptr_t RawObject::NumberOfTypedDataClasses() { | 2371 inline intptr_t RawObject::NumberOfTypedDataClasses() { |
2485 // Make sure this is updated when new TypedData types are added. | 2372 // Make sure this is updated when new TypedData types are added. |
2486 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); | 2373 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); |
2487 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2374 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
2488 kTypedDataInt8ArrayViewCid + 15); | 2375 kTypedDataInt8ArrayViewCid + 15); |
2489 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2376 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
2490 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2377 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
2491 return (kNullCid - kTypedDataInt8ArrayCid); | 2378 return (kNullCid - kTypedDataInt8ArrayCid); |
2492 } | 2379 } |
2493 | 2380 |
2494 } // namespace dart | 2381 } // namespace dart |
2495 | 2382 |
2496 #endif // RUNTIME_VM_RAW_OBJECT_H_ | 2383 #endif // RUNTIME_VM_RAW_OBJECT_H_ |
OLD | NEW |