Repository navigation
Move the JavaScript frontend onto unibind, and ship a SpiderMonkey build - #46
Open
ResurrectedTrader wants to merge 1 commit into
Open
ResurrectedTrader wants to merge 1 commit into
ResurrectedTrader wants to merge 1 commit into
Conversation
This was referenced Sep 23, 2026
ResurrectedTrader
force-pushed
the
unibind
branch
2 times, most recently
from
September 24, 2026 12:00
233e3ab to
22335ef
Compare
The frontend compiles against unibind's headers (ub::) instead of V8's, so the same library links into a V8 DLL and a SpiderMonkey one; which engine a DLL runs is decided by the unibind backend and engine its DLL project links. No engine header remains in the frontend. The code keeps main's plain-V8 shape with unibind types in place of V8's: - Bindings are declared through api::ClassBase over ub::Class, and the api/core helpers (Convert, Extract, Error, Function) work in unibind values. Class properties are declared on the instance template, so they stay own properties of each instance, as on main. - Events build their arguments in MakeArgs(const ub::Context&) and run their handlers in Execute(context, fns); timers hold a ub::Global<ub::Function>; drawable click/hover events resolve the handler on the script thread; a broadcast argument that cannot be cloned arrives as undefined. - Engine::GetPlatform() owns the ub::Platform, with one fault handler for both engines. The console reads ub::HeapStatistics and the backend's name and version directly. - Script owns its ScriptInspector directly; ub::Inspector is null on an engine without one (SpiderMonkey), and the server and the console's debugging settings are used only where ub::Inspector::Supported(). - Teardown collects until every wrapper is finalized and reports what is still referenced before the isolate goes, and waits for other holders of the isolate without spinning. - FetchUnibind and FetchSpiderMonkey sit beside FetchV8, through one fetch script; the V8 DLL project is d2bs-v8 and a d2bs-sm project builds the SpiderMonkey DLL, both as d2bs.dll in their own directory. - THIRD-PARTY-NOTICES.txt ships with each release, and analytics records which engine a session runs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ResurrectedTrader
force-pushed
the
unibind
branch
from
September 26, 2026 21:26
22335ef to
8441aa0
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves the JavaScript frontend off V8's API onto unibind (
ub::), a V8-shaped embedding API over V8 and SpiderMonkey. The frontend compiles once against unibind's headers - no engine header anywhere in the tree - and the engine is chosen when a DLL project links it:d2bs-v8.vcxprojunibind_backend_v8.lib+ V8 15.6.8Release\js-v8-lod114d\d2bs.dll, released asd2bs.dlld2bs-sm.vcxprojunibind_backend_spidermonkey.lib+ SpiderMonkey 153.3.0esrRelease\js-sm-lod114d\d2bs.dll, released asd2bs-spidermonkey.zipWhat changed
The renames (#47, #48) and the return to plain V8 (#49) landed first, so this diff is the migration alone, and it keeps main's shape with unibind types in place of V8's:
api::ClassBaseoverub::Class(api/core/Class.h), and theapi/core/{Convert,Extract,Error,Function}.hhelpers work in unibind values. Class properties are declared on the instance template, so they stay own properties of each instance, as on main.MakeArgs(const ub::Context&),Execute(context, fns)with the handler loop inline, timers holding aub::Global<ub::Function>, drawable click/hover handlers resolved on the script thread, and the same lenient broadcast serialisation.Engine::GetPlatform()owns theub::Platform, with one fault handler for both engines (fatal errors, V8 DCHECKs and SpiderMonkeyMOZ_CRASHall arrive asEngineFault::Fatal). The console readsub::HeapStatisticsandub::Platform::BackendName()/BackendVersion()directly.Scriptowns itsScriptInspectordirectly, as on main.ub::Inspectoris null on SpiderMonkey, which has none; the server is started, and the console's debugging settings shown, only whereub::Inspector::Supported().FetchUnibindandFetchSpiderMonkeysit besideFetchV8, through onescripts/fetch_archive.ps1(unibind's archive is checked against its published SHA-256). The backend no longer compiles against V8. CI and the release build and ship both DLLs.scripts/check_compile.ps1: compile one frontend file for errors without MSBuild.src/runtimeind2bs::runtime::*namespaces, both DLL projects live undersrc/dlls/(js-v8-lod114d,js-sm-lod114d),lint.ps1finds a project's compile database by itsTargetName(both DLL projects buildd2bs.dll), andgen_enum_names.pyparses against unibind's headers instead of V8's.JS-visible differences
The extracted API surface (
api.json: every class, member, readonly flag, constructability, global, constant,memember and event) is identical to v2.1.6's; only two descriptions now say "the engine" where they said "V8". Behaviour that differs:Object.getOwnPropertyDescriptorshowsget/set, assigning to a read-only one throws in strict code (it used to silently replace the value), and reading one throughObject.create(unit)throwsIllegal invocation.TypeError: Illegal invocationinstead of crashing.remove()(it used to readundefined); writes do nothing.getDialogLines()handlers are not constructable (new handler()throws).main(), insidedelay()), not whenever a native call returns.ArrayBufferView;sendPackettakes anArrayBufferor typed array as before.:0:rather than:-1:; syntax errors now report file, line and the offending source line.Verification
build.ps1 Release(both DLLs, no linker warnings),build.ps1 Release -Platform x64,build.ps1 test(157/157),check-format,lint(126/126) - all clean, with unibind 0.6.3 fetched from its release.extract_api.py: API surface identical to v2.1.6.copyObj(for...in+hasOwnProperty) copied nothing; and script teardown spun a core for ever when DevTools was enabled. unibind 0.6.2 / 0.6.3 also made wrapping an object with many members (copyUnit,getUnit) fast on SpiderMonkey. The SpiderMonkey DLL still needs its live run, and this rebuilt branch a fresh one on V8.Licensing and analytics
THIRD-PARTY-NOTICES.txt(every component's own licence text, and the SpiderMonkey source location MPL-2.0 asks for) ships with each release: besided2bs.dlland insided2bs-spidermonkey.zip.session_startrecordsengine/engineVersion; theinspectorfeature tag counts only where the engine has a debugger (docs/analytics.md).🤖 Generated with Claude Code