| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 return Handle(isolate, object::null()); \ | 55 return Handle(isolate, object::null()); \ |
| 56 } \ | 56 } \ |
| 57 static object& Handle(Raw##object* raw_ptr) { \ | 57 static object& Handle(Raw##object* raw_ptr) { \ |
| 58 return Handle(Isolate::Current(), raw_ptr); \ | 58 return Handle(Isolate::Current(), raw_ptr); \ |
| 59 } \ | 59 } \ |
| 60 static object& CheckedHandle(Isolate* isolate, RawObject* raw_ptr) { \ | 60 static object& CheckedHandle(Isolate* isolate, RawObject* raw_ptr) { \ |
| 61 object* obj = \ | 61 object* obj = \ |
| 62 reinterpret_cast<object*>(VMHandles::AllocateHandle(isolate)); \ | 62 reinterpret_cast<object*>(VMHandles::AllocateHandle(isolate)); \ |
| 63 initializeHandle(obj, raw_ptr); \ | 63 initializeHandle(obj, raw_ptr); \ |
| 64 if (!obj->Is##object()) { \ | 64 if (!obj->Is##object()) { \ |
| 65 FATAL("Handle check failed."); \ | 65 FATAL2("Handle check failed: saw %s expected %s", \ |
| 66 obj->ToCString(), #object); \ |
| 66 } \ | 67 } \ |
| 67 return *obj; \ | 68 return *obj; \ |
| 68 } \ | 69 } \ |
| 69 static object& CheckedHandle(RawObject* raw_ptr) { \ | 70 static object& CheckedHandle(RawObject* raw_ptr) { \ |
| 70 return CheckedHandle(Isolate::Current(), raw_ptr); \ | 71 return CheckedHandle(Isolate::Current(), raw_ptr); \ |
| 71 } \ | 72 } \ |
| 72 static object& ZoneHandle(Isolate* isolate, Raw##object* raw_ptr) { \ | 73 static object& ZoneHandle(Isolate* isolate, Raw##object* raw_ptr) { \ |
| 73 object* obj = reinterpret_cast<object*>( \ | 74 object* obj = reinterpret_cast<object*>( \ |
| 74 VMHandles::AllocateZoneHandle(isolate)); \ | 75 VMHandles::AllocateZoneHandle(isolate)); \ |
| 75 initializeHandle(obj, raw_ptr); \ | 76 initializeHandle(obj, raw_ptr); \ |
| 76 return *obj; \ | 77 return *obj; \ |
| 77 } \ | 78 } \ |
| 78 static object& ZoneHandle() { \ | 79 static object& ZoneHandle() { \ |
| 79 return ZoneHandle(Isolate::Current(), object::null()); \ | 80 return ZoneHandle(Isolate::Current(), object::null()); \ |
| 80 } \ | 81 } \ |
| 81 static object& ZoneHandle(Raw##object* raw_ptr) { \ | 82 static object& ZoneHandle(Raw##object* raw_ptr) { \ |
| 82 return ZoneHandle(Isolate::Current(), raw_ptr); \ | 83 return ZoneHandle(Isolate::Current(), raw_ptr); \ |
| 83 } \ | 84 } \ |
| 84 static object& CheckedZoneHandle(Isolate* isolate, RawObject* raw_ptr) { \ | 85 static object& CheckedZoneHandle(Isolate* isolate, RawObject* raw_ptr) { \ |
| 85 object* obj = reinterpret_cast<object*>( \ | 86 object* obj = reinterpret_cast<object*>( \ |
| 86 VMHandles::AllocateZoneHandle(isolate)); \ | 87 VMHandles::AllocateZoneHandle(isolate)); \ |
| 87 initializeHandle(obj, raw_ptr); \ | 88 initializeHandle(obj, raw_ptr); \ |
| 88 if (!obj->Is##object()) { \ | 89 if (!obj->Is##object()) { \ |
| 89 FATAL("Handle check failed."); \ | 90 FATAL2("Handle check failed: saw %s expected %s", \ |
| 91 obj->ToCString(), #object); \ |
| 90 } \ | 92 } \ |
| 91 return *obj; \ | 93 return *obj; \ |
| 92 } \ | 94 } \ |
| 93 static object& CheckedZoneHandle(RawObject* raw_ptr) { \ | 95 static object& CheckedZoneHandle(RawObject* raw_ptr) { \ |
| 94 return CheckedZoneHandle(Isolate::Current(), raw_ptr); \ | 96 return CheckedZoneHandle(Isolate::Current(), raw_ptr); \ |
| 95 } \ | 97 } \ |
| 96 /* T::Cast cannot be applied to a null Object, because the object vtable */ \ | 98 /* T::Cast cannot be applied to a null Object, because the object vtable */ \ |
| 97 /* is not setup for type T, although some methods are supposed to work */ \ | 99 /* is not setup for type T, although some methods are supposed to work */ \ |
| 98 /* with null, for example Instance::Equals(). */ \ | 100 /* with null, for example Instance::Equals(). */ \ |
| 99 static const object& Cast(const Object& obj) { \ | 101 static const object& Cast(const Object& obj) { \ |
| (...skipping 5345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5445 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5447 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
| 5446 return false; | 5448 return false; |
| 5447 } | 5449 } |
| 5448 } | 5450 } |
| 5449 return true; | 5451 return true; |
| 5450 } | 5452 } |
| 5451 | 5453 |
| 5452 } // namespace dart | 5454 } // namespace dart |
| 5453 | 5455 |
| 5454 #endif // VM_OBJECT_H_ | 5456 #endif // VM_OBJECT_H_ |
| OLD | NEW |