| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1a104ba commit 043b1aa
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,7 +36,7 @@ | |||
| 36 | 36 | ||
| 37 | 37 | # Reset this number to 0 on major V8 upgrades. | |
| 38 | 38 | # Increment by one for each non-official patch applied to deps/v8. | |
| 39 | - 'v8_embedder_string': '-node.13', | ||
| 39 | + 'v8_embedder_string': '-node.14', | ||
| 40 | 40 | ||
| 41 | 41 | ##### V8 defaults for Node.js ##### | |
| 42 | 42 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -104,9 +104,7 @@ transitioning macro RunContextPromiseHookInit(implicit context: Context)( | |||
| 104 | 104 | promise: JSPromise, parent: Object) { | |
| 105 | 105 | const maybeHook = *NativeContextSlot( | |
| 106 | 106 | ContextSlot::PROMISE_HOOK_INIT_FUNCTION_INDEX); | |
| 107 | - if (IsUndefined(maybeHook)) return; | ||
| 108 | - | ||
| 109 | - const hook = Cast<JSFunction>(maybeHook) otherwise unreachable; | ||
| 107 | + const hook = Cast<Callable>(maybeHook) otherwise return; | ||
| 110 | 108 | const parentObject = Is<JSPromise>(parent) ? Cast<JSPromise>(parent) | |
| 111 | 109 | otherwise unreachable: Undefined; | |
| 112 | 110 | ||
@@ -165,13 +163,11 @@ transitioning macro RunContextPromiseHookAfter(implicit context: Context)( | |||
| 165 | 163 | } | |
| 166 | 164 | ||
| 167 | 165 | transitioning macro RunContextPromiseHook(implicit context: Context)( | |
| 168 | - slot: Slot<NativeContext, Undefined|JSFunction>, | ||
| 166 | + slot: Slot<NativeContext, Undefined|Callable>, | ||
| 169 | 167 | promiseOrCapability: JSPromise|PromiseCapability|Undefined, flags: uint32) { | |
| 170 | 168 | if (!IsContextPromiseHookEnabled(flags)) return; | |
| 171 | 169 | const maybeHook = *NativeContextSlot(slot); | |
| 172 | - if (IsUndefined(maybeHook)) return; | ||
| 173 | - | ||
| 174 | - const hook = Cast<JSFunction>(maybeHook) otherwise unreachable; | ||
| 170 | + const hook = Cast<Callable>(maybeHook) otherwise return; | ||
| 175 | 171 | ||
| 176 | 172 | let promise: JSPromise; | |
| 177 | 173 | typeswitch (promiseOrCapability) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,7 +30,8 @@ transitioning builtin | |||
| 30 | 30 | PromiseResolve(implicit context: Context)( | |
| 31 | 31 | constructor: JSReceiver, value: JSAny): JSAny { | |
| 32 | 32 | const nativeContext = LoadNativeContext(context); | |
| 33 | - const promiseFun = *NativeContextSlot(ContextSlot::PROMISE_FUNCTION_INDEX); | ||
| 33 | + const promiseFun = *NativeContextSlot( | ||
| 34 | + nativeContext, ContextSlot::PROMISE_FUNCTION_INDEX); | ||
| 34 | 35 | try { | |
| 35 | 36 | // Check if {value} is a JSPromise. | |
| 36 | 37 | const value = Cast<JSPromise>(value) otherwise NeedToAllocate; | |
@@ -40,7 +41,8 @@ PromiseResolve(implicit context: Context)( | |||
| 40 | 41 | // intact, as that guards the lookup path for "constructor" on | |
| 41 | 42 | // JSPromise instances which have the (initial) Promise.prototype. | |
| 42 | 43 | const promisePrototype = | |
| 43 | - *NativeContextSlot(ContextSlot::PROMISE_PROTOTYPE_INDEX); | ||
| 44 | + *NativeContextSlot( | ||
| 45 | + nativeContext, ContextSlot::PROMISE_PROTOTYPE_INDEX); | ||
| 44 | 46 | // Check that Torque load elimination works. | |
| 45 | 47 | static_assert(nativeContext == LoadNativeContext(context)); | |
| 46 | 48 | if (value.map.prototype != promisePrototype) { | |
@@ -139,18 +141,20 @@ ResolvePromise(implicit context: Context)( | |||
| 139 | 141 | assert(IsJSReceiverMap(resolutionMap)); | |
| 140 | 142 | assert(!IsPromiseThenProtectorCellInvalid()); | |
| 141 | 143 | if (resolutionMap == | |
| 142 | - *NativeContextSlot(ContextSlot::ITERATOR_RESULT_MAP_INDEX)) { | ||
| 144 | + *NativeContextSlot( | ||
| 145 | + nativeContext, ContextSlot::ITERATOR_RESULT_MAP_INDEX)) { | ||
| 143 | 146 | return FulfillPromise(promise, resolution); | |
| 144 | 147 | } else { | |
| 145 | 148 | goto Slow; | |
| 146 | 149 | } | |
| 147 | 150 | } | |
| 148 | 151 | ||
| 149 | 152 | const promisePrototype = | |
| 150 | - *NativeContextSlot(ContextSlot::PROMISE_PROTOTYPE_INDEX); | ||
| 153 | + *NativeContextSlot( | ||
| 154 | + nativeContext, ContextSlot::PROMISE_PROTOTYPE_INDEX); | ||
| 151 | 155 | if (resolutionMap.prototype == promisePrototype) { | |
| 152 | 156 | // The {resolution} is a native Promise in this case. | |
| 153 | - then = *NativeContextSlot(ContextSlot::PROMISE_THEN_INDEX); | ||
| 157 | + then = *NativeContextSlot(nativeContext, ContextSlot::PROMISE_THEN_INDEX); | ||
| 154 | 158 | // Check that Torque load elimination works. | |
| 155 | 159 | static_assert(nativeContext == LoadNativeContext(context)); | |
| 156 | 160 | goto Enqueue; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -124,11 +124,10 @@ extern enum ContextSlot extends intptr constexpr 'Context::Field' { | |||
| 124 | 124 | PROMISE_PROTOTYPE_INDEX: Slot<NativeContext, JSObject>, | |
| 125 | 125 | STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX: Slot<NativeContext, Map>, | |
| 126 | 126 | ||
| 127 | - PROMISE_HOOK_INIT_FUNCTION_INDEX: Slot<NativeContext, Undefined|JSFunction>, | ||
| 128 | - PROMISE_HOOK_BEFORE_FUNCTION_INDEX: Slot<NativeContext, Undefined|JSFunction>, | ||
| 129 | - PROMISE_HOOK_AFTER_FUNCTION_INDEX: Slot<NativeContext, Undefined|JSFunction>, | ||
| 130 | - PROMISE_HOOK_RESOLVE_FUNCTION_INDEX: | ||
| 131 | - Slot<NativeContext, Undefined|JSFunction>, | ||
| 127 | + PROMISE_HOOK_INIT_FUNCTION_INDEX: Slot<NativeContext, Undefined|Callable>, | ||
| 128 | + PROMISE_HOOK_BEFORE_FUNCTION_INDEX: Slot<NativeContext, Undefined|Callable>, | ||
| 129 | + PROMISE_HOOK_AFTER_FUNCTION_INDEX: Slot<NativeContext, Undefined|Callable>, | ||
| 130 | + PROMISE_HOOK_RESOLVE_FUNCTION_INDEX: Slot<NativeContext, Undefined|Callable>, | ||
| 132 | 131 | ||
| 133 | 132 | CONTINUATION_PRESERVED_EMBEDDER_DATA_INDEX: Slot<NativeContext, HeapObject>, | |
| 134 | 133 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -252,3 +252,13 @@ exceptions(); | |||
| 252 | 252 | } | |
| 253 | 253 | __f_16(async () => { await Promise.resolve()}); | |
| 254 | 254 | })(); | |
| 255 | + | ||
| 256 | + (function boundFunction() { | ||
| 257 | + function hook() {}; | ||
| 258 | + const bound = hook.bind(this); | ||
| 259 | + d8.promise.setHooks(bound, bound, bound, bound); | ||
| 260 | + Promise.resolve(); | ||
| 261 | + Promise.reject(); | ||
| 262 | + %PerformMicrotaskCheckpoint(); | ||
| 263 | + d8.promise.setHooks(); | ||
| 264 | + })(); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments