| Index: src/isolate.cc | 
| diff --git a/src/isolate.cc b/src/isolate.cc | 
| index f7605d8d21b346e85a78c557aca0b74d78cb624c..5a5f9801bc498691ca0927364833bce7218d8b6d 100644 | 
| --- a/src/isolate.cc | 
| +++ b/src/isolate.cc | 
| @@ -2234,11 +2234,11 @@ void Isolate::FireCallCompletedCallback() { | 
| if (!handle_scope_implementer()->CallDepthIsZero()) return; | 
| if (run_microtasks) RunMicrotasks(); | 
| // Fire callbacks.  Increase call depth to prevent recursive callbacks. | 
| -  handle_scope_implementer()->IncrementCallDepth(); | 
| +  v8::Isolate::SuppressMicrotaskExecutionScope suppress( | 
| +      reinterpret_cast<v8::Isolate*>(this)); | 
| for (int i = 0; i < call_completed_callbacks_.length(); i++) { | 
| call_completed_callbacks_.at(i)(); | 
| } | 
| -  handle_scope_implementer()->DecrementCallDepth(); | 
| } | 
|  | 
|  | 
| @@ -2268,7 +2268,8 @@ void Isolate::RunMicrotasks() { | 
| // ASSERT(handle_scope_implementer()->CallDepthIsZero()); | 
|  | 
| // Increase call depth to prevent recursive callbacks. | 
| -  handle_scope_implementer()->IncrementCallDepth(); | 
| +  v8::Isolate::SuppressMicrotaskExecutionScope suppress( | 
| +      reinterpret_cast<v8::Isolate*>(this)); | 
|  | 
| while (pending_microtask_count() > 0) { | 
| HandleScope scope(this); | 
| @@ -2281,13 +2282,20 @@ void Isolate::RunMicrotasks() { | 
| for (int i = 0; i < num_tasks; i++) { | 
| HandleScope scope(this); | 
| Handle<JSFunction> microtask(JSFunction::cast(queue->get(i)), this); | 
| -      // TODO(adamk): This should ignore/clear exceptions instead of Checking. | 
| -      Execution::Call(this, microtask, factory()->undefined_value(), | 
| -                      0, NULL).Check(); | 
| +      Handle<Object> exception; | 
| +      MaybeHandle<Object> result = Execution::TryCall( | 
| +          microtask, factory()->undefined_value(), 0, NULL, &exception); | 
| +      // If execution is terminating, just bail out. | 
| +      if (result.is_null() && | 
| +          !exception.is_null() && | 
| +          *exception == heap()->termination_exception()) { | 
| +        // Clear out any remaining callbacks in the queue. | 
| +        heap()->set_microtask_queue(heap()->empty_fixed_array()); | 
| +        set_pending_microtask_count(0); | 
| +        return; | 
| +      } | 
| } | 
| } | 
| - | 
| -  handle_scope_implementer()->DecrementCallDepth(); | 
| } | 
|  | 
|  | 
|  |