| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/isolate.h" | 7 #include "vm/isolate.h" |
| 8 #include "vm/object.h" | 8 #include "vm/object.h" |
| 9 #include "vm/visitor.h" | 9 #include "vm/visitor.h" |
| 10 | 10 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 instance_size = FourByteString::InstanceSize(string_length); | 97 instance_size = FourByteString::InstanceSize(string_length); |
| 98 break; | 98 break; |
| 99 } | 99 } |
| 100 case kArray: | 100 case kArray: |
| 101 case kImmutableArray: { | 101 case kImmutableArray: { |
| 102 const RawArray* raw_array = reinterpret_cast<const RawArray*>(this); | 102 const RawArray* raw_array = reinterpret_cast<const RawArray*>(this); |
| 103 intptr_t array_length = Smi::Value(raw_array->ptr()->length_); | 103 intptr_t array_length = Smi::Value(raw_array->ptr()->length_); |
| 104 instance_size = Array::InstanceSize(array_length); | 104 instance_size = Array::InstanceSize(array_length); |
| 105 break; | 105 break; |
| 106 } | 106 } |
| 107 case kTypeArray: { | 107 case kTypeArguments: { |
| 108 const RawTypeArray* raw_array = | 108 const RawTypeArguments* raw_array = |
| 109 reinterpret_cast<const RawTypeArray*>(this); | 109 reinterpret_cast<const RawTypeArguments*>(this); |
| 110 intptr_t array_length = Smi::Value(raw_array->ptr()->length_); | 110 intptr_t array_length = Smi::Value(raw_array->ptr()->length_); |
| 111 instance_size = TypeArray::InstanceSize(array_length); | 111 instance_size = TypeArguments::InstanceSize(array_length); |
| 112 break; | 112 break; |
| 113 } | 113 } |
| 114 case kPcDescriptors: { | 114 case kPcDescriptors: { |
| 115 const RawPcDescriptors* raw_descriptors = | 115 const RawPcDescriptors* raw_descriptors = |
| 116 reinterpret_cast<const RawPcDescriptors*>(this); | 116 reinterpret_cast<const RawPcDescriptors*>(this); |
| 117 intptr_t num_descriptors = Smi::Value(raw_descriptors->ptr()->length_); | 117 intptr_t num_descriptors = Smi::Value(raw_descriptors->ptr()->length_); |
| 118 instance_size = PcDescriptors::InstanceSize(num_descriptors); | 118 instance_size = PcDescriptors::InstanceSize(num_descriptors); |
| 119 break; | 119 break; |
| 120 } | 120 } |
| 121 case kExceptionHandlers: { | 121 case kExceptionHandlers: { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 switch (kind) { | 168 switch (kind) { |
| 169 #define RAW_VISITPOINTERS(clazz) \ | 169 #define RAW_VISITPOINTERS(clazz) \ |
| 170 case clazz::kInstanceKind: { \ | 170 case clazz::kInstanceKind: { \ |
| 171 Raw##clazz* raw_obj = reinterpret_cast<Raw##clazz*>(this); \ | 171 Raw##clazz* raw_obj = reinterpret_cast<Raw##clazz*>(this); \ |
| 172 size = Raw##clazz::Visit##clazz##Pointers(raw_obj, visitor); \ | 172 size = Raw##clazz::Visit##clazz##Pointers(raw_obj, visitor); \ |
| 173 break; \ | 173 break; \ |
| 174 } | 174 } |
| 175 CLASS_LIST_NO_OBJECT(RAW_VISITPOINTERS) | 175 CLASS_LIST_NO_OBJECT(RAW_VISITPOINTERS) |
| 176 #undef RAW_VISITPOINTERS | 176 #undef RAW_VISITPOINTERS |
| 177 default: | 177 default: |
| 178 OS::Print("Kind: %d\n", kind); |
| 178 UNREACHABLE(); | 179 UNREACHABLE(); |
| 179 break; | 180 break; |
| 180 } | 181 } |
| 181 | 182 |
| 182 ASSERT(size != 0); | 183 ASSERT(size != 0); |
| 183 return size; | 184 return size; |
| 184 } | 185 } |
| 185 | 186 |
| 186 | 187 |
| 187 intptr_t RawClass::VisitClassPointers(RawClass* raw_obj, | 188 intptr_t RawClass::VisitClassPointers(RawClass* raw_obj, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 } | 221 } |
| 221 | 222 |
| 222 | 223 |
| 223 intptr_t RawInstantiatedType::VisitInstantiatedTypePointers( | 224 intptr_t RawInstantiatedType::VisitInstantiatedTypePointers( |
| 224 RawInstantiatedType* raw_obj, ObjectPointerVisitor* visitor) { | 225 RawInstantiatedType* raw_obj, ObjectPointerVisitor* visitor) { |
| 225 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 226 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 226 return InstantiatedType::InstanceSize(); | 227 return InstantiatedType::InstanceSize(); |
| 227 } | 228 } |
| 228 | 229 |
| 229 | 230 |
| 231 intptr_t RawAbstractTypeArguments::VisitAbstractTypeArgumentsPointers( |
| 232 RawAbstractTypeArguments* raw_obj, ObjectPointerVisitor* visitor) { |
| 233 // RawAbstractTypeArguments is an abstract class. |
| 234 UNREACHABLE(); |
| 235 return 0; |
| 236 } |
| 237 |
| 238 |
| 230 intptr_t RawTypeArguments::VisitTypeArgumentsPointers( | 239 intptr_t RawTypeArguments::VisitTypeArgumentsPointers( |
| 231 RawTypeArguments* raw_obj, ObjectPointerVisitor* visitor) { | 240 RawTypeArguments* raw_obj, ObjectPointerVisitor* visitor) { |
| 232 // RawTypeArguments is an abstract class. | 241 intptr_t length = Smi::Value(raw_obj->ptr()->length_); |
| 233 UNREACHABLE(); | 242 visitor->VisitPointers(raw_obj->from(), raw_obj->to(length)); |
| 234 return 0; | 243 return TypeArguments::InstanceSize(length); |
| 235 } | 244 } |
| 236 | 245 |
| 237 | 246 |
| 238 intptr_t RawTypeArray::VisitTypeArrayPointers(RawTypeArray* raw_obj, | |
| 239 ObjectPointerVisitor* visitor) { | |
| 240 intptr_t length = Smi::Value(raw_obj->ptr()->length_); | |
| 241 visitor->VisitPointers(raw_obj->from(), raw_obj->to(length)); | |
| 242 return TypeArray::InstanceSize(length); | |
| 243 } | |
| 244 | |
| 245 | |
| 246 intptr_t RawInstantiatedTypeArguments::VisitInstantiatedTypeArgumentsPointers( | 247 intptr_t RawInstantiatedTypeArguments::VisitInstantiatedTypeArgumentsPointers( |
| 247 RawInstantiatedTypeArguments* raw_obj, ObjectPointerVisitor* visitor) { | 248 RawInstantiatedTypeArguments* raw_obj, ObjectPointerVisitor* visitor) { |
| 248 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 249 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 249 return InstantiatedTypeArguments::InstanceSize(); | 250 return InstantiatedTypeArguments::InstanceSize(); |
| 250 } | 251 } |
| 251 | 252 |
| 252 | 253 |
| 253 intptr_t RawFunction::VisitFunctionPointers(RawFunction* raw_obj, | 254 intptr_t RawFunction::VisitFunctionPointers(RawFunction* raw_obj, |
| 254 ObjectPointerVisitor* visitor) { | 255 ObjectPointerVisitor* visitor) { |
| 255 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 256 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, | 545 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, |
| 545 ObjectPointerVisitor* visitor) { | 546 ObjectPointerVisitor* visitor) { |
| 546 // Make sure that we got here with the tagged pointer as this. | 547 // Make sure that we got here with the tagged pointer as this. |
| 547 ASSERT(raw_obj->IsHeapObject()); | 548 ASSERT(raw_obj->IsHeapObject()); |
| 548 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); | 549 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); |
| 549 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 550 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 550 return JSRegExp::InstanceSize(length); | 551 return JSRegExp::InstanceSize(length); |
| 551 } | 552 } |
| 552 | 553 |
| 553 } // namespace dart | 554 } // namespace dart |
| OLD | NEW |