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

Unified Diff: runtime/vm/thread.h

Issue 1236403004: Migrate handle scope fields to Thread. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Ready for review. Created 5 years, 5 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_impl.h ('k') | runtime/vm/thread_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread.h
diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h
index bc9cb61dcd69c6226b1426c225efdc6efdab2616..98cd55d3f1bd6309ff0cea04058c177a637ccfd7 100644
--- a/runtime/vm/thread.h
+++ b/runtime/vm/thread.h
@@ -12,6 +12,7 @@
namespace dart {
class CHA;
+class HandleScope;
class Isolate;
class Object;
class RawBool;
@@ -116,12 +117,52 @@ class Thread {
return OFFSET_OF(Thread, state_) + OFFSET_OF(State, top_resource);
}
+ int32_t no_handle_scope_depth() const {
+#if defined(DEBUG)
+ return state_.no_handle_scope_depth;
+#else
+ return 0;
+#endif
+ }
+
+ void IncrementNoHandleScopeDepth() {
+#if defined(DEBUG)
+ ASSERT(state_.no_handle_scope_depth < INT_MAX);
+ state_.no_handle_scope_depth += 1;
+#endif
+ }
+
+ void DecrementNoHandleScopeDepth() {
+#if defined(DEBUG)
+ ASSERT(state_.no_handle_scope_depth > 0);
+ state_.no_handle_scope_depth -= 1;
+#endif
+ }
+
+ HandleScope* top_handle_scope() const {
+#if defined(DEBUG)
+ return state_.top_handle_scope;
+#else
+ return 0;
+#endif
+ }
+
+ void set_top_handle_scope(HandleScope* handle_scope) {
+#if defined(DEBUG)
+ state_.top_handle_scope = handle_scope;
+#endif
+ }
+
// Collection of isolate-specific state of a thread that is saved/restored
// on isolate exit/re-entry.
struct State {
Zone* zone;
uword top_exit_frame_info;
StackResource* top_resource;
+#if defined(DEBUG)
+ HandleScope* top_handle_scope;
+ intptr_t no_handle_scope_depth;
+#endif
};
#define DEFINE_OFFSET_METHOD(type_name, member_name, expr, default_init_value) \
« no previous file with comments | « runtime/vm/handles_impl.h ('k') | runtime/vm/thread_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698