Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: src/isolate.cc

Issue 991833002: Simplify promise event on throw handling. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/es6/debug-promises/resolve-after-aborted-try-finally.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include <fstream> // NOLINT(readability/streams) 7 #include <fstream> // NOLINT(readability/streams)
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/v8.h" 10 #include "src/v8.h"
(...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 } 1548 }
1549 1549
1550 1550
1551 Handle<Object> Isolate::GetPromiseOnStackOnThrow() { 1551 Handle<Object> Isolate::GetPromiseOnStackOnThrow() {
1552 Handle<Object> undefined = factory()->undefined_value(); 1552 Handle<Object> undefined = factory()->undefined_value();
1553 ThreadLocalTop* tltop = thread_local_top(); 1553 ThreadLocalTop* tltop = thread_local_top();
1554 if (tltop->promise_on_stack_ == NULL) return undefined; 1554 if (tltop->promise_on_stack_ == NULL) return undefined;
1555 StackHandler* promise_try = tltop->promise_on_stack_->handler(); 1555 StackHandler* promise_try = tltop->promise_on_stack_->handler();
1556 // Find the top-most try-catch handler. 1556 // Find the top-most try-catch handler.
1557 StackHandler* handler = StackHandler::FromAddress(Isolate::handler(tltop)); 1557 StackHandler* handler = StackHandler::FromAddress(Isolate::handler(tltop));
1558 do { 1558 // Throwing inside a Promise only leads to a reject if not caught by an inner
1559 if (handler == promise_try) { 1559 // try-catch or try-finally.
1560 return tltop->promise_on_stack_->promise(); 1560 if (handler == promise_try) return tltop->promise_on_stack_->promise();
1561 }
1562 handler = handler->next();
1563 // Throwing inside a Promise can be intercepted by an inner try-catch, so
1564 // we stop at the first try-catch handler.
1565 } while (handler != NULL && !handler->is_catch());
1566 return undefined; 1561 return undefined;
1567 } 1562 }
1568 1563
1569 1564
1570 void Isolate::SetCaptureStackTraceForUncaughtExceptions( 1565 void Isolate::SetCaptureStackTraceForUncaughtExceptions(
1571 bool capture, 1566 bool capture,
1572 int frame_limit, 1567 int frame_limit,
1573 StackTrace::StackTraceOptions options) { 1568 StackTrace::StackTraceOptions options) {
1574 capture_stack_trace_for_uncaught_exceptions_ = capture; 1569 capture_stack_trace_for_uncaught_exceptions_ = capture;
1575 stack_trace_for_uncaught_exceptions_frame_limit_ = frame_limit; 1570 stack_trace_for_uncaught_exceptions_frame_limit_ = frame_limit;
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
2659 if (prev_ && prev_->Intercept(flag)) return true; 2654 if (prev_ && prev_->Intercept(flag)) return true;
2660 // Then check whether this scope intercepts. 2655 // Then check whether this scope intercepts.
2661 if ((flag & intercept_mask_)) { 2656 if ((flag & intercept_mask_)) {
2662 intercepted_flags_ |= flag; 2657 intercepted_flags_ |= flag;
2663 return true; 2658 return true;
2664 } 2659 }
2665 return false; 2660 return false;
2666 } 2661 }
2667 2662
2668 } } // namespace v8::internal 2663 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es6/debug-promises/resolve-after-aborted-try-finally.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698