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 #include "vm/raw_object.h" | 5 #include "vm/raw_object.h" |
6 | 6 |
7 #include "vm/become.h" | 7 #include "vm/become.h" |
8 #include "vm/class_table.h" | 8 #include "vm/class_table.h" |
9 #include "vm/dart.h" | 9 #include "vm/dart.h" |
10 #include "vm/freelist.h" | 10 #include "vm/freelist.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 break; | 66 break; |
67 } | 67 } |
68 case kInstructionsCid: { | 68 case kInstructionsCid: { |
69 const RawInstructions* raw_instructions = | 69 const RawInstructions* raw_instructions = |
70 reinterpret_cast<const RawInstructions*>(this); | 70 reinterpret_cast<const RawInstructions*>(this); |
71 intptr_t instructions_size = abs(raw_instructions->ptr()->size_); | 71 intptr_t instructions_size = abs(raw_instructions->ptr()->size_); |
72 instance_size = Instructions::InstanceSize(instructions_size); | 72 instance_size = Instructions::InstanceSize(instructions_size); |
73 break; | 73 break; |
74 } | 74 } |
75 case kContextCid: { | 75 case kContextCid: { |
76 const RawContext* raw_context = | 76 const RawContext* raw_context = reinterpret_cast<const RawContext*>(this); |
77 reinterpret_cast<const RawContext*>(this); | |
78 intptr_t num_variables = raw_context->ptr()->num_variables_; | 77 intptr_t num_variables = raw_context->ptr()->num_variables_; |
79 instance_size = Context::InstanceSize(num_variables); | 78 instance_size = Context::InstanceSize(num_variables); |
80 break; | 79 break; |
81 } | 80 } |
82 case kContextScopeCid: { | 81 case kContextScopeCid: { |
83 const RawContextScope* raw_context_scope = | 82 const RawContextScope* raw_context_scope = |
84 reinterpret_cast<const RawContextScope*>(this); | 83 reinterpret_cast<const RawContextScope*>(this); |
85 intptr_t num_variables = raw_context_scope->ptr()->num_variables_; | 84 intptr_t num_variables = raw_context_scope->ptr()->num_variables_; |
86 instance_size = ContextScope::InstanceSize(num_variables); | 85 instance_size = ContextScope::InstanceSize(num_variables); |
87 break; | 86 break; |
(...skipping 19 matching lines...) Expand all Loading... |
107 instance_size = Array::InstanceSize(array_length); | 106 instance_size = Array::InstanceSize(array_length); |
108 break; | 107 break; |
109 } | 108 } |
110 case kObjectPoolCid: { | 109 case kObjectPoolCid: { |
111 const RawObjectPool* raw_object_pool = | 110 const RawObjectPool* raw_object_pool = |
112 reinterpret_cast<const RawObjectPool*>(this); | 111 reinterpret_cast<const RawObjectPool*>(this); |
113 intptr_t len = raw_object_pool->ptr()->length_; | 112 intptr_t len = raw_object_pool->ptr()->length_; |
114 instance_size = ObjectPool::InstanceSize(len); | 113 instance_size = ObjectPool::InstanceSize(len); |
115 break; | 114 break; |
116 } | 115 } |
117 #define SIZE_FROM_CLASS(clazz) \ | 116 #define SIZE_FROM_CLASS(clazz) case kTypedData##clazz##Cid: |
118 case kTypedData##clazz##Cid: | 117 CLASS_LIST_TYPED_DATA(SIZE_FROM_CLASS) { |
119 CLASS_LIST_TYPED_DATA(SIZE_FROM_CLASS) { | 118 const RawTypedData* raw_obj = |
120 const RawTypedData* raw_obj = | 119 reinterpret_cast<const RawTypedData*>(this); |
121 reinterpret_cast<const RawTypedData*>(this); | 120 intptr_t cid = raw_obj->GetClassId(); |
122 intptr_t cid = raw_obj->GetClassId(); | 121 intptr_t array_len = Smi::Value(raw_obj->ptr()->length_); |
123 intptr_t array_len = Smi::Value(raw_obj->ptr()->length_); | 122 intptr_t lengthInBytes = array_len * TypedData::ElementSizeInBytes(cid); |
124 intptr_t lengthInBytes = array_len * TypedData::ElementSizeInBytes(cid); | 123 instance_size = TypedData::InstanceSize(lengthInBytes); |
125 instance_size = TypedData::InstanceSize(lengthInBytes); | 124 break; |
126 break; | 125 } |
127 } | |
128 #undef SIZE_FROM_CLASS | 126 #undef SIZE_FROM_CLASS |
129 case kTypeArgumentsCid: { | 127 case kTypeArgumentsCid: { |
130 const RawTypeArguments* raw_array = | 128 const RawTypeArguments* raw_array = |
131 reinterpret_cast<const RawTypeArguments*>(this); | 129 reinterpret_cast<const RawTypeArguments*>(this); |
132 intptr_t array_length = Smi::Value(raw_array->ptr()->length_); | 130 intptr_t array_length = Smi::Value(raw_array->ptr()->length_); |
133 instance_size = TypeArguments::InstanceSize(array_length); | 131 instance_size = TypeArguments::InstanceSize(array_length); |
134 break; | 132 break; |
135 } | 133 } |
136 case kPcDescriptorsCid: { | 134 case kPcDescriptorsCid: { |
137 const RawPcDescriptors* raw_descriptors = | 135 const RawPcDescriptors* raw_descriptors = |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 break; | 178 break; |
181 } | 179 } |
182 default: { | 180 default: { |
183 // Get the (constant) instance size out of the class object. | 181 // Get the (constant) instance size out of the class object. |
184 // TODO(koda): Add Size(ClassTable*) interface to allow caching in loops. | 182 // TODO(koda): Add Size(ClassTable*) interface to allow caching in loops. |
185 Isolate* isolate = Isolate::Current(); | 183 Isolate* isolate = Isolate::Current(); |
186 #if defined(DEBUG) | 184 #if defined(DEBUG) |
187 ClassTable* class_table = isolate->class_table(); | 185 ClassTable* class_table = isolate->class_table(); |
188 if (!class_table->IsValidIndex(class_id) || | 186 if (!class_table->IsValidIndex(class_id) || |
189 !class_table->HasValidClassAt(class_id)) { | 187 !class_table->HasValidClassAt(class_id)) { |
190 FATAL2("Invalid class id: %" Pd " from tags %" Px "\n", | 188 FATAL2("Invalid class id: %" Pd " from tags %" Px "\n", class_id, |
191 class_id, ptr()->tags_); | 189 ptr()->tags_); |
192 } | 190 } |
193 #endif // DEBUG | 191 #endif // DEBUG |
194 RawClass* raw_class = isolate->GetClassForHeapWalkAt(class_id); | 192 RawClass* raw_class = isolate->GetClassForHeapWalkAt(class_id); |
195 instance_size = | 193 instance_size = raw_class->ptr()->instance_size_in_words_ |
196 raw_class->ptr()->instance_size_in_words_ << kWordSizeLog2; | 194 << kWordSizeLog2; |
197 } | 195 } |
198 } | 196 } |
199 ASSERT(instance_size != 0); | 197 ASSERT(instance_size != 0); |
200 #if defined(DEBUG) | 198 #if defined(DEBUG) |
201 uword tags = ptr()->tags_; | 199 uword tags = ptr()->tags_; |
202 intptr_t tags_size = SizeTag::decode(tags); | 200 intptr_t tags_size = SizeTag::decode(tags); |
203 if ((class_id == kArrayCid) && (instance_size > tags_size && tags_size > 0)) { | 201 if ((class_id == kArrayCid) && (instance_size > tags_size && tags_size > 0)) { |
204 // TODO(22501): Array::MakeArray could be in the process of shrinking | 202 // TODO(22501): Array::MakeArray could be in the process of shrinking |
205 // the array (see comment therein), having already updated the tags but not | 203 // the array (see comment therein), having already updated the tags but not |
206 // yet set the new length. Wait a millisecond and try again. | 204 // yet set the new length. Wait a millisecond and try again. |
(...skipping 19 matching lines...) Expand all Loading... |
226 | 224 |
227 // Only reasonable to be called on heap objects. | 225 // Only reasonable to be called on heap objects. |
228 ASSERT(IsHeapObject()); | 226 ASSERT(IsHeapObject()); |
229 | 227 |
230 // Read the necessary data out of the class before visting the class itself. | 228 // Read the necessary data out of the class before visting the class itself. |
231 intptr_t class_id = GetClassId(); | 229 intptr_t class_id = GetClassId(); |
232 | 230 |
233 if (class_id < kNumPredefinedCids) { | 231 if (class_id < kNumPredefinedCids) { |
234 switch (class_id) { | 232 switch (class_id) { |
235 #define RAW_VISITPOINTERS(clazz) \ | 233 #define RAW_VISITPOINTERS(clazz) \ |
236 case k##clazz##Cid: { \ | 234 case k##clazz##Cid: { \ |
237 Raw##clazz* raw_obj = reinterpret_cast<Raw##clazz*>(this); \ | 235 Raw##clazz* raw_obj = reinterpret_cast<Raw##clazz*>(this); \ |
238 size = Raw##clazz::Visit##clazz##Pointers(raw_obj, visitor); \ | 236 size = Raw##clazz::Visit##clazz##Pointers(raw_obj, visitor); \ |
239 break; \ | 237 break; \ |
240 } | 238 } |
241 CLASS_LIST_NO_OBJECT(RAW_VISITPOINTERS) | 239 CLASS_LIST_NO_OBJECT(RAW_VISITPOINTERS) |
242 #undef RAW_VISITPOINTERS | 240 #undef RAW_VISITPOINTERS |
243 #define RAW_VISITPOINTERS(clazz) \ | 241 #define RAW_VISITPOINTERS(clazz) case kTypedData##clazz##Cid: |
244 case kTypedData##clazz##Cid: | |
245 CLASS_LIST_TYPED_DATA(RAW_VISITPOINTERS) { | 242 CLASS_LIST_TYPED_DATA(RAW_VISITPOINTERS) { |
246 RawTypedData* raw_obj = reinterpret_cast<RawTypedData*>(this); | 243 RawTypedData* raw_obj = reinterpret_cast<RawTypedData*>(this); |
247 size = RawTypedData::VisitTypedDataPointers(raw_obj, visitor); | 244 size = RawTypedData::VisitTypedDataPointers(raw_obj, visitor); |
248 break; | 245 break; |
249 } | 246 } |
250 #undef RAW_VISITPOINTERS | 247 #undef RAW_VISITPOINTERS |
251 #define RAW_VISITPOINTERS(clazz) \ | 248 #define RAW_VISITPOINTERS(clazz) case kExternalTypedData##clazz##Cid: |
252 case kExternalTypedData##clazz##Cid: | |
253 CLASS_LIST_TYPED_DATA(RAW_VISITPOINTERS) { | 249 CLASS_LIST_TYPED_DATA(RAW_VISITPOINTERS) { |
254 RawExternalTypedData* raw_obj = | 250 RawExternalTypedData* raw_obj = |
255 reinterpret_cast<RawExternalTypedData*>(this); | 251 reinterpret_cast<RawExternalTypedData*>(this); |
256 size = RawExternalTypedData::VisitExternalTypedDataPointers(raw_obj, | 252 size = RawExternalTypedData::VisitExternalTypedDataPointers(raw_obj, |
257 visitor); | 253 visitor); |
258 break; | 254 break; |
259 } | 255 } |
260 #undef RAW_VISITPOINTERS | 256 #undef RAW_VISITPOINTERS |
261 #define RAW_VISITPOINTERS(clazz) \ | 257 #define RAW_VISITPOINTERS(clazz) case kTypedData##clazz##ViewCid: |
262 case kTypedData##clazz##ViewCid: | |
263 CLASS_LIST_TYPED_DATA(RAW_VISITPOINTERS) | 258 CLASS_LIST_TYPED_DATA(RAW_VISITPOINTERS) |
264 case kByteDataViewCid: | 259 case kByteDataViewCid: |
265 case kByteBufferCid: { | 260 case kByteBufferCid: { |
266 RawInstance* raw_obj = reinterpret_cast<RawInstance*>(this); | 261 RawInstance* raw_obj = reinterpret_cast<RawInstance*>(this); |
267 size = RawInstance::VisitInstancePointers(raw_obj, visitor); | 262 size = RawInstance::VisitInstancePointers(raw_obj, visitor); |
268 break; | 263 break; |
269 } | 264 } |
270 #undef RAW_VISITPOINTERS | 265 #undef RAW_VISITPOINTERS |
271 case kFreeListElement: { | 266 case kFreeListElement: { |
272 uword addr = RawObject::ToAddr(this); | 267 uword addr = RawObject::ToAddr(this); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 301 |
307 | 302 |
308 intptr_t RawClass::VisitClassPointers(RawClass* raw_obj, | 303 intptr_t RawClass::VisitClassPointers(RawClass* raw_obj, |
309 ObjectPointerVisitor* visitor) { | 304 ObjectPointerVisitor* visitor) { |
310 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 305 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
311 return Class::InstanceSize(); | 306 return Class::InstanceSize(); |
312 } | 307 } |
313 | 308 |
314 | 309 |
315 intptr_t RawUnresolvedClass::VisitUnresolvedClassPointers( | 310 intptr_t RawUnresolvedClass::VisitUnresolvedClassPointers( |
316 RawUnresolvedClass* raw_obj, ObjectPointerVisitor* visitor) { | 311 RawUnresolvedClass* raw_obj, |
| 312 ObjectPointerVisitor* visitor) { |
317 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 313 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
318 return UnresolvedClass::InstanceSize(); | 314 return UnresolvedClass::InstanceSize(); |
319 } | 315 } |
320 | 316 |
321 | 317 |
322 intptr_t RawAbstractType::VisitAbstractTypePointers( | 318 intptr_t RawAbstractType::VisitAbstractTypePointers( |
323 RawAbstractType* raw_obj, ObjectPointerVisitor* visitor) { | 319 RawAbstractType* raw_obj, |
| 320 ObjectPointerVisitor* visitor) { |
324 // RawAbstractType is an abstract class. | 321 // RawAbstractType is an abstract class. |
325 UNREACHABLE(); | 322 UNREACHABLE(); |
326 return 0; | 323 return 0; |
327 } | 324 } |
328 | 325 |
329 | 326 |
330 intptr_t RawType::VisitTypePointers( | 327 intptr_t RawType::VisitTypePointers(RawType* raw_obj, |
331 RawType* raw_obj, ObjectPointerVisitor* visitor) { | 328 ObjectPointerVisitor* visitor) { |
332 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 329 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
333 return Type::InstanceSize(); | 330 return Type::InstanceSize(); |
334 } | 331 } |
335 | 332 |
336 | 333 |
337 intptr_t RawTypeRef::VisitTypeRefPointers( | 334 intptr_t RawTypeRef::VisitTypeRefPointers(RawTypeRef* raw_obj, |
338 RawTypeRef* raw_obj, ObjectPointerVisitor* visitor) { | 335 ObjectPointerVisitor* visitor) { |
339 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 336 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
340 return TypeRef::InstanceSize(); | 337 return TypeRef::InstanceSize(); |
341 } | 338 } |
342 | 339 |
343 | 340 |
344 intptr_t RawTypeParameter::VisitTypeParameterPointers( | 341 intptr_t RawTypeParameter::VisitTypeParameterPointers( |
345 RawTypeParameter* raw_obj, ObjectPointerVisitor* visitor) { | 342 RawTypeParameter* raw_obj, |
| 343 ObjectPointerVisitor* visitor) { |
346 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 344 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
347 return TypeParameter::InstanceSize(); | 345 return TypeParameter::InstanceSize(); |
348 } | 346 } |
349 | 347 |
350 | 348 |
351 intptr_t RawBoundedType::VisitBoundedTypePointers( | 349 intptr_t RawBoundedType::VisitBoundedTypePointers( |
352 RawBoundedType* raw_obj, ObjectPointerVisitor* visitor) { | 350 RawBoundedType* raw_obj, |
| 351 ObjectPointerVisitor* visitor) { |
353 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 352 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
354 return BoundedType::InstanceSize(); | 353 return BoundedType::InstanceSize(); |
355 } | 354 } |
356 | 355 |
357 | 356 |
358 intptr_t RawMixinAppType::VisitMixinAppTypePointers( | 357 intptr_t RawMixinAppType::VisitMixinAppTypePointers( |
359 RawMixinAppType* raw_obj, ObjectPointerVisitor* visitor) { | 358 RawMixinAppType* raw_obj, |
| 359 ObjectPointerVisitor* visitor) { |
360 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 360 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
361 return MixinAppType::InstanceSize(); | 361 return MixinAppType::InstanceSize(); |
362 } | 362 } |
363 | 363 |
364 | 364 |
365 intptr_t RawTypeArguments::VisitTypeArgumentsPointers( | 365 intptr_t RawTypeArguments::VisitTypeArgumentsPointers( |
366 RawTypeArguments* raw_obj, ObjectPointerVisitor* visitor) { | 366 RawTypeArguments* raw_obj, |
| 367 ObjectPointerVisitor* visitor) { |
367 intptr_t length = Smi::Value(raw_obj->ptr()->length_); | 368 intptr_t length = Smi::Value(raw_obj->ptr()->length_); |
368 visitor->VisitPointers(raw_obj->from(), raw_obj->to(length)); | 369 visitor->VisitPointers(raw_obj->from(), raw_obj->to(length)); |
369 return TypeArguments::InstanceSize(length); | 370 return TypeArguments::InstanceSize(length); |
370 } | 371 } |
371 | 372 |
372 | 373 |
373 intptr_t RawPatchClass::VisitPatchClassPointers(RawPatchClass* raw_obj, | 374 intptr_t RawPatchClass::VisitPatchClassPointers(RawPatchClass* raw_obj, |
374 ObjectPointerVisitor* visitor) { | 375 ObjectPointerVisitor* visitor) { |
375 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 376 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
376 return PatchClass::InstanceSize(); | 377 return PatchClass::InstanceSize(); |
377 } | 378 } |
378 | 379 |
379 | 380 |
380 intptr_t RawClosure::VisitClosurePointers( | 381 intptr_t RawClosure::VisitClosurePointers(RawClosure* raw_obj, |
381 RawClosure* raw_obj, ObjectPointerVisitor* visitor) { | 382 ObjectPointerVisitor* visitor) { |
382 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 383 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
383 return Closure::InstanceSize(); | 384 return Closure::InstanceSize(); |
384 } | 385 } |
385 | 386 |
386 | 387 |
387 intptr_t RawClosureData::VisitClosureDataPointers( | 388 intptr_t RawClosureData::VisitClosureDataPointers( |
388 RawClosureData* raw_obj, ObjectPointerVisitor* visitor) { | 389 RawClosureData* raw_obj, |
| 390 ObjectPointerVisitor* visitor) { |
389 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 391 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
390 return ClosureData::InstanceSize(); | 392 return ClosureData::InstanceSize(); |
391 } | 393 } |
392 | 394 |
393 | 395 |
394 intptr_t RawRedirectionData::VisitRedirectionDataPointers( | 396 intptr_t RawRedirectionData::VisitRedirectionDataPointers( |
395 RawRedirectionData* raw_obj, ObjectPointerVisitor* visitor) { | 397 RawRedirectionData* raw_obj, |
| 398 ObjectPointerVisitor* visitor) { |
396 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 399 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
397 return RedirectionData::InstanceSize(); | 400 return RedirectionData::InstanceSize(); |
398 } | 401 } |
399 | 402 |
400 | 403 |
401 bool RawFunction::CheckUsageCounter(RawFunction* raw_fun) { | 404 bool RawFunction::CheckUsageCounter(RawFunction* raw_fun) { |
402 // NOTE: This code runs while GC is in progress and runs within | 405 // NOTE: This code runs while GC is in progress and runs within |
403 // a NoHandleScope block. Hence it is not okay to use regular Zone or | 406 // a NoHandleScope block. Hence it is not okay to use regular Zone or |
404 // Scope handles. We use direct stack handles, and so the raw pointers in | 407 // Scope handles. We use direct stack handles, and so the raw pointers in |
405 // these handles are not traversed. The use of handles is mainly to | 408 // these handles are not traversed. The use of handles is mainly to |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 | 469 |
467 | 470 |
468 intptr_t RawField::VisitFieldPointers(RawField* raw_obj, | 471 intptr_t RawField::VisitFieldPointers(RawField* raw_obj, |
469 ObjectPointerVisitor* visitor) { | 472 ObjectPointerVisitor* visitor) { |
470 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 473 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
471 return Field::InstanceSize(); | 474 return Field::InstanceSize(); |
472 } | 475 } |
473 | 476 |
474 | 477 |
475 intptr_t RawLiteralToken::VisitLiteralTokenPointers( | 478 intptr_t RawLiteralToken::VisitLiteralTokenPointers( |
476 RawLiteralToken* raw_obj, ObjectPointerVisitor* visitor) { | 479 RawLiteralToken* raw_obj, |
| 480 ObjectPointerVisitor* visitor) { |
477 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 481 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
478 return LiteralToken::InstanceSize(); | 482 return LiteralToken::InstanceSize(); |
479 } | 483 } |
480 | 484 |
481 | 485 |
482 intptr_t RawTokenStream::VisitTokenStreamPointers( | 486 intptr_t RawTokenStream::VisitTokenStreamPointers( |
483 RawTokenStream* raw_obj, ObjectPointerVisitor* visitor) { | 487 RawTokenStream* raw_obj, |
| 488 ObjectPointerVisitor* visitor) { |
484 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 489 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
485 return TokenStream::InstanceSize(); | 490 return TokenStream::InstanceSize(); |
486 } | 491 } |
487 | 492 |
488 | 493 |
489 intptr_t RawScript::VisitScriptPointers(RawScript* raw_obj, | 494 intptr_t RawScript::VisitScriptPointers(RawScript* raw_obj, |
490 ObjectPointerVisitor* visitor) { | 495 ObjectPointerVisitor* visitor) { |
491 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 496 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
492 return Script::InstanceSize(); | 497 return Script::InstanceSize(); |
493 } | 498 } |
494 | 499 |
495 | 500 |
496 intptr_t RawLibrary::VisitLibraryPointers(RawLibrary* raw_obj, | 501 intptr_t RawLibrary::VisitLibraryPointers(RawLibrary* raw_obj, |
497 ObjectPointerVisitor* visitor) { | 502 ObjectPointerVisitor* visitor) { |
498 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 503 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
499 return Library::InstanceSize(); | 504 return Library::InstanceSize(); |
500 } | 505 } |
501 | 506 |
502 | 507 |
503 intptr_t RawLibraryPrefix::VisitLibraryPrefixPointers( | 508 intptr_t RawLibraryPrefix::VisitLibraryPrefixPointers( |
504 RawLibraryPrefix* raw_obj, ObjectPointerVisitor* visitor) { | 509 RawLibraryPrefix* raw_obj, |
| 510 ObjectPointerVisitor* visitor) { |
505 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 511 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
506 return LibraryPrefix::InstanceSize(); | 512 return LibraryPrefix::InstanceSize(); |
507 } | 513 } |
508 | 514 |
509 | 515 |
510 intptr_t RawNamespace::VisitNamespacePointers( | 516 intptr_t RawNamespace::VisitNamespacePointers(RawNamespace* raw_obj, |
511 RawNamespace* raw_obj, ObjectPointerVisitor* visitor) { | 517 ObjectPointerVisitor* visitor) { |
512 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 518 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
513 return Namespace::InstanceSize(); | 519 return Namespace::InstanceSize(); |
514 } | 520 } |
515 | 521 |
516 | 522 |
517 bool RawCode::ContainsPC(RawObject* raw_obj, uword pc) { | 523 bool RawCode::ContainsPC(RawObject* raw_obj, uword pc) { |
518 uword tags = raw_obj->ptr()->tags_; | 524 uword tags = raw_obj->ptr()->tags_; |
519 if (RawObject::ClassIdTag::decode(tags) == kCodeCid) { | 525 if (RawObject::ClassIdTag::decode(tags) == kCodeCid) { |
520 RawCode* raw_code = reinterpret_cast<RawCode*>(raw_obj); | 526 RawCode* raw_code = reinterpret_cast<RawCode*>(raw_obj); |
521 return RawInstructions::ContainsPC(raw_code->ptr()->instructions_, pc); | 527 return RawInstructions::ContainsPC(raw_code->ptr()->instructions_, pc); |
522 } | 528 } |
523 return false; | 529 return false; |
524 } | 530 } |
525 | 531 |
526 | 532 |
527 intptr_t RawCode::VisitCodePointers(RawCode* raw_obj, | 533 intptr_t RawCode::VisitCodePointers(RawCode* raw_obj, |
528 ObjectPointerVisitor* visitor) { | 534 ObjectPointerVisitor* visitor) { |
529 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 535 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
530 | 536 |
531 RawCode* obj = raw_obj->ptr(); | 537 RawCode* obj = raw_obj->ptr(); |
532 intptr_t length = Code::PtrOffBits::decode(obj->state_bits_); | 538 intptr_t length = Code::PtrOffBits::decode(obj->state_bits_); |
533 #if defined(TARGET_ARCH_IA32) | 539 #if defined(TARGET_ARCH_IA32) |
534 // On IA32 only we embed pointers to objects directly in the generated | 540 // On IA32 only we embed pointers to objects directly in the generated |
535 // instructions. The variable portion of a Code object describes where to | 541 // instructions. The variable portion of a Code object describes where to |
536 // find those pointers for tracing. | 542 // find those pointers for tracing. |
537 if (Code::AliveBit::decode(obj->state_bits_)) { | 543 if (Code::AliveBit::decode(obj->state_bits_)) { |
538 uword entry_point = reinterpret_cast<uword>(obj->instructions_->ptr()) + | 544 uword entry_point = reinterpret_cast<uword>(obj->instructions_->ptr()) + |
539 Instructions::HeaderSize(); | 545 Instructions::HeaderSize(); |
540 for (intptr_t i = 0; i < length; i++) { | 546 for (intptr_t i = 0; i < length; i++) { |
541 int32_t offset = obj->data()[i]; | 547 int32_t offset = obj->data()[i]; |
542 visitor->VisitPointer( | 548 visitor->VisitPointer( |
543 reinterpret_cast<RawObject**>(entry_point + offset)); | 549 reinterpret_cast<RawObject**>(entry_point + offset)); |
544 } | 550 } |
545 } | 551 } |
546 return Code::InstanceSize(length); | 552 return Code::InstanceSize(length); |
547 #else | 553 #else |
548 // On all other architectures, objects are referenced indirectly through | 554 // On all other architectures, objects are referenced indirectly through |
549 // either an ObjectPool or Thread. | 555 // either an ObjectPool or Thread. |
550 ASSERT(length == 0); | 556 ASSERT(length == 0); |
551 return Code::InstanceSize(0); | 557 return Code::InstanceSize(0); |
552 #endif | 558 #endif |
553 } | 559 } |
554 | 560 |
555 | 561 |
556 intptr_t RawObjectPool::VisitObjectPoolPointers( | 562 intptr_t RawObjectPool::VisitObjectPoolPointers(RawObjectPool* raw_obj, |
557 RawObjectPool* raw_obj, ObjectPointerVisitor* visitor) { | 563 ObjectPointerVisitor* visitor) { |
558 visitor->VisitPointer( | 564 visitor->VisitPointer( |
559 reinterpret_cast<RawObject**>(&raw_obj->ptr()->info_array_)); | 565 reinterpret_cast<RawObject**>(&raw_obj->ptr()->info_array_)); |
560 const intptr_t len = raw_obj->ptr()->length_; | 566 const intptr_t len = raw_obj->ptr()->length_; |
561 RawTypedData* info_array = raw_obj->ptr()->info_array_->ptr(); | 567 RawTypedData* info_array = raw_obj->ptr()->info_array_->ptr(); |
562 Entry* first = raw_obj->first_entry(); | 568 Entry* first = raw_obj->first_entry(); |
563 for (intptr_t i = 0; i < len; ++i) { | 569 for (intptr_t i = 0; i < len; ++i) { |
564 ObjectPool::EntryType entry_type = | 570 ObjectPool::EntryType entry_type = |
565 static_cast<ObjectPool::EntryType>(info_array->data()[i]); | 571 static_cast<ObjectPool::EntryType>(info_array->data()[i]); |
566 if (entry_type == ObjectPool::kTaggedObject) { | 572 if (entry_type == ObjectPool::kTaggedObject) { |
567 visitor->VisitPointer(&(first + i)->raw_obj_); | 573 visitor->VisitPointer(&(first + i)->raw_obj_); |
568 } | 574 } |
569 } | 575 } |
570 return ObjectPool::InstanceSize(raw_obj->ptr()->length_); | 576 return ObjectPool::InstanceSize(raw_obj->ptr()->length_); |
571 } | 577 } |
572 | 578 |
573 | 579 |
574 intptr_t RawInstructions::VisitInstructionsPointers( | 580 intptr_t RawInstructions::VisitInstructionsPointers( |
575 RawInstructions* raw_obj, ObjectPointerVisitor* visitor) { | 581 RawInstructions* raw_obj, |
| 582 ObjectPointerVisitor* visitor) { |
576 RawInstructions* obj = raw_obj->ptr(); | 583 RawInstructions* obj = raw_obj->ptr(); |
577 return Instructions::InstanceSize(abs(obj->size_)); | 584 return Instructions::InstanceSize(abs(obj->size_)); |
578 } | 585 } |
579 | 586 |
580 | 587 |
581 bool RawInstructions::ContainsPC(RawInstructions* raw_instr, uword pc) { | 588 bool RawInstructions::ContainsPC(RawInstructions* raw_instr, uword pc) { |
582 uword start_pc = | 589 uword start_pc = |
583 reinterpret_cast<uword>(raw_instr->ptr()) + Instructions::HeaderSize(); | 590 reinterpret_cast<uword>(raw_instr->ptr()) + Instructions::HeaderSize(); |
584 uword end_pc = start_pc + abs(raw_instr->ptr()->size_); | 591 uword end_pc = start_pc + abs(raw_instr->ptr()->size_); |
585 ASSERT(end_pc > start_pc); | 592 ASSERT(end_pc > start_pc); |
586 return (pc >= start_pc) && (pc < end_pc); | 593 return (pc >= start_pc) && (pc < end_pc); |
587 } | 594 } |
588 | 595 |
589 | 596 |
590 intptr_t RawPcDescriptors::VisitPcDescriptorsPointers( | 597 intptr_t RawPcDescriptors::VisitPcDescriptorsPointers( |
591 RawPcDescriptors* raw_obj, ObjectPointerVisitor* visitor) { | 598 RawPcDescriptors* raw_obj, |
| 599 ObjectPointerVisitor* visitor) { |
592 return PcDescriptors::InstanceSize(raw_obj->ptr()->length_); | 600 return PcDescriptors::InstanceSize(raw_obj->ptr()->length_); |
593 } | 601 } |
594 | 602 |
595 | 603 |
596 intptr_t RawCodeSourceMap::VisitCodeSourceMapPointers( | 604 intptr_t RawCodeSourceMap::VisitCodeSourceMapPointers( |
597 RawCodeSourceMap* raw_obj, ObjectPointerVisitor* visitor) { | 605 RawCodeSourceMap* raw_obj, |
| 606 ObjectPointerVisitor* visitor) { |
598 return CodeSourceMap::InstanceSize(raw_obj->ptr()->length_); | 607 return CodeSourceMap::InstanceSize(raw_obj->ptr()->length_); |
599 } | 608 } |
600 | 609 |
601 | 610 |
602 intptr_t RawStackmap::VisitStackmapPointers(RawStackmap* raw_obj, | 611 intptr_t RawStackmap::VisitStackmapPointers(RawStackmap* raw_obj, |
603 ObjectPointerVisitor* visitor) { | 612 ObjectPointerVisitor* visitor) { |
604 return Stackmap::InstanceSize(raw_obj->ptr()->length_); | 613 return Stackmap::InstanceSize(raw_obj->ptr()->length_); |
605 } | 614 } |
606 | 615 |
607 | 616 |
608 intptr_t RawLocalVarDescriptors::VisitLocalVarDescriptorsPointers( | 617 intptr_t RawLocalVarDescriptors::VisitLocalVarDescriptorsPointers( |
609 RawLocalVarDescriptors* raw_obj, ObjectPointerVisitor* visitor) { | 618 RawLocalVarDescriptors* raw_obj, |
| 619 ObjectPointerVisitor* visitor) { |
610 intptr_t num_entries = raw_obj->ptr()->num_entries_; | 620 intptr_t num_entries = raw_obj->ptr()->num_entries_; |
611 visitor->VisitPointers(raw_obj->from(), raw_obj->to(num_entries)); | 621 visitor->VisitPointers(raw_obj->from(), raw_obj->to(num_entries)); |
612 return LocalVarDescriptors::InstanceSize(num_entries); | 622 return LocalVarDescriptors::InstanceSize(num_entries); |
613 } | 623 } |
614 | 624 |
615 | 625 |
616 intptr_t RawExceptionHandlers::VisitExceptionHandlersPointers( | 626 intptr_t RawExceptionHandlers::VisitExceptionHandlersPointers( |
617 RawExceptionHandlers* raw_obj, ObjectPointerVisitor* visitor) { | 627 RawExceptionHandlers* raw_obj, |
| 628 ObjectPointerVisitor* visitor) { |
618 RawExceptionHandlers* obj = raw_obj->ptr(); | 629 RawExceptionHandlers* obj = raw_obj->ptr(); |
619 intptr_t len = obj->num_entries_; | 630 intptr_t len = obj->num_entries_; |
620 visitor->VisitPointer( | 631 visitor->VisitPointer( |
621 reinterpret_cast<RawObject**>(&obj->handled_types_data_)); | 632 reinterpret_cast<RawObject**>(&obj->handled_types_data_)); |
622 return ExceptionHandlers::InstanceSize(len); | 633 return ExceptionHandlers::InstanceSize(len); |
623 } | 634 } |
624 | 635 |
625 | 636 |
626 intptr_t RawContext::VisitContextPointers(RawContext* raw_obj, | 637 intptr_t RawContext::VisitContextPointers(RawContext* raw_obj, |
627 ObjectPointerVisitor* visitor) { | 638 ObjectPointerVisitor* visitor) { |
628 intptr_t num_variables = raw_obj->ptr()->num_variables_; | 639 intptr_t num_variables = raw_obj->ptr()->num_variables_; |
629 visitor->VisitPointers(raw_obj->from(), raw_obj->to(num_variables)); | 640 visitor->VisitPointers(raw_obj->from(), raw_obj->to(num_variables)); |
630 return Context::InstanceSize(num_variables); | 641 return Context::InstanceSize(num_variables); |
631 } | 642 } |
632 | 643 |
633 | 644 |
634 intptr_t RawContextScope::VisitContextScopePointers( | 645 intptr_t RawContextScope::VisitContextScopePointers( |
635 RawContextScope* raw_obj, ObjectPointerVisitor* visitor) { | 646 RawContextScope* raw_obj, |
| 647 ObjectPointerVisitor* visitor) { |
636 intptr_t num_variables = raw_obj->ptr()->num_variables_; | 648 intptr_t num_variables = raw_obj->ptr()->num_variables_; |
637 visitor->VisitPointers(raw_obj->from(), raw_obj->to(num_variables)); | 649 visitor->VisitPointers(raw_obj->from(), raw_obj->to(num_variables)); |
638 return ContextScope::InstanceSize(num_variables); | 650 return ContextScope::InstanceSize(num_variables); |
639 } | 651 } |
640 | 652 |
641 | 653 |
642 intptr_t RawSingleTargetCache::VisitSingleTargetCachePointers( | 654 intptr_t RawSingleTargetCache::VisitSingleTargetCachePointers( |
643 RawSingleTargetCache* raw_obj, ObjectPointerVisitor* visitor) { | 655 RawSingleTargetCache* raw_obj, |
| 656 ObjectPointerVisitor* visitor) { |
644 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 657 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
645 return SingleTargetCache::InstanceSize(); | 658 return SingleTargetCache::InstanceSize(); |
646 } | 659 } |
647 | 660 |
648 | 661 |
649 intptr_t RawUnlinkedCall::VisitUnlinkedCallPointers( | 662 intptr_t RawUnlinkedCall::VisitUnlinkedCallPointers( |
650 RawUnlinkedCall* raw_obj, ObjectPointerVisitor* visitor) { | 663 RawUnlinkedCall* raw_obj, |
| 664 ObjectPointerVisitor* visitor) { |
651 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 665 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
652 return UnlinkedCall::InstanceSize(); | 666 return UnlinkedCall::InstanceSize(); |
653 } | 667 } |
654 | 668 |
655 | 669 |
656 intptr_t RawICData::VisitICDataPointers(RawICData* raw_obj, | 670 intptr_t RawICData::VisitICDataPointers(RawICData* raw_obj, |
657 ObjectPointerVisitor* visitor) { | 671 ObjectPointerVisitor* visitor) { |
658 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 672 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
659 return ICData::InstanceSize(); | 673 return ICData::InstanceSize(); |
660 } | 674 } |
661 | 675 |
662 | 676 |
663 intptr_t RawMegamorphicCache::VisitMegamorphicCachePointers( | 677 intptr_t RawMegamorphicCache::VisitMegamorphicCachePointers( |
664 RawMegamorphicCache* raw_obj, | 678 RawMegamorphicCache* raw_obj, |
665 ObjectPointerVisitor* visitor) { | 679 ObjectPointerVisitor* visitor) { |
666 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 680 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
667 return MegamorphicCache::InstanceSize(); | 681 return MegamorphicCache::InstanceSize(); |
668 } | 682 } |
669 | 683 |
670 | 684 |
671 intptr_t RawSubtypeTestCache::VisitSubtypeTestCachePointers( | 685 intptr_t RawSubtypeTestCache::VisitSubtypeTestCachePointers( |
672 RawSubtypeTestCache* raw_obj, ObjectPointerVisitor* visitor) { | 686 RawSubtypeTestCache* raw_obj, |
| 687 ObjectPointerVisitor* visitor) { |
673 // Make sure that we got here with the tagged pointer as this. | 688 // Make sure that we got here with the tagged pointer as this. |
674 RawSubtypeTestCache* obj = raw_obj->ptr(); | 689 RawSubtypeTestCache* obj = raw_obj->ptr(); |
675 visitor->VisitPointer(reinterpret_cast<RawObject**>(&obj->cache_)); | 690 visitor->VisitPointer(reinterpret_cast<RawObject**>(&obj->cache_)); |
676 return SubtypeTestCache::InstanceSize(); | 691 return SubtypeTestCache::InstanceSize(); |
677 } | 692 } |
678 | 693 |
679 | 694 |
680 intptr_t RawError::VisitErrorPointers(RawError* raw_obj, | 695 intptr_t RawError::VisitErrorPointers(RawError* raw_obj, |
681 ObjectPointerVisitor* visitor) { | 696 ObjectPointerVisitor* visitor) { |
682 // Error is an abstract class. | 697 // Error is an abstract class. |
683 UNREACHABLE(); | 698 UNREACHABLE(); |
684 return 0; | 699 return 0; |
685 } | 700 } |
686 | 701 |
687 | 702 |
688 intptr_t RawApiError::VisitApiErrorPointers( | 703 intptr_t RawApiError::VisitApiErrorPointers(RawApiError* raw_obj, |
689 RawApiError* raw_obj, ObjectPointerVisitor* visitor) { | 704 ObjectPointerVisitor* visitor) { |
690 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 705 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
691 return ApiError::InstanceSize(); | 706 return ApiError::InstanceSize(); |
692 } | 707 } |
693 | 708 |
694 | 709 |
695 intptr_t RawLanguageError::VisitLanguageErrorPointers( | 710 intptr_t RawLanguageError::VisitLanguageErrorPointers( |
696 RawLanguageError* raw_obj, ObjectPointerVisitor* visitor) { | 711 RawLanguageError* raw_obj, |
| 712 ObjectPointerVisitor* visitor) { |
697 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 713 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
698 return LanguageError::InstanceSize(); | 714 return LanguageError::InstanceSize(); |
699 } | 715 } |
700 | 716 |
701 | 717 |
702 intptr_t RawUnhandledException::VisitUnhandledExceptionPointers( | 718 intptr_t RawUnhandledException::VisitUnhandledExceptionPointers( |
703 RawUnhandledException* raw_obj, ObjectPointerVisitor* visitor) { | 719 RawUnhandledException* raw_obj, |
| 720 ObjectPointerVisitor* visitor) { |
704 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 721 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
705 return UnhandledException::InstanceSize(); | 722 return UnhandledException::InstanceSize(); |
706 } | 723 } |
707 | 724 |
708 | 725 |
709 intptr_t RawUnwindError::VisitUnwindErrorPointers( | 726 intptr_t RawUnwindError::VisitUnwindErrorPointers( |
710 RawUnwindError* raw_obj, ObjectPointerVisitor* visitor) { | 727 RawUnwindError* raw_obj, |
| 728 ObjectPointerVisitor* visitor) { |
711 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 729 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
712 return UnwindError::InstanceSize(); | 730 return UnwindError::InstanceSize(); |
713 } | 731 } |
714 | 732 |
715 | 733 |
716 intptr_t RawInstance::VisitInstancePointers(RawInstance* raw_obj, | 734 intptr_t RawInstance::VisitInstancePointers(RawInstance* raw_obj, |
717 ObjectPointerVisitor* visitor) { | 735 ObjectPointerVisitor* visitor) { |
718 // Make sure that we got here with the tagged pointer as this. | 736 // Make sure that we got here with the tagged pointer as this. |
719 ASSERT(raw_obj->IsHeapObject()); | 737 ASSERT(raw_obj->IsHeapObject()); |
720 uword tags = raw_obj->ptr()->tags_; | 738 uword tags = raw_obj->ptr()->tags_; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 | 804 |
787 intptr_t RawString::VisitStringPointers(RawString* raw_obj, | 805 intptr_t RawString::VisitStringPointers(RawString* raw_obj, |
788 ObjectPointerVisitor* visitor) { | 806 ObjectPointerVisitor* visitor) { |
789 // String is an abstract class. | 807 // String is an abstract class. |
790 UNREACHABLE(); | 808 UNREACHABLE(); |
791 return 0; | 809 return 0; |
792 } | 810 } |
793 | 811 |
794 | 812 |
795 intptr_t RawOneByteString::VisitOneByteStringPointers( | 813 intptr_t RawOneByteString::VisitOneByteStringPointers( |
796 RawOneByteString* raw_obj, ObjectPointerVisitor* visitor) { | 814 RawOneByteString* raw_obj, |
| 815 ObjectPointerVisitor* visitor) { |
797 ASSERT(!raw_obj->ptr()->length_->IsHeapObject()); | 816 ASSERT(!raw_obj->ptr()->length_->IsHeapObject()); |
798 ASSERT(!raw_obj->ptr()->hash_->IsHeapObject()); | 817 ASSERT(!raw_obj->ptr()->hash_->IsHeapObject()); |
799 intptr_t length = Smi::Value(raw_obj->ptr()->length_); | 818 intptr_t length = Smi::Value(raw_obj->ptr()->length_); |
800 return OneByteString::InstanceSize(length); | 819 return OneByteString::InstanceSize(length); |
801 } | 820 } |
802 | 821 |
803 | 822 |
804 intptr_t RawTwoByteString::VisitTwoByteStringPointers( | 823 intptr_t RawTwoByteString::VisitTwoByteStringPointers( |
805 RawTwoByteString* raw_obj, ObjectPointerVisitor* visitor) { | 824 RawTwoByteString* raw_obj, |
| 825 ObjectPointerVisitor* visitor) { |
806 ASSERT(!raw_obj->ptr()->length_->IsHeapObject()); | 826 ASSERT(!raw_obj->ptr()->length_->IsHeapObject()); |
807 ASSERT(!raw_obj->ptr()->hash_->IsHeapObject()); | 827 ASSERT(!raw_obj->ptr()->hash_->IsHeapObject()); |
808 intptr_t length = Smi::Value(raw_obj->ptr()->length_); | 828 intptr_t length = Smi::Value(raw_obj->ptr()->length_); |
809 return TwoByteString::InstanceSize(length); | 829 return TwoByteString::InstanceSize(length); |
810 } | 830 } |
811 | 831 |
812 | 832 |
813 intptr_t RawExternalOneByteString::VisitExternalOneByteStringPointers( | 833 intptr_t RawExternalOneByteString::VisitExternalOneByteStringPointers( |
814 RawExternalOneByteString* raw_obj, ObjectPointerVisitor* visitor) { | 834 RawExternalOneByteString* raw_obj, |
| 835 ObjectPointerVisitor* visitor) { |
815 // Make sure that we got here with the tagged pointer as this. | 836 // Make sure that we got here with the tagged pointer as this. |
816 ASSERT(raw_obj->IsHeapObject()); | 837 ASSERT(raw_obj->IsHeapObject()); |
817 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 838 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
818 return ExternalOneByteString::InstanceSize(); | 839 return ExternalOneByteString::InstanceSize(); |
819 } | 840 } |
820 | 841 |
821 | 842 |
822 intptr_t RawExternalTwoByteString::VisitExternalTwoByteStringPointers( | 843 intptr_t RawExternalTwoByteString::VisitExternalTwoByteStringPointers( |
823 RawExternalTwoByteString* raw_obj, ObjectPointerVisitor* visitor) { | 844 RawExternalTwoByteString* raw_obj, |
| 845 ObjectPointerVisitor* visitor) { |
824 // Make sure that we got here with the tagged pointer as this. | 846 // Make sure that we got here with the tagged pointer as this. |
825 ASSERT(raw_obj->IsHeapObject()); | 847 ASSERT(raw_obj->IsHeapObject()); |
826 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 848 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
827 return ExternalTwoByteString::InstanceSize(); | 849 return ExternalTwoByteString::InstanceSize(); |
828 } | 850 } |
829 | 851 |
830 | 852 |
831 intptr_t RawBool::VisitBoolPointers(RawBool* raw_obj, | 853 intptr_t RawBool::VisitBoolPointers(RawBool* raw_obj, |
832 ObjectPointerVisitor* visitor) { | 854 ObjectPointerVisitor* visitor) { |
833 // Make sure that we got here with the tagged pointer as this. | 855 // Make sure that we got here with the tagged pointer as this. |
834 ASSERT(raw_obj->IsHeapObject()); | 856 ASSERT(raw_obj->IsHeapObject()); |
835 return Bool::InstanceSize(); | 857 return Bool::InstanceSize(); |
836 } | 858 } |
837 | 859 |
838 | 860 |
839 intptr_t RawArray::VisitArrayPointers(RawArray* raw_obj, | 861 intptr_t RawArray::VisitArrayPointers(RawArray* raw_obj, |
840 ObjectPointerVisitor* visitor) { | 862 ObjectPointerVisitor* visitor) { |
841 intptr_t length = Smi::Value(raw_obj->ptr()->length_); | 863 intptr_t length = Smi::Value(raw_obj->ptr()->length_); |
842 visitor->VisitPointers(raw_obj->from(), raw_obj->to(length)); | 864 visitor->VisitPointers(raw_obj->from(), raw_obj->to(length)); |
843 return Array::InstanceSize(length); | 865 return Array::InstanceSize(length); |
844 } | 866 } |
845 | 867 |
846 | 868 |
847 intptr_t RawImmutableArray::VisitImmutableArrayPointers( | 869 intptr_t RawImmutableArray::VisitImmutableArrayPointers( |
848 RawImmutableArray* raw_obj, ObjectPointerVisitor* visitor) { | 870 RawImmutableArray* raw_obj, |
| 871 ObjectPointerVisitor* visitor) { |
849 return RawArray::VisitArrayPointers(raw_obj, visitor); | 872 return RawArray::VisitArrayPointers(raw_obj, visitor); |
850 } | 873 } |
851 | 874 |
852 | 875 |
853 intptr_t RawGrowableObjectArray::VisitGrowableObjectArrayPointers( | 876 intptr_t RawGrowableObjectArray::VisitGrowableObjectArrayPointers( |
854 RawGrowableObjectArray* raw_obj, ObjectPointerVisitor* visitor) { | 877 RawGrowableObjectArray* raw_obj, |
| 878 ObjectPointerVisitor* visitor) { |
855 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 879 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
856 return GrowableObjectArray::InstanceSize(); | 880 return GrowableObjectArray::InstanceSize(); |
857 } | 881 } |
858 | 882 |
859 | 883 |
860 intptr_t RawLinkedHashMap::VisitLinkedHashMapPointers( | 884 intptr_t RawLinkedHashMap::VisitLinkedHashMapPointers( |
861 RawLinkedHashMap* raw_obj, ObjectPointerVisitor* visitor) { | 885 RawLinkedHashMap* raw_obj, |
| 886 ObjectPointerVisitor* visitor) { |
862 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 887 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
863 return LinkedHashMap::InstanceSize(); | 888 return LinkedHashMap::InstanceSize(); |
864 } | 889 } |
865 | 890 |
866 | 891 |
867 intptr_t RawFloat32x4::VisitFloat32x4Pointers( | 892 intptr_t RawFloat32x4::VisitFloat32x4Pointers(RawFloat32x4* raw_obj, |
868 RawFloat32x4* raw_obj, | 893 ObjectPointerVisitor* visitor) { |
869 ObjectPointerVisitor* visitor) { | 894 ASSERT(raw_obj->IsHeapObject()); |
870 ASSERT(raw_obj->IsHeapObject()); | 895 return Float32x4::InstanceSize(); |
871 return Float32x4::InstanceSize(); | |
872 } | 896 } |
873 | 897 |
874 | 898 |
875 intptr_t RawInt32x4::VisitInt32x4Pointers( | 899 intptr_t RawInt32x4::VisitInt32x4Pointers(RawInt32x4* raw_obj, |
876 RawInt32x4* raw_obj, | 900 ObjectPointerVisitor* visitor) { |
877 ObjectPointerVisitor* visitor) { | 901 ASSERT(raw_obj->IsHeapObject()); |
878 ASSERT(raw_obj->IsHeapObject()); | 902 return Int32x4::InstanceSize(); |
879 return Int32x4::InstanceSize(); | |
880 } | 903 } |
881 | 904 |
882 | 905 |
883 intptr_t RawFloat64x2::VisitFloat64x2Pointers( | 906 intptr_t RawFloat64x2::VisitFloat64x2Pointers(RawFloat64x2* raw_obj, |
884 RawFloat64x2* raw_obj, | 907 ObjectPointerVisitor* visitor) { |
885 ObjectPointerVisitor* visitor) { | 908 ASSERT(raw_obj->IsHeapObject()); |
886 ASSERT(raw_obj->IsHeapObject()); | 909 return Float64x2::InstanceSize(); |
887 return Float64x2::InstanceSize(); | |
888 } | 910 } |
889 | 911 |
890 intptr_t RawTypedData::VisitTypedDataPointers( | 912 intptr_t RawTypedData::VisitTypedDataPointers(RawTypedData* raw_obj, |
891 RawTypedData* raw_obj, ObjectPointerVisitor* visitor) { | 913 ObjectPointerVisitor* visitor) { |
892 // Make sure that we got here with the tagged pointer as this. | 914 // Make sure that we got here with the tagged pointer as this. |
893 ASSERT(raw_obj->IsHeapObject()); | 915 ASSERT(raw_obj->IsHeapObject()); |
894 intptr_t cid = raw_obj->GetClassId(); | 916 intptr_t cid = raw_obj->GetClassId(); |
895 intptr_t array_len = Smi::Value(raw_obj->ptr()->length_); | 917 intptr_t array_len = Smi::Value(raw_obj->ptr()->length_); |
896 intptr_t lengthInBytes = array_len * TypedData::ElementSizeInBytes(cid); | 918 intptr_t lengthInBytes = array_len * TypedData::ElementSizeInBytes(cid); |
897 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 919 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
898 return TypedData::InstanceSize(lengthInBytes); | 920 return TypedData::InstanceSize(lengthInBytes); |
899 } | 921 } |
900 | 922 |
901 | 923 |
902 intptr_t RawExternalTypedData::VisitExternalTypedDataPointers( | 924 intptr_t RawExternalTypedData::VisitExternalTypedDataPointers( |
903 RawExternalTypedData* raw_obj, ObjectPointerVisitor* visitor) { | 925 RawExternalTypedData* raw_obj, |
| 926 ObjectPointerVisitor* visitor) { |
904 // Make sure that we got here with the tagged pointer as this. | 927 // Make sure that we got here with the tagged pointer as this. |
905 ASSERT(raw_obj->IsHeapObject()); | 928 ASSERT(raw_obj->IsHeapObject()); |
906 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 929 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
907 return ExternalTypedData::InstanceSize(); | 930 return ExternalTypedData::InstanceSize(); |
908 } | 931 } |
909 | 932 |
910 intptr_t RawCapability::VisitCapabilityPointers(RawCapability* raw_obj, | 933 intptr_t RawCapability::VisitCapabilityPointers(RawCapability* raw_obj, |
911 ObjectPointerVisitor* visitor) { | 934 ObjectPointerVisitor* visitor) { |
912 // Make sure that we got here with the tagged pointer as this. | 935 // Make sure that we got here with the tagged pointer as this. |
913 ASSERT(raw_obj->IsHeapObject()); | 936 ASSERT(raw_obj->IsHeapObject()); |
914 return Capability::InstanceSize(); | 937 return Capability::InstanceSize(); |
915 } | 938 } |
916 | 939 |
917 | 940 |
918 intptr_t RawReceivePort::VisitReceivePortPointers( | 941 intptr_t RawReceivePort::VisitReceivePortPointers( |
919 RawReceivePort* raw_obj, ObjectPointerVisitor* visitor) { | 942 RawReceivePort* raw_obj, |
| 943 ObjectPointerVisitor* visitor) { |
920 // Make sure that we got here with the tagged pointer as this. | 944 // Make sure that we got here with the tagged pointer as this. |
921 ASSERT(raw_obj->IsHeapObject()); | 945 ASSERT(raw_obj->IsHeapObject()); |
922 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 946 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
923 return ReceivePort::InstanceSize(); | 947 return ReceivePort::InstanceSize(); |
924 } | 948 } |
925 | 949 |
926 | 950 |
927 intptr_t RawSendPort::VisitSendPortPointers(RawSendPort* raw_obj, | 951 intptr_t RawSendPort::VisitSendPortPointers(RawSendPort* raw_obj, |
928 ObjectPointerVisitor* visitor) { | 952 ObjectPointerVisitor* visitor) { |
929 // Make sure that we got here with the tagged pointer as this. | 953 // Make sure that we got here with the tagged pointer as this. |
(...skipping 14 matching lines...) Expand all Loading... |
944 intptr_t RawRegExp::VisitRegExpPointers(RawRegExp* raw_obj, | 968 intptr_t RawRegExp::VisitRegExpPointers(RawRegExp* raw_obj, |
945 ObjectPointerVisitor* visitor) { | 969 ObjectPointerVisitor* visitor) { |
946 // Make sure that we got here with the tagged pointer as this. | 970 // Make sure that we got here with the tagged pointer as this. |
947 ASSERT(raw_obj->IsHeapObject()); | 971 ASSERT(raw_obj->IsHeapObject()); |
948 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 972 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
949 return RegExp::InstanceSize(); | 973 return RegExp::InstanceSize(); |
950 } | 974 } |
951 | 975 |
952 | 976 |
953 intptr_t RawWeakProperty::VisitWeakPropertyPointers( | 977 intptr_t RawWeakProperty::VisitWeakPropertyPointers( |
954 RawWeakProperty* raw_obj, ObjectPointerVisitor* visitor) { | 978 RawWeakProperty* raw_obj, |
| 979 ObjectPointerVisitor* visitor) { |
955 // Make sure that we got here with the tagged pointer as this. | 980 // Make sure that we got here with the tagged pointer as this. |
956 ASSERT(raw_obj->IsHeapObject()); | 981 ASSERT(raw_obj->IsHeapObject()); |
957 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 982 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
958 return WeakProperty::InstanceSize(); | 983 return WeakProperty::InstanceSize(); |
959 } | 984 } |
960 | 985 |
961 | 986 |
962 intptr_t RawMirrorReference::VisitMirrorReferencePointers( | 987 intptr_t RawMirrorReference::VisitMirrorReferencePointers( |
963 RawMirrorReference* raw_obj, ObjectPointerVisitor* visitor) { | 988 RawMirrorReference* raw_obj, |
| 989 ObjectPointerVisitor* visitor) { |
964 // Make sure that we got here with the tagged pointer as this. | 990 // Make sure that we got here with the tagged pointer as this. |
965 ASSERT(raw_obj->IsHeapObject()); | 991 ASSERT(raw_obj->IsHeapObject()); |
966 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 992 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
967 return MirrorReference::InstanceSize(); | 993 return MirrorReference::InstanceSize(); |
968 } | 994 } |
969 | 995 |
970 | 996 |
971 intptr_t RawUserTag::VisitUserTagPointers( | 997 intptr_t RawUserTag::VisitUserTagPointers(RawUserTag* raw_obj, |
972 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { | 998 ObjectPointerVisitor* visitor) { |
973 // Make sure that we got here with the tagged pointer as this. | 999 // Make sure that we got here with the tagged pointer as this. |
974 ASSERT(raw_obj->IsHeapObject()); | 1000 ASSERT(raw_obj->IsHeapObject()); |
975 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 1001 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
976 return UserTag::InstanceSize(); | 1002 return UserTag::InstanceSize(); |
977 } | 1003 } |
978 | 1004 |
979 | 1005 |
980 } // namespace dart | 1006 } // namespace dart |
OLD | NEW |