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 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 static void RegisterSingletonClassNames(); | 346 static void RegisterSingletonClassNames(); |
347 static void CreateInternalMetaData(); | 347 static void CreateInternalMetaData(); |
348 static void MakeUnusedSpaceTraversable(const Object& obj, | 348 static void MakeUnusedSpaceTraversable(const Object& obj, |
349 intptr_t original_size, | 349 intptr_t original_size, |
350 intptr_t used_size); | 350 intptr_t used_size); |
351 | 351 |
352 static intptr_t InstanceSize() { | 352 static intptr_t InstanceSize() { |
353 return RoundedAllocationSize(sizeof(RawObject)); | 353 return RoundedAllocationSize(sizeof(RawObject)); |
354 } | 354 } |
355 | 355 |
| 356 static void VerifyBuiltinVtables(); |
| 357 |
356 static const ClassId kClassId = kObjectCid; | 358 static const ClassId kClassId = kObjectCid; |
357 | 359 |
358 // Different kinds of type tests. | 360 // Different kinds of type tests. |
359 enum TypeTestKind { | 361 enum TypeTestKind { |
360 kIsSubtypeOf = 0, | 362 kIsSubtypeOf = 0, |
361 kIsMoreSpecificThan | 363 kIsMoreSpecificThan |
362 }; | 364 }; |
363 | 365 |
364 // Different kinds of name visibility. | 366 // Different kinds of name visibility. |
365 enum NameVisibility { | 367 enum NameVisibility { |
(...skipping 5796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6162 if ((reinterpret_cast<uword>(raw_) & kSmiTagMask) == kSmiTag) { | 6164 if ((reinterpret_cast<uword>(raw_) & kSmiTagMask) == kSmiTag) { |
6163 set_vtable(Smi::handle_vtable_); | 6165 set_vtable(Smi::handle_vtable_); |
6164 return; | 6166 return; |
6165 } | 6167 } |
6166 intptr_t cid = raw_->GetClassId(); | 6168 intptr_t cid = raw_->GetClassId(); |
6167 if (cid >= kNumPredefinedCids) { | 6169 if (cid >= kNumPredefinedCids) { |
6168 cid = kInstanceCid; | 6170 cid = kInstanceCid; |
6169 } | 6171 } |
6170 set_vtable(builtin_vtables_[cid]); | 6172 set_vtable(builtin_vtables_[cid]); |
6171 #if defined(DEBUG) | 6173 #if defined(DEBUG) |
6172 Isolate* isolate = Isolate::Current(); | |
6173 if (FLAG_verify_handles) { | 6174 if (FLAG_verify_handles) { |
| 6175 Isolate* isolate = Isolate::Current(); |
6174 Heap* isolate_heap = isolate->heap(); | 6176 Heap* isolate_heap = isolate->heap(); |
6175 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); | 6177 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); |
6176 ASSERT(isolate_heap->Contains(RawObject::ToAddr(raw_)) || | 6178 ASSERT(isolate_heap->Contains(RawObject::ToAddr(raw_)) || |
6177 vm_isolate_heap->Contains(RawObject::ToAddr(raw_))); | 6179 vm_isolate_heap->Contains(RawObject::ToAddr(raw_))); |
6178 } | 6180 } |
6179 ASSERT(builtin_vtables_[cid] == | |
6180 isolate->class_table()->At(cid)->ptr()->handle_vtable_); | |
6181 #endif | 6181 #endif |
6182 } | 6182 } |
6183 | 6183 |
6184 | 6184 |
6185 bool Function::HasCode() const { | 6185 bool Function::HasCode() const { |
6186 return raw_ptr()->code_ != Code::null(); | 6186 return raw_ptr()->code_ != Code::null(); |
6187 } | 6187 } |
6188 | 6188 |
6189 | 6189 |
6190 intptr_t Field::Offset() const { | 6190 intptr_t Field::Offset() const { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6263 | 6263 |
6264 | 6264 |
6265 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6265 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
6266 intptr_t index) { | 6266 intptr_t index) { |
6267 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6267 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
6268 } | 6268 } |
6269 | 6269 |
6270 } // namespace dart | 6270 } // namespace dart |
6271 | 6271 |
6272 #endif // VM_OBJECT_H_ | 6272 #endif // VM_OBJECT_H_ |
OLD | NEW |