| 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/class_table.h" | 7 #include "vm/class_table.h" |
| 8 #include "vm/freelist.h" | 8 #include "vm/freelist.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 FreeListElement* element = reinterpret_cast<FreeListElement*>(addr); | 286 FreeListElement* element = reinterpret_cast<FreeListElement*>(addr); |
| 287 size = element->Size(); | 287 size = element->Size(); |
| 288 break; | 288 break; |
| 289 } | 289 } |
| 290 default: | 290 default: |
| 291 OS::Print("Class Id: %d\n", class_id); | 291 OS::Print("Class Id: %d\n", class_id); |
| 292 UNREACHABLE(); | 292 UNREACHABLE(); |
| 293 break; | 293 break; |
| 294 } | 294 } |
| 295 } else { | 295 } else { |
| 296 RawClass* raw_class = Isolate::Current()->class_table()->At(class_id); | 296 RawClass* raw_class = visitor->isolate()->class_table()->At(class_id); |
| 297 if (Class::IsSignatureClass(raw_class)) { | 297 if (Class::IsSignatureClass(raw_class)) { |
| 298 RawClosure* raw_obj = reinterpret_cast<RawClosure*>(this); | 298 RawClosure* raw_obj = reinterpret_cast<RawClosure*>(this); |
| 299 size = RawClosure::VisitClosurePointers(raw_obj, visitor); | 299 size = RawClosure::VisitClosurePointers(raw_obj, visitor); |
| 300 } else { | 300 } else { |
| 301 RawInstance* raw_obj = reinterpret_cast<RawInstance*>(this); | 301 RawInstance* raw_obj = reinterpret_cast<RawInstance*>(this); |
| 302 size = RawInstance::VisitInstancePointers(raw_obj, visitor); | 302 size = RawInstance::VisitInstancePointers(raw_obj, visitor); |
| 303 } | 303 } |
| 304 } | 304 } |
| 305 | 305 |
| 306 ASSERT(size != 0); | 306 ASSERT(size != 0); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 RawUnwindError* raw_obj, ObjectPointerVisitor* visitor) { | 583 RawUnwindError* raw_obj, ObjectPointerVisitor* visitor) { |
| 584 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 584 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 585 return UnwindError::InstanceSize(); | 585 return UnwindError::InstanceSize(); |
| 586 } | 586 } |
| 587 | 587 |
| 588 | 588 |
| 589 intptr_t RawInstance::VisitInstancePointers(RawInstance* raw_obj, | 589 intptr_t RawInstance::VisitInstancePointers(RawInstance* raw_obj, |
| 590 ObjectPointerVisitor* visitor) { | 590 ObjectPointerVisitor* visitor) { |
| 591 // Make sure that we got here with the tagged pointer as this. | 591 // Make sure that we got here with the tagged pointer as this. |
| 592 ASSERT(raw_obj->IsHeapObject()); | 592 ASSERT(raw_obj->IsHeapObject()); |
| 593 RawClass* cls = Isolate::Current()->class_table()->At(raw_obj->GetClassId()); | 593 RawClass* cls = visitor->isolate()->class_table()->At(raw_obj->GetClassId()); |
| 594 intptr_t instance_size = cls->ptr()->instance_size_; | 594 intptr_t instance_size = cls->ptr()->instance_size_; |
| 595 intptr_t num_native_fields = cls->ptr()->num_native_fields_; | 595 intptr_t num_native_fields = cls->ptr()->num_native_fields_; |
| 596 | 596 |
| 597 // Calculate the first and last raw object pointer fields. | 597 // Calculate the first and last raw object pointer fields. |
| 598 uword obj_addr = RawObject::ToAddr(raw_obj); | 598 uword obj_addr = RawObject::ToAddr(raw_obj); |
| 599 uword from = obj_addr + sizeof(RawObject) + num_native_fields * kWordSize; | 599 uword from = obj_addr + sizeof(RawObject) + num_native_fields * kWordSize; |
| 600 uword to = obj_addr + instance_size - kWordSize; | 600 uword to = obj_addr + instance_size - kWordSize; |
| 601 visitor->VisitPointers(reinterpret_cast<RawObject**>(from), | 601 visitor->VisitPointers(reinterpret_cast<RawObject**>(from), |
| 602 reinterpret_cast<RawObject**>(to)); | 602 reinterpret_cast<RawObject**>(to)); |
| 603 return instance_size; | 603 return instance_size; |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 | 978 |
| 979 intptr_t RawWeakProperty::VisitWeakPropertyPointers( | 979 intptr_t RawWeakProperty::VisitWeakPropertyPointers( |
| 980 RawWeakProperty* raw_obj, ObjectPointerVisitor* visitor) { | 980 RawWeakProperty* raw_obj, ObjectPointerVisitor* visitor) { |
| 981 // Make sure that we got here with the tagged pointer as this. | 981 // Make sure that we got here with the tagged pointer as this. |
| 982 ASSERT(raw_obj->IsHeapObject()); | 982 ASSERT(raw_obj->IsHeapObject()); |
| 983 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 983 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 984 return WeakProperty::InstanceSize(); | 984 return WeakProperty::InstanceSize(); |
| 985 } | 985 } |
| 986 | 986 |
| 987 } // namespace dart | 987 } // namespace dart |
| OLD | NEW |