1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-21 23:04:45 -05:00

feat: upgrade deno_core (#24886)

Fixes: https://github.com/denoland/deno/issues/24869

Includes changes for `node:vm` rewrite.
This commit is contained in:
snek 2024-08-05 08:28:12 -07:00 committed by GitHub
parent e97764e7ec
commit 649725442a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 31 additions and 23 deletions

16
Cargo.lock generated
View file

@ -1357,9 +1357,9 @@ dependencies = [
[[package]]
name = "deno_core"
version = "0.301.0"
version = "0.302.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d595cedb88ce9972e35b6b6ea3832792a570412c06c4ef2fe2b1e54505595e51"
checksum = "063e249fa30a9ee3320f5b1a69f86be1d98db234a112671ad85f648c876a6705"
dependencies = [
"anyhow",
"bincode",
@ -1843,9 +1843,9 @@ dependencies = [
[[package]]
name = "deno_ops"
version = "0.177.0"
version = "0.178.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9e89d5b94f766a73ecfa03b8481c9b4932d137670bdd9b227e5fcf283175af7"
checksum = "1df4f8e16146f71cd35f3730350005be64807e37a89900366b55d6d798ab545a"
dependencies = [
"proc-macro-rules",
"proc-macro2",
@ -6078,9 +6078,9 @@ dependencies = [
[[package]]
name = "serde_v8"
version = "0.210.0"
version = "0.211.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef949bc9a8f4eb6c6620ed5e52c60f8d7239ef31c9c5e1eb3ad88d882ad9bde2"
checksum = "74f34bfd3eb4e7d79bfb7ec0c0870cc4413289c047502c87e3011f09a5d0dd98"
dependencies = [
"num-bigint",
"serde",
@ -7718,9 +7718,9 @@ dependencies = [
[[package]]
name = "v8"
version = "0.101.0"
version = "0.102.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06bc034c7b5e85fac85d2c6f181878266dd344790702d03e946c25cba78646a9"
checksum = "88a710d5b95bff79a90708203cf9f74384e080d21fc6664aa4df463f2c66ac83"
dependencies = [
"bindgen",
"bitflags 2.5.0",

View file

@ -45,7 +45,7 @@ repository = "https://github.com/denoland/deno"
[workspace.dependencies]
deno_ast = { version = "=0.41.2", features = ["transpiling"] }
deno_core = { version = "0.301.0" }
deno_core = { version = "0.302.0" }
deno_bench_util = { version = "0.158.0", path = "./bench_util" }
deno_lockfile = "0.20.0"

View file

@ -207,7 +207,7 @@ pub fn global_object_middleware<'s>(
deno_globals,
node_globals,
};
scope.get_current_context().set_slot(scope, storage);
scope.get_current_context().set_slot(storage);
}
fn is_managed_key(
@ -269,7 +269,7 @@ pub fn getter<'s>(
let context = scope.get_current_context();
let inner = {
let storage = context.get_slot::<GlobalsStorage>(scope).unwrap();
let storage = context.get_slot::<GlobalsStorage>().unwrap();
storage.inner_for_mode(mode)
};
let inner = v8::Local::new(scope, inner);
@ -302,7 +302,7 @@ pub fn setter<'s>(
let context = scope.get_current_context();
let inner = {
let storage = context.get_slot::<GlobalsStorage>(scope).unwrap();
let storage = context.get_slot::<GlobalsStorage>().unwrap();
storage.inner_for_mode(mode)
};
let inner = v8::Local::new(scope, inner);
@ -329,7 +329,7 @@ pub fn query<'s>(
let context = scope.get_current_context();
let inner = {
let storage = context.get_slot::<GlobalsStorage>(scope).unwrap();
let storage = context.get_slot::<GlobalsStorage>().unwrap();
storage.inner_for_mode(mode)
};
let inner = v8::Local::new(scope, inner);
@ -361,7 +361,7 @@ pub fn deleter<'s>(
let context = scope.get_current_context();
let inner = {
let storage = context.get_slot::<GlobalsStorage>(scope).unwrap();
let storage = context.get_slot::<GlobalsStorage>().unwrap();
storage.inner_for_mode(mode)
};
let inner = v8::Local::new(scope, inner);
@ -390,7 +390,7 @@ pub fn enumerator<'s>(
let context = scope.get_current_context();
let inner = {
let storage = context.get_slot::<GlobalsStorage>(scope).unwrap();
let storage = context.get_slot::<GlobalsStorage>().unwrap();
storage.inner_for_mode(mode)
};
let inner = v8::Local::new(scope, inner);
@ -424,7 +424,7 @@ pub fn definer<'s>(
let context = scope.get_current_context();
let inner = {
let storage = context.get_slot::<GlobalsStorage>(scope).unwrap();
let storage = context.get_slot::<GlobalsStorage>().unwrap();
storage.inner_for_mode(mode)
};
let inner = v8::Local::new(scope, inner);
@ -458,7 +458,7 @@ pub fn descriptor<'s>(
let context = scope.get_current_context();
let inner = {
let storage = context.get_slot::<GlobalsStorage>(scope).unwrap();
let storage = context.get_slot::<GlobalsStorage>().unwrap();
storage.inner_for_mode(mode)
};
let inner = v8::Local::new(scope, inner);

View file

@ -145,7 +145,7 @@ mod tests {
let isolate = &mut v8::Isolate::new(Default::default());
let scope = &mut v8::HandleScope::new(isolate);
let context = v8::Context::new(scope);
let context = v8::Context::new(scope, Default::default());
let scope = &mut v8::ContextScope::new(scope, context);
let source = v8::String::new(scope, "1 + 2").unwrap();

View file

@ -35,11 +35,12 @@ impl ContextifyScript {
false,
Some(host_defined_options),
);
let source = v8::script_compiler::Source::new(source_str, Some(&origin));
let mut source =
v8::script_compiler::Source::new(source_str, Some(&origin));
let unbound_script = v8::script_compiler::compile_unbound_script(
scope,
source,
&mut source,
v8::script_compiler::CompileOptions::NoCompileOptions,
v8::script_compiler::NoCacheReason::NoReason,
)
@ -226,15 +227,22 @@ pub fn create_v8_context<'a>(
let scope = &mut v8::EscapableHandleScope::new(scope);
let context = if mode == ContextInitMode::UseSnapshot {
v8::Context::from_snapshot(scope, VM_CONTEXT_INDEX).unwrap()
v8::Context::from_snapshot(scope, VM_CONTEXT_INDEX, Default::default())
.unwrap()
} else {
let ctx = v8::Context::new_from_template(scope, object_template);
let ctx = v8::Context::new(
scope,
v8::ContextOptions {
global_template: Some(object_template),
..Default::default()
},
);
// SAFETY: ContextifyContexts will update this to a pointer to the native object
unsafe {
ctx.set_aligned_pointer_in_embedder_data(1, std::ptr::null_mut());
ctx.set_aligned_pointer_in_embedder_data(2, std::ptr::null_mut());
ctx.set_aligned_pointer_in_embedder_data(3, std::ptr::null_mut());
ctx.clear_all_slots(scope);
ctx.clear_all_slots();
};
ctx
};