Index: src/runtime/runtime-promise.cc |
diff --git a/src/runtime/runtime-promise.cc b/src/runtime/runtime-promise.cc |
index b018fce990189b4464d24d612986acd5dfc759c7..a214f5b8ac25e1273a8b61287cc3d9685d1c7b47 100644 |
--- a/src/runtime/runtime-promise.cc |
+++ b/src/runtime/runtime-promise.cc |
@@ -51,6 +51,16 @@ RUNTIME_FUNCTION(Runtime_PromiseRejectEventFromStack) { |
return isolate->heap()->undefined_value(); |
} |
+RUNTIME_FUNCTION(Runtime_ReportPromiseReject) { |
+ DCHECK_EQ(2, args.length()); |
+ HandleScope scope(isolate); |
+ CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
+ isolate->ReportPromiseReject(Handle<JSObject>::cast(promise), value, |
+ v8::kPromiseRejectWithNoHandler); |
+ return isolate->heap()->undefined_value(); |
+} |
+ |
RUNTIME_FUNCTION(Runtime_PromiseRevokeReject) { |
DCHECK_EQ(1, args.length()); |
HandleScope scope(isolate); |
@@ -130,58 +140,8 @@ void EnqueuePromiseReactionJob(Isolate* isolate, Handle<JSPromise> promise, |
isolate->EnqueueMicrotask(info); |
} |
-void PromiseSet(Isolate* isolate, Handle<JSPromise> promise, int status, |
- Handle<Object> result) { |
- promise->set_status(status); |
- promise->set_result(*result); |
- promise->set_deferred_promise(isolate->heap()->undefined_value()); |
- promise->set_deferred_on_resolve(isolate->heap()->undefined_value()); |
- promise->set_deferred_on_reject(isolate->heap()->undefined_value()); |
- promise->set_fulfill_reactions(isolate->heap()->undefined_value()); |
- promise->set_reject_reactions(isolate->heap()->undefined_value()); |
-} |
- |
-void PromiseFulfill(Isolate* isolate, Handle<JSPromise> promise, int status, |
- Handle<Object> value) { |
- if (isolate->debug()->is_active()) { |
- isolate->debug()->OnAsyncTaskEvent( |
- status == v8::Promise::kFulfilled ? debug::kDebugEnqueuePromiseResolve |
- : debug::kDebugEnqueuePromiseReject, |
- isolate->debug()->NextAsyncTaskId(promise)); |
- } |
- // Check if there are any callbacks. |
- if (!promise->deferred_promise()->IsUndefined(isolate)) { |
- Handle<Object> tasks((status == v8::Promise::kFulfilled) |
- ? promise->fulfill_reactions() |
- : promise->reject_reactions(), |
- isolate); |
- Handle<PromiseReactionJobInfo> info = |
- isolate->factory()->NewPromiseReactionJobInfo( |
- value, tasks, handle(promise->deferred_promise(), isolate), |
- handle(promise->deferred_on_resolve(), isolate), |
- handle(promise->deferred_on_reject(), isolate), |
- isolate->native_context()); |
- EnqueuePromiseReactionJob(isolate, promise, info, status); |
- } |
- |
- PromiseSet(isolate, promise, status, value); |
-} |
- |
} // namespace |
-RUNTIME_FUNCTION(Runtime_PromiseReject) { |
- DCHECK_EQ(3, args.length()); |
- HandleScope scope(isolate); |
- CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); |
- CONVERT_ARG_HANDLE_CHECKED(Object, reason, 1); |
- CONVERT_BOOLEAN_ARG_CHECKED(debug_event, 2); |
- |
- PromiseRejectEvent(isolate, promise, promise, reason, debug_event); |
- PromiseFulfill(isolate, promise, v8::Promise::kRejected, reason); |
- |
- return isolate->heap()->undefined_value(); |
-} |
- |
RUNTIME_FUNCTION(Runtime_EnqueuePromiseReactionJob) { |
HandleScope scope(isolate); |
DCHECK_EQ(3, args.length()); |