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/freelist.h" | 7 #include "vm/freelist.h" |
8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/visitor.h" | 10 #include "vm/visitor.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 UNREACHABLE(); | 221 UNREACHABLE(); |
222 break; | 222 break; |
223 } | 223 } |
224 | 224 |
225 ASSERT(size != 0); | 225 ASSERT(size != 0); |
226 ASSERT(size == Size()); | 226 ASSERT(size == Size()); |
227 return size; | 227 return size; |
228 } | 228 } |
229 | 229 |
230 | 230 |
| 231 bool RawObject::FindObject(FindObjectVisitor* visitor) { |
| 232 ASSERT(visitor != NULL); |
| 233 return visitor->FindObject(const_cast<RawObject*>(this)); |
| 234 } |
| 235 |
| 236 |
231 intptr_t RawClass::VisitClassPointers(RawClass* raw_obj, | 237 intptr_t RawClass::VisitClassPointers(RawClass* raw_obj, |
232 ObjectPointerVisitor* visitor) { | 238 ObjectPointerVisitor* visitor) { |
233 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 239 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
234 return Class::InstanceSize(); | 240 return Class::InstanceSize(); |
235 } | 241 } |
236 | 242 |
237 | 243 |
238 intptr_t RawUnresolvedClass::VisitUnresolvedClassPointers( | 244 intptr_t RawUnresolvedClass::VisitUnresolvedClassPointers( |
239 RawUnresolvedClass* raw_obj, ObjectPointerVisitor* visitor) { | 245 RawUnresolvedClass* raw_obj, ObjectPointerVisitor* visitor) { |
240 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 246 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 368 |
363 | 369 |
364 intptr_t RawInstructions::VisitInstructionsPointers( | 370 intptr_t RawInstructions::VisitInstructionsPointers( |
365 RawInstructions* raw_obj, ObjectPointerVisitor* visitor) { | 371 RawInstructions* raw_obj, ObjectPointerVisitor* visitor) { |
366 RawInstructions* obj = raw_obj->ptr(); | 372 RawInstructions* obj = raw_obj->ptr(); |
367 visitor->VisitPointer(reinterpret_cast<RawObject**>(&obj->code_)); | 373 visitor->VisitPointer(reinterpret_cast<RawObject**>(&obj->code_)); |
368 return Instructions::InstanceSize(obj->size_); | 374 return Instructions::InstanceSize(obj->size_); |
369 } | 375 } |
370 | 376 |
371 | 377 |
| 378 bool RawInstructions::ContainsPC(RawObject* raw_obj, uword pc) { |
| 379 RawClass* raw_class = raw_obj->ptr()->class_; |
| 380 ObjectKind instance_kind = raw_class->ptr()->instance_kind_; |
| 381 if (instance_kind == kInstructions) { |
| 382 RawInstructions* raw_instr = reinterpret_cast<RawInstructions*>(raw_obj); |
| 383 uword start_pc = |
| 384 reinterpret_cast<uword>(raw_instr->ptr()) + Instructions::HeaderSize(); |
| 385 uword end_pc = start_pc + raw_instr->ptr()->size_; |
| 386 ASSERT(end_pc > start_pc); |
| 387 if ((pc >= start_pc) && (pc < end_pc)) { |
| 388 return true; |
| 389 } |
| 390 } |
| 391 return false; |
| 392 } |
| 393 |
| 394 |
372 intptr_t RawPcDescriptors::VisitPcDescriptorsPointers( | 395 intptr_t RawPcDescriptors::VisitPcDescriptorsPointers( |
373 RawPcDescriptors* raw_obj, ObjectPointerVisitor* visitor) { | 396 RawPcDescriptors* raw_obj, ObjectPointerVisitor* visitor) { |
374 RawPcDescriptors* obj = raw_obj->ptr(); | 397 RawPcDescriptors* obj = raw_obj->ptr(); |
375 intptr_t length = Smi::Value(obj->length_); | 398 intptr_t length = Smi::Value(obj->length_); |
376 visitor->VisitPointer(reinterpret_cast<RawObject**>(&obj->length_)); | 399 visitor->VisitPointer(reinterpret_cast<RawObject**>(&obj->length_)); |
377 return PcDescriptors::InstanceSize(length); | 400 return PcDescriptors::InstanceSize(length); |
378 } | 401 } |
379 | 402 |
380 | 403 |
381 intptr_t RawStackmap::VisitStackmapPointers(RawStackmap* raw_obj, | 404 intptr_t RawStackmap::VisitStackmapPointers(RawStackmap* raw_obj, |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, | 693 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, |
671 ObjectPointerVisitor* visitor) { | 694 ObjectPointerVisitor* visitor) { |
672 // Make sure that we got here with the tagged pointer as this. | 695 // Make sure that we got here with the tagged pointer as this. |
673 ASSERT(raw_obj->IsHeapObject()); | 696 ASSERT(raw_obj->IsHeapObject()); |
674 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); | 697 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); |
675 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 698 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
676 return JSRegExp::InstanceSize(length); | 699 return JSRegExp::InstanceSize(length); |
677 } | 700 } |
678 | 701 |
679 } // namespace dart | 702 } // namespace dart |
OLD | NEW |