Index: src/v8.cc |
diff --git a/src/v8.cc b/src/v8.cc |
index 2407037b32feebaca9cc5bc28e50c49b58fac1f4..7d01582c1a866d2a0cf643f274f8ce4cf925b929 100644 |
--- a/src/v8.cc |
+++ b/src/v8.cc |
@@ -38,6 +38,7 @@ |
#include "hydrogen.h" |
#include "lithium-allocator.h" |
#include "log.h" |
+#include "objects.h" |
#include "once.h" |
#include "platform.h" |
#include "runtime-profiler.h" |
@@ -216,14 +217,22 @@ void V8::RemoveCallCompletedCallback(CallCompletedCallback callback) { |
void V8::FireCallCompletedCallback(Isolate* isolate) { |
- if (call_completed_callbacks_ == NULL) return; |
+ bool has_call_completed_callbacks = call_completed_callbacks_ != NULL; |
+ bool observer_delivery_pending = |
+ FLAG_harmony_observation && isolate->observer_delivery_pending(); |
+ if (!has_call_completed_callbacks && !observer_delivery_pending) return; |
HandleScopeImplementer* handle_scope_implementer = |
isolate->handle_scope_implementer(); |
if (!handle_scope_implementer->CallDepthIsZero()) return; |
// Fire callbacks. Increase call depth to prevent recursive callbacks. |
handle_scope_implementer->IncrementCallDepth(); |
- for (int i = 0; i < call_completed_callbacks_->length(); i++) { |
- call_completed_callbacks_->at(i)(); |
+ if (observer_delivery_pending) { |
+ JSObject::DeliverChangeRecords(isolate); |
+ } |
+ if (has_call_completed_callbacks) { |
+ for (int i = 0; i < call_completed_callbacks_->length(); i++) { |
+ call_completed_callbacks_->at(i)(); |
+ } |
} |
handle_scope_implementer->DecrementCallDepth(); |
} |