Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade deno_core #24886

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
16 changes: 8 additions & 8 deletions ext/node/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ext/node/ops/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
18 changes: 13 additions & 5 deletions ext/node/ops/vm_internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down Expand Up @@ -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
};
Expand Down