This renderer command line switch is intended to prevent feature
flag overrides from configuring V8 flags.
To enforce this, v8 feature flag overrides have been conditioned on
this command line switch in the following locations:
- content::RenderProcessImpl::RenderProcessImpl()
- gin::SetFeatureFlags()
This change is intended to enable consistent V8 flags at build-time
and run-time, and hence compatibility for bundled code caches.
Bug: 388577282
Change-Id: Ifd2465cf54bc8353a2f33701157bc9be538eb777
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6144831
Commit-Queue: Thomas Lukaszewicz <tluk@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1407497}
This switches from LegacyOOMErrorCallback to OOMErrorCallback, which
receives a reference to OOMDetails instead of just a boolean value.
The struct currently holds an additional (optional) "detail" string, but
might be further extended in the future.
A new crash key "v8-oom-detail" is added to capture the value of the
optional detail string on OOM crashes.
R=mlippautz@chromium.org
Bug: chromium:1323177
Change-Id: I0478f5ea4e18bba821ccc990dd4684368c2abc48
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3650439
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1004200}
V8 can post tasks to embedder worker threads using the v8::Platform API.
These tasks did not have access to the Isolate where Blink's OOM handler
was set; thus they were not getting reported to Blink as OOM. This CL
fixes the issue by initializing the V8 OOM handler globally. For
convenience, we move management of both the fatal error handler and the
OOM handler from Blink to Gin. Blink sets them once during Gin
initialization, and Gin handles setting them on V8 globally or
per-Isolate as needed.
Bug: 614440
Change-Id: I43602712272c0a5545f1a79e2c842fb0ce64439e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3576640
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Kevin Babbitt <kbabbitt@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#990208}
- Move --js-flags handling from the RenderProcessImpl constructor
to a late stage in gin::V8Initializer::Initialize where they can
override previously set flags
- Move content::switches::kJavaScriptFlags to blink::switches
- Allow blink_initializer.cc to access base::CommandLine to pass
--js-flags to V8
V8 engineers are used to provide command-line flags manually.
For local testing it can be quite confusing if the flags conflict
with finch / field trial settings.
This CL changes the priority of --js-flags to be able to override
any flags previously set by features.
V8Flags are mostly initialized in two place:
1. content::RenderProcessImpl::RenderProcessImpl
2. gin::V8Initializer::Initialize
V8 flags are per-process globals, many of them should not be changed
after initialising V8. Thus the latest safe point to set V8 flags is
in gin::V8Initializer::Initialize.
Currently some flags are set in the RenderProcessImpl constructors,
especially --js-flags is processed there. With V8::SetFlagsFromString
the last flag takes precedence. As a result chrome feature flags that
are processed (late) in gin could not be overridden with --js-flags.
Bug: v8:12309
Change-Id: I832c274e760bf9bd61f9bf3fa8d7fc00251b4685
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3208413
Reviewed-by: Wez <wez@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Elad Alon <eladalon@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Finnur Thorarinsson <finnur@chromium.org>
Owners-Override: Wez <wez@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#931522}
The V8 natives blob (natives_blob.bin) is unused and will shortly be
removed in V8. This CL removes all related infrastructure in chromium.
Specifically, this means that natives_blob.bin is no longer
1. generated during the build process,
2. installed on the target system,
3. loaded by chrome at runtime, and
4. passed to V8.
Tbr: oksamyt@chromium.org
Bug: v8:7624
Change-Id: I535d4308a8aa539c354a212174d47ade411bc89d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1847217
Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Greg Thompson <grt@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708094}
gin::V8Initializer::LoadV8SnapshotFromFD and LoadV8NativesFromFD were
accepting a base::PlatformFile owned by a File and then passing it into
MemoryMappedFile::Initialize, which constructs another owning base::File
from the PlatformFile.
Refactor the functions to take base::File instead, and delete some code
that was maintaining a cache that only ever missed.
Bug: 884034
Change-Id: I2758bc45de63ee4d34dcd5a4b806f1806e25e4f8
Reviewed-on: https://chromium-review.googlesource.com/c/1247322
Commit-Queue: Josh Gao <jmgao@google.com>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596775}
REASON OF RELAND: The issue was out of Chromium repository,
and run on only Chrome official build.
Hence I revert the chagne in merger.py, not to check
v8_context_snapshot.bin.
Original CL is https://chromium-review.googlesource.com/c/chromium/src/+/923683
This CL makes it possible to create and use V8 context snapshot
files on Android, if a developer puts "use_v8_context_snapshot=true"
The V8 context snapshot feature is currently supported and enabled on
Windows, MacOSX, and Linux (not ChromeOS), and its Finch experiment
showed 20% reduction of time to create V8 contexts.
On local Android machine, this feature shows 50% time recution.
Beside it, in order to enable the feature on cross-build platforms
like Android, we have to build Blink twice.
So this CL does not flip the flag |use_v8_context_snapshot|.
FYI, some numbers with the feature are written in the next CL;
https://chromium-review.googlesource.com/c/chromium/src/+/923623
TBR=caitkp,kuniko,nyquist,rockot,haraken,mkwst
Bug: 764576, 817288
Change-Id: Id819aa2d4762e04bd7a9b4f700603d89ee0fe5dd
Reviewed-on: https://chromium-review.googlesource.com/945248
Reviewed-by: Hitoshi Yoshida <peria@chromium.org>
Reviewed-by: Xiaohan Wang <xhwang@chromium.org>
Reviewed-by: Tao Bai <michaelbai@chromium.org>
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#540780}
This CL makes it possible to create and use V8 context snapshot
files on Android, if a developer puts "use_v8_context_snapshot=true"
The V8 context snapshot feature is currently supported and enabled on
Windows, MacOSX, and Linux (not ChromeOS), and its Finch experiment
showed 20% reduction of time to create V8 contexts.
On local Android machine, this feature shows 50% time recution.
Beside it, in order to enable the feature on cross-build platforms
like Android, we have to build Blink twice.
So this CL does not flip the flag |use_v8_context_snapshot|.
FYI, some numbers with the feature are written in the next CL;
https://chromium-review.googlesource.com/c/chromium/src/+/923623
TBR=rockot
Bug: 764576
Change-Id: I7ee8a26d350b65b196854fc9209a52fb607b580d
Reviewed-on: https://chromium-review.googlesource.com/923683
Reviewed-by: Cait Phillips <caitkp@chromium.org>
Reviewed-by: Xiaohan Wang <xhwang@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Tommy Nyquist <nyquist@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Tao Bai <michaelbai@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539558}
To make Chrome independent from snapshot_blob.bin, this CL
makes v8_context_snapshot.bin as the default snapshot.
As a background issue, if we want to use JS (=V8), we have to
load a snapshot file on most platforms. It means we have to
load either snapshot_blob.bin or v8_context_snapshot.bin.
And some unit tests, e.g. net_unittests, do not need to use
v8_context_snapshot.bin, and they don't want to depend on
blink component. (It takes very long time just to create the
snapshot.)
This CL makes it possible to load either snapshot file
depending on the order of function calls, and make dependencies
clear.
TBR=liberato
Bug: 789964
Change-Id: I4df90ed5fe7be37ab969a7f7d5db79bf572ed02a
Reviewed-on: https://chromium-review.googlesource.com/859577
Reviewed-by: Hitoshi Yoshida <peria@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#530539}
We had V8 context snapshot in C++ code regardless V8 settings,
but it introduced some complex errors.
This CL disables usages of V8 context snapshot if a GN flag
"v8_use_external_startup_data" is not true, because V8 context
snapshot depends on what is built with the flag.
Bug: 764576
Change-Id: If9b1cc497a6f6122f213b83ed2f9746d9af8bb62
Reviewed-on: https://chromium-review.googlesource.com/788631
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#519208}
gin::GetV8ExternalSnapshotData works for v8::StartupData, but it uses
const char* and int instead.
This CL adds an overloaded GetV8ExternalSnapshotData() using
v8::StartupData to simplify its arguments.
Note: Legacy style one is used in ppapi/proxy.
Bug: None
Change-Id: I4a00faba1dcedc9bd5a05dd645457e12951e3616
Reviewed-on: https://chromium-review.googlesource.com/654361
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#500809}
This is first patch which keeps renaming logical in gn, but didn't rename natives_blob.bin to arch specific name, so the v8 patch (https://codereview.chromium.org/2074283002/) could be landed afterwards without breaking anything.
BUG=620855
Review-Url: https://codereview.chromium.org/2075283003
Cr-Commit-Position: refs/heads/master@{#401005}
Reason for revert:
Added a static initializer: https://build.chromium.org/p/chromium/builders/Linux/builds/71576
# v8_initializer.cc _GLOBAL__sub_I_v8_initializer.cc+0xf
# v8_initializer.cc __cxa_atexit@plt [registers a dtor to run at exit]
Original issue's description:
> Pass both 32 and 64 bit snapshot and natives fds to child processes.
>
> Child processes are in the best position to determine which files
> to use, therefore it is simplest just to provide both 32 and 64
> bit versions from the parent.
>
> BUG=581380,455699
>
> Committed: https://crrev.com/c560d75783aca05249092dd11503b53f7b631be1
> Cr-Commit-Position: refs/heads/master@{#374371}
TBR=jochen@chromium.org,torne@chromium.org,tobiasjs@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=581380,455699
Review URL: https://codereview.chromium.org/1681003003
Cr-Commit-Position: refs/heads/master@{#374380}
Child processes are in the best position to determine which files
to use, therefore it is simplest just to provide both 32 and 64
bit versions from the parent.
BUG=581380,455699
Review URL: https://codereview.chromium.org/1665513002
Cr-Commit-Position: refs/heads/master@{#374371}
Currently V8 extras mode is set in content/renderer. In order to enable
the experimental V8 extras in webkit_unit_tests, this change moves the
initialization settings from content/renderrer to gin.
BUG=503491
Review URL: https://codereview.chromium.org/1491083002
Cr-Commit-Position: refs/heads/master@{#363458}
Used to be defined in each app's ContentBrowserClient, but since
content/ is the one that receives the FDs, it makes sense that it should
be the one to send them.
This also removes ChildProcessLauncher::AppendMappedFileCommandLineSwitches
as it is no longer needed.
Changes MemoryMappedFile::Region to be a POD so that it doesn't create require static initializers.
BUG=394502
Review URL: https://codereview.chromium.org/1185973003
Cr-Commit-Position: refs/heads/master@{#335207}
Used to be defined in each app's ContentBrowserClient, but since
content/ is the one that receives the FDs, it makes sense that it should
be the one to send them.
This also removes ChildProcessLauncher::AppendMappedFileCommandLineSwitches
as it is no longer needed.
BUG=394502
Review URL: https://codereview.chromium.org/1182443003
Cr-Commit-Position: refs/heads/master@{#334702}
We want to stop shipping the snapshot file, and instead we want
to generate it on the client. This will reduce the download size.
But since snapshot generation will be asynchronous in a utility
process, it might not be present on the first few runs of the
browser. This means we have to be able to start up without the
snapshot file (just with the natives source file). This CL
fixes Blink to cope with a missing snapshot file (V8 could
already cope).
R=rmcilroy@chromium.org, sky@chromium.org
BUG=
Review URL: https://codereview.chromium.org/1164483003
Cr-Commit-Position: refs/heads/master@{#333258}
Adds support to extension_shell and ash_shell to use external V8 snapshot files
in preparation for moving ChromeOS and ChromeCast to use this.
Re-factors the chrome_content_browser_client and
content/shell_content_browser_client to allow more reuse
of the code which opens the V8 external snapshot for child processes
by adding IsolateHolder::OpenV8FilesForChildProcesses.
This does not yet switch ChromeOS to use external V8 snapshot files -
this will be done in follow up CL https://codereview.chromium.org/1019123002.
BUG=421063
Review URL: https://codereview.chromium.org/1019483002
Cr-Commit-Position: refs/heads/master@{#323953}
isolate_holder.h is public and used by blink and therefore cannot refer to types from base. As part of porting this to other platforms we needed to load snapshots from BaseFile descriptors.
BUG=421063
Review URL: https://codereview.chromium.org/1011133006
Cr-Commit-Position: refs/heads/master@{#323886}