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

Unified Diff: src/runtime/runtime-internal.cc

Issue 2325813002: Async/await catch prediction for "the synchronous case" (Closed)
Patch Set: TryCall Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/isolate.cc ('k') | test/mjsunit/harmony/async-debug-caught-exception-cases.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-internal.cc
diff --git a/src/runtime/runtime-internal.cc b/src/runtime/runtime-internal.cc
index 1bc6fcdaf97d55a21ad1495c99cb3ce5492c15e3..a094d938d094d5f56d47f237a8bf05fee86df5bb 100644
--- a/src/runtime/runtime-internal.cc
+++ b/src/runtime/runtime-internal.cc
@@ -274,7 +274,7 @@ RUNTIME_FUNCTION(Runtime_ThrowApplyNonFunction) {
namespace {
void PromiseRejectEvent(Isolate* isolate, Handle<JSObject> promise,
- Handle<JSObject> rejected_promise, Handle<Object> value,
+ Handle<Object> rejected_promise, Handle<Object> value,
bool debug_event) {
if (isolate->debug()->is_active() && debug_event) {
isolate->debug()->OnPromiseReject(rejected_promise, value);
@@ -306,12 +306,12 @@ RUNTIME_FUNCTION(Runtime_PromiseRejectEventFromStack) {
CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
- Handle<JSObject> rejected_promise = promise;
+ Handle<Object> rejected_promise = promise;
if (isolate->debug()->is_active()) {
- Handle<Object> promise_on_stack = isolate->GetPromiseOnStackOnThrow();
- if (promise_on_stack->IsJSObject()) {
- rejected_promise = Handle<JSObject>::cast(promise_on_stack);
- }
+ // If the Promise.reject call is caught, then this will return
+ // undefined, which will be interpreted by PromiseRejectEvent
+ // as being a caught exception event.
+ rejected_promise = isolate->GetPromiseOnStackOnThrow();
}
PromiseRejectEvent(isolate, promise, rejected_promise, value, true);
return isolate->heap()->undefined_value();
« no previous file with comments | « src/isolate.cc ('k') | test/mjsunit/harmony/async-debug-caught-exception-cases.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698