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

Unified Diff: src/runtime/runtime.cc

Issue 600723005: Introduce PromiseRejectCallback. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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.cc
diff --git a/src/runtime/runtime.cc b/src/runtime/runtime.cc
index 427b8217456c165f4ba8884fbb689043bb76ccbd..01b08e99611490e8bdbdb9927c7826fae391986c 100644
--- a/src/runtime/runtime.cc
+++ b/src/runtime/runtime.cc
@@ -2657,16 +2657,42 @@ RUNTIME_FUNCTION(Runtime_DebugPromiseEvent) {
}
-RUNTIME_FUNCTION(Runtime_DebugPromiseRejectEvent) {
- DCHECK(args.length() == 2);
+RUNTIME_FUNCTION(Runtime_PromiseRejectEvent) {
+ DCHECK(args.length() == 3);
HandleScope scope(isolate);
CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
- isolate->debug()->OnPromiseReject(promise, value);
+ CONVERT_BOOLEAN_ARG_CHECKED(debug_event, 2);
+ if (debug_event) isolate->debug()->OnPromiseReject(promise, value);
+ Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol();
+ // Do not report if we actually have a handler.
+ if (JSObject::GetDataProperty(promise, key)->IsUndefined()) {
+ isolate->ReportPromiseReject(promise, value,
+ v8::kPromiseRejectWithNoHandler);
+ }
+ return isolate->heap()->undefined_value();
+}
+
+
+RUNTIME_FUNCTION(Runtime_PromiseRevokeReject) {
+ DCHECK(args.length() == 1);
+ HandleScope scope(isolate);
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0);
+ Handle<Symbol> key = isolate->factory()->promise_has_handler_symbol();
+ // At this point, no revocation has been issued before
+ RUNTIME_ASSERT(JSObject::GetDataProperty(promise, key)->IsUndefined());
+ isolate->ReportPromiseReject(promise, Handle<Object>(),
+ v8::kPromiseHandlerAddedAfterReject);
return isolate->heap()->undefined_value();
}
+RUNTIME_FUNCTION(Runtime_PromiseHasHandlerSymbol) {
+ DCHECK(args.length() == 0);
+ return isolate->heap()->promise_has_handler_symbol();
+}
+
+
RUNTIME_FUNCTION(Runtime_DebugAsyncTaskEvent) {
DCHECK(args.length() == 1);
HandleScope scope(isolate);
« include/v8.h ('K') | « src/runtime/runtime.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698