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 | |
237 intptr_t RawClass::VisitClassPointers(RawClass* raw_obj, | 231 intptr_t RawClass::VisitClassPointers(RawClass* raw_obj, |
238 ObjectPointerVisitor* visitor) { | 232 ObjectPointerVisitor* visitor) { |
239 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 233 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
240 return Class::InstanceSize(); | 234 return Class::InstanceSize(); |
241 } | 235 } |
242 | 236 |
243 | 237 |
244 intptr_t RawUnresolvedClass::VisitUnresolvedClassPointers( | 238 intptr_t RawUnresolvedClass::VisitUnresolvedClassPointers( |
245 RawUnresolvedClass* raw_obj, ObjectPointerVisitor* visitor) { | 239 RawUnresolvedClass* raw_obj, ObjectPointerVisitor* visitor) { |
246 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 240 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 362 |
369 | 363 |
370 intptr_t RawInstructions::VisitInstructionsPointers( | 364 intptr_t RawInstructions::VisitInstructionsPointers( |
371 RawInstructions* raw_obj, ObjectPointerVisitor* visitor) { | 365 RawInstructions* raw_obj, ObjectPointerVisitor* visitor) { |
372 RawInstructions* obj = raw_obj->ptr(); | 366 RawInstructions* obj = raw_obj->ptr(); |
373 visitor->VisitPointer(reinterpret_cast<RawObject**>(&obj->code_)); | 367 visitor->VisitPointer(reinterpret_cast<RawObject**>(&obj->code_)); |
374 return Instructions::InstanceSize(obj->size_); | 368 return Instructions::InstanceSize(obj->size_); |
375 } | 369 } |
376 | 370 |
377 | 371 |
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 | |
395 intptr_t RawPcDescriptors::VisitPcDescriptorsPointers( | 372 intptr_t RawPcDescriptors::VisitPcDescriptorsPointers( |
396 RawPcDescriptors* raw_obj, ObjectPointerVisitor* visitor) { | 373 RawPcDescriptors* raw_obj, ObjectPointerVisitor* visitor) { |
397 RawPcDescriptors* obj = raw_obj->ptr(); | 374 RawPcDescriptors* obj = raw_obj->ptr(); |
398 intptr_t length = Smi::Value(obj->length_); | 375 intptr_t length = Smi::Value(obj->length_); |
399 visitor->VisitPointer(reinterpret_cast<RawObject**>(&obj->length_)); | 376 visitor->VisitPointer(reinterpret_cast<RawObject**>(&obj->length_)); |
400 return PcDescriptors::InstanceSize(length); | 377 return PcDescriptors::InstanceSize(length); |
401 } | 378 } |
402 | 379 |
403 | 380 |
404 intptr_t RawStackmap::VisitStackmapPointers(RawStackmap* raw_obj, | 381 intptr_t RawStackmap::VisitStackmapPointers(RawStackmap* raw_obj, |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, | 670 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, |
694 ObjectPointerVisitor* visitor) { | 671 ObjectPointerVisitor* visitor) { |
695 // Make sure that we got here with the tagged pointer as this. | 672 // Make sure that we got here with the tagged pointer as this. |
696 ASSERT(raw_obj->IsHeapObject()); | 673 ASSERT(raw_obj->IsHeapObject()); |
697 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); | 674 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); |
698 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 675 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
699 return JSRegExp::InstanceSize(length); | 676 return JSRegExp::InstanceSize(length); |
700 } | 677 } |
701 | 678 |
702 } // namespace dart | 679 } // namespace dart |
OLD | NEW |