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

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

Issue 2325813002: Async/await catch prediction for "the synchronous case" (Closed)
Patch Set: rebase 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
Index: src/runtime/runtime-internal.cc
diff --git a/src/runtime/runtime-internal.cc b/src/runtime/runtime-internal.cc
index 1bc6fcdaf97d55a21ad1495c99cb3ce5492c15e3..d6f6f09f5c18cda33bd76d799c594c66ce214b95 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 uncaught as being a
+ // caught exception event.
+ rejected_promise = isolate->GetPromiseOnStackOnThrow();
}
PromiseRejectEvent(isolate, promise, rejected_promise, value, true);
return isolate->heap()->undefined_value();

Powered by Google App Engine
This is Rietveld 408576698