Index: runtime/vm/allocation.h |
diff --git a/runtime/vm/allocation.h b/runtime/vm/allocation.h |
index 3947f0e79881db294753869df3f3185280f49837..74a2d7d6d17aa85c4dd05d34d3fd9231088e2475 100644 |
--- a/runtime/vm/allocation.h |
+++ b/runtime/vm/allocation.h |
@@ -134,6 +134,27 @@ class ZoneAllocated { |
DISALLOW_COPY_AND_ASSIGN(ZoneAllocated); |
}; |
+ |
+ |
+// Within a NoSafepointScope, the thread must not reach any safepoint. Used |
+// around code that manipulates raw object pointers directly without handles. |
+#if defined(DEBUG) |
+class NoSafepointScope : public StackResource { |
+ public: |
+ NoSafepointScope(); |
+ ~NoSafepointScope(); |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(NoSafepointScope); |
+}; |
+#else // defined(DEBUG) |
+class NoSafepointScope : public ValueObject { |
+ public: |
+ NoSafepointScope() {} |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(NoSafepointScope); |
+}; |
+#endif // defined(DEBUG) |
+ |
} // namespace dart |
#endif // VM_ALLOCATION_H_ |