summaryrefslogtreecommitdiff
path: root/deps/v8/src/builtins/promise-misc.tq
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/builtins/promise-misc.tq')
-rw-r--r--deps/v8/src/builtins/promise-misc.tq59
1 files changed, 37 insertions, 22 deletions
diff --git a/deps/v8/src/builtins/promise-misc.tq b/deps/v8/src/builtins/promise-misc.tq
index 7996cc5b3d..61461de29f 100644
--- a/deps/v8/src/builtins/promise-misc.tq
+++ b/deps/v8/src/builtins/promise-misc.tq
@@ -16,10 +16,6 @@ namespace promise_internal {
void;
extern macro PromiseBuiltinsAssembler::AllocateJSPromise(Context): HeapObject;
-
- extern macro PromiseBuiltinsAssembler::AllocatePromiseReactionJobTask(
- Context): HeapObject;
-
}
namespace promise {
@@ -45,7 +41,7 @@ namespace promise {
assert(IsFunctionWithPrototypeSlotMap(promiseFun.map));
const promiseMap = UnsafeCast<Map>(promiseFun.prototype_or_initial_map);
const promiseHeapObject = promise_internal::AllocateJSPromise(context);
- promiseHeapObject.map = promiseMap;
+ * UnsafeConstCast(& promiseHeapObject.map) = promiseMap;
const promise = UnsafeCast<JSPromise>(promiseHeapObject);
promise.properties_or_hash = kEmptyFixedArray;
promise.elements = kEmptyFixedArray;
@@ -54,20 +50,36 @@ namespace promise {
return promise;
}
- macro NewPromiseReactionJobTask(implicit context: Context)(
- map: Map, handlerContext: Context, argument: Object,
- handler: Callable|Undefined,
+ macro NewPromiseFulfillReactionJobTask(implicit context: Context)(
+ handlerContext: Context, argument: Object, handler: Callable|Undefined,
promiseOrCapability: JSPromise|PromiseCapability|
- Undefined): PromiseReactionJobTask {
- const taskHeapObject =
- promise_internal::AllocatePromiseReactionJobTask(context);
- taskHeapObject.map = map;
- const jobTask = UnsafeCast<PromiseReactionJobTask>(taskHeapObject);
- jobTask.argument = argument;
- jobTask.context = handlerContext;
- jobTask.handler = handler;
- jobTask.promise_or_capability = promiseOrCapability;
- return jobTask;
+ Undefined): PromiseFulfillReactionJobTask {
+ const nativeContext = LoadNativeContext(handlerContext);
+ return new PromiseFulfillReactionJobTask{
+ map: PromiseFulfillReactionJobTaskMapConstant(),
+ argument,
+ context: handlerContext,
+ handler,
+ promise_or_capability: promiseOrCapability,
+ continuation_preserved_embedder_data: nativeContext
+ [NativeContextSlot::CONTINUATION_PRESERVED_EMBEDDER_DATA_INDEX]
+ };
+ }
+
+ macro NewPromiseRejectReactionJobTask(implicit context: Context)(
+ handlerContext: Context, argument: Object, handler: Callable|Undefined,
+ promiseOrCapability: JSPromise|PromiseCapability|
+ Undefined): PromiseRejectReactionJobTask {
+ const nativeContext = LoadNativeContext(handlerContext);
+ return new PromiseRejectReactionJobTask{
+ map: PromiseRejectReactionJobTaskMapConstant(),
+ argument,
+ context: handlerContext,
+ handler,
+ promise_or_capability: promiseOrCapability,
+ continuation_preserved_embedder_data: nativeContext
+ [NativeContextSlot::CONTINUATION_PRESERVED_EMBEDDER_DATA_INDEX]
+ };
}
// These allocate and initialize a promise with pending state and
@@ -113,16 +125,19 @@ namespace promise {
}
macro NewPromiseReaction(implicit context: Context)(
- next: Zero|PromiseReaction,
+ handlerContext: Context, next: Zero|PromiseReaction,
promiseOrCapability: JSPromise|PromiseCapability|Undefined,
fulfillHandler: Callable|Undefined,
rejectHandler: Callable|Undefined): PromiseReaction {
+ const nativeContext = LoadNativeContext(handlerContext);
return new PromiseReaction{
map: PromiseReactionMapConstant(),
next: next,
reject_handler: rejectHandler,
fulfill_handler: fulfillHandler,
- promise_or_capability: promiseOrCapability
+ promise_or_capability: promiseOrCapability,
+ continuation_preserved_embedder_data: nativeContext
+ [NativeContextSlot::CONTINUATION_PRESERVED_EMBEDDER_DATA_INDEX]
};
}
@@ -130,10 +145,10 @@ namespace promise {
macro NewPromiseResolveThenableJobTask(implicit context: Context)(
promiseToResolve: JSPromise, then: JSReceiver, thenable: JSReceiver,
- thenableContext: Context): PromiseResolveThenableJobTask {
+ thenContext: Context): PromiseResolveThenableJobTask {
return new PromiseResolveThenableJobTask{
map: PromiseResolveThenableJobTaskMapConstant(),
- context: thenableContext,
+ context: thenContext,
promise_to_resolve: promiseToResolve,
then: then,
thenable: thenable