Index: runtime/vm/thread.cc |
diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc |
index 09ae4c0d1ea29dc5dfcc71237649dcacf7dcb9cb..a2af102a7ebc4736a645e2fd800e2c5b4ef5aa8a 100644 |
--- a/runtime/vm/thread.cc |
+++ b/runtime/vm/thread.cc |
@@ -185,12 +185,13 @@ Thread::Thread(bool init_vm_constants) |
timeline_block_(NULL), |
store_buffer_block_(NULL), |
log_(new class Log()), |
- deopt_id_(0), |
- vm_tag_(0), |
REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) |
REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) |
reusable_handles_(), |
cha_(NULL), |
+ deopt_id_(0), |
+ vm_tag_(0), |
+ pending_functions_(GrowableObjectArray::null()), |
no_callback_scope_depth_(0), |
thread_list_next_(NULL) { |
ClearState(); |
@@ -250,6 +251,20 @@ LEAF_RUNTIME_ENTRY_LIST(INIT_VALUE) |
} |
+void Thread::ClearState() { |
+ memset(&state_, 0, sizeof(state_)); |
+ pending_functions_ = GrowableObjectArray::null(); |
+} |
+ |
+ |
+RawGrowableObjectArray* Thread::pending_functions() { |
+ if (pending_functions_ == GrowableObjectArray::null()) { |
+ pending_functions_ = GrowableObjectArray::New(Heap::kOld); |
+ } |
+ return pending_functions_; |
+} |
+ |
+ |
void Thread::Schedule(Isolate* isolate, bool bypass_safepoint) { |
State st; |
if (isolate->thread_registry()->RestoreStateTo(this, &st, bypass_safepoint)) { |
@@ -429,6 +444,11 @@ void Thread::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
// Visit objects in thread specific handles area. |
reusable_handles_.VisitObjectPointers(visitor); |
+ |
+ if (pending_functions_ != GrowableObjectArray::null()) { |
+ visitor->VisitPointer( |
+ reinterpret_cast<RawObject**>(&pending_functions_)); |
+ } |
} |