New Features in V8 8.4: WebAssembly Enhancements, WeakRefs, and Private Methods
V8 version 8.4, slated for release with Chrome 84, introduces developer‑focused enhancements including faster WebAssembly startup via Liftoff, improved debugging, SIMD origin trial support, new JavaScript WeakRef and FinalizationRegistry APIs, and syntax for private methods and accessors using the # prefix.
V8 version 8.4 (currently in testing) will be released with Chrome 84 and brings several developer‑oriented features.
WebAssembly : The Liftoff baseline compiler now supports atomic instructions and large‑memory operations, reducing startup time, and debugging has been improved by allowing inspection of paused or breakpoint‑reached frames using Liftoff. SIMD support is available via an origin trial (chrome://flags/#enable-webassembly-simd).
JavaScript : New WeakRef API lets developers hold weak references that do not prevent garbage collection, and the accompanying FinalizationRegistry enables registration of callbacks to run after an object is collected. Example code demonstrates creating a weak reference and using the registry.
const globalRef = {
callback() { console.log('foo'); }
};
// As long as globalRef is reachable through the global scope,
// neither it nor the function in its callback property will be collected. const globalWeakRef = new WeakRef({
callback() { console.log('foo'); }
});
(async function() {
globalWeakRef.deref().callback();
await new Promise((resolve, reject) => {
setTimeout(() => resolve('foo'), 42);
});
globalWeakRef.deref()?.callback();
})(); const registry = new FinalizationRegistry((heldValue) => {
console.log(heldValue);
});
(function () {
const garbage = {};
registry.register(garbage, 42);
})();Private fields introduced in V7.4 are now complemented by private methods and accessors, which use the # prefix. Example syntax shows a class with a private method, a private getter, and a private setter.
class Component {
#privateMethod() {
console.log("I'm only callable inside Component!");
}
get #privateAccessor() { return 42; }
set #privateAccessor(x) { }
}Laravel Tech Community
Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.