Chromium Code Reviews| Index: src/isolate.cc | 
| diff --git a/src/isolate.cc b/src/isolate.cc | 
| index dd1587082c7145559781d2604abe7522ef515dbf..a2761e58fc1d4711915c90ae03e5c75e9054b658 100644 | 
| --- a/src/isolate.cc | 
| +++ b/src/isolate.cc | 
| @@ -1278,7 +1278,7 @@ Isolate::CatchType Isolate::PredictExceptionCatcher() { | 
| if (js_frame->LookupExceptionHandlerInTable(nullptr, &prediction) > 0) { | 
| // We are conservative with our prediction: try-finally is considered | 
| // to always rethrow, to meet the expectation of the debugger. | 
| - if (prediction == HandlerTable::CAUGHT) return CAUGHT_BY_JAVASCRIPT; | 
| + if (prediction != HandlerTable::UNCAUGHT) return CAUGHT_BY_JAVASCRIPT; | 
| 
 
Dan Ehrenberg
2016/07/21 21:07:33
This is big--it deserves a comment mentioning the
 
Dan Ehrenberg
2016/07/21 21:08:51
Sorry, please ignore this comment; I wrote it whil
 
 | 
| } | 
| } | 
| @@ -1663,17 +1663,12 @@ bool Isolate::OptionalRescheduleException(bool is_bottom_call) { | 
| return true; | 
| } | 
| - | 
| -void Isolate::PushPromise(Handle<JSObject> promise, | 
| - Handle<JSFunction> function) { | 
| +void Isolate::PushPromise(Handle<JSObject> promise) { | 
| ThreadLocalTop* tltop = thread_local_top(); | 
| PromiseOnStack* prev = tltop->promise_on_stack_; | 
| Handle<JSObject> global_promise = | 
| Handle<JSObject>::cast(global_handles()->Create(*promise)); | 
| - Handle<JSFunction> global_function = | 
| - Handle<JSFunction>::cast(global_handles()->Create(*function)); | 
| - tltop->promise_on_stack_ = | 
| - new PromiseOnStack(global_function, global_promise, prev); | 
| + tltop->promise_on_stack_ = new PromiseOnStack(global_promise, prev); | 
| } | 
| @@ -1681,11 +1676,9 @@ void Isolate::PopPromise() { | 
| ThreadLocalTop* tltop = thread_local_top(); | 
| if (tltop->promise_on_stack_ == NULL) return; | 
| PromiseOnStack* prev = tltop->promise_on_stack_->prev(); | 
| - Handle<Object> global_function = tltop->promise_on_stack_->function(); | 
| Handle<Object> global_promise = tltop->promise_on_stack_->promise(); | 
| delete tltop->promise_on_stack_; | 
| tltop->promise_on_stack_ = prev; | 
| - global_handles()->Destroy(global_function.location()); | 
| global_handles()->Destroy(global_promise.location()); | 
| } | 
| @@ -1694,15 +1687,15 @@ Handle<Object> Isolate::GetPromiseOnStackOnThrow() { | 
| Handle<Object> undefined = factory()->undefined_value(); | 
| ThreadLocalTop* tltop = thread_local_top(); | 
| if (tltop->promise_on_stack_ == NULL) return undefined; | 
| - Handle<JSFunction> promise_function = tltop->promise_on_stack_->function(); | 
| // Find the top-most try-catch or try-finally handler. | 
| if (PredictExceptionCatcher() != CAUGHT_BY_JAVASCRIPT) return undefined; | 
| for (JavaScriptFrameIterator it(this); !it.done(); it.Advance()) { | 
| JavaScriptFrame* frame = it.frame(); | 
| - if (frame->LookupExceptionHandlerInTable(nullptr, nullptr) > 0) { | 
| + HandlerTable::CatchPrediction prediction; | 
| + if (frame->LookupExceptionHandlerInTable(nullptr, &prediction) > 0) { | 
| // Throwing inside a Promise only leads to a reject if not caught by an | 
| // inner try-catch or try-finally. | 
| - if (frame->function() == *promise_function) { | 
| + if (prediction == HandlerTable::PROMISE) { | 
| 
 
Dan Ehrenberg
2016/07/21 21:07:33
Beautiful
 
 | 
| return tltop->promise_on_stack_->promise(); | 
| } | 
| return undefined; |