Skip to content

Commit 3970a84

Browse files
authored
feat: v8 14.9 (#34226)
1 parent 99c6f7a commit 3970a84

69 files changed

Lines changed: 620 additions & 239 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 8 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ deno_task_shell = "=0.30.0"
102102
deno_terminal = "=0.2.3"
103103
deno_unsync = { version = "0.4.4", default-features = false }
104104
deno_whoami = "0.1.0"
105-
v8 = { version = "147.4.0", default-features = false, features = ["simdutf"] }
105+
v8 = { version = "149.0.0", default-features = false, features = ["simdutf"] }
106106

107107
denokv_proto = "0.13.0"
108108
denokv_remote = "0.13.0"

cli/tools/lint/plugins.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
use std::path::Path;
44
use std::path::PathBuf;
5-
use std::rc::Rc;
65
use std::sync::Arc;
76

87
use ::tokio_util::sync::CancellationToken;
@@ -121,8 +120,8 @@ impl PluginHostProxy {
121120

122121
pub struct PluginHost {
123122
worker: MainWorker,
124-
install_plugins_fn: Rc<v8::Global<v8::Function>>,
125-
run_plugins_for_file_fn: Rc<v8::Global<v8::Function>>,
123+
install_plugins_fn: v8::Global<v8::Function>,
124+
run_plugins_for_file_fn: v8::Global<v8::Function>,
126125
rx: mpsc::Receiver<PluginHostRequest>,
127126
}
128127

@@ -194,8 +193,8 @@ async fn create_plugin_runner_inner(
194193
run_plugins_for_file_fn_val.try_into().unwrap();
195194

196195
(
197-
Rc::new(v8::Global::new(scope, install_plugins_fn)),
198-
Rc::new(v8::Global::new(scope, run_plugins_for_file_fn)),
196+
v8::Global::new(scope, install_plugins_fn),
197+
v8::Global::new(scope, run_plugins_for_file_fn),
199198
)
200199
};
201200

@@ -344,7 +343,7 @@ impl PluginHost {
344343
.unwrap()
345344
.into();
346345
let run_plugins_for_file =
347-
v8::Local::new(scope, &*self.run_plugins_for_file_fn);
346+
v8::Local::new(scope, &self.run_plugins_for_file_fn);
348347
let undefined = v8::undefined(scope);
349348

350349
let _run_plugins_result = {
@@ -402,8 +401,7 @@ impl PluginHost {
402401
}
403402

404403
deno_core::scope!(scope, &mut self.worker.js_runtime);
405-
let install_plugins_local =
406-
v8::Local::new(scope, &*self.install_plugins_fn.clone());
404+
let install_plugins_local = v8::Local::new(scope, &self.install_plugins_fn);
407405
let exclude_v8: v8::Local<v8::Value> =
408406
exclude.map_or(v8::null(scope).into(), |v| {
409407
let elems = v

ext/node/polyfills/worker_threads.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,6 @@ class NodeWorker extends EventEmitter {
632632
switch (type) {
633633
case 1: { // TerminalError
634634
this.#status = "CLOSED";
635-
this.#closeStdio();
636635
if (this.listenerCount("error") > 0) {
637636
const errMsg = data.errorMessage ?? data.message;
638637
const errName = data.name;
@@ -652,9 +651,13 @@ class NodeWorker extends EventEmitter {
652651
err.stack = undefined;
653652
this.emit("error", err);
654653
}
655-
// Drain pending messages before emitting exit so that
656-
// all 'message' events fire before 'exit' (Node.js behavior).
654+
// Drain pending messages before closing stdio and emitting exit:
655+
// any stdio chunks still queued on the message channel must be
656+
// pushed onto the Readable streams *before* we EOF them, otherwise
657+
// we hit "stream.push() after EOF" if the Close control arrives
658+
// before the last stdout/stderr message (Node.js behavior).
657659
await this.#messageLoopPromise;
660+
this.#closeStdio();
658661
this.resourceLimits = {};
659662
if (!this.#exited) {
660663
this.#exited = true;
@@ -669,10 +672,13 @@ class NodeWorker extends EventEmitter {
669672
case 3: { // Close
670673
debugWT(`Host got "close" message from worker: ${this.#name}`);
671674
this.#status = "CLOSED";
672-
this.#closeStdio();
673-
// Drain pending messages before emitting exit so that
674-
// all 'message' events fire before 'exit' (Node.js behavior).
675+
// Drain pending messages before closing stdio and emitting exit:
676+
// any stdio chunks still queued on the message channel must be
677+
// pushed onto the Readable streams *before* we EOF them, otherwise
678+
// we hit "stream.push() after EOF" if the Close control arrives
679+
// before the last stdout/stderr message (Node.js behavior).
675680
await this.#messageLoopPromise;
681+
this.#closeStdio();
676682
this.resourceLimits = {};
677683
if (!this.#exited) {
678684
this.#exited = true;

libs/core/modules/map.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,9 +1146,7 @@ impl ModuleMap {
11461146
);
11471147
};
11481148
let wasm_module_object: v8::Local<v8::Object> = wasm_module.into();
1149-
let wasm_module_object_global = v8::Global::new(scope, wasm_module_object);
1150-
1151-
let source = Rc::new(wasm_module_object_global);
1149+
let source = v8::Global::new(scope, wasm_module_object);
11521150
{
11531151
let mut data = self.data.borrow_mut();
11541152
data.sources.insert(reference_key, source.clone());
@@ -1423,7 +1421,7 @@ impl ModuleMap {
14231421
};
14241422
let key = ModuleSourceKey::from_reference(&module_reference);
14251423
if let Some(entry) = module_map.data.borrow().sources.get(&key) {
1426-
Some(v8::Local::new(scope, entry.as_ref()))
1424+
Some(v8::Local::new(scope, entry))
14271425
} else {
14281426
let message = v8::String::new(
14291427
scope,
@@ -2504,7 +2502,7 @@ impl ModuleMap {
25042502
let key = ModuleSourceKey::from_reference(module_reference);
25052503
let source = {
25062504
let data = self.data.borrow();
2507-
let source = data.sources.get(&key).expect("Source had to have been inserted successfully, or recursion would error.").as_ref();
2505+
let source = data.sources.get(&key).expect("Source had to have been inserted successfully, or recursion would error.");
25082506
v8::Local::new(scope, source).into()
25092507
};
25102508
let resolver = state.resolver.open(scope);

libs/core/modules/module_map_data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ pub(crate) struct ModuleMapData {
231231
/// the `synthetic_esm` dispatch goes straight through Rust without the
232232
/// JS `core.loadExtScript` wrapper. Runtime-only — not snapshotted.
233233
pub(crate) captured_bootstrap: RefCell<Option<v8::Global<v8::Value>>>,
234-
pub(crate) sources: HashMap<ModuleSourceKey, Rc<v8::Global<v8::Object>>>,
234+
pub(crate) sources: HashMap<ModuleSourceKey, v8::Global<v8::Object>>,
235235
/// Specifiers of `lazy_loaded_esm` / `lazy_loaded_js` files whose source
236236
/// was actually compiled by V8 during snapshot creation. Their bytes live
237237
/// in the snapshot blob; the binary does not need a separate copy.

libs/core/ops_metrics.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,10 @@ pub unsafe extern "C" fn slow_metrics_dispatch(
104104
) {
105105
// SAFETY: info is a valid pointer from V8
106106
let info_ref = unsafe { &*info };
107-
let args =
108-
v8::FunctionCallbackArguments::from_function_callback_info(info_ref);
107+
let parts = info_ref.get_parts();
109108
// SAFETY: data is always an External pointing to OpCtx
110109
let opctx: &OpCtx = unsafe {
111-
&*(v8::Local::<v8::External>::cast_unchecked(args.data()).value()
110+
&*(v8::Local::<v8::External>::cast_unchecked(parts.data).value()
112111
as *const OpCtx)
113112
};
114113

0 commit comments

Comments
 (0)