Index: src/isolate.cc |
diff --git a/src/isolate.cc b/src/isolate.cc |
index cb73c26b98e8849d3ee1048a47e05e5f1d0b1d43..e5d46cd903b8354d08391470d9f5d46564123d22 100644 |
--- a/src/isolate.cc |
+++ b/src/isolate.cc |
@@ -477,6 +477,14 @@ void Isolate::Iterate(ObjectVisitor* v) { |
Iterate(v, current_t); |
} |
+void Isolate::IterateDeferredHandles(ObjectVisitor* visitor) { |
+ for (DeferredHandles* deferred = deferred_handles_head_; |
+ deferred != NULL; |
+ deferred = deferred->next_) { |
+ deferred->Iterate(visitor); |
+ } |
+} |
+ |
void Isolate::RegisterTryCatchHandler(v8::TryCatch* that) { |
// The ARM simulator has a separate JS stack. We therefore register |
@@ -1484,7 +1492,8 @@ Isolate::Isolate() |
string_tracker_(NULL), |
regexp_stack_(NULL), |
date_cache_(NULL), |
- context_exit_happened_(false) { |
+ context_exit_happened_(false), |
+ deferred_handles_head_(NULL) { |
TRACE_ISOLATE(constructor); |
memset(isolate_addresses_, 0, |
@@ -1989,6 +1998,36 @@ void Isolate::Exit() { |
} |
+void Isolate::LinkDeferredHandles(DeferredHandles* deferred) { |
+ deferred->next_ = deferred_handles_head_; |
+ if (deferred_handles_head_ != NULL) { |
+ deferred_handles_head_->previous_ = deferred; |
+ } |
+ deferred_handles_head_ = deferred; |
+} |
+ |
+ |
+void Isolate::UnlinkDeferredHandles(DeferredHandles* deferred) { |
+#ifdef DEBUG |
+ // In debug mode assert that the linked list is well-formed. |
+ DeferredHandles* deferred_iterator = deferred; |
+ while (deferred_iterator->previous_ != NULL) { |
+ deferred_iterator = deferred_iterator->previous_; |
+ } |
+ ASSERT(deferred_handles_head_ == deferred_iterator); |
+#endif |
+ if (deferred_handles_head_ == deferred) { |
+ deferred_handles_head_ = deferred_handles_head_->next_; |
+ } |
+ if (deferred->next_ != NULL) { |
+ deferred->next_->previous_ = deferred->previous_; |
+ } |
+ if (deferred->previous_ != NULL) { |
+ deferred->previous_->next_ = deferred->next_; |
+ } |
+} |
+ |
+ |
#ifdef DEBUG |
#define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |