Chromium Code Reviews| Index: runtime/vm/handles_impl.h |
| =================================================================== |
| --- runtime/vm/handles_impl.h (revision 43075) |
| +++ runtime/vm/handles_impl.h (working copy) |
| @@ -85,36 +85,39 @@ |
| } |
| -// Figure out the current handle scope using the current Isolate and |
| +// Figure out the current handle scope using the current Zone and |
| // allocate a handle in that scope. The function assumes that a |
| -// current Isolate, current zone and current handle scope exist. It |
| -// asserts for this appropriately. |
| +// current handle scope exists. It asserts for this appropriately. |
| template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> |
| uword Handles<kHandleSizeInWords, |
| kHandlesPerChunk, |
| - kOffsetOfRawPtr>::AllocateHandle(Isolate* isolate) { |
| + kOffsetOfRawPtr>::AllocateHandle(Zone* zone) { |
| +#if defined(DEBUG) |
| + Isolate* isolate = Isolate::Current(); |
|
siva
2015/01/23 19:29:27
I think this should be
Thread* thread = Thread::Cu
koda
2015/01/23 21:09:42
Agreed. That's why I already marked it as obsolete
|
| ASSERT(isolate != NULL); |
| - ASSERT(isolate->current_zone() != NULL); |
| + ASSERT(isolate->current_zone() == zone); |
| ASSERT(isolate->top_handle_scope() != NULL); |
| ASSERT(isolate->no_handle_scope_depth() == 0); |
| - Handles* handles = isolate->current_zone()->handles(); |
| +#endif // DEBUG |
| + Handles* handles = zone->handles(); |
| ASSERT(handles != NULL); |
| return handles->AllocateScopedHandle(); |
| } |
| -// Figure out the current zone using the current Isolate and |
| -// allocate a handle in that zone. The function assumes that a |
| -// current Isolate and current zone exist. It asserts for |
| +// The function assumes that 'zone' is the current zone and asserts for |
| // this appropriately. |
| template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> |
| uword Handles<kHandleSizeInWords, |
| kHandlesPerChunk, |
| - kOffsetOfRawPtr>::AllocateZoneHandle(Isolate* isolate) { |
| + kOffsetOfRawPtr>::AllocateZoneHandle(Zone* zone) { |
| +#if defined(DEBUG) |
| + Isolate* isolate = Isolate::Current(); |
|
siva
2015/01/23 19:29:27
Ditto here Thread::Current();
koda
2015/01/23 21:09:42
Done.
|
| ASSERT(isolate != NULL); |
| - ASSERT(isolate->current_zone() != NULL); |
| + ASSERT(isolate->current_zone() == zone); |
| ASSERT(isolate->no_handle_scope_depth() == 0); |
| - Handles* handles = isolate->current_zone()->handles(); |
| +#endif // DEBUG |
| + Handles* handles = zone->handles(); |
| ASSERT(handles != NULL); |
| uword address = handles->AllocateHandleInZone(); |
| return address; |