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

Unified Diff: src/debug/debug.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/debug/debug.h ('k') | src/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug/debug.cc
diff --git a/src/debug/debug.cc b/src/debug/debug.cc
index 747093e7492cb2119ee3d8008ef9492f713d56cf..b7a2f27a17d505f85f882925c6a58945a0c4b34e 100644
--- a/src/debug/debug.cc
+++ b/src/debug/debug.cc
@@ -1682,43 +1682,33 @@ void Debug::OnThrow(Handle<Object> exception) {
}
}
-
-void Debug::OnPromiseReject(Handle<JSObject> promise, Handle<Object> value) {
+void Debug::OnPromiseReject(Handle<Object> promise, Handle<Object> value) {
if (in_debug_scope() || ignore_events()) return;
HandleScope scope(isolate_);
// Check whether the promise has been marked as having triggered a message.
Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol();
- if (JSReceiver::GetDataProperty(promise, key)->IsUndefined(isolate_)) {
+ if (!promise->IsJSObject() ||
+ JSReceiver::GetDataProperty(Handle<JSObject>::cast(promise), key)
+ ->IsUndefined(isolate_)) {
OnException(value, promise);
}
}
-MaybeHandle<Object> Debug::PromiseHasUserDefinedRejectHandler(
- Handle<JSObject> promise) {
- Handle<JSFunction> fun = isolate_->promise_has_user_defined_reject_handler();
- return Execution::Call(isolate_, fun, promise, 0, NULL);
-}
-
-
void Debug::OnException(Handle<Object> exception, Handle<Object> promise) {
Isolate::CatchType catch_type = isolate_->PredictExceptionCatcher();
// Don't notify listener of exceptions that are internal to a desugaring.
if (catch_type == Isolate::CAUGHT_BY_DESUGARING) return;
- bool uncaught = (catch_type == Isolate::NOT_CAUGHT);
+ bool uncaught = catch_type == Isolate::NOT_CAUGHT;
if (promise->IsJSObject()) {
Handle<JSObject> jspromise = Handle<JSObject>::cast(promise);
// Mark the promise as already having triggered a message.
Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol();
JSObject::SetProperty(jspromise, key, key, STRICT).Assert();
// Check whether the promise reject is considered an uncaught exception.
- Handle<Object> has_reject_handler;
- ASSIGN_RETURN_ON_EXCEPTION_VALUE(
- isolate_, has_reject_handler,
- PromiseHasUserDefinedRejectHandler(jspromise), /* void */);
- uncaught = has_reject_handler->IsFalse(isolate_);
+ uncaught = !isolate_->PromiseHasUserDefinedRejectHandler(jspromise);
}
// Bail out if exception breaks are not active
if (uncaught) {
« no previous file with comments | « src/debug/debug.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698