Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Unified Diff: runtime/vm/handles_impl.h

Issue 868913002: Add Zone-based handle allocation interface and reduce use of Isolate-based interfaces. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698