summaryrefslogtreecommitdiff
path: root/ext/ffi
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-11-09 13:57:26 -0700
committerGitHub <noreply@github.com>2023-11-09 13:57:26 -0700
commit9010b8df53cd37f0410e08c43a194667974686a2 (patch)
tree97c13d696ba1216e74b745f5ce1b25ed34afa2cd /ext/ffi
parentc4029f6af22b373bf22383453cb4e2159f3b5b72 (diff)
perf: remove knowledge of promise IDs from deno (#21132)
We can move all promise ID knowledge to deno_core, allowing us to better experiment with promise implementation in deno_core. `{un,}refOpPromise(promise)` is equivalent to `{un,}refOp(promise[promiseIdSymbol])`
Diffstat (limited to 'ext/ffi')
-rw-r--r--ext/ffi/00_ffi.js7
1 files changed, 2 insertions, 5 deletions
diff --git a/ext/ffi/00_ffi.js b/ext/ffi/00_ffi.js
index fe7344e17..233935be9 100644
--- a/ext/ffi/00_ffi.js
+++ b/ext/ffi/00_ffi.js
@@ -32,7 +32,6 @@ const {
SafeMap,
SafeArrayIterator,
SafeWeakMap,
- SymbolFor,
} = primordials;
import { pathFromURL } from "ext:deno_web/00_infra.js";
@@ -52,8 +51,6 @@ function getBufferSourceByteLength(source) {
}
return ArrayBufferPrototypeGetByteLength(source);
}
-const promiseIdSymbol = SymbolFor("Deno.core.internalPromiseId");
-
const U32_BUFFER = new Uint32Array(2);
const U64_BUFFER = new BigUint64Array(TypedArrayPrototypeGetBuffer(U32_BUFFER));
const I64_BUFFER = new BigInt64Array(TypedArrayPrototypeGetBuffer(U32_BUFFER));
@@ -422,7 +419,7 @@ class UnsafeCallback {
if (this.#refcount++ === 0) {
if (this.#refpromise) {
// Re-refing
- core.refOp(this.#refpromise[promiseIdSymbol]);
+ core.refOpPromise(this.#refpromise);
} else {
this.#refpromise = core.opAsync(
"op_ffi_unsafe_callback_ref",
@@ -437,7 +434,7 @@ class UnsafeCallback {
// Only decrement refcount if it is positive, and only
// unref the callback if refcount reaches zero.
if (this.#refcount > 0 && --this.#refcount === 0) {
- core.unrefOp(this.#refpromise[promiseIdSymbol]);
+ core.unrefOpPromise(this.#refpromise);
}
return this.#refcount;
}