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.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
New Features in V8 8.4: WebAssembly Enhancements, WeakRefs, and Private Methods

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) { }
}
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavaScriptWebAssemblyV8weakrefPrivateMethods
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.