Chromium Code Reviews| Index: runtime/vm/object.h |
| =================================================================== |
| --- runtime/vm/object.h (revision 43075) |
| +++ runtime/vm/object.h (working copy) |
| @@ -21,6 +21,7 @@ |
| #include "vm/report.h" |
| #include "vm/scanner.h" |
| #include "vm/tags.h" |
| +#include "vm/thread.h" |
| #include "vm/verified_memory.h" |
| namespace dart { |
| @@ -59,24 +60,32 @@ |
| public: /* NOLINT */ \ |
| Raw##object* raw() const { return reinterpret_cast<Raw##object*>(raw_); } \ |
| bool Is##object() const { return true; } \ |
| - static object& Handle(Isolate* isolate, Raw##object* raw_ptr) { \ |
| + static object& Handle(Zone* zone, Raw##object* raw_ptr) { \ |
| object* obj = \ |
| - reinterpret_cast<object*>(VMHandles::AllocateHandle(isolate)); \ |
| + reinterpret_cast<object*>(VMHandles::AllocateHandle(zone)); \ |
| initializeHandle(obj, raw_ptr); \ |
| return *obj; \ |
| } \ |
| + /* DEPRECATED: Use Zone version. */ \ |
| + static object& Handle(Isolate* isolate, Raw##object* raw_ptr) { \ |
| + return Handle(isolate->current_zone(), raw_ptr); \ |
| + } \ |
| static object& Handle() { \ |
| - return Handle(Isolate::Current(), object::null()); \ |
| + return Handle(Thread::Current()->zone(), object::null()); \ |
| } \ |
| + static object& Handle(Zone* zone) { \ |
| + return Handle(zone, object::null()); \ |
| + } \ |
| + /* DEPRECATED: Use Zone version. */ \ |
| static object& Handle(Isolate* isolate) { \ |
| - return Handle(isolate, object::null()); \ |
| + return Handle(isolate->current_zone(), object::null()); \ |
| } \ |
| static object& Handle(Raw##object* raw_ptr) { \ |
| - return Handle(Isolate::Current(), raw_ptr); \ |
| + return Handle(Thread::Current()->zone(), raw_ptr); \ |
| } \ |
| - static object& CheckedHandle(Isolate* isolate, RawObject* raw_ptr) { \ |
| + static object& CheckedHandle(Zone* zone, RawObject* raw_ptr) { \ |
| object* obj = \ |
| - reinterpret_cast<object*>(VMHandles::AllocateHandle(isolate)); \ |
| + reinterpret_cast<object*>(VMHandles::AllocateHandle(zone)); \ |
| initializeHandle(obj, raw_ptr); \ |
| if (!obj->Is##object()) { \ |
| FATAL2("Handle check failed: saw %s expected %s", \ |
| @@ -84,15 +93,22 @@ |
| } \ |
| return *obj; \ |
| } \ |
| + /* DEPRECATED: Use Zone version. */ \ |
| + static object& CheckedHandle(Isolate* isolate, RawObject* raw_ptr) { \ |
| + return CheckedHandle(isolate->current_zone(), raw_ptr); \ |
|
Ivan Posva
2015/01/23 04:53:04
I thought we had switched to isolate->zone() from
koda
2015/01/23 14:29:31
No, that renaming concerned Thread::zone. Since Is
|
| + } \ |
| static object& CheckedHandle(RawObject* raw_ptr) { \ |
| - return CheckedHandle(Isolate::Current(), raw_ptr); \ |
| + return CheckedHandle(Thread::Current()->zone(), raw_ptr); \ |
| } \ |
| - static object& ZoneHandle(Isolate* isolate, Raw##object* raw_ptr) { \ |
| + static object& ZoneHandle(Zone* zone, Raw##object* raw_ptr) { \ |
| object* obj = reinterpret_cast<object*>( \ |
| - VMHandles::AllocateZoneHandle(isolate)); \ |
| + VMHandles::AllocateZoneHandle(zone)); \ |
| initializeHandle(obj, raw_ptr); \ |
| return *obj; \ |
| } \ |
| + static object& ZoneHandle(Isolate* isolate, Raw##object* raw_ptr) { \ |
| + return ZoneHandle(isolate->current_zone(), raw_ptr); \ |
| + } \ |
| static object* ReadOnlyHandle() { \ |
| object* obj = reinterpret_cast<object*>( \ |
| Dart::AllocateReadOnlyHandle()); \ |
| @@ -99,18 +115,22 @@ |
| initializeHandle(obj, object::null()); \ |
| return obj; \ |
| } \ |
| + static object& ZoneHandle(Zone* zone) { \ |
| + return ZoneHandle(zone, object::null()); \ |
| + } \ |
| + /* DEPRECATED: Use Zone version. */ \ |
| static object& ZoneHandle(Isolate* isolate) { \ |
| - return ZoneHandle(isolate, object::null()); \ |
| + return ZoneHandle(isolate->current_zone(), object::null()); \ |
| } \ |
| static object& ZoneHandle() { \ |
| - return ZoneHandle(Isolate::Current(), object::null()); \ |
| + return ZoneHandle(Thread::Current()->zone(), object::null()); \ |
| } \ |
| static object& ZoneHandle(Raw##object* raw_ptr) { \ |
| - return ZoneHandle(Isolate::Current(), raw_ptr); \ |
| + return ZoneHandle(Thread::Current()->zone(), raw_ptr); \ |
| } \ |
| - static object& CheckedZoneHandle(Isolate* isolate, RawObject* raw_ptr) { \ |
| + static object& CheckedZoneHandle(Zone* zone, RawObject* raw_ptr) { \ |
| object* obj = reinterpret_cast<object*>( \ |
| - VMHandles::AllocateZoneHandle(isolate)); \ |
| + VMHandles::AllocateZoneHandle(zone)); \ |
| initializeHandle(obj, raw_ptr); \ |
| if (!obj->Is##object()) { \ |
| FATAL2("Handle check failed: saw %s expected %s", \ |
| @@ -119,7 +139,7 @@ |
| return *obj; \ |
| } \ |
| static object& CheckedZoneHandle(RawObject* raw_ptr) { \ |
| - return CheckedZoneHandle(Isolate::Current(), raw_ptr); \ |
| + return CheckedZoneHandle(Thread::Current()->zone(), raw_ptr); \ |
| } \ |
| /* T::Cast cannot be applied to a null Object, because the object vtable */ \ |
| /* is not setup for type T, although some methods are supposed to work */ \ |
| @@ -321,11 +341,15 @@ |
| bool IsNotTemporaryScopedHandle() const; |
| - static Object& Handle(Isolate* isolate, RawObject* raw_ptr) { |
| - Object* obj = reinterpret_cast<Object*>(VMHandles::AllocateHandle(isolate)); |
| + static Object& Handle(Zone* zone, RawObject* raw_ptr) { |
| + Object* obj = reinterpret_cast<Object*>(VMHandles::AllocateHandle(zone)); |
| initializeHandle(obj, raw_ptr); |
| return *obj; |
| } |
| + // DEPRECATED: Use Zone version. |
| + static Object& Handle(Isolate* isolate, RawObject* raw_ptr) { |
| + return Handle(isolate->current_zone(), raw_ptr); |
| + } |
| static Object* ReadOnlyHandle() { |
| Object* obj = reinterpret_cast<Object*>( |
| Dart::AllocateReadOnlyHandle()); |
| @@ -337,8 +361,12 @@ |
| return Handle(Isolate::Current(), null_); |
| } |
| + static Object& Handle(Zone* zone) { |
| + return Handle(zone, null_); |
| + } |
| + // DEPRECATED: Use Zone version. |
| static Object& Handle(Isolate* isolate) { |
| - return Handle(isolate, null_); |
| + return Handle(isolate->current_zone(), null_); |
| } |
| static Object& Handle(RawObject* raw_ptr) { |
| @@ -347,7 +375,7 @@ |
| static Object& ZoneHandle(Isolate* isolate, RawObject* raw_ptr) { |
|
siva
2015/01/23 19:29:27
DEPRECATED tag for this too.
koda
2015/01/23 21:09:42
Done.
|
| Object* obj = reinterpret_cast<Object*>( |
| - VMHandles::AllocateZoneHandle(isolate)); |
| + VMHandles::AllocateZoneHandle(isolate->current_zone())); |
| initializeHandle(obj, raw_ptr); |
| return *obj; |
| } |
| @@ -805,8 +833,8 @@ |
| raw_ = value; |
| } |
| static PassiveObject& Handle(Isolate* I, RawObject* raw_ptr) { |
|
siva
2015/01/23 19:29:27
Deprecated tag for this too.
koda
2015/01/23 21:09:42
Done.
|
| - PassiveObject* obj = |
| - reinterpret_cast<PassiveObject*>(VMHandles::AllocateHandle(I)); |
| + PassiveObject* obj = reinterpret_cast<PassiveObject*>( |
| + VMHandles::AllocateHandle(I->current_zone())); |
| obj->raw_ = raw_ptr; |
| obj->set_vtable(0); |
| return *obj; |
| @@ -822,7 +850,7 @@ |
| } |
| static PassiveObject& ZoneHandle(Isolate* I, RawObject* raw_ptr) { |
|
siva
2015/01/23 19:29:27
Deprecated tag?
koda
2015/01/23 21:09:42
Done.
|
| PassiveObject* obj = reinterpret_cast<PassiveObject*>( |
| - VMHandles::AllocateZoneHandle(I)); |
| + VMHandles::AllocateZoneHandle(I->current_zone())); |
| obj->raw_ = raw_ptr; |
| obj->set_vtable(0); |
| return *obj; |