summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsnek <snek@deno.com>2024-07-01 15:48:52 -0700
committerGitHub <noreply@github.com>2024-07-01 15:48:52 -0700
commita555cb4d1d3c04a4bdc0e04d20d23b157cef3b92 (patch)
tree9ebedb3c3cc499026f84053e6774a10ae19b2f75
parent740c6a0998fb5873d0b9bf804b2f9c9730743e90 (diff)
feat: upgrade deno_core (#24364)
- Symbol.asyncDispose no longer needs to be polyfilled - assorted updates for cppgc api changes
-rw-r--r--Cargo.lock85
-rw-r--r--Cargo.toml2
-rw-r--r--ext/node/ops/blocklist.rs2
-rw-r--r--ext/node/ops/crypto/digest.rs4
-rw-r--r--ext/node/ops/crypto/x509.rs2
-rw-r--r--ext/node/ops/vm.rs2
-rw-r--r--ext/node/ops/vm_internal.rs34
-rw-r--r--ext/node/ops/zlib/mod.rs4
-rw-r--r--ext/tls/tls_key.rs4
-rw-r--r--runtime/js/99_main.js16
10 files changed, 108 insertions, 47 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 77d0b35f6..5aea422a3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -439,6 +439,29 @@ dependencies = [
]
[[package]]
+name = "bindgen"
+version = "0.69.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0"
+dependencies = [
+ "bitflags 2.5.0",
+ "cexpr",
+ "clang-sys",
+ "itertools",
+ "lazy_static",
+ "lazycell",
+ "log",
+ "prettyplease 0.2.17",
+ "proc-macro2",
+ "quote",
+ "regex",
+ "rustc-hash",
+ "shlex",
+ "syn 2.0.58",
+ "which 4.4.2",
+]
+
+[[package]]
name = "bit-set"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -597,6 +620,15 @@ dependencies = [
]
[[package]]
+name = "cexpr"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
+dependencies = [
+ "nom 7.1.3",
+]
+
+[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -629,6 +661,17 @@ dependencies = [
]
[[package]]
+name = "clang-sys"
+version = "1.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
+dependencies = [
+ "glob",
+ "libc",
+ "libloading 0.8.3",
+]
+
+[[package]]
name = "clap"
version = "4.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1292,9 +1335,9 @@ dependencies = [
[[package]]
name = "deno_core"
-version = "0.291.0"
+version = "0.292.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec3d6bd1d8fc2858208a55aa492d43d92de7d42b9f434f0a7ed251befaf27a3c"
+checksum = "248b86ab980532603f44c14e1c079881133fc54be4c5c716d5333c67952293d2"
dependencies = [
"anyhow",
"bincode",
@@ -1755,9 +1798,9 @@ dependencies = [
[[package]]
name = "deno_ops"
-version = "0.167.0"
+version = "0.168.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b573e543149e9a37cdf9cf37b88d778215a8eff7da8211b94f84d3d155cfe3f5"
+checksum = "81638e46cda0051461c034e6aeef73d7184264fffface2372586a6ce410a0e89"
dependencies = [
"proc-macro-rules",
"proc-macro2",
@@ -3762,6 +3805,12 @@ dependencies = [
]
[[package]]
+name = "lazycell"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
+
+[[package]]
name = "lexical-core"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4893,6 +4942,16 @@ dependencies = [
]
[[package]]
+name = "prettyplease"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7"
+dependencies = [
+ "proc-macro2",
+ "syn 2.0.58",
+]
+
+[[package]]
name = "primeorder"
version = "0.13.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4986,7 +5045,7 @@ dependencies = [
"log",
"multimap",
"petgraph",
- "prettyplease",
+ "prettyplease 0.1.25",
"prost",
"prost-types",
"regex",
@@ -5771,9 +5830,9 @@ dependencies = [
[[package]]
name = "serde_v8"
-version = "0.200.0"
+version = "0.201.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "579057484ec81c031826ca53bc5b4ab5d1273fcd5cc4c8057c0f0cd1e57dfa65"
+checksum = "4f7436cf7c06303e6570fea42ec827e47111a77edbf6b40fcfc05424da4d01c0"
dependencies = [
"num-bigint",
"serde",
@@ -5847,6 +5906,12 @@ dependencies = [
]
[[package]]
+name = "shlex"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
+
+[[package]]
name = "signal-hook"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -7365,16 +7430,18 @@ dependencies = [
[[package]]
name = "v8"
-version = "0.93.1"
+version = "0.95.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82943fec029559cb43f9d7fc36e2bb85121534702d6f893554e737d1b147d140"
+checksum = "c4395d3c43b81368d91335ffc78d71cb6e3288d311ab6a55094634cb2afdc5c5"
dependencies = [
+ "bindgen",
"bitflags 2.5.0",
"fslock",
"gzip-header",
"home",
"miniz_oxide",
"once_cell",
+ "paste",
"which 6.0.1",
]
diff --git a/Cargo.toml b/Cargo.toml
index 85a052d08..293d6b440 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -44,7 +44,7 @@ repository = "https://github.com/denoland/deno"
[workspace.dependencies]
deno_ast = { version = "=0.39.2", features = ["transpiling"] }
-deno_core = { version = "0.291.0" }
+deno_core = { version = "0.292.0" }
deno_bench_util = { version = "0.152.0", path = "./bench_util" }
deno_lockfile = "0.20.0"
diff --git a/ext/node/ops/blocklist.rs b/ext/node/ops/blocklist.rs
index b853a5723..182f15df3 100644
--- a/ext/node/ops/blocklist.rs
+++ b/ext/node/ops/blocklist.rs
@@ -22,7 +22,7 @@ pub struct BlockListResource {
blocklist: RefCell<BlockList>,
}
-impl deno_core::GcResource for BlockListResource {}
+impl deno_core::GarbageCollected for BlockListResource {}
#[derive(Serialize)]
struct SocketAddressSerialization(String, String);
diff --git a/ext/node/ops/crypto/digest.rs b/ext/node/ops/crypto/digest.rs
index 588ea7425..e3a91e338 100644
--- a/ext/node/ops/crypto/digest.rs
+++ b/ext/node/ops/crypto/digest.rs
@@ -1,7 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use deno_core::error::generic_error;
use deno_core::error::AnyError;
-use deno_core::GcResource;
+use deno_core::GarbageCollected;
use digest::Digest;
use digest::DynDigest;
use digest::ExtendableOutput;
@@ -13,7 +13,7 @@ pub struct Hasher {
pub hash: Rc<RefCell<Option<Hash>>>,
}
-impl GcResource for Hasher {}
+impl GarbageCollected for Hasher {}
impl Hasher {
pub fn new(
diff --git a/ext/node/ops/crypto/x509.rs b/ext/node/ops/crypto/x509.rs
index 517a3a943..c9a23aca0 100644
--- a/ext/node/ops/crypto/x509.rs
+++ b/ext/node/ops/crypto/x509.rs
@@ -19,7 +19,7 @@ pub(crate) struct Certificate {
cert: X509Certificate<'static>,
}
-impl deno_core::GcResource for Certificate {}
+impl deno_core::GarbageCollected for Certificate {}
impl Certificate {
fn fingerprint<D: Digest>(&self) -> Option<String> {
diff --git a/ext/node/ops/vm.rs b/ext/node/ops/vm.rs
index 2614c4f73..df631a51f 100644
--- a/ext/node/ops/vm.rs
+++ b/ext/node/ops/vm.rs
@@ -29,7 +29,7 @@ pub struct Script {
inner: i::ContextifyScript,
}
-impl deno_core::GcResource for Script {}
+impl deno_core::GarbageCollected for Script {}
impl Script {
fn new(
diff --git a/ext/node/ops/vm_internal.rs b/ext/node/ops/vm_internal.rs
index 0ac714c9f..afcdc1b9c 100644
--- a/ext/node/ops/vm_internal.rs
+++ b/ext/node/ops/vm_internal.rs
@@ -58,13 +58,17 @@ impl ContextifyScript {
}
}
-#[derive(Debug, Clone)]
pub struct ContextifyContext {
- context: v8::Global<v8::Context>,
- sandbox: v8::Global<v8::Object>,
+ context: v8::TracedReference<v8::Context>,
+ sandbox: v8::TracedReference<v8::Object>,
}
-impl deno_core::GcResource for ContextifyContext {}
+impl deno_core::GarbageCollected for ContextifyContext {
+ fn trace(&self, visitor: &v8::cppgc::Visitor) {
+ visitor.trace(&self.context);
+ visitor.trace(&self.sandbox);
+ }
+}
impl ContextifyContext {
pub fn attach(
@@ -102,12 +106,12 @@ impl ContextifyContext {
);
}
- let context = v8::Global::new(scope, v8_context);
- let sandbox = v8::Global::new(scope, sandbox_obj);
+ let context = v8::TracedReference::new(scope, v8_context);
+ let sandbox = v8::TracedReference::new(scope, sandbox_obj);
let wrapper =
deno_core::cppgc::make_cppgc_object(scope, Self { context, sandbox });
- let ptr = deno_core::cppgc::try_unwrap_cppgc_object::<Self>(wrapper.into())
- .unwrap();
+ let ptr =
+ deno_core::cppgc::try_unwrap_cppgc_object::<Self>(scope, wrapper.into());
// SAFETY: We are storing a pointer to the ContextifyContext
// in the embedder data of the v8::Context. The contextified wrapper
@@ -115,7 +119,7 @@ impl ContextifyContext {
unsafe {
v8_context.set_aligned_pointer_in_embedder_data(
3,
- ptr as *const ContextifyContext as _,
+ ptr.borrow().unwrap() as *const ContextifyContext as _,
);
}
@@ -137,8 +141,12 @@ impl ContextifyContext {
sandbox_obj
.get_private(scope, private_symbol)
.and_then(|wrapper| {
- deno_core::cppgc::try_unwrap_cppgc_object::<Self>(wrapper)
- .map(|s| s as _)
+ deno_core::cppgc::try_unwrap_cppgc_object::<Self>(scope, wrapper)
+ .borrow()
+ // SAFETY: the lifetime of the scope does not actually bind to
+ // the lifetime of this reference at all, but the object we read
+ // it from does, so it will be alive at least that long.
+ .map(|r| unsafe { &*(r as *const _) })
})
}
@@ -153,7 +161,7 @@ impl ContextifyContext {
&self,
scope: &mut v8::HandleScope<'a>,
) -> v8::Local<'a, v8::Context> {
- v8::Local::new(scope, &self.context)
+ self.context.get(scope).unwrap()
}
fn global_proxy<'s>(
@@ -168,7 +176,7 @@ impl ContextifyContext {
&self,
scope: &mut v8::HandleScope<'a>,
) -> v8::Local<'a, v8::Object> {
- v8::Local::new(scope, &self.sandbox)
+ self.sandbox.get(scope).unwrap()
}
fn get<'a, 'c>(
diff --git a/ext/node/ops/zlib/mod.rs b/ext/node/ops/zlib/mod.rs
index 9e030176a..b1d6d21d2 100644
--- a/ext/node/ops/zlib/mod.rs
+++ b/ext/node/ops/zlib/mod.rs
@@ -144,7 +144,7 @@ impl ZlibInner {
self.err = self.strm.inflate(self.flush);
// TODO(@littledivy): Use if let chain when it is stable.
// https://github.com/rust-lang/rust/issues/53667
- //
+ //
// Data was encoded with dictionary
if let (Z_NEED_DICT, Some(dictionary)) = (self.err, &self.dictionary) {
self.err = self.strm.inflate_set_dictionary(dictionary);
@@ -233,7 +233,7 @@ struct Zlib {
inner: RefCell<Option<ZlibInner>>,
}
-impl deno_core::GcResource for Zlib {}
+impl deno_core::GarbageCollected for Zlib {}
impl deno_core::Resource for Zlib {
fn name(&self) -> Cow<str> {
diff --git a/ext/tls/tls_key.rs b/ext/tls/tls_key.rs
index 66fea3a69..47a8e0e57 100644
--- a/ext/tls/tls_key.rs
+++ b/ext/tls/tls_key.rs
@@ -50,7 +50,7 @@ pub enum TlsKeys {
pub struct TlsKeysHolder(RefCell<TlsKeys>);
-impl deno_core::GcResource for TlsKeysHolder {}
+impl deno_core::GarbageCollected for TlsKeysHolder {}
impl TlsKeysHolder {
pub fn take(&self) -> TlsKeys {
@@ -224,7 +224,7 @@ pub struct TlsKeyLookup {
RefCell<HashMap<String, broadcast::Sender<Result<TlsKey, ErrorType>>>>,
}
-impl deno_core::GcResource for TlsKeyLookup {}
+impl deno_core::GarbageCollected for TlsKeyLookup {}
impl TlsKeyLookup {
/// Multiple `poll` calls are safe, but this method is not starvation-safe. Generally
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js
index 4f949b214..0a750f891 100644
--- a/runtime/js/99_main.js
+++ b/runtime/js/99_main.js
@@ -92,15 +92,7 @@ import {
import {
workerRuntimeGlobalProperties,
} from "ext:runtime/98_global_scope_worker.js";
-import {
- SymbolAsyncDispose,
- SymbolDispose,
- SymbolMetadata,
-} from "ext:deno_web/00_infra.js";
-// deno-lint-ignore prefer-primordials
-if (Symbol.asyncDispose) {
- throw "V8 supports Symbol.asyncDispose now, no need to shim it!";
-}
+import { SymbolDispose, SymbolMetadata } from "ext:deno_web/00_infra.js";
// deno-lint-ignore prefer-primordials
if (Symbol.metadata) {
throw "V8 supports Symbol.metadata now, no need to shim it!";
@@ -112,12 +104,6 @@ ObjectDefineProperties(Symbol, {
writable: false,
configurable: false,
},
- asyncDispose: {
- value: SymbolAsyncDispose,
- enumerable: false,
- writable: false,
- configurable: false,
- },
metadata: {
value: SymbolMetadata,
enumerable: false,