| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 ASSERT(instance_size != 0); | 239 ASSERT(instance_size != 0); |
| 240 uword tags = ptr()->tags_; | 240 uword tags = ptr()->tags_; |
| 241 ASSERT((instance_size == SizeTag::decode(tags)) || | 241 ASSERT((instance_size == SizeTag::decode(tags)) || |
| 242 (SizeTag::decode(tags) == 0)); | 242 (SizeTag::decode(tags) == 0)); |
| 243 return instance_size; | 243 return instance_size; |
| 244 } | 244 } |
| 245 | 245 |
| 246 | 246 |
| 247 ObjectKind RawObject::GetObjectKind() const { |
| 248 intptr_t class_id = GetClassId(); |
| 249 ObjectKind kind; |
| 250 if (class_id < kNumPredefinedKinds) { |
| 251 kind = static_cast<ObjectKind>(class_id); |
| 252 } else { |
| 253 RawClass* raw_class = Isolate::Current()->class_table()->At(class_id); |
| 254 kind = raw_class->ptr()->instance_kind_; |
| 255 } |
| 256 return kind; |
| 257 } |
| 258 |
| 259 |
| 247 intptr_t RawObject::VisitPointers(ObjectPointerVisitor* visitor) { | 260 intptr_t RawObject::VisitPointers(ObjectPointerVisitor* visitor) { |
| 248 intptr_t size = 0; | 261 intptr_t size = 0; |
| 249 NoHandleScope no_handles(visitor->isolate()); | 262 NoHandleScope no_handles(visitor->isolate()); |
| 250 | 263 |
| 251 // Only reasonable to be called on heap objects. | 264 // Only reasonable to be called on heap objects. |
| 252 ASSERT(IsHeapObject()); | 265 ASSERT(IsHeapObject()); |
| 253 | 266 |
| 254 // Read the necessary data out of the class before visting the class itself. | 267 // Read the necessary data out of the class before visting the class itself. |
| 255 intptr_t class_id = GetClassId(); | 268 intptr_t class_id = GetClassId(); |
| 256 ObjectKind kind; | 269 ObjectKind kind; |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, | 940 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, |
| 928 ObjectPointerVisitor* visitor) { | 941 ObjectPointerVisitor* visitor) { |
| 929 // Make sure that we got here with the tagged pointer as this. | 942 // Make sure that we got here with the tagged pointer as this. |
| 930 ASSERT(raw_obj->IsHeapObject()); | 943 ASSERT(raw_obj->IsHeapObject()); |
| 931 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); | 944 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); |
| 932 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 945 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 933 return JSRegExp::InstanceSize(length); | 946 return JSRegExp::InstanceSize(length); |
| 934 } | 947 } |
| 935 | 948 |
| 936 } // namespace dart | 949 } // namespace dart |
| OLD | NEW |