summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/broadcast_channel/01_broadcast_channel.js7
-rw-r--r--ext/crypto/00_crypto.js113
-rw-r--r--ext/fetch/22_http_client.js4
-rw-r--r--ext/fetch/26_fetch.js8
-rw-r--r--ext/ffi/00_ffi.js68
-rw-r--r--ext/http/01_http.js6
-rw-r--r--ext/net/01_net.js8
-rw-r--r--ext/net/02_tls.js3
-rw-r--r--ext/node/01_require.js34
-rw-r--r--ext/url/00_url.js16
-rw-r--r--ext/url/01_urlpattern.js9
-rw-r--r--ext/web/00_infra.js5
-rw-r--r--ext/web/02_timers.js5
-rw-r--r--ext/web/05_base64.js5
-rw-r--r--ext/web/08_text_encoding.js11
-rw-r--r--ext/web/09_file.js9
-rw-r--r--ext/web/11_blob_url.js6
-rw-r--r--ext/web/13_message_port.js6
-rw-r--r--ext/web/14_compression.js15
-rw-r--r--ext/webgpu/src/01_webgpu.js232
-rw-r--r--ext/websocket/01_websocket.js4
-rw-r--r--ext/websocket/02_websocketstream.js4
-rw-r--r--ext/webstorage/01_webstorage.js15
23 files changed, 259 insertions, 334 deletions
diff --git a/ext/broadcast_channel/01_broadcast_channel.js b/ext/broadcast_channel/01_broadcast_channel.js
index f3b091709..e14b59779 100644
--- a/ext/broadcast_channel/01_broadcast_channel.js
+++ b/ext/broadcast_channel/01_broadcast_channel.js
@@ -6,6 +6,7 @@
((window) => {
const core = window.Deno.core;
+ const ops = core.ops;
const webidl = window.__bootstrap.webidl;
const { defineEventHandler, setTarget } = window.__bootstrap.event;
const { DOMException } = window.__bootstrap.domException;
@@ -92,7 +93,7 @@
if (rid === null) {
// Create the rid immediately, otherwise there is a time window (and a
// race condition) where messages can get lost, because recv() is async.
- rid = core.opSync("op_broadcast_subscribe");
+ rid = ops.op_broadcast_subscribe();
recv();
}
}
@@ -128,7 +129,9 @@
if (index === -1) return;
ArrayPrototypeSplice(channels, index, 1);
- if (channels.length === 0) core.opSync("op_broadcast_unsubscribe", rid);
+ if (channels.length === 0) {
+ ops.op_broadcast_unsubscribe(rid);
+ }
}
}
diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js
index 2b14a204e..d00f29e7c 100644
--- a/ext/crypto/00_crypto.js
+++ b/ext/crypto/00_crypto.js
@@ -10,6 +10,7 @@
((window) => {
const core = window.Deno.core;
+ const ops = core.ops;
const webidl = window.__bootstrap.webidl;
const { DOMException } = window.__bootstrap.domException;
@@ -1374,7 +1375,7 @@
switch (normalizedAlgorithm.name) {
case "AES-KW": {
- const cipherText = await core.opSync("op_crypto_wrap_key", {
+ const cipherText = await ops.op_crypto_wrap_key({
key: keyData,
algorithm: normalizedAlgorithm.name,
}, bytes);
@@ -1510,7 +1511,7 @@
switch (normalizedAlgorithm.name) {
case "AES-KW": {
- const plainText = await core.opSync("op_crypto_unwrap_key", {
+ const plainText = await ops.op_crypto_unwrap_key({
key: keyData,
algorithm: normalizedAlgorithm.name,
}, wrappedKey);
@@ -1986,7 +1987,7 @@
};
// 3.
- const data = core.opSync("op_crypto_export_key", {
+ const data = ops.op_crypto_export_key({
format: "jwksecret",
algorithm: "AES",
}, innerKey);
@@ -2080,8 +2081,7 @@
}
// 4.
- const { rawData } = core.opSync(
- "op_crypto_import_key",
+ const { rawData } = ops.op_crypto_import_key(
{ algorithm: "AES" },
{ jwkSecret: jwk },
);
@@ -2241,8 +2241,7 @@
}
// 4.
- const { rawData } = core.opSync(
- "op_crypto_import_key",
+ const { rawData } = ops.op_crypto_import_key(
{ algorithm: "HMAC" },
{ jwkSecret: jwk },
);
@@ -2427,7 +2426,7 @@
}
// 3.
- const { rawData } = core.opSync("op_crypto_import_key", {
+ const { rawData } = ops.op_crypto_import_key({
algorithm: normalizedAlgorithm.name,
namedCurve: normalizedAlgorithm.namedCurve,
}, { raw: keyData });
@@ -2468,7 +2467,7 @@
}
// 2-9.
- const { rawData } = core.opSync("op_crypto_import_key", {
+ const { rawData } = ops.op_crypto_import_key({
algorithm: normalizedAlgorithm.name,
namedCurve: normalizedAlgorithm.namedCurve,
}, { pkcs8: keyData });
@@ -2511,7 +2510,7 @@
}
// 2-12
- const { rawData } = core.opSync("op_crypto_import_key", {
+ const { rawData } = ops.op_crypto_import_key({
algorithm: normalizedAlgorithm.name,
namedCurve: normalizedAlgorithm.namedCurve,
}, { spki: keyData });
@@ -2655,7 +2654,7 @@
if (jwk.d !== undefined) {
// it's also a Private key
- const { rawData } = core.opSync("op_crypto_import_key", {
+ const { rawData } = ops.op_crypto_import_key({
algorithm: normalizedAlgorithm.name,
namedCurve: normalizedAlgorithm.namedCurve,
}, { jwkPrivateEc: jwk });
@@ -2678,7 +2677,7 @@
return key;
} else {
- const { rawData } = core.opSync("op_crypto_import_key", {
+ const { rawData } = ops.op_crypto_import_key({
algorithm: normalizedAlgorithm.name,
namedCurve: normalizedAlgorithm.namedCurve,
}, { jwkPublicEc: jwk });
@@ -2759,15 +2758,15 @@
}
// 2-9.
- const { modulusLength, publicExponent, rawData } = core.opSync(
- "op_crypto_import_key",
- {
- algorithm: normalizedAlgorithm.name,
- // Needed to perform step 7 without normalization.
- hash: normalizedAlgorithm.hash.name,
- },
- { pkcs8: keyData },
- );
+ const { modulusLength, publicExponent, rawData } = ops
+ .op_crypto_import_key(
+ {
+ algorithm: normalizedAlgorithm.name,
+ // Needed to perform step 7 without normalization.
+ hash: normalizedAlgorithm.hash.name,
+ },
+ { pkcs8: keyData },
+ );
const handle = {};
WeakMapPrototypeSet(KEY_STORE, handle, rawData);
@@ -2805,15 +2804,15 @@
}
// 2-9.
- const { modulusLength, publicExponent, rawData } = core.opSync(
- "op_crypto_import_key",
- {
- algorithm: normalizedAlgorithm.name,
- // Needed to perform step 7 without normalization.
- hash: normalizedAlgorithm.hash.name,
- },
- { spki: keyData },
- );
+ const { modulusLength, publicExponent, rawData } = ops
+ .op_crypto_import_key(
+ {
+ algorithm: normalizedAlgorithm.name,
+ // Needed to perform step 7 without normalization.
+ hash: normalizedAlgorithm.hash.name,
+ },
+ { spki: keyData },
+ );
const handle = {};
WeakMapPrototypeSet(KEY_STORE, handle, rawData);
@@ -3055,14 +3054,14 @@
);
}
- const { modulusLength, publicExponent, rawData } = core.opSync(
- "op_crypto_import_key",
- {
- algorithm: normalizedAlgorithm.name,
- hash: normalizedAlgorithm.hash.name,
- },
- { jwkPrivateRsa: jwk },
- );
+ const { modulusLength, publicExponent, rawData } = ops
+ .op_crypto_import_key(
+ {
+ algorithm: normalizedAlgorithm.name,
+ hash: normalizedAlgorithm.hash.name,
+ },
+ { jwkPrivateRsa: jwk },
+ );
const handle = {};
WeakMapPrototypeSet(KEY_STORE, handle, rawData);
@@ -3098,14 +3097,14 @@
);
}
- const { modulusLength, publicExponent, rawData } = core.opSync(
- "op_crypto_import_key",
- {
- algorithm: normalizedAlgorithm.name,
- hash: normalizedAlgorithm.hash.name,
- },
- { jwkPublicRsa: jwk },
- );
+ const { modulusLength, publicExponent, rawData } = ops
+ .op_crypto_import_key(
+ {
+ algorithm: normalizedAlgorithm.name,
+ hash: normalizedAlgorithm.hash.name,
+ },
+ { jwkPublicRsa: jwk },
+ );
const handle = {};
WeakMapPrototypeSet(KEY_STORE, handle, rawData);
@@ -3259,7 +3258,7 @@
};
// 3.
- const data = core.opSync("op_crypto_export_key", {
+ const data = ops.op_crypto_export_key({
format: "jwksecret",
algorithm: key[_algorithm].name,
}, innerKey);
@@ -3313,7 +3312,7 @@
}
// 2.
- const data = core.opSync("op_crypto_export_key", {
+ const data = ops.op_crypto_export_key({
algorithm: key[_algorithm].name,
format: "pkcs8",
}, innerKey);
@@ -3331,7 +3330,7 @@
}
// 2.
- const data = core.opSync("op_crypto_export_key", {
+ const data = ops.op_crypto_export_key({
algorithm: key[_algorithm].name,
format: "spki",
}, innerKey);
@@ -3412,7 +3411,7 @@
}
// 5-6.
- const data = core.opSync("op_crypto_export_key", {
+ const data = ops.op_crypto_export_key({
format: key[_type] === "private" ? "jwkprivate" : "jwkpublic",
algorithm: key[_algorithm].name,
}, innerKey);
@@ -3443,7 +3442,7 @@
}
// 2.
- const data = core.opSync("op_crypto_export_key", {
+ const data = ops.op_crypto_export_key({
algorithm: key[_algorithm].name,
namedCurve: key[_algorithm].namedCurve,
format: "raw",
@@ -3461,7 +3460,7 @@
}
// 2.
- const data = core.opSync("op_crypto_export_key", {
+ const data = ops.op_crypto_export_key({
algorithm: key[_algorithm].name,
namedCurve: key[_algorithm].namedCurve,
format: "pkcs8",
@@ -3479,7 +3478,7 @@
}
// 2.
- const data = core.opSync("op_crypto_export_key", {
+ const data = ops.op_crypto_export_key({
algorithm: key[_algorithm].name,
namedCurve: key[_algorithm].namedCurve,
format: "spki",
@@ -3523,7 +3522,7 @@
jwk.alg = algNamedCurve;
// 3.2 - 3.4.
- const data = core.opSync("op_crypto_export_key", {
+ const data = ops.op_crypto_export_key({
format: key[_type] === "private" ? "jwkprivate" : "jwkpublic",
algorithm: key[_algorithm].name,
namedCurve: key[_algorithm].namedCurve,
@@ -3550,7 +3549,7 @@
jwk.crv = key[_algorithm].namedCurve;
// 3.2 - 3.4
- const data = core.opSync("op_crypto_export_key", {
+ const data = ops.op_crypto_export_key({
format: key[_type] === "private" ? "jwkprivate" : "jwkpublic",
algorithm: key[_algorithm].name,
namedCurve: key[_algorithm].namedCurve,
@@ -3925,13 +3924,13 @@
arrayBufferView.byteOffset,
arrayBufferView.byteLength,
);
- core.opSync("op_crypto_get_random_values", ui8);
+ ops.op_crypto_get_random_values(ui8);
return arrayBufferView;
}
randomUUID() {
webidl.assertBranded(this, CryptoPrototype);
- return core.opSync("op_crypto_random_uuid");
+ return ops.op_crypto_random_uuid();
}
get subtle() {
diff --git a/ext/fetch/22_http_client.js b/ext/fetch/22_http_client.js
index f0c2394c3..d096b08ca 100644
--- a/ext/fetch/22_http_client.js
+++ b/ext/fetch/22_http_client.js
@@ -13,6 +13,7 @@
((window) => {
const core = window.Deno.core;
+ const ops = core.ops;
/**
* @param {Deno.CreateHttpClientOptions} options
@@ -21,8 +22,7 @@
function createHttpClient(options) {
options.caCerts ??= [];
return new HttpClient(
- core.opSync(
- "op_fetch_custom_client",
+ ops.op_fetch_custom_client(
options,
),
);
diff --git a/ext/fetch/26_fetch.js b/ext/fetch/26_fetch.js
index 9a4916e21..a069583a7 100644
--- a/ext/fetch/26_fetch.js
+++ b/ext/fetch/26_fetch.js
@@ -13,6 +13,7 @@
((window) => {
const core = window.Deno.core;
+ const ops = core.ops;
const webidl = window.__bootstrap.webidl;
const { byteLowerCase } = window.__bootstrap.infra;
const { BlobPrototype } = window.__bootstrap.file;
@@ -68,8 +69,7 @@
* @returns {{ requestRid: number, requestBodyRid: number | null }}
*/
function opFetch(method, url, headers, clientRid, hasBody, bodyLength, body) {
- return core.opSync(
- "op_fetch",
+ return ops.op_fetch(
method,
url,
headers,
@@ -560,7 +560,7 @@
}
// Pass the resolved URL to v8.
- core.opSync("op_wasm_streaming_set_url", rid, res.url);
+ ops.op_wasm_streaming_set_url(rid, res.url);
if (res.body !== null) {
// 2.6.
@@ -571,7 +571,7 @@
while (true) {
const { value: chunk, done } = await reader.read();
if (done) break;
- core.opSync("op_wasm_streaming_feed", rid, chunk);
+ ops.op_wasm_streaming_feed(rid, chunk);
}
})().then(
// 2.7
diff --git a/ext/ffi/00_ffi.js b/ext/ffi/00_ffi.js
index 7ba5aadc0..ca9cb3474 100644
--- a/ext/ffi/00_ffi.js
+++ b/ext/ffi/00_ffi.js
@@ -3,6 +3,7 @@
((window) => {
const core = window.Deno.core;
+ const ops = core.ops;
const __bootstrap = window.__bootstrap;
const {
BigInt,
@@ -45,108 +46,93 @@
}
getUint8(offset = 0) {
- return core.opSync(
- "op_ffi_read_u8",
+ return ops.op_ffi_read_u8(
offset ? BigInt(this.pointer) + BigInt(offset) : this.pointer,
);
}
getInt8(offset = 0) {
- return core.opSync(
- "op_ffi_read_i8",
+ return ops.op_ffi_read_i8(
offset ? BigInt(this.pointer) + BigInt(offset) : this.pointer,
);
}
getUint16(offset = 0) {
- return core.opSync(
- "op_ffi_read_u16",
+ return ops.op_ffi_read_u16(
offset ? BigInt(this.pointer) + BigInt(offset) : this.pointer,
);
}
getInt16(offset = 0) {
- return core.opSync(
- "op_ffi_read_i16",
+ return ops.op_ffi_read_i16(
offset ? BigInt(this.pointer) + BigInt(offset) : this.pointer,
);
}
getUint32(offset = 0) {
- return core.opSync(
- "op_ffi_read_u32",
+ return ops.op_ffi_read_u32(
offset ? BigInt(this.pointer) + BigInt(offset) : this.pointer,
);
}
getInt32(offset = 0) {
- return core.opSync(
- "op_ffi_read_i32",
+ return ops.op_ffi_read_i32(
offset ? BigInt(this.pointer) + BigInt(offset) : this.pointer,
);
}
getBigUint64(offset = 0) {
- return core.opSync(
- "op_ffi_read_u64",
+ return ops.op_ffi_read_u64(
offset ? BigInt(this.pointer) + BigInt(offset) : this.pointer,
);
}
getBigInt64(offset = 0) {
- return core.opSync(
- "op_ffi_read_i64",
+ return ops.op_ffi_read_i64(
offset ? BigInt(this.pointer) + BigInt(offset) : this.pointer,
);
}
getFloat32(offset = 0) {
- return core.opSync(
- "op_ffi_read_f32",
+ return ops.op_ffi_read_f32(
offset ? BigInt(this.pointer) + BigInt(offset) : this.pointer,
);
}
getFloat64(offset = 0) {
- return core.opSync(
- "op_ffi_read_f64",
+ return ops.op_ffi_read_f64(
offset ? BigInt(this.pointer) + BigInt(offset) : this.pointer,
);
}
getCString(offset = 0) {
- return core.opSync(
- "op_ffi_cstr_read",
+ return ops.op_ffi_cstr_read(
offset ? BigInt(this.pointer) + BigInt(offset) : this.pointer,
);
}
static getCString(pointer, offset = 0) {
- return core.opSync(
- "op_ffi_cstr_read",
+ return ops.op_ffi_cstr_read(
offset ? BigInt(pointer) + BigInt(offset) : pointer,
);
}
getArrayBuffer(byteLength, offset = 0) {
- return core.opSync(
- "op_ffi_get_buf",
+ return ops.op_ffi_get_buf(
offset ? BigInt(this.pointer) + BigInt(offset) : this.pointer,
byteLength,
);
}
static getArrayBuffer(pointer, byteLength, offset = 0) {
- return core.opSync(
- "op_ffi_get_buf",
+ return ops.op_ffi_get_buf(
offset ? BigInt(pointer) + BigInt(offset) : pointer,
byteLength,
);
}
copyInto(destination, offset = 0) {
- core.opSync(
- "op_ffi_buf_copy_into",
+ ops.op_ffi_buf_copy_into(
offset ? BigInt(this.pointer) + BigInt(offset) : this.pointer,
destination,
destination.byteLength,
@@ -154,8 +140,7 @@
}
static copyInto(pointer, destination, offset = 0) {
- core.opSync(
- "op_ffi_buf_copy_into",
+ ops.op_ffi_buf_copy_into(
offset ? BigInt(pointer) + BigInt(offset) : pointer,
destination,
destination.byteLength,
@@ -168,7 +153,7 @@
if (ObjectPrototypeIsPrototypeOf(UnsafeCallbackPrototype, value)) {
return value.pointer;
}
- return core.opSync("op_ffi_ptr_of", value);
+ return ops.op_ffi_ptr_of(value);
}
}
@@ -221,8 +206,7 @@
return promise;
} else {
- return core.opSync(
- "op_ffi_call_ptr",
+ return ops.op_ffi_call_ptr(
this.pointer,
this.definition,
parameters,
@@ -258,8 +242,7 @@
"Invalid UnsafeCallback, cannot be nonblocking",
);
}
- const [rid, pointer] = core.opSync(
- "op_ffi_unsafe_callback_create",
+ const [rid, pointer] = ops.op_ffi_unsafe_callback_create(
definition,
callback,
);
@@ -272,7 +255,7 @@
ref() {
if (this.#refcount++ === 0) {
- core.opSync("op_ffi_unsafe_callback_ref", true);
+ ops.op_ffi_unsafe_callback_ref(true);
}
}
@@ -280,14 +263,14 @@
// Only decrement refcount if it is positive, and only
// unref the callback if refcount reaches zero.
if (this.#refcount > 0 && --this.#refcount === 0) {
- core.opSync("op_ffi_unsafe_callback_ref", false);
+ ops.op_ffi_unsafe_callback_ref(false);
}
}
close() {
if (this.#refcount) {
this.#refcount = 0;
- core.opSync("op_ffi_unsafe_callback_ref", false);
+ ops.op_ffi_unsafe_callback_ref(false);
}
core.close(this.#rid);
}
@@ -300,7 +283,7 @@
symbols = {};
constructor(path, symbols) {
- [this.#rid, this.symbols] = core.opSync("op_ffi_load", { path, symbols });
+ [this.#rid, this.symbols] = ops.op_ffi_load({ path, symbols });
for (const symbol in symbols) {
if ("type" in symbols[symbol]) {
const type = symbols[symbol].type;
@@ -311,8 +294,7 @@
}
const name = symbols[symbol].name || symbol;
- const value = core.opSync(
- "op_ffi_get_static",
+ const value = ops.op_ffi_get_static(
this.#rid,
name,
type,
diff --git a/ext/http/01_http.js b/ext/http/01_http.js
index 332763451..34457ab0b 100644
--- a/ext/http/01_http.js
+++ b/ext/http/01_http.js
@@ -15,7 +15,7 @@
fromInnerResponse,
} = window.__bootstrap.fetch;
const core = window.Deno.core;
- const { BadResourcePrototype, InterruptedPrototype } = core;
+ const { BadResourcePrototype, InterruptedPrototype, ops } = core;
const { ReadableStream, ReadableStreamPrototype } =
window.__bootstrap.streams;
const abortSignal = window.__bootstrap.abortSignal;
@@ -126,7 +126,7 @@
const innerRequest = newInnerRequest(
method,
url,
- () => core.opSync("op_http_headers", streamRid),
+ () => ops.op_http_headers(streamRid),
body !== null ? new InnerBody(body) : null,
false,
);
@@ -438,7 +438,7 @@
);
}
- const accept = core.opSync("op_http_websocket_accept_header", websocketKey);
+ const accept = ops.op_http_websocket_accept_header(websocketKey);
const r = newInnerResponse(101);
r.headerList = [
diff --git a/ext/net/01_net.js b/ext/net/01_net.js
index fde75fe56..2c7ec0f47 100644
--- a/ext/net/01_net.js
+++ b/ext/net/01_net.js
@@ -3,7 +3,7 @@
((window) => {
const core = window.Deno.core;
- const { BadResourcePrototype, InterruptedPrototype } = core;
+ const { BadResourcePrototype, InterruptedPrototype, ops } = core;
const { WritableStream, readableStreamForRid } = window.__bootstrap.streams;
const {
Error,
@@ -42,7 +42,7 @@
}
function opListen(args) {
- return core.opSync("op_net_listen", args);
+ return ops.op_net_listen(args);
}
function opConnect(args) {
@@ -157,11 +157,11 @@
class TcpConn extends Conn {
setNoDelay(nodelay = true) {
- return core.opSync("op_set_nodelay", this.rid, nodelay);
+ return ops.op_set_nodelay(this.rid, nodelay);
}
setKeepAlive(keepalive = true) {
- return core.opSync("op_set_keepalive", this.rid, keepalive);
+ return ops.op_set_keepalive(this.rid, keepalive);
}
}
diff --git a/ext/net/02_tls.js b/ext/net/02_tls.js
index 86f651521..04b25caf9 100644
--- a/ext/net/02_tls.js
+++ b/ext/net/02_tls.js
@@ -3,6 +3,7 @@
((window) => {
const core = window.Deno.core;
+ const ops = core.ops;
const { Listener, Conn } = window.__bootstrap.net;
function opConnectTls(
@@ -16,7 +17,7 @@
}
function opListenTls(args) {
- return core.opSync("op_tls_listen", args);
+ return ops.op_tls_listen(args);
}
function opStartTls(args) {
diff --git a/ext/node/01_require.js b/ext/node/01_require.js
index 7b89e9dc3..ccccb8578 100644
--- a/ext/node/01_require.js
+++ b/ext/node/01_require.js
@@ -31,16 +31,17 @@
RegExpPrototypeTest,
} = window.__bootstrap.primordials;
const core = window.Deno.core;
+ const ops = core.ops;
// Map used to store CJS parsing data.
const cjsParseCache = new SafeWeakMap();
function pathDirname(filepath) {
- return core.opSync("op_require_path_dirname", filepath);
+ return ops.op_require_path_dirname(filepath);
}
function pathResolve(...args) {
- return core.opSync("op_require_path_resolve", args);
+ return ops.op_require_path_resolve(args);
}
function assert(cond) {
@@ -76,7 +77,7 @@
return result;
}
}
- const result = core.opSync("op_require_stat", filename);
+ const result = ops.op_require_stat(filename);
if (statCache !== null && result >= 0) {
statCache.set(filename, result);
}
@@ -162,7 +163,7 @@
if (maybeCached) {
return maybeCached;
}
- const rp = core.opSync("op_require_real_path", requestPath);
+ const rp = ops.op_require_real_path(requestPath);
realpathCache.set(requestPath, rp);
return rp;
}
@@ -181,7 +182,7 @@
// Find the longest (possibly multi-dot) extension registered in
// Module._extensions
function findLongestRegisteredExtension(filename) {
- const name = core.opSync("op_require_path_basename", filename);
+ const name = ops.op_require_path_basename(filename);
let currentExtension;
let index;
let startIndex = 0;
@@ -269,7 +270,7 @@
const CHAR_FORWARD_SLASH = 47;
const TRAILING_SLASH_REGEX = /(?:^|\/)\.?\.$/;
Module._findPath = function (request, paths, isMain) {
- const absoluteRequest = core.opSync("op_require_path_is_absolute", request);
+ const absoluteRequest = ops.op_require_path_is_absolute(request);
if (absoluteRequest) {
paths = [""];
} else if (!paths || paths.length === 0) {
@@ -346,12 +347,11 @@
};
Module._nodeModulePaths = function (from) {
- return core.opSync("op_require_node_module_paths", from);
+ return ops.op_require_node_module_paths(from);
};
Module._resolveLookupPaths = function (request, parent) {
- return core.opSync(
- "op_require_resolve_lookup_paths",
+ return ops.op_require_resolve_lookup_paths(
request,
parent?.paths,
parent?.filename ?? "",
@@ -475,8 +475,7 @@
if (typeof options === "object" && options !== null) {
if (ArrayIsArray(options.paths)) {
- const isRelative = core.opSync(
- "op_require_is_request_relative",
+ const isRelative = ops.op_require_is_request_relative(
request,
);
@@ -537,13 +536,12 @@
// Try module self resolution first
// TODO(bartlomieju): make into a single op
- const parentPath = core.opSync(
- "op_require_try_self_parent_path",
+ const parentPath = ops.op_require_try_self_parent_path(
!!parent,
parent?.filename,
parent?.id,
);
- // const selfResolved = core.opSync("op_require_try_self", parentPath, request);
+ // const selfResolved = ops.op_require_try_self(parentPath, request);
const selfResolved = false;
if (selfResolved) {
const cacheKey = request + "\x00" +
@@ -666,7 +664,7 @@
};
Module._extensions[".js"] = function (module, filename) {
- const content = core.opSync("op_require_read_file", filename);
+ const content = ops.op_require_read_file(filename);
console.log(`TODO: Module._extensions[".js"] is ESM`);
@@ -682,7 +680,7 @@
// Native extension for .json
Module._extensions[".json"] = function (module, filename) {
- const content = core.opSync("op_require_read_file", filename);
+ const content = ops.op_require_read_file(filename);
try {
module.exports = JSONParse(stripBOM(content));
@@ -698,7 +696,7 @@
};
function createRequireFromPath(filename) {
- const proxyPath = core.opSync("op_require_proxy_path", filename);
+ const proxyPath = ops.op_require_proxy_path(filename);
const mod = new Module(proxyPath);
mod.filename = proxyPath;
mod.paths = Module._nodeModulePaths(mod.path);
@@ -737,7 +735,7 @@
Module.createRequire = createRequire;
Module._initPaths = function () {
- const paths = core.opSync("op_require_init_paths");
+ const paths = ops.op_require_init_paths();
modulePaths = paths;
Module.globalPaths = ArrayPrototypeSlice(modulePaths);
};
diff --git a/ext/url/00_url.js b/ext/url/00_url.js
index 06630a2d0..ab87e85e0 100644
--- a/ext/url/00_url.js
+++ b/ext/url/00_url.js
@@ -9,6 +9,7 @@
((window) => {
const core = window.Deno.core;
+ const ops = core.ops;
const webidl = window.__bootstrap.webidl;
const {
ArrayIsArray,
@@ -43,10 +44,12 @@
// Helper functions
function opUrlReparse(href, setter, value) {
- return _urlParts(core.opSync("op_url_reparse", href, [setter, value]));
+ return _urlParts(
+ ops.op_url_reparse(href, [setter, value]),
+ );
}
function opUrlParse(href, maybeBase) {
- return _urlParts(core.opSync("op_url_parse", href, maybeBase));
+ return _urlParts(ops.op_url_parse(href, maybeBase));
}
function _urlParts(internalParts) {
// WARNING: must match UrlParts serialization rust's url_result()
@@ -101,7 +104,7 @@
if (init[0] == "?") {
init = StringPrototypeSlice(init, 1);
}
- this[_list] = core.opSync("op_url_parse_search_params", init);
+ this[_list] = ops.op_url_parse_search_params(init);
} else if (ArrayIsArray(init)) {
// Overload: sequence<sequence<USVString>>
this[_list] = ArrayPrototypeMap(init, (pair, i) => {
@@ -291,7 +294,7 @@
*/
toString() {
webidl.assertBranded(this, URLSearchParamsPrototype);
- return core.opSync("op_url_stringify_search_params", this[_list]);
+ return ops.op_url_stringify_search_params(this[_list]);
}
}
@@ -348,8 +351,7 @@
#updateSearchParams() {
if (this.#queryObject !== null) {
const params = this.#queryObject[_list];
- const newParams = core.opSync(
- "op_url_parse_search_params",
+ const newParams = ops.op_url_parse_search_params(
StringPrototypeSlice(this.search, 1),
);
ArrayPrototypeSplice(
@@ -617,7 +619,7 @@
* @returns {[string, string][]}
*/
function parseUrlEncoded(bytes) {
- return core.opSync("op_url_parse_search_params", null, bytes);
+ return ops.op_url_parse_search_params(null, bytes);
}
webidl
diff --git a/ext/url/01_urlpattern.js b/ext/url/01_urlpattern.js
index 51968e68a..ac18a4c82 100644
--- a/ext/url/01_urlpattern.js
+++ b/ext/url/01_urlpattern.js
@@ -11,6 +11,7 @@
((window) => {
const core = window.Deno.core;
+ const ops = core.ops;
const webidl = window.__bootstrap.webidl;
const {
ArrayPrototypeMap,
@@ -68,7 +69,7 @@
});
}
- const components = core.opSync("op_urlpattern_parse", input, baseURL);
+ const components = ops.op_urlpattern_parse(input, baseURL);
for (const key of ObjectKeys(components)) {
try {
@@ -144,8 +145,7 @@
});
}
- const res = core.opSync(
- "op_urlpattern_process_match_input",
+ const res = ops.op_urlpattern_process_match_input(
input,
baseURL,
);
@@ -184,8 +184,7 @@
});
}
- const res = core.opSync(
- "op_urlpattern_process_match_input",
+ const res = ops.op_urlpattern_process_match_input(
input,
baseURL,
);
diff --git a/ext/web/00_infra.js b/ext/web/00_infra.js
index bf931f8c7..9a9db5c22 100644
--- a/ext/web/00_infra.js
+++ b/ext/web/00_infra.js
@@ -10,6 +10,7 @@
((window) => {
const core = Deno.core;
+ const ops = core.ops;
const {
ArrayPrototypeJoin,
ArrayPrototypeMap,
@@ -239,7 +240,7 @@
* @returns {string}
*/
function forgivingBase64Encode(data) {
- return core.opSync("op_base64_encode", data);
+ return ops.op_base64_encode(data);
}
/**
@@ -247,7 +248,7 @@
* @returns {Uint8Array}
*/
function forgivingBase64Decode(data) {
- return core.opSync("op_base64_decode", data);
+ return ops.op_base64_decode(data);
}
/**
diff --git a/ext/web/02_timers.js b/ext/web/02_timers.js
index a4ce33a18..07b9587ea 100644
--- a/ext/web/02_timers.js
+++ b/ext/web/02_timers.js
@@ -3,6 +3,7 @@
((window) => {
const core = window.Deno.core;
+ const ops = core.ops;
const {
ArrayPrototypePush,
ArrayPrototypeShift,
@@ -25,7 +26,7 @@
const { assert } = window.__bootstrap.infra;
function opNow() {
- return core.opSync("op_now");
+ return ops.op_now();
}
// ---------------------------------------------------------------------------
@@ -103,7 +104,7 @@
// TODO(@andreubotella): Deal with overflow.
// https://github.com/whatwg/html/issues/7358
id = nextId++;
- const cancelRid = core.opSync("op_timer_handle");
+ const cancelRid = ops.op_timer_handle();
timerInfo = { cancelRid, isRef: true, promiseId: -1 };
// Step 4 in "run steps after a timeout".
diff --git a/ext/web/05_base64.js b/ext/web/05_base64.js
index 8238831f8..89c409ae2 100644
--- a/ext/web/05_base64.js
+++ b/ext/web/05_base64.js
@@ -10,6 +10,7 @@
((window) => {
const core = Deno.core;
+ const ops = core.ops;
const webidl = window.__bootstrap.webidl;
const { DOMException } = window.__bootstrap.domException;
const { TypeError } = window.__bootstrap.primordials;
@@ -26,7 +27,7 @@
context: "Argument 1",
});
try {
- return core.opSync("op_base64_atob", data);
+ return ops.op_base64_atob(data);
} catch (e) {
if (e instanceof TypeError) {
throw new DOMException(
@@ -50,7 +51,7 @@
context: "Argument 1",
});
try {
- return core.opSync("op_base64_btoa", data);
+ return ops.op_base64_btoa(data);
} catch (e) {
if (e instanceof TypeError) {
throw new DOMException(
diff --git a/ext/web/08_text_encoding.js b/ext/web/08_text_encoding.js
index 282618da3..44087b1de 100644
--- a/ext/web/08_text_encoding.js
+++ b/ext/web/08_text_encoding.js
@@ -13,6 +13,7 @@
((window) => {
const core = Deno.core;
+ const ops = core.ops;
const webidl = window.__bootstrap.webidl;
const {
ArrayBufferIsView,
@@ -51,7 +52,7 @@
prefix,
context: "Argument 2",
});
- const encoding = core.opSync("op_encoding_normalize_label", label);
+ const encoding = ops.op_encoding_normalize_label(label);
this.#encoding = encoding;
this.#fatal = options.fatal;
this.#ignoreBOM = options.ignoreBOM;
@@ -124,7 +125,7 @@
}
if (!options.stream && this.#rid === null) {
- return core.opSync("op_encoding_decode_single", input, {
+ return ops.op_encoding_decode_single(input, {
label: this.#encoding,
fatal: this.#fatal,
ignoreBom: this.#ignoreBOM,
@@ -132,13 +133,13 @@
}
if (this.#rid === null) {
- this.#rid = core.opSync("op_encoding_new_decoder", {
+ this.#rid = ops.op_encoding_new_decoder({
label: this.#encoding,
fatal: this.#fatal,
ignoreBom: this.#ignoreBOM,
});
}
- return core.opSync("op_encoding_decode", input, {
+ return ops.op_encoding_decode(input, {
rid: this.#rid,
stream: options.stream,
});
@@ -200,7 +201,7 @@
context: "Argument 2",
allowShared: true,
});
- return core.opSync("op_encoding_encode_into", source, destination);
+ return ops.op_encoding_encode_into(source, destination);
}
}
diff --git a/ext/web/09_file.js b/ext/web/09_file.js
index 50cce9004..d01858c92 100644
--- a/ext/web/09_file.js
+++ b/ext/web/09_file.js
@@ -13,6 +13,7 @@
((window) => {
const core = window.Deno.core;
+ const ops = core.ops;
const webidl = window.__bootstrap.webidl;
const {
ArrayBufferPrototype,
@@ -505,7 +506,7 @@
// A finalization registry to deallocate a blob part when its JS reference is
// garbage collected.
const registry = new FinalizationRegistry((uuid) => {
- core.opSync("op_blob_remove_part", uuid);
+ ops.op_blob_remove_part(uuid);
});
// TODO(lucacasonato): get a better stream from Rust in BlobReference#stream
@@ -533,7 +534,7 @@
* @returns {BlobReference}
*/
static fromUint8Array(data) {
- const id = core.opSync("op_blob_create_part", data);
+ const id = ops.op_blob_create_part(data);
return new BlobReference(id, data.byteLength);
}
@@ -548,7 +549,7 @@
*/
slice(start, end) {
const size = end - start;
- const id = core.opSync("op_blob_slice_part", this._id, {
+ const id = ops.op_blob_slice_part(this._id, {
start,
len: size,
});
@@ -588,7 +589,7 @@
* @returns {Blob | null}
*/
function blobFromObjectUrl(url) {
- const blobData = core.opSync("op_blob_from_object_url", url);
+ const blobData = ops.op_blob_from_object_url(url);
if (blobData === null) {
return null;
}
diff --git a/ext/web/11_blob_url.js b/ext/web/11_blob_url.js
index cd9d0929e..9a705f391 100644
--- a/ext/web/11_blob_url.js
+++ b/ext/web/11_blob_url.js
@@ -14,6 +14,7 @@
((window) => {
const core = Deno.core;
+ const ops = core.ops;
const webidl = window.__bootstrap.webidl;
const { getParts } = window.__bootstrap.file;
const { URL } = window.__bootstrap.url;
@@ -30,8 +31,7 @@
prefix,
});
- const url = core.opSync(
- "op_blob_create_object_url",
+ const url = ops.op_blob_create_object_url(
blob.type,
getParts(blob),
);
@@ -51,7 +51,7 @@
prefix,
});
- core.opSync("op_blob_revoke_object_url", url);
+ ops.op_blob_revoke_object_url(url);
}
URL.createObjectURL = createObjectURL;
diff --git a/ext/web/13_message_port.js b/ext/web/13_message_port.js
index 19aa0a93b..1fbeeaff7 100644
--- a/ext/web/13_message_port.js
+++ b/ext/web/13_message_port.js
@@ -10,7 +10,7 @@
((window) => {
const core = window.Deno.core;
- const { InterruptedPrototype } = core;
+ const { InterruptedPrototype, ops } = core;
const webidl = window.__bootstrap.webidl;
const { setEventTargetData } = window.__bootstrap.eventTarget;
const { defineEventHandler } = window.__bootstrap.event;
@@ -128,7 +128,7 @@
}
const data = serializeJsMessageData(message, transfer);
if (this[_id] === null) return;
- core.opSync("op_message_port_post_message", this[_id], data);
+ ops.op_message_port_post_message(this[_id], data);
}
start() {
@@ -193,7 +193,7 @@
* @returns {[number, number]}
*/
function opCreateEntangledMessagePort() {
- return core.opSync("op_message_port_create_entangled");
+ return ops.op_message_port_create_entangled();
}
/**
diff --git a/ext/web/14_compression.js b/ext/web/14_compression.js
index a96a7ce43..c56954c74 100644
--- a/ext/web/14_compression.js
+++ b/ext/web/14_compression.js
@@ -9,6 +9,7 @@
((window) => {
const core = window.Deno.core;
+ const ops = core.ops;
const webidl = window.__bootstrap.webidl;
const { TransformStream } = window.__bootstrap.streams;
@@ -32,7 +33,7 @@
context: "Argument 1",
});
- const rid = core.opSync("op_compression_new", format, false);
+ const rid = ops.op_compression_new(format, false);
this.#transform = new TransformStream({
transform(chunk, controller) {
@@ -40,15 +41,14 @@
prefix,
context: "chunk",
});
- const output = core.opSync(
- "op_compression_write",
+ const output = ops.op_compression_write(
rid,
chunk,
);
maybeEnqueue(controller, output);
},
flush(controller) {
- const output = core.opSync("op_compression_finish", rid);
+ const output = ops.op_compression_finish(rid);
maybeEnqueue(controller, output);
},
});
@@ -81,7 +81,7 @@
context: "Argument 1",
});
- const rid = core.opSync("op_compression_new", format, true);
+ const rid = ops.op_compression_new(format, true);
this.#transform = new TransformStream({
transform(chunk, controller) {
@@ -89,15 +89,14 @@
prefix,
context: "chunk",
});
- const output = core.opSync(
- "op_compression_write",
+ const output = ops.op_compression_write(
rid,
chunk,
);
maybeEnqueue(controller, output);
},
flush(controller) {
- const output = core.opSync("op_compression_finish", rid);
+ const output = ops.op_compression_finish(rid);
maybeEnqueue(controller, output);
},
});
diff --git a/ext/webgpu/src/01_webgpu.js b/ext/webgpu/src/01_webgpu.js
index 79d1f497c..9b8c7eb50 100644
--- a/ext/webgpu/src/01_webgpu.js
+++ b/ext/webgpu/src/01_webgpu.js
@@ -10,6 +10,7 @@
((window) => {
const core = window.Deno.core;
+ const ops = core.ops;
const webidl = window.__bootstrap.webidl;
const eventTarget = window.__bootstrap.eventTarget;
const { DOMException } = window.__bootstrap.domException;
@@ -940,8 +941,7 @@
context: "Argument 1",
});
const device = assertDevice(this, { prefix, context: "this" });
- const { rid, err } = core.opSync(
- "op_webgpu_create_buffer",
+ const { rid, err } = ops.op_webgpu_create_buffer(
device.rid,
descriptor.label,
descriptor.size,
@@ -991,7 +991,7 @@
context: "Argument 1",
});
const device = assertDevice(this, { prefix, context: "this" });
- const { rid, err } = core.opSync("op_webgpu_create_texture", {
+ const { rid, err } = ops.op_webgpu_create_texture({
deviceRid: device.rid,
...descriptor,
size: normalizeGPUExtent3D(descriptor.size),
@@ -1019,7 +1019,7 @@
context: "Argument 1",
});
const device = assertDevice(this, { prefix, context: "this" });
- const { rid, err } = core.opSync("op_webgpu_create_sampler", {
+ const { rid, err } = ops.op_webgpu_create_sampler({
deviceRid: device.rid,
...descriptor,
});
@@ -1059,8 +1059,7 @@
}
}
- const { rid, err } = core.opSync(
- "op_webgpu_create_bind_group_layout",
+ const { rid, err } = ops.op_webgpu_create_bind_group_layout(
device.rid,
descriptor.label,
descriptor.entries,
@@ -1102,8 +1101,7 @@
return rid;
},
);
- const { rid, err } = core.opSync(
- "op_webgpu_create_pipeline_layout",
+ const { rid, err } = ops.op_webgpu_create_pipeline_layout(
device.rid,
descriptor.label,
bindGroupLayouts,
@@ -1197,8 +1195,7 @@
}
});
- const { rid, err } = core.opSync(
- "op_webgpu_create_bind_group",
+ const { rid, err } = ops.op_webgpu_create_bind_group(
device.rid,
descriptor.label,
layout,
@@ -1227,8 +1224,7 @@
context: "Argument 1",
});
const device = assertDevice(this, { prefix, context: "this" });
- const { rid, err } = core.opSync(
- "op_webgpu_create_shader_module",
+ const { rid, err } = ops.op_webgpu_create_shader_module(
device.rid,
descriptor.label,
descriptor.code,
@@ -1278,8 +1274,7 @@
selfContext: "this",
});
- const { rid, err } = core.opSync(
- "op_webgpu_create_compute_pipeline",
+ const { rid, err } = ops.op_webgpu_create_compute_pipeline(
device.rid,
descriptor.label,
layout,
@@ -1350,7 +1345,7 @@
};
}
- const { rid, err } = core.opSync("op_webgpu_create_render_pipeline", {
+ const { rid, err } = ops.op_webgpu_create_render_pipeline({
deviceRid: device.rid,
label: descriptor.label,
layout,
@@ -1397,8 +1392,7 @@
context: "Argument 1",
});
const device = assertDevice(this, { prefix, context: "this" });
- const { rid, err } = core.opSync(
- "op_webgpu_create_command_encoder",
+ const { rid, err } = ops.op_webgpu_create_command_encoder(
device.rid,
descriptor.label,
);
@@ -1430,8 +1424,7 @@
},
);
const device = assertDevice(this, { prefix, context: "this" });
- const { rid, err } = core.opSync(
- "op_webgpu_create_render_bundle_encoder",
+ const { rid, err } = ops.op_webgpu_create_render_bundle_encoder(
{
deviceRid: device.rid,
...descriptor,
@@ -1464,7 +1457,7 @@
},
);
const device = assertDevice(this, { prefix, context: "this" });
- const { rid, err } = core.opSync("op_webgpu_create_query_set", {
+ const { rid, err } = ops.op_webgpu_create_query_set({
deviceRid: device.rid,
...descriptor,
});
@@ -1595,8 +1588,7 @@
return rid;
},
);
- const { err } = core.opSync(
- "op_webgpu_queue_submit",
+ const { err } = ops.op_webgpu_queue_submit(
device.rid,
commandBufferRids,
);
@@ -1654,8 +1646,7 @@
selfContext: "this",
resourceContext: "Argument 1",
});
- const { err } = core.opSync(
- "op_webgpu_write_buffer",
+ const { err } = ops.op_webgpu_write_buffer(
device.rid,
bufferRid,
bufferOffset,
@@ -1702,8 +1693,7 @@
selfContext: "this",
resourceContext: "texture",
});
- const { err } = core.opSync(
- "op_webgpu_write_texture",
+ const { err } = ops.op_webgpu_write_texture(
device.rid,
{
texture: textureRid,
@@ -1960,8 +1950,7 @@
}
const buffer = new ArrayBuffer(rangeSize);
- const { rid } = core.opSync(
- "op_webgpu_buffer_get_mapped_range",
+ const { rid } = ops.op_webgpu_buffer_get_mapped_range(
bufferRid,
offset,
size,
@@ -2015,8 +2004,7 @@
throw new DOMException(`${prefix}: invalid state.`, "OperationError");
}
for (const [buffer, mappedRid] of mappedRanges) {
- const { err } = core.opSync(
- "op_webgpu_buffer_unmap",
+ const { err } = ops.op_webgpu_buffer_unmap(
bufferRid,
mappedRid,
...new SafeArrayIterator(write ? [new Uint8Array(buffer)] : []),
@@ -2153,7 +2141,7 @@
});
const device = assertDevice(this, { prefix, context: "this" });
const textureRid = assertResource(this, { prefix, context: "this" });
- const { rid, err } = core.opSync("op_webgpu_create_texture_view", {
+ const { rid, err } = ops.op_webgpu_create_texture_view({
textureRid,
...descriptor,
});
@@ -2536,11 +2524,11 @@
prefix,
context: "this",
});
- const { rid, label, err } = core.opSync(
- "op_webgpu_compute_pipeline_get_bind_group_layout",
- computePipelineRid,
- index,
- );
+ const { rid, label, err } = ops
+ .op_webgpu_compute_pipeline_get_bind_group_layout(
+ computePipelineRid,
+ index,
+ );
device.pushError(err);
const bindGroupLayout = createGPUBindGroupLayout(
@@ -2613,11 +2601,11 @@
prefix,
context: "this",
});
- const { rid, label, err } = core.opSync(
- "op_webgpu_render_pipeline_get_bind_group_layout",
- renderPipelineRid,
- index,
- );
+ const { rid, label, err } = ops
+ .op_webgpu_render_pipeline_get_bind_group_layout(
+ renderPipelineRid,
+ index,
+ );
device.pushError(err);
const bindGroupLayout = createGPUBindGroupLayout(
@@ -2807,8 +2795,7 @@
},
);
- const { rid } = core.opSync(
- "op_webgpu_command_encoder_begin_render_pass",
+ const { rid } = ops.op_webgpu_command_encoder_begin_render_pass(
commandEncoderRid,
descriptor.label,
colorAttachments,
@@ -2842,8 +2829,7 @@
context: "this",
});
- const { rid } = core.opSync(
- "op_webgpu_command_encoder_begin_compute_pass",
+ const { rid } = ops.op_webgpu_command_encoder_begin_compute_pass(
commandEncoderRid,
descriptor.label,
);
@@ -2919,8 +2905,7 @@
selfContext: "this",
});
- const { err } = core.opSync(
- "op_webgpu_command_encoder_copy_buffer_to_buffer",
+ const { err } = ops.op_webgpu_command_encoder_copy_buffer_to_buffer(
commandEncoderRid,
sourceRid,
sourceOffset,
@@ -2977,8 +2962,7 @@
selfContext: "this",
});
- const { err } = core.opSync(
- "op_webgpu_command_encoder_copy_buffer_to_texture",
+ const { err } = ops.op_webgpu_command_encoder_copy_buffer_to_texture(
commandEncoderRid,
{
...source,
@@ -3042,8 +3026,7 @@
resourceContext: "buffer in Argument 2",
selfContext: "this",
});
- const { err } = core.opSync(
- "op_webgpu_command_encoder_copy_texture_to_buffer",
+ const { err } = ops.op_webgpu_command_encoder_copy_texture_to_buffer(
commandEncoderRid,
{
texture: sourceTextureRid,
@@ -3107,8 +3090,7 @@
resourceContext: "texture in Argument 2",
selfContext: "this",
});
- const { err } = core.opSync(
- "op_webgpu_command_encoder_copy_texture_to_texture",
+ const { err } = ops.op_webgpu_command_encoder_copy_texture_to_texture(
commandEncoderRid,
{
texture: sourceTextureRid,
@@ -3161,8 +3143,7 @@
prefix,
context: "Argument 1",
});
- const { err } = core.opSync(
- "op_webgpu_command_encoder_clear_buffer",
+ const { err } = ops.op_webgpu_command_encoder_clear_buffer(
commandEncoderRid,
bufferRid,
offset,
@@ -3188,8 +3169,7 @@
prefix,
context: "this",
});
- const { err } = core.opSync(
- "op_webgpu_command_encoder_push_debug_group",
+ const { err } = ops.op_webgpu_command_encoder_push_debug_group(
commandEncoderRid,
groupLabel,
);
@@ -3204,8 +3184,7 @@
prefix,
context: "this",
});
- const { err } = core.opSync(
- "op_webgpu_command_encoder_pop_debug_group",
+ const { err } = ops.op_webgpu_command_encoder_pop_debug_group(
commandEncoderRid,
);
device.pushError(err);
@@ -3228,8 +3207,7 @@
prefix,
context: "this",
});
- const { err } = core.opSync(
- "op_webgpu_command_encoder_insert_debug_marker",
+ const { err } = ops.op_webgpu_command_encoder_insert_debug_marker(
commandEncoderRid,
markerLabel,
);
@@ -3267,8 +3245,7 @@
resourceContext: "Argument 1",
selfContext: "this",
});
- const { err } = core.opSync(
- "op_webgpu_command_encoder_write_timestamp",
+ const { err } = ops.op_webgpu_command_encoder_write_timestamp(
commandEncoderRid,
querySetRid,
queryIndex,
@@ -3337,8 +3314,7 @@
resourceContext: "Argument 3",
selfContext: "this",
});
- const { err } = core.opSync(
- "op_webgpu_command_encoder_resolve_query_set",
+ const { err } = ops.op_webgpu_command_encoder_resolve_query_set(
commandEncoderRid,
querySetRid,
firstQuery,
@@ -3365,8 +3341,7 @@
prefix,
context: "this",
});
- const { rid, err } = core.opSync(
- "op_webgpu_command_encoder_finish",
+ const { rid, err } = ops.op_webgpu_command_encoder_finish(
commandEncoderRid,
descriptor.label,
);
@@ -3465,7 +3440,7 @@
context: "encoder referenced by this",
});
const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync("op_webgpu_render_pass_set_viewport", {
+ ops.op_webgpu_render_pass_set_viewport({
renderPassRid,
x,
y,
@@ -3512,8 +3487,7 @@
context: "encoder referenced by this",
});
const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync(
- "op_webgpu_render_pass_set_scissor_rect",
+ ops.op_webgpu_render_pass_set_scissor_rect(
renderPassRid,
x,
y,
@@ -3543,8 +3517,7 @@
context: "encoder referenced by this",
});
const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync(
- "op_webgpu_render_pass_set_blend_constant",
+ ops.op_webgpu_render_pass_set_blend_constant(
renderPassRid,
normalizeGPUColor(color),
);
@@ -3571,8 +3544,7 @@
context: "encoder referenced by this",
});
const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync(
- "op_webgpu_render_pass_set_stencil_reference",
+ ops.op_webgpu_render_pass_set_stencil_reference(
renderPassRid,
reference,
);
@@ -3621,8 +3593,7 @@
resourceContext: "Argument 1",
selfContext: "this",
});
- core.opSync(
- "op_webgpu_render_pass_begin_pipeline_statistics_query",
+ ops.op_webgpu_render_pass_begin_pipeline_statistics_query(
renderPassRid,
querySetRid,
queryIndex,
@@ -3642,8 +3613,7 @@
context: "encoder referenced by this",
});
const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync(
- "op_webgpu_render_pass_end_pipeline_statistics_query",
+ ops.op_webgpu_render_pass_end_pipeline_statistics_query(
renderPassRid,
);
}
@@ -3683,8 +3653,7 @@
resourceContext: "Argument 1",
selfContext: "this",
});
- core.opSync(
- "op_webgpu_render_pass_write_timestamp",
+ ops.op_webgpu_render_pass_write_timestamp(
renderPassRid,
querySetRid,
queryIndex,
@@ -3722,8 +3691,7 @@
});
return rid;
});
- core.opSync(
- "op_webgpu_render_pass_execute_bundles",
+ ops.op_webgpu_render_pass_execute_bundles(
renderPassRid,
bundleRids,
);
@@ -3741,8 +3709,7 @@
context: "encoder referenced by this",
});
const renderPassRid = assertResource(this, { prefix, context: "this" });
- const { err } = core.opSync(
- "op_webgpu_render_pass_end",
+ const { err } = ops.op_webgpu_render_pass_end(
commandEncoderRid,
renderPassRid,
);
@@ -3789,8 +3756,7 @@
dynamicOffsetsDataStart = 0;
dynamicOffsetsDataLength = dynamicOffsetsData.length;
}
- core.opSync(
- "op_webgpu_render_pass_set_bind_group",
+ ops.op_webgpu_render_pass_set_bind_group(
renderPassRid,
index,
bindGroupRid,
@@ -3821,8 +3787,7 @@
context: "encoder referenced by this",
});
const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync(
- "op_webgpu_render_pass_push_debug_group",
+ ops.op_webgpu_render_pass_push_debug_group(
renderPassRid,
groupLabel,
);
@@ -3841,7 +3806,7 @@
context: "encoder referenced by this",
});
const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync("op_webgpu_render_pass_pop_debug_group", renderPassRid);
+ ops.op_webgpu_render_pass_pop_debug_group(renderPassRid);
}
/**
@@ -3865,8 +3830,7 @@
context: "encoder referenced by this",
});
const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync(
- "op_webgpu_render_pass_insert_debug_marker",
+ ops.op_webgpu_render_pass_insert_debug_marker(
renderPassRid,
markerLabel,
);
@@ -3902,8 +3866,7 @@
resourceContext: "Argument 1",
selfContext: "this",
});
- core.opSync(
- "op_webgpu_render_pass_set_pipeline",
+ ops.op_webgpu_render_pass_set_pipeline(
renderPassRid,
pipelineRid,
);
@@ -3956,8 +3919,7 @@
resourceContext: "Argument 1",
selfContext: "this",
});
- core.opSync(
- "op_webgpu_render_pass_set_index_buffer",
+ ops.op_webgpu_render_pass_set_index_buffer(
renderPassRid,
bufferRid,
indexFormat,
@@ -4013,8 +3975,7 @@
resourceContext: "Argument 2",
selfContext: "this",
});
- core.opSync(
- "op_webgpu_render_pass_set_vertex_buffer",
+ ops.op_webgpu_render_pass_set_vertex_buffer(
renderPassRid,
slot,
bufferRid,
@@ -4058,8 +4019,7 @@
context: "encoder referenced by this",
});
const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync(
- "op_webgpu_render_pass_draw",
+ ops.op_webgpu_render_pass_draw(
renderPassRid,
vertexCount,
instanceCount,
@@ -4115,8 +4075,7 @@
context: "encoder referenced by this",
});
const renderPassRid = assertResource(this, { prefix, context: "this" });
- core.opSync(
- "op_webgpu_render_pass_draw_indexed",
+ ops.op_webgpu_render_pass_draw_indexed(
renderPassRid,
indexCount,
instanceCount,
@@ -4161,8 +4120,7 @@
resourceContext: "Argument 1",
selfContext: "this",
});
- core.opSync(
- "op_webgpu_render_pass_draw_indirect",
+ ops.op_webgpu_render_pass_draw_indirect(
renderPassRid,
indirectBufferRid,
indirectOffset,
@@ -4204,8 +4162,7 @@
resourceContext: "Argument 1",
selfContext: "this",
});
- core.opSync(
- "op_webgpu_render_pass_draw_indexed_indirect",
+ ops.op_webgpu_render_pass_draw_indexed_indirect(
renderPassRid,
indirectBufferRid,
indirectOffset,
@@ -4288,8 +4245,7 @@
resourceContext: "Argument 1",
selfContext: "this",
});
- core.opSync(
- "op_webgpu_compute_pass_set_pipeline",
+ ops.op_webgpu_compute_pass_set_pipeline(
computePassRid,
pipelineRid,
);
@@ -4330,8 +4286,7 @@
context: "encoder referenced by this",
});
const computePassRid = assertResource(this, { prefix, context: "this" });
- core.opSync(
- "op_webgpu_compute_pass_dispatch_workgroups",
+ ops.op_webgpu_compute_pass_dispatch_workgroups(
computePassRid,
workgroupCountX,
workgroupCountY,
@@ -4374,8 +4329,7 @@
resourceContext: "Argument 1",
selfContext: "this",
});
- core.opSync(
- "op_webgpu_compute_pass_dispatch_workgroups_indirect",
+ ops.op_webgpu_compute_pass_dispatch_workgroups_indirect(
computePassRid,
indirectBufferRid,
indirectOffset,
@@ -4417,8 +4371,7 @@
resourceContext: "Argument 1",
selfContext: "this",
});
- core.opSync(
- "op_webgpu_compute_pass_begin_pipeline_statistics_query",
+ ops.op_webgpu_compute_pass_begin_pipeline_statistics_query(
computePassRid,
querySetRid,
queryIndex,
@@ -4438,8 +4391,7 @@
context: "encoder referenced by this",
});
const computePassRid = assertResource(this, { prefix, context: "this" });
- core.opSync(
- "op_webgpu_compute_pass_end_pipeline_statistics_query",
+ ops.op_webgpu_compute_pass_end_pipeline_statistics_query(
computePassRid,
);
}
@@ -4479,8 +4431,7 @@
resourceContext: "Argument 1",
selfContext: "this",
});
- core.opSync(
- "op_webgpu_compute_pass_write_timestamp",
+ ops.op_webgpu_compute_pass_write_timestamp(
computePassRid,
querySetRid,
queryIndex,
@@ -4499,8 +4450,7 @@
context: "encoder referenced by this",
});
const computePassRid = assertResource(this, { prefix, context: "this" });
- const { err } = core.opSync(
- "op_webgpu_compute_pass_end",
+ const { err } = ops.op_webgpu_compute_pass_end(
commandEncoderRid,
computePassRid,
);
@@ -4547,8 +4497,7 @@
dynamicOffsetsDataStart = 0;
dynamicOffsetsDataLength = dynamicOffsetsData.length;
}
- core.opSync(
- "op_webgpu_compute_pass_set_bind_group",
+ ops.op_webgpu_compute_pass_set_bind_group(
computePassRid,
index,
bindGroupRid,
@@ -4579,8 +4528,7 @@
context: "encoder referenced by this",
});
const computePassRid = assertResource(this, { prefix, context: "this" });
- core.opSync(
- "op_webgpu_compute_pass_push_debug_group",
+ ops.op_webgpu_compute_pass_push_debug_group(
computePassRid,
groupLabel,
);
@@ -4599,7 +4547,7 @@
context: "encoder referenced by this",
});
const computePassRid = assertResource(this, { prefix, context: "this" });
- core.opSync("op_webgpu_compute_pass_pop_debug_group", computePassRid);
+ ops.op_webgpu_compute_pass_pop_debug_group(computePassRid);
}
/**
@@ -4623,8 +4571,7 @@
context: "encoder referenced by this",
});
const computePassRid = assertResource(this, { prefix, context: "this" });
- core.opSync(
- "op_webgpu_compute_pass_insert_debug_marker",
+ ops.op_webgpu_compute_pass_insert_debug_marker(
computePassRid,
markerLabel,
);
@@ -4734,8 +4681,7 @@
prefix,
context: "this",
});
- const { rid, err } = core.opSync(
- "op_webgpu_render_bundle_encoder_finish",
+ const { rid, err } = ops.op_webgpu_render_bundle_encoder_finish(
renderBundleEncoderRid,
descriptor.label,
);
@@ -4786,8 +4732,7 @@
dynamicOffsetsDataStart = 0;
dynamicOffsetsDataLength = dynamicOffsetsData.length;
}
- core.opSync(
- "op_webgpu_render_bundle_encoder_set_bind_group",
+ ops.op_webgpu_render_bundle_encoder_set_bind_group(
renderBundleEncoderRid,
index,
bindGroupRid,
@@ -4814,8 +4759,7 @@
prefix,
context: "this",
});
- core.opSync(
- "op_webgpu_render_bundle_encoder_push_debug_group",
+ ops.op_webgpu_render_bundle_encoder_push_debug_group(
renderBundleEncoderRid,
groupLabel,
);
@@ -4830,8 +4774,7 @@
prefix,
context: "this",
});
- core.opSync(
- "op_webgpu_render_bundle_encoder_pop_debug_group",
+ ops.op_webgpu_render_bundle_encoder_pop_debug_group(
renderBundleEncoderRid,
);
}
@@ -4853,8 +4796,7 @@
prefix,
context: "this",
});
- core.opSync(
- "op_webgpu_render_bundle_encoder_insert_debug_marker",
+ ops.op_webgpu_render_bundle_encoder_insert_debug_marker(
renderBundleEncoderRid,
markerLabel,
);
@@ -4886,8 +4828,7 @@
resourceContext: "Argument 1",
selfContext: "this",
});
- core.opSync(
- "op_webgpu_render_bundle_encoder_set_pipeline",
+ ops.op_webgpu_render_bundle_encoder_set_pipeline(
renderBundleEncoderRid,
pipelineRid,
);
@@ -4934,8 +4875,7 @@
resourceContext: "Argument 1",
selfContext: "this",
});
- core.opSync(
- "op_webgpu_render_bundle_encoder_set_index_buffer",
+ ops.op_webgpu_render_bundle_encoder_set_index_buffer(
renderBundleEncoderRid,
bufferRid,
indexFormat,
@@ -4985,8 +4925,7 @@
resourceContext: "Argument 2",
selfContext: "this",
});
- core.opSync(
- "op_webgpu_render_bundle_encoder_set_vertex_buffer",
+ ops.op_webgpu_render_bundle_encoder_set_vertex_buffer(
renderBundleEncoderRid,
slot,
bufferRid,
@@ -5026,8 +4965,7 @@
prefix,
context: "this",
});
- core.opSync(
- "op_webgpu_render_bundle_encoder_draw",
+ ops.op_webgpu_render_bundle_encoder_draw(
renderBundleEncoderRid,
vertexCount,
instanceCount,
@@ -5079,8 +5017,7 @@
prefix,
context: "this",
});
- core.opSync(
- "op_webgpu_render_bundle_encoder_draw_indexed",
+ ops.op_webgpu_render_bundle_encoder_draw_indexed(
renderBundleEncoderRid,
indexCount,
instanceCount,
@@ -5121,8 +5058,7 @@
resourceContext: "Argument 1",
selfContext: "this",
});
- core.opSync(
- "op_webgpu_render_bundle_encoder_draw_indirect",
+ ops.op_webgpu_render_bundle_encoder_draw_indirect(
renderBundleEncoderRid,
indirectBufferRid,
indirectOffset,
diff --git a/ext/websocket/01_websocket.js b/ext/websocket/01_websocket.js
index 8c407dff8..bdb29526e 100644
--- a/ext/websocket/01_websocket.js
+++ b/ext/websocket/01_websocket.js
@@ -5,6 +5,7 @@
((window) => {
const core = window.Deno.core;
+ const ops = core.ops;
const { URL } = window.__bootstrap.url;
const webidl = window.__bootstrap.webidl;
const { HTTP_TOKEN_CODE_POINT_RE } = window.__bootstrap.infra;
@@ -189,8 +190,7 @@
this[_url] = wsURL.href;
- core.opSync(
- "op_ws_check_permission_and_cancel_handle",
+ ops.op_ws_check_permission_and_cancel_handle(
this[_url],
false,
);
diff --git a/ext/websocket/02_websocketstream.js b/ext/websocket/02_websocketstream.js
index df87c0c97..5266c8dfb 100644
--- a/ext/websocket/02_websocketstream.js
+++ b/ext/websocket/02_websocketstream.js
@@ -5,6 +5,7 @@
((window) => {
const core = window.Deno.core;
+ const ops = core.ops;
const webidl = window.__bootstrap.webidl;
const { writableStreamClose, Deferred } = window.__bootstrap.streams;
const { DOMException } = window.__bootstrap.domException;
@@ -128,8 +129,7 @@
fillHeaders(headers, options.headers);
}
- const cancelRid = core.opSync(
- "op_ws_check_permission_and_cancel_handle",
+ const cancelRid = ops.op_ws_check_permission_and_cancel_handle(
this[_url],
true,
);
diff --git a/ext/webstorage/01_webstorage.js b/ext/webstorage/01_webstorage.js
index 5b9cccd6d..0e9b28b1f 100644
--- a/ext/webstorage/01_webstorage.js
+++ b/ext/webstorage/01_webstorage.js
@@ -4,6 +4,7 @@
((window) => {
const core = window.Deno.core;
+ const ops = core.ops;
const webidl = window.__bootstrap.webidl;
const {
SafeArrayIterator,
@@ -28,7 +29,7 @@
get length() {
webidl.assertBranded(this, StoragePrototype);
- return core.opSync("op_webstorage_length", this[_persistent]);
+ return ops.op_webstorage_length(this[_persistent]);
}
key(index) {
@@ -40,7 +41,7 @@
context: "Argument 1",
});
- return core.opSync("op_webstorage_key", index, this[_persistent]);
+ return ops.op_webstorage_key(index, this[_persistent]);
}
setItem(key, value) {
@@ -56,7 +57,7 @@
context: "Argument 2",
});
- core.opSync("op_webstorage_set", key, value, this[_persistent]);
+ ops.op_webstorage_set(key, value, this[_persistent]);
}
getItem(key) {
@@ -68,7 +69,7 @@
context: "Argument 1",
});
- return core.opSync("op_webstorage_get", key, this[_persistent]);
+ return ops.op_webstorage_get(key, this[_persistent]);
}
removeItem(key) {
@@ -80,12 +81,12 @@
context: "Argument 1",
});
- core.opSync("op_webstorage_remove", key, this[_persistent]);
+ ops.op_webstorage_remove(key, this[_persistent]);
}
clear() {
webidl.assertBranded(this, StoragePrototype);
- core.opSync("op_webstorage_clear", this[_persistent]);
+ ops.op_webstorage_clear(this[_persistent]);
}
}
@@ -136,7 +137,7 @@
(typeof target.getItem(p)) === "string";
},
ownKeys() {
- return core.opSync("op_webstorage_iterate_keys", persistent);
+ return ops.op_webstorage_iterate_keys(persistent);
},
getOwnPropertyDescriptor(target, key) {
if (arguments.length === 1) {