| 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/dart.h" | 8 #include "vm/dart.h" |
| 9 #include "vm/freelist.h" | 9 #include "vm/freelist.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 instance_size = LocalVarDescriptors::InstanceSize(num_descriptors); | 162 instance_size = LocalVarDescriptors::InstanceSize(num_descriptors); |
| 163 break; | 163 break; |
| 164 } | 164 } |
| 165 case kExceptionHandlersCid: { | 165 case kExceptionHandlersCid: { |
| 166 const RawExceptionHandlers* raw_handlers = | 166 const RawExceptionHandlers* raw_handlers = |
| 167 reinterpret_cast<const RawExceptionHandlers*>(this); | 167 reinterpret_cast<const RawExceptionHandlers*>(this); |
| 168 intptr_t num_handlers = raw_handlers->ptr()->num_entries_; | 168 intptr_t num_handlers = raw_handlers->ptr()->num_entries_; |
| 169 instance_size = ExceptionHandlers::InstanceSize(num_handlers); | 169 instance_size = ExceptionHandlers::InstanceSize(num_handlers); |
| 170 break; | 170 break; |
| 171 } | 171 } |
| 172 case kJSRegExpCid: { | |
| 173 const RawJSRegExp* raw_jsregexp = | |
| 174 reinterpret_cast<const RawJSRegExp*>(this); | |
| 175 intptr_t data_length = Smi::Value(raw_jsregexp->ptr()->data_length_); | |
| 176 instance_size = JSRegExp::InstanceSize(data_length); | |
| 177 break; | |
| 178 } | |
| 179 case kFreeListElement: { | 172 case kFreeListElement: { |
| 180 uword addr = RawObject::ToAddr(const_cast<RawObject*>(this)); | 173 uword addr = RawObject::ToAddr(const_cast<RawObject*>(this)); |
| 181 FreeListElement* element = reinterpret_cast<FreeListElement*>(addr); | 174 FreeListElement* element = reinterpret_cast<FreeListElement*>(addr); |
| 182 instance_size = element->Size(); | 175 instance_size = element->Size(); |
| 183 break; | 176 break; |
| 184 } | 177 } |
| 185 default: { | 178 default: { |
| 186 // Get the (constant) instance size out of the class object. | 179 // Get the (constant) instance size out of the class object. |
| 187 // TODO(koda): Add Size(ClassTable*) interface to allow caching in loops. | 180 // TODO(koda): Add Size(ClassTable*) interface to allow caching in loops. |
| 188 Isolate* isolate = Isolate::Current(); | 181 Isolate* isolate = Isolate::Current(); |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 ASSERT(raw_obj->IsHeapObject()); | 874 ASSERT(raw_obj->IsHeapObject()); |
| 882 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 875 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 883 return Stacktrace::InstanceSize(); | 876 return Stacktrace::InstanceSize(); |
| 884 } | 877 } |
| 885 | 878 |
| 886 | 879 |
| 887 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, | 880 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, |
| 888 ObjectPointerVisitor* visitor) { | 881 ObjectPointerVisitor* visitor) { |
| 889 // Make sure that we got here with the tagged pointer as this. | 882 // Make sure that we got here with the tagged pointer as this. |
| 890 ASSERT(raw_obj->IsHeapObject()); | 883 ASSERT(raw_obj->IsHeapObject()); |
| 891 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); | |
| 892 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 884 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 893 return JSRegExp::InstanceSize(length); | 885 return JSRegExp::InstanceSize(); |
| 894 } | 886 } |
| 895 | 887 |
| 896 | 888 |
| 897 intptr_t RawWeakProperty::VisitWeakPropertyPointers( | 889 intptr_t RawWeakProperty::VisitWeakPropertyPointers( |
| 898 RawWeakProperty* raw_obj, ObjectPointerVisitor* visitor) { | 890 RawWeakProperty* raw_obj, ObjectPointerVisitor* visitor) { |
| 899 // Make sure that we got here with the tagged pointer as this. | 891 // Make sure that we got here with the tagged pointer as this. |
| 900 ASSERT(raw_obj->IsHeapObject()); | 892 ASSERT(raw_obj->IsHeapObject()); |
| 901 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 893 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 902 return WeakProperty::InstanceSize(); | 894 return WeakProperty::InstanceSize(); |
| 903 } | 895 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 915 intptr_t RawUserTag::VisitUserTagPointers( | 907 intptr_t RawUserTag::VisitUserTagPointers( |
| 916 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { | 908 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { |
| 917 // Make sure that we got here with the tagged pointer as this. | 909 // Make sure that we got here with the tagged pointer as this. |
| 918 ASSERT(raw_obj->IsHeapObject()); | 910 ASSERT(raw_obj->IsHeapObject()); |
| 919 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 911 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 920 return UserTag::InstanceSize(); | 912 return UserTag::InstanceSize(); |
| 921 } | 913 } |
| 922 | 914 |
| 923 | 915 |
| 924 } // namespace dart | 916 } // namespace dart |
| OLD | NEW |