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

Unified Diff: runtime/vm/handles.cc

Issue 1191443008: Assert no VM handles are created in the zone that belongs to a ApiNativeScopes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Descrease scopes, ASSERT on handle allocation Created 5 years, 6 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
« no previous file with comments | « runtime/vm/handles.h ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/handles.cc
diff --git a/runtime/vm/handles.cc b/runtime/vm/handles.cc
index 6a8d6ca49014a2264ce3f436ddc9ee832de903f2..bd45c731369df723f4733bf35f1d0c64c20bfb58 100644
--- a/runtime/vm/handles.cc
+++ b/runtime/vm/handles.cc
@@ -6,6 +6,7 @@
#include "platform/assert.h"
#include "platform/utils.h"
+#include "vm/dart_api_state.h"
#include "vm/flags.h"
#include "vm/isolate.h"
#include "vm/os.h"
@@ -43,7 +44,16 @@ void VMHandles::VisitObjectPointers(ObjectPointerVisitor* visitor) {
}
+#if defined(DEBUG)
+static bool IsCurrentApiNativeScope(Zone* zone) {
+ ApiNativeScope* scope = ApiNativeScope::Current();
+ return (scope != NULL) && (scope->zone() == zone);
+}
+#endif // DEBUG
+
+
uword VMHandles::AllocateHandle(Zone* zone) {
+ DEBUG_ASSERT(!IsCurrentApiNativeScope(zone));
return Handles<kVMHandleSizeInWords,
kVMHandlesPerChunk,
kOffsetOfRawPtr>::AllocateHandle(zone);
@@ -51,6 +61,7 @@ uword VMHandles::AllocateHandle(Zone* zone) {
uword VMHandles::AllocateZoneHandle(Zone* zone) {
+ DEBUG_ASSERT(!IsCurrentApiNativeScope(zone));
return Handles<kVMHandleSizeInWords,
kVMHandlesPerChunk,
kOffsetOfRawPtr>::AllocateZoneHandle(zone);
« no previous file with comments | « runtime/vm/handles.h ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698