Index: src/execution.cc |
diff --git a/src/execution.cc b/src/execution.cc |
index cc067a8ab88ca61ca95878f68d96eb49fd5f815d..01005977e588a135ff4b893846f5ca3ec4ed9f9c 100644 |
--- a/src/execution.cc |
+++ b/src/execution.cc |
@@ -68,6 +68,7 @@ MUST_USE_RESULT MaybeHandle<Object> Invoke(Isolate* isolate, bool is_construct, |
isolate->ReportPendingMessages(); |
return MaybeHandle<Object>(); |
} |
+ JavascriptExecutionObserver::SetObserved(isolate); |
// Placeholder for return value. |
Object* value = NULL; |
@@ -535,5 +536,27 @@ Object* StackGuard::HandleInterrupts() { |
return isolate_->heap()->undefined_value(); |
} |
+ |
+JavascriptExecutionObserver::JavascriptExecutionObserver(Isolate* isolate) |
+ : isolate_(isolate), observed_(false) { |
+ prev_ = isolate->execution_observer(); |
+ isolate->set_execution_observer(this); |
+} |
+ |
+ |
+JavascriptExecutionObserver::~JavascriptExecutionObserver() { |
+ isolate_->set_execution_observer(prev_); |
+} |
+ |
+ |
+void JavascriptExecutionObserver::SetObserved(Isolate* isolate) { |
+ for (JavascriptExecutionObserver* observer = isolate->execution_observer(); |
+ observer != NULL; observer = observer->prev_) { |
+ // If this observer is already set to true, so are all its predecessors. |
+ if (observer->observed_) break; |
+ observer->observed_ = true; |
+ } |
+} |
+ |
} // namespace internal |
} // namespace v8 |