Index: src/runtime/runtime-promise.cc |
diff --git a/src/runtime/runtime-promise.cc b/src/runtime/runtime-promise.cc |
index f609df73fd6e7864266e54e640291a14ecefaca2..656227d0c8b0238cb9c240e03f4dbcdfc4f3b689 100644 |
--- a/src/runtime/runtime-promise.cc |
+++ b/src/runtime/runtime-promise.cc |
@@ -15,6 +15,9 @@ namespace { |
void PromiseRejectEvent(Isolate* isolate, Handle<JSPromise> promise, |
Handle<Object> rejected_promise, Handle<Object> value, |
bool debug_event) { |
+ isolate->RunPromiseHook(PromiseHookType::kResolve, promise, |
+ isolate->factory()->undefined_value()); |
+ |
if (isolate->debug()->is_active() && debug_event) { |
isolate->debug()->OnPromiseReject(rejected_promise, value); |
} |
@@ -284,5 +287,41 @@ RUNTIME_FUNCTION(Runtime_PromiseMarkAsHandled) { |
return isolate->heap()->undefined_value(); |
} |
+RUNTIME_FUNCTION(Runtime_PromiseHookInit) { |
+ HandleScope scope(isolate); |
+ DCHECK_EQ(2, args.length()); |
+ CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, parent, 1); |
+ isolate->RunPromiseHook(PromiseHookType::kInit, promise, parent); |
+ return isolate->heap()->undefined_value(); |
+} |
+ |
+RUNTIME_FUNCTION(Runtime_PromiseHookResolve) { |
+ HandleScope scope(isolate); |
+ DCHECK_EQ(1, args.length()); |
+ CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); |
+ isolate->RunPromiseHook(PromiseHookType::kResolve, promise, |
+ isolate->factory()->undefined_value()); |
+ return isolate->heap()->undefined_value(); |
+} |
+ |
+RUNTIME_FUNCTION(Runtime_PromiseHookBefore) { |
+ HandleScope scope(isolate); |
+ DCHECK_EQ(1, args.length()); |
+ CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); |
+ isolate->RunPromiseHook(PromiseHookType::kBefore, promise, |
+ isolate->factory()->undefined_value()); |
+ return isolate->heap()->undefined_value(); |
+} |
+ |
+RUNTIME_FUNCTION(Runtime_PromiseHookAfter) { |
+ HandleScope scope(isolate); |
+ DCHECK_EQ(1, args.length()); |
+ CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); |
+ isolate->RunPromiseHook(PromiseHookType::kAfter, promise, |
+ isolate->factory()->undefined_value()); |
+ return isolate->heap()->undefined_value(); |
+} |
+ |
} // namespace internal |
} // namespace v8 |