Remove remainder of support for external startup data - #1758
Merged
Conversation
As per NativeScript/NativeScript#8926, this isn't supported. "heapSnapshotScript" and "heapSnapshotBlob" keys in package.json will be ignored, but I believe this isn't a breaking change because I think they were already nonfunctional. The V8 library is updated with a build configured with v8_use_external_startup_data=false, and we can remove the snapshot_blob.h files because the snapshot data no longer needs to be compiled into the runtime. The V8 artifacts were built using NativeScript/v8-buildscripts and GitHub Actions, with the following provenance: arm64: commit 0368bca, job https://github.com/NativeScript/v8-buildscripts/actions/runs/4895461273 arm: commit b074e10, job https://github.com/NativeScript/v8-buildscripts/actions/runs/4895462464 x86_64: commit a9bf41b, job https://github.com/NativeScript/v8-buildscripts/actions/runs/4895463287 x86: commit e7aa7ed, job https://github.com/NativeScript/v8-buildscripts/actions/runs/4895464030
This was primarily used by the heap snapshot code which is now removed. It was also used internally in File::ReadBinary(), but that wasn't necessary, as fopen() also handles the file not existing. In new code, it's probably a good idea to perform operations without checking if the file exists first anyway, as otherwise it can lead to race conditions if the file is deleted.
This was only used by the snapshot code, which is now removed.
Contributor
Author
|
I've updated the artifacts with information on how they were built using NativeScript/v8-buildscripts. This is ready for review/merge now. |
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.
Description
As per NativeScript/NativeScript#8926, external startup data is no longer supported. We can gain a small amount of size savings by building V8 with support for external startup data switched off.
Without the machinery to load an external snapshot from a file, nothing is using MemoryMappedFile any longer, so we can remove it. File::Exists has one remaining usage, but that usage is redundant, so we can remove it as well.
As you can see in this PR, the V8 libraries get slightly larger (30–40 kb depending on architecture) because they now include the snapshot internally. But the total size of an APK shrinks, because we don't need to link the external startup data into the runtime. I tested with a hello world app, and got -564 kb for debug, -23 kb for release.
We also don't need to separately commit
snapshot_blob.hto this repo anymore, which makes the process for modifying V8 slightly easier.The V8 artifacts added in this PR were built from my fork of v8-buildscripts, with commits from NativeScript/v8-buildscripts#2 ported to all the Android branches. Unfortunately I had to delete and recreate my fork in order to open the PR (I guess because I forked it when the repo was private?) so the jobs that created those artifacts are gone. In order to establish provenance for the artifacts, what I'd recommend is to review and merge NativeScript/v8-buildscripts#2 first and port it to the other Android branches, then we can rebuild all 4 of them and I'll update this PR with the resulting artifacts from those jobs.Related Pull Requests
Does your pull request have unit tests?
No tests; all functionality should be unchanged, except that the
heapSnapshotScriptandsnapshot.blobconfig options should now be ignored completely.