| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 FreeListElement* element = reinterpret_cast<FreeListElement*>(addr); | 279 FreeListElement* element = reinterpret_cast<FreeListElement*>(addr); |
| 280 size = element->Size(); | 280 size = element->Size(); |
| 281 break; | 281 break; |
| 282 } | 282 } |
| 283 default: | 283 default: |
| 284 OS::Print("Class Id: %"Pd"\n", class_id); | 284 OS::Print("Class Id: %"Pd"\n", class_id); |
| 285 UNREACHABLE(); | 285 UNREACHABLE(); |
| 286 break; | 286 break; |
| 287 } | 287 } |
| 288 } else { | 288 } else { |
| 289 RawClass* raw_class = visitor->isolate()->class_table()->At(class_id); | 289 RawInstance* raw_obj = reinterpret_cast<RawInstance*>(this); |
| 290 if (Class::IsSignatureClass(raw_class)) { | 290 size = RawInstance::VisitInstancePointers(raw_obj, visitor); |
| 291 RawClosure* raw_obj = reinterpret_cast<RawClosure*>(this); | |
| 292 size = RawClosure::VisitClosurePointers(raw_obj, visitor); | |
| 293 } else { | |
| 294 RawInstance* raw_obj = reinterpret_cast<RawInstance*>(this); | |
| 295 size = RawInstance::VisitInstancePointers(raw_obj, visitor); | |
| 296 } | |
| 297 } | 291 } |
| 298 | 292 |
| 299 ASSERT(size != 0); | 293 ASSERT(size != 0); |
| 300 ASSERT(size == Size()); | 294 ASSERT(size == Size()); |
| 301 return size; | 295 return size; |
| 302 } | 296 } |
| 303 | 297 |
| 304 | 298 |
| 305 bool RawObject::FindObject(FindObjectVisitor* visitor) { | 299 bool RawObject::FindObject(FindObjectVisitor* visitor) { |
| 306 ASSERT(visitor != NULL); | 300 ASSERT(visitor != NULL); |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 | 951 |
| 958 | 952 |
| 959 intptr_t RawDartFunction::VisitDartFunctionPointers( | 953 intptr_t RawDartFunction::VisitDartFunctionPointers( |
| 960 RawDartFunction* raw_obj, ObjectPointerVisitor* visitor) { | 954 RawDartFunction* raw_obj, ObjectPointerVisitor* visitor) { |
| 961 // Function (defined in core library) is an abstract class. | 955 // Function (defined in core library) is an abstract class. |
| 962 UNREACHABLE(); | 956 UNREACHABLE(); |
| 963 return 0; | 957 return 0; |
| 964 } | 958 } |
| 965 | 959 |
| 966 | 960 |
| 967 intptr_t RawClosure::VisitClosurePointers(RawClosure* raw_obj, | |
| 968 ObjectPointerVisitor* visitor) { | |
| 969 // Make sure that we got here with the tagged pointer as this. | |
| 970 ASSERT(raw_obj->IsHeapObject()); | |
| 971 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | |
| 972 return Closure::InstanceSize(); | |
| 973 } | |
| 974 | |
| 975 | |
| 976 intptr_t RawStacktrace::VisitStacktracePointers(RawStacktrace* raw_obj, | 961 intptr_t RawStacktrace::VisitStacktracePointers(RawStacktrace* raw_obj, |
| 977 ObjectPointerVisitor* visitor) { | 962 ObjectPointerVisitor* visitor) { |
| 978 // Make sure that we got here with the tagged pointer as this. | 963 // Make sure that we got here with the tagged pointer as this. |
| 979 ASSERT(raw_obj->IsHeapObject()); | 964 ASSERT(raw_obj->IsHeapObject()); |
| 980 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 965 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 981 return Stacktrace::InstanceSize(); | 966 return Stacktrace::InstanceSize(); |
| 982 } | 967 } |
| 983 | 968 |
| 984 | 969 |
| 985 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, | 970 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, |
| 986 ObjectPointerVisitor* visitor) { | 971 ObjectPointerVisitor* visitor) { |
| 987 // Make sure that we got here with the tagged pointer as this. | 972 // Make sure that we got here with the tagged pointer as this. |
| 988 ASSERT(raw_obj->IsHeapObject()); | 973 ASSERT(raw_obj->IsHeapObject()); |
| 989 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); | 974 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); |
| 990 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 975 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 991 return JSRegExp::InstanceSize(length); | 976 return JSRegExp::InstanceSize(length); |
| 992 } | 977 } |
| 993 | 978 |
| 994 | 979 |
| 995 intptr_t RawWeakProperty::VisitWeakPropertyPointers( | 980 intptr_t RawWeakProperty::VisitWeakPropertyPointers( |
| 996 RawWeakProperty* raw_obj, ObjectPointerVisitor* visitor) { | 981 RawWeakProperty* raw_obj, ObjectPointerVisitor* visitor) { |
| 997 // Make sure that we got here with the tagged pointer as this. | 982 // Make sure that we got here with the tagged pointer as this. |
| 998 ASSERT(raw_obj->IsHeapObject()); | 983 ASSERT(raw_obj->IsHeapObject()); |
| 999 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 984 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 1000 return WeakProperty::InstanceSize(); | 985 return WeakProperty::InstanceSize(); |
| 1001 } | 986 } |
| 1002 | 987 |
| 1003 } // namespace dart | 988 } // namespace dart |
| OLD | NEW |