| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 195 |
| 196 // Returns the name that is used to identify an object in the | 196 // Returns the name that is used to identify an object in the |
| 197 // namespace dictionary. | 197 // namespace dictionary. |
| 198 // Object::DictionaryName() returns String::null(). Only subclasses | 198 // Object::DictionaryName() returns String::null(). Only subclasses |
| 199 // of Object that need to be entered in the library and library prefix | 199 // of Object that need to be entered in the library and library prefix |
| 200 // namespaces need to provide an implementation. | 200 // namespaces need to provide an implementation. |
| 201 virtual RawString* DictionaryName() const; | 201 virtual RawString* DictionaryName() const; |
| 202 | 202 |
| 203 bool IsNew() const { return raw()->IsNewObject(); } | 203 bool IsNew() const { return raw()->IsNewObject(); } |
| 204 bool IsOld() const { return raw()->IsOldObject(); } | 204 bool IsOld() const { return raw()->IsOldObject(); } |
| 205 bool InVMHeap() const { |
| 206 #if defined(DEBUG) |
| 207 if (raw()->IsVMHeapObject()) { |
| 208 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); |
| 209 ASSERT(vm_isolate_heap->Contains(RawObject::ToAddr(raw()))); |
| 210 } |
| 211 #endif |
| 212 return raw()->IsVMHeapObject(); |
| 213 } |
| 205 | 214 |
| 206 // Print the object on stdout for debugging. | 215 // Print the object on stdout for debugging. |
| 207 void Print() const; | 216 void Print() const; |
| 208 | 217 |
| 209 bool IsZoneHandle() const { | 218 bool IsZoneHandle() const { |
| 210 return VMHandles::IsZoneHandle(reinterpret_cast<uword>(this)); | 219 return VMHandles::IsZoneHandle(reinterpret_cast<uword>(this)); |
| 211 } | 220 } |
| 212 | 221 |
| 213 bool IsReadOnlyHandle() const; | 222 bool IsReadOnlyHandle() const; |
| 214 | 223 |
| (...skipping 5916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6131 intptr_t cid = raw_->GetClassId(); | 6140 intptr_t cid = raw_->GetClassId(); |
| 6132 if (cid >= kNumPredefinedCids) { | 6141 if (cid >= kNumPredefinedCids) { |
| 6133 cid = kInstanceCid; | 6142 cid = kInstanceCid; |
| 6134 } | 6143 } |
| 6135 set_vtable(builtin_vtables_[cid]); | 6144 set_vtable(builtin_vtables_[cid]); |
| 6136 #if defined(DEBUG) | 6145 #if defined(DEBUG) |
| 6137 Isolate* isolate = Isolate::Current(); | 6146 Isolate* isolate = Isolate::Current(); |
| 6138 if (FLAG_verify_handles) { | 6147 if (FLAG_verify_handles) { |
| 6139 Heap* isolate_heap = isolate->heap(); | 6148 Heap* isolate_heap = isolate->heap(); |
| 6140 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); | 6149 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); |
| 6141 ASSERT(isolate_heap->Contains(reinterpret_cast<uword>(raw_->ptr())) || | 6150 ASSERT(isolate_heap->Contains(RawObject::ToAddr(raw_)) || |
| 6142 vm_isolate_heap->Contains(reinterpret_cast<uword>(raw_->ptr()))); | 6151 vm_isolate_heap->Contains(RawObject::ToAddr(raw_))); |
| 6143 } | 6152 } |
| 6144 ASSERT(builtin_vtables_[cid] == | 6153 ASSERT(builtin_vtables_[cid] == |
| 6145 isolate->class_table()->At(cid)->ptr()->handle_vtable_); | 6154 isolate->class_table()->At(cid)->ptr()->handle_vtable_); |
| 6146 #endif | 6155 #endif |
| 6147 } | 6156 } |
| 6148 | 6157 |
| 6149 | 6158 |
| 6150 bool Function::HasCode() const { | 6159 bool Function::HasCode() const { |
| 6151 return raw_ptr()->code_ != Code::null(); | 6160 return raw_ptr()->code_ != Code::null(); |
| 6152 } | 6161 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6228 | 6237 |
| 6229 | 6238 |
| 6230 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6239 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6231 intptr_t index) { | 6240 intptr_t index) { |
| 6232 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6241 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6233 } | 6242 } |
| 6234 | 6243 |
| 6235 } // namespace dart | 6244 } // namespace dart |
| 6236 | 6245 |
| 6237 #endif // VM_OBJECT_H_ | 6246 #endif // VM_OBJECT_H_ |
| OLD | NEW |