Title: feat!: upgrade V8 to 14.9.207.39 by edusperoni · Pull Request #1987 · NativeScript/android · GitHub
Open Graph Title: feat!: upgrade V8 to 14.9.207.39 by edusperoni · Pull Request #1987 · NativeScript/android
X Title: feat!: upgrade V8 to 14.9.207.39 by edusperoni · Pull Request #1987 · NativeScript/android
Description: Upgrades the runtime from V8 10.3.22 → 14.9.207.39. Companion to NativeScript/ios#412.
Status
Runtime test suite (API 35, arm64)
594 tests, 0 failures, 0 errors, 5 skipped
Inspector / CDP
verified end to end
Release (optimized) configuration
compiles and links
All four ABIs
built green in buildscripts CI
Size vs the current release
+2.7 MiB raw / +1.5 MB download
The five skips are the pre-existing xit()s already in the suite.
The libraries are no longer committed
./download_v8.sh installs them from the release pinned in V8_RELEASE, verifying every archive against the SHA256SUMS published with it. It is a no-op once they are in place, V8_SKIP_DOWNLOAD=1 skips it entirely, and build.sh calls it — deliberately not a Gradle task, matching how the iOS runtime treats download_llvm.sh. Keeping it out of the build means a stale or unreachable release cannot wedge an otherwise working build.
Two reasons this had to change:
The arm64-v8a and x86_64 monoliths are 100.7 MiB and 106.1 MiB, over GitHub's hard 100 MiB per-file push limit. Stripping recovers ~2%, leaving x86_64 still over.
More fundamentally, the full matrix cannot be produced on any single machine. The 32-bit ABIs need an ia32-capable host — v8config.h refuses anything else — and the Apple variants need macOS. Hand-assembled artifacts are therefore neither reproducible nor verifiable.
The vendored headers are ignored along with the libraries, not just the binaries. Keeping a copy in git is how it drifts out of step with the libraries it describes — the iOS runtime was carrying 10.3 crdtp headers against a 14.9 libcrdtp.a for exactly that reason. Sourcing both from one verified artifact makes the mismatch impossible. libzip.a and zip.h stay tracked; they are not V8.
tools/v8/vendor_inspector_sources.py stays too: it recomputes the inspector's internals by closure from the release's src-headers artifact. What the glue includes is this repo's business, not the build repo's.
V8_RELEASE pins v8-14.9.207.39-1. Contributors with a local V8 build can use V8_SKIP_DOWNLOAD=1.
What changed
Build config. JIT and WebAssembly stay on, i18n stays off — same shape as the 10.3 build. The gn args live in buildscripts now; the reasoning is in docs/knowledge/v8-14-migration.md. The one worth repeating here:
v8_array_buffer_internal_field_count / ..._view_... defaulted to 2 in 10.3 and default to 0 in 14.9. JSToJavaObjectsConverter marshals an ArrayBuffer/SharedArrayBuffer/typed array to a Java NIO buffer by calling ObjectManager::Link on the buffer object itself, and Link stores its JSInstanceInfo in internal field 0. With zero fields every such conversion throws "Trying to link invalid 'this' to a Java object" — this was the only test failure in the first full run. v8-array-buffer.h still falls back to 2 when the macro is undefined, so the gn default also put V8 and the embedder silently out of agreement.
NDK r27d → r29. Forced: V8 14.9's src/base/atomicops.h uses std::atomic_ref unconditionally and r27d ships libc++ 18, which does not implement it. The runtime compiles that header because v8_inspector vendors V8 internals. minSdk is unchanged at 21. V8 must be built against the same NDK — libc++ is only ABI-compatible with itself across a static link, and V8's bundled NDK is newer than any released one (mixing fails on std::__ndk1::__hash_memory).
API migration. Mostly mechanical — full table in the doc. The one part that is not:
PropertyCallbackInfo no longer exposes the receiver at all, and SetNativeDataProperty is not a drop-in for SetAccessor on anything inherited from. Six MetadataNode accessors live on an object other than the one they are read through — class, nullObject and static fields on the constructor, super on the implementation object, instance fields and properties on the prototype template — and are now SetAccessorProperty with FunctionTemplate-backed callbacks, whose This() is still the receiver. Static fields are the sharp edge: they have a setter, and a data-like property would let Derived.baseField = x shadow the base with an own property and silently never reach the native setter.
One guard could not be translated directly. The field accessors used thiz->StrictEquals(info.Holder()) to catch an instance field read straight off the prototype; function-backed accessors have no holder, so that is now !objectManager->IsJsRuntimeObject(thiz) — being a runtime-managed object is what actually separates an instance from the prototype. The two agree for every receiver the old check could see.
Flags. V8::Initialize() freezes the flag list and changing a flag afterwards aborts the process, so v8Flags is applied once in InitializeV8() instead of per isolate.
Performance
Measured on an arm64 emulator against the shipped 10.3 runtime, both sides arm64-v8a with the runtime C++ at the same optimization level. Best-of-3 runs, each case auto-calibrated to =120 ms.
14.9 vs 10.3
Pure JS (16 workloads)
1.26x faster geomean
Java/JNI (14 workloads)
1.09x geomean - effectively flat
WebAssembly
39x faster to compile, ~1.9x faster calls
Biggest JS wins are JSON round-trip (1.96x), float math (1.58x) and integer loops (1.46x); already-JIT-friendly property and typed-array loops are unchanged because they were already optimal on 10.3.
JNI being flat is the expected result - bridge cost is the runtime's own marshalling plus JNI, and V8 barely participates. Worth noting the absolute numbers rather than the ratio: a JNI instance call is ~540 ns against ~0.5 ns for a JS property access, on both versions.
WebAssembly works on 10.3 - every capability probe returns identically on both (sync/async compile, host imports, Memory, validate). It is not broken today, merely unused. The compile speedup was verified against a caching artifact by compiling bytes never seen before, so 39x is real rather than a cache hit.
Maglev is worth its size. Disabling it costs ~1.8x on warm, short-lived functions - the shape most app code has - while leaving peak throughput untouched, so v8_enable_maglev=false is not a good trade for 3.4 MiB.
Full tables, methodology and caveats in V8_14_PERFORMANCE_AND_SIZE.md.
Three build bugs found while measuring size
All three predate this PR and are fixed here; each is independently validated at 594/0/0/5.
The link flags were never applied (4b201927). set_target_properties(... PROPERTIES ...) takes key/value pairs, so LINK_FLAGS got only -Wl,--allow-multiple-definition while -Wl,--exclude-libs=ALL was parsed as a property name whose value was -Wl,--gc-sections, and silently discarded. The optimized runtime was exporting 72,670 dynamic symbols, 59,442 of them v8::internal::, costing 12.1 MiB of .dynstr.
The fix is a linker version script rather than --exclude-libs=ALL, so plugins linking V8's public API keep working: 1,749 symbols exported, -20.7 MB off the stripped .so. Blanket hiding would have saved only 393 KB more.
-O3 never reached a release AAR (bab7ce38). CMake appends CMAKE_CXX_FLAGS_
Open Graph Description: Upgrades the runtime from V8 10.3.22 → 14.9.207.39. Companion to NativeScript/ios#412. Status Runtime test suite (API 35, arm64) 594 tests, 0 failures, 0 errors, 5 skipped Inspector / CD...
X Description: Upgrades the runtime from V8 10.3.22 → 14.9.207.39. Companion to NativeScript/ios#412. Status Runtime test suite (API 35, arm64) 594 tests, 0 failures, 0 errors, 5 skipped Inspector / CD...
Opengraph URL: https://github.com/NativeScript/android/pull/1987
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:2b93ed79-a7de-f700-7c4d-c040947a19ea |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DACA:2C4BED:195198F:2028518:6B014607 |
| html-safe-nonce | aa1654c3047b98651d98afddec599a0e7908bc34b3c0f82aa5ddb7f93a3366a8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQUNBOjJDNEJFRDoxOTUxOThGOjIwMjg1MTg6NkIwMTQ2MDciLCJ2aXNpdG9yX2lkIjoiMzE2Njc5NzQyMzQyNzI3NDI0NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2ca017d819bedc630d8a6712616e5e7e188df9e1a40329c83185b6de3dcba0a4 |
| hovercard-subject-tag | pull_request:4136592893 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/NativeScript/android/pull/1987/files |
| twitter:image | https://avatars.githubusercontent.com/u/4061767?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/4061767?s=400&v=4 |
| og:image:alt | Upgrades the runtime from V8 10.3.22 → 14.9.207.39. Companion to NativeScript/ios#412. Status Runtime test suite (API 35, arm64) 594 tests, 0 failures, 0 errors, 5 skipped Inspector / CD... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/NativeScript/android git https://github.com/NativeScript/android.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 29137950 |
| octolytics-dimension-repository_nwo | NativeScript/android |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 29137950 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/android |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width