0
Commit Graph

41 Commits

Author SHA1 Message Date
Thomas Lukaszewicz
47141e8d6a Enforce --disallow-v8-feature-flag-overrides in the renderer
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}
2025-01-16 12:00:42 -08:00
Tom Sepez
3e537807b0 Replace const-value arguments where const-ref intended.
This is of concern when passing vectors and strings, as unintended
(and often expensive) copies occur under the covers.

-- Make non-const and move in callee where appropriate.
-- Convert to string_view where appropriate.
-- Avoid stray const in a few places

This CL was uploaded by git cl split.

R=dcheng@chromium.org, jsbell@chromium.org, vogelheim@chromium.org, yukishiino@chromium.org

Bug: 369952985
Change-Id: Ib3fce29d31e6e7ca41c1bfcd61bf3c34ebff88f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5901115
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Auto-Submit: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1363389}
2024-10-02 23:42:13 +00:00
Avi Drissman
468e51b677 Update copyright headers in gin/
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c34.

No-Try: true
Bug: 1098010
Change-Id: Iafb266228260abedd345bc3e8c1d483c3a4dc4d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3891087
Commit-Queue: Mark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1046550}
2022-09-13 20:47:01 +00:00
Clemens Backes
a1ff90cab8 [gin] Use new OOMErrorCallback with more details
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}
2022-05-17 11:18:50 +00:00
Clemens Backes
08cc5bb867 [gin] Use v8::LegacyOOMErrorCallback
The v8::OOMErrorCallback definition will be updated to contain an
additional parameter for OOM details.
https://crrev.com/c/3632305 introduced LegacyOOMErrorCallback with the
old signature. This CL updates gin to use that type, so we can deprecate
OOMErrorCallback and then update its definition.

R=mlippautz@chromium.org

Bug: chromium:1323177
Change-Id: I4101916866ed6f8ccff0d48cfcee657713cbd958
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3629365
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1001416}
2022-05-10 09:08:22 +00:00
Kevin Babbitt
7b2d15ec98 Set OOM handler during V8 initialization
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}
2022-04-08 00:35:42 +00:00
Xiaohan Wang
c696a4748e gin: Use BUILDFLAG for OS checking
Use BUILDFLAG(IS_XXX) instead of defined(OS_XXX).

Generated by `os_buildflag_migration.py` (https://crrev.com/c/3311983).

R=thakis@chromium.org

Bug: 1234043
Test: No functionality change
Change-Id: I992993b030d052e6821486adbb7f8653dd363bd8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3373825
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Owners-Override: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#956756}
2022-01-08 01:20:46 +00:00
Camillo Bruni
dcd255e349 [flags] Make --js-flags settings have priority over V8 features
- 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}
2021-10-14 15:50:05 +00:00
Scott Violet
592f4f76a9 blink/gin: changes blink to load snapshot based on runtime information
In order to do an experiment (finch) that measures the impact of
switching from v8-snapshot to blink context-snapshot I need to support
both at the same time. This patch changes gin to store the type of
snapshot that was loaded, and blink to use that information rather
than ifdefs.

BUG=764576,1257321
TEST=none

Change-Id: I56db96937ef22ddf1c91975a9a4dc355c1c7559c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3212165
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Richard Coles <torne@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/main@{#930573}
2021-10-12 16:01:55 +00:00
Dan Elphick
05acd60b25 Use fine-grained v8 headers in gin
Now that v8.h has been split into many parts, include only the parts
that are needed.

Bug: v8:11965
Change-Id: Id7557c588354a88533268d51f5fcdfc4fe29a733
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3122173
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Dan Elphick <delphick@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#916424}
2021-08-30 15:22:07 +00:00
Jakob Gruber
dfa06417b4 Remove all infrastructure for the V8 natives blob
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}
2019-10-22 04:40:39 +00:00
peterwmwong
d9cbb39799 v8: Remove obsolete V8 extras flag
Bug: chromium:920347
Tbr: avi@chromium.org,rdevlin.cronin@chromium.org,mmenke@chromium.org,thestig@chromium.org
Change-Id: I6334a195d4804e07563c9a61fe771e005234b134
Reviewed-on: https://chromium-review.googlesource.com/c/1404554
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#621611}
2019-01-10 16:58:28 +00:00
Josh Gao
79f75279db Fix fd ownership mismanagement in V8 initialization.
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}
2018-10-04 18:37:45 +00:00
Hitoshi Yoshida
06697237ec Reland: bindings: Prepare V8ContextSnapshot on Android
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}
2018-03-05 04:09:15 +00:00
Eric Stevenson
e86e465cd0 Revert "bindings: Prepare V8ContextSnapshot on Android"
This reverts commit 31b8b46586.

Reason for revert: Breaks downstream apk merging (https://crbug.com/817288)

Original change's description:
> bindings: Prepare V8ContextSnapshot on Android
>
> 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}

TBR=michaelbai@chromium.org,caitkp@chromium.org,peria@chromium.org,kinuko@chromium.org,xhwang@chromium.org,nyquist@chromium.org,rmcilroy@chromium.org,rockot@chromium.org,haraken@chromium.org,mkwst@chromium.org

Change-Id: Ifc644f2fdffbbdad3607e6eb0e867f283e80ff68
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 764576, 817288
Reviewed-on: https://chromium-review.googlesource.com/941387
Commit-Queue: Eric Stevenson <estevenson@chromium.org>
Reviewed-by: Eric Stevenson <estevenson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539937}
2018-02-28 19:59:20 +00:00
Hitoshi Yoshida
31b8b46586 bindings: Prepare V8ContextSnapshot on Android
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}
2018-02-27 22:13:48 +00:00
Hitoshi Yoshida
9aff02e57f gin: Make v8_context_snapshot.bin as a default snapshot blob
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}
2018-01-19 16:55:03 +00:00
Hitoshi Yoshida
ba9c2f0f30 gin: Hide V8 context snapshot behind a build flag
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}
2017-11-27 03:11:46 +00:00
Hitoshi Yoshida
d88a223e38 bindings: Use v8::StartupData in GetV8ExternalSnapshotData's arguments
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}
2017-09-10 05:55:25 +00:00
Hitoshi Yoshida
129ff2b945 gin: refactor: Simplify some methods in gin/v8_initializer
This CL does 3 refactorings in gin/v8_initializer.{cc,h}.
1. Unify OpenFileIfNecessary() and GetOpenFile()
2. Factor out GetMappedFileData()
3. Remove unused methods; GetOpenXXXForChildProcesses()

Bug: None
Change-Id: I24816e8e1e10f3e054bc8c90ac3dfa2708a194f2
Reviewed-on: https://chromium-review.googlesource.com/628004
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#496920}
2017-08-24 02:19:10 +00:00
Hitoshi Yoshida
f2f50dec16 (Reland)[Bindings] Create and use V8 context snapshots.
This CL does two things.

1. In compile time, creates a snapshot file, which consists of V8 contexts.
2. Creates v8::Context from the snapshot in LocalWindowProxy::CreateContext().

We expect this speeds up context creation for 3 times faster on Android.
Detailed information is described in the design doc [1].

[1] Design doc: https://docs.google.com/document/d/1jpQQX0piaxcHJPWakp_Kr_03g5Gnma5h5-Kdlqu7jVQ/edit#heading=h.k6iklq6rvd30

This CL is a re-land of https://chromium-review.googlesource.com/c/594608/
Test expectations are changed due to http://crbug.com/705364

TBR=rkc, jochen, dchen, kinuko, eroman, thakis

BUG: 588893, 617892, 705364
Change-Id: I2065fbf13991cddac3e9586beb6aecd879b1ad36
Reviewed-on: https://chromium-review.googlesource.com/623287
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Reviewed-by: Hitoshi Yoshida <peria@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#496290}
2017-08-22 13:23:55 +00:00
Max Morin
f0d13c9a82 Revert "(Reland)[Bindings] Create and use V8 context snapshots."
This reverts commit f6a5016d03.

Reason for revert: Speculative revert for failing webkit tests at https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux%20Trusty%20%28dbg%29/builds/4057.

Original change's description:
> (Reland)[Bindings] Create and use V8 context snapshots.
> 
> This CL does two things.
> 
> 1. In compile time, creates a snapshot file, which consists of V8 contexts.
> 2. Creates v8::Context from the snapshot in LocalWindowProxy::CreateContext().
> 
> We expect this speeds up context creation for 3 times faster on Android.
> Detailed information is described in the design doc [1].
> 
> 
> [1] Design doc: https://docs.google.com/document/d/1jpQQX0piaxcHJPWakp_Kr_03g5Gnma5h5-Kdlqu7jVQ/edit#heading=h.k6iklq6rvd30
> 
> 
> This CL is a re-land of https://chromium-review.googlesource.com/c/594608/
> Test expectations are changed due to http://crbug.com/705364
> 
> BUG=588893, 617892, 705364
> TBR=rkc, jochen, dchen, kinuko, eroman, thakis
> 
> Change-Id: I8e98ff881a2219380edc3c48de38bc661c139fb1
> Reviewed-on: https://chromium-review.googlesource.com/596167
> Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
> Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Kentaro Hara <haraken@chromium.org>
> Reviewed-by: Hitoshi Yoshida <peria@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#495105}

TBR=rkc@chromium.org,dcheng@chromium.org,peria@chromium.org,kinuko@chromium.org,thakis@chromium.org,eroman@chromium.org,yukishiino@chromium.org,haraken@chromium.org,yangguo@chromium.org,jochen@chromium.org

Change-Id: I1050b0b84372ec683f3409ef77b9e9c45e39528f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 588893, 617892, 705364
Reviewed-on: https://chromium-review.googlesource.com/618746
Reviewed-by: Max Morin <maxmorin@chromium.org>
Commit-Queue: Max Morin <maxmorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#495122}
2017-08-17 10:04:59 +00:00
Hitoshi Yoshida
f6a5016d03 (Reland)[Bindings] Create and use V8 context snapshots.
This CL does two things.

1. In compile time, creates a snapshot file, which consists of V8 contexts.
2. Creates v8::Context from the snapshot in LocalWindowProxy::CreateContext().

We expect this speeds up context creation for 3 times faster on Android.
Detailed information is described in the design doc [1].


[1] Design doc: https://docs.google.com/document/d/1jpQQX0piaxcHJPWakp_Kr_03g5Gnma5h5-Kdlqu7jVQ/edit#heading=h.k6iklq6rvd30


This CL is a re-land of https://chromium-review.googlesource.com/c/594608/
Test expectations are changed due to http://crbug.com/705364

BUG=588893, 617892, 705364
TBR=rkc, jochen, dchen, kinuko, eroman, thakis

Change-Id: I8e98ff881a2219380edc3c48de38bc661c139fb1
Reviewed-on: https://chromium-review.googlesource.com/596167
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Hitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#495105}
2017-08-17 08:13:59 +00:00
Jan Krcal
9f043c3f6c Revert "(Reland)[Bindings] Create and use V8 context snapshots."
This reverts commit 59784d15a1.

Reason for revert: it breaks compilation (linking of v8_context_snapshot_generator), see https://build.chromium.org/p/chromium.chrome/builders/Google%20Chrome%20Linux%20x64/builds/19741

Original change's description:
> (Reland)[Bindings] Create and use V8 context snapshots.
> 
> This CL does two things.
> 
> 1. In compile time, creates a snapshot file, which consists of V8 contexts.
> 2. Creates v8::Context from the snapshot in LocalWindowProxy::CreateContext().
> 
> We expect this speeds up context creation for 3 times faster on Android.
> Detailed information is described in the design doc [1].
> 
> 
> [1] Design doc: https://docs.google.com/document/d/1jpQQX0piaxcHJPWakp_Kr_03g5Gnma5h5-Kdlqu7jVQ/edit#heading=h.k6iklq6rvd30
> 
> 
> This CL is a re-land of https://codereview.chromium.org/2841443005 (and the 1st patch is same with it)
> Test expectations are changed due to http://crbug.com/705364
> 
> BUG=588893, 617892, 705364
> TBR=rkc, jochen, dchen, kinuko, eroman, thakis
> 
> Change-Id: If85e68a6498f7d35a0c59f4af9323ba72fc36d5f
> Reviewed-on: https://chromium-review.googlesource.com/594608
> Reviewed-by: Hitoshi Yoshida <peria@chromium.org>
> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
> Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
> Reviewed-by: Kentaro Hara <haraken@chromium.org>
> Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#490955}

TBR=rkc@chromium.org,dcheng@chromium.org,peria@chromium.org,kinuko@chromium.org,thakis@chromium.org,eroman@chromium.org,yukishiino@chromium.org,haraken@chromium.org,jochen@chromium.org

Change-Id: I67f166ae37b2103100c066334586a3b49a3a21e1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 588893, 617892, 705364
Reviewed-on: https://chromium-review.googlesource.com/596087
Reviewed-by: Jan Krcal <jkrcal@chromium.org>
Commit-Queue: Jan Krcal <jkrcal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#490973}
2017-08-01 13:50:48 +00:00
Hitoshi Yoshida
59784d15a1 (Reland)[Bindings] Create and use V8 context snapshots.
This CL does two things.

1. In compile time, creates a snapshot file, which consists of V8 contexts.
2. Creates v8::Context from the snapshot in LocalWindowProxy::CreateContext().

We expect this speeds up context creation for 3 times faster on Android.
Detailed information is described in the design doc [1].


[1] Design doc: https://docs.google.com/document/d/1jpQQX0piaxcHJPWakp_Kr_03g5Gnma5h5-Kdlqu7jVQ/edit#heading=h.k6iklq6rvd30


This CL is a re-land of https://codereview.chromium.org/2841443005 (and the 1st patch is same with it)
Test expectations are changed due to http://crbug.com/705364

BUG=588893, 617892, 705364
TBR=rkc, jochen, dchen, kinuko, eroman, thakis

Change-Id: If85e68a6498f7d35a0c59f4af9323ba72fc36d5f
Reviewed-on: https://chromium-review.googlesource.com/594608
Reviewed-by: Hitoshi Yoshida <peria@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#490955}
2017-08-01 13:02:27 +00:00
blundell
45b25591b1 Revert of [Bindings] Create and use V8 context snapshots (patchset id:520001 of https://codereview.chromium.org/2841443005/ )
Reason for revert:
Causes compile to fail on MSAN because of usage
of uninitialized memory:

https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Fchromium.webkit%2FWebKit_Linux_Trusty_MSAN%2F2265%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout

Original issue's description:
> Create and use V8 context snapshots.
>
> This CL does two things.
>
> 1. In compile time, creates a snapshot file, which consists of V8 contexts.
> 2. Creates v8::Context from the snapshot in LocalWindowProxy::CreateContext().
>
> We expect this speeds up context creation for 3 times faster on Android.
> Detailed information is described in the design doc [1].
>
>
> [1] Design doc: https://docs.google.com/document/d/1jpQQX0piaxcHJPWakp_Kr_03g5Gnma5h5-Kdlqu7jVQ/edit#heading=h.k6iklq6rvd30
>
>
>
> Test expectations are changed due to http://crbug.com/705364
>
> BUG=588893, 617892, 705364
>
> Review-Url: https://codereview.chromium.org/2841443005
> Cr-Commit-Position: refs/heads/master@{#490329}
> Committed: 54afe29f86

TBR=jochen@chromium.org,agrieve@chromium.org,brettw@chromium.org,dcheng@chromium.org,eroman@chromium.org,haraken@chromium.org,jam@chromium.org,mlippautz@chromium.org,rkc@chromium.org,thakis@chromium.org,yukishiino@chromium.org,kinuko@chromium.org,peria@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=588893, 617892, 705364

Review-Url: https://codereview.chromium.org/2989793003
Cr-Commit-Position: refs/heads/master@{#490339}
2017-07-28 09:48:17 +00:00
peria
54afe29f86 Create and use V8 context snapshots.
This CL does two things.

1. In compile time, creates a snapshot file, which consists of V8 contexts.
2. Creates v8::Context from the snapshot in LocalWindowProxy::CreateContext().

We expect this speeds up context creation for 3 times faster on Android.
Detailed information is described in the design doc [1].

[1] Design doc: https://docs.google.com/document/d/1jpQQX0piaxcHJPWakp_Kr_03g5Gnma5h5-Kdlqu7jVQ/edit#heading=h.k6iklq6rvd30

Test expectations are changed due to http://crbug.com/705364

BUG=588893, 617892, 705364

Review-Url: https://codereview.chromium.org/2841443005
Cr-Commit-Position: refs/heads/master@{#490329}
2017-07-28 08:55:22 +00:00
michaelbai
020375884d Remove natives_blob.bin's arch dependence.
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}
2016-06-21 16:09:42 +00:00
tobiasjs
b2001627a9 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=581409,455699

Committed: https://crrev.com/c560d75783aca05249092dd11503b53f7b631be1
Cr-Commit-Position: refs/heads/master@{#374371}

Review URL: https://codereview.chromium.org/1665513002

Cr-Commit-Position: refs/heads/master@{#374643}
2016-02-10 11:56:11 +00:00
thakis
09ea387c32 Revert of Pass both 32 and 64 bit snapshot and natives fds to child processes. (patchset id:40001 of https://codereview.chromium.org/1665513002/ )
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}
2016-02-09 15:37:57 +00:00
tobiasjs
c560d75783 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

Review URL: https://codereview.chromium.org/1665513002

Cr-Commit-Position: refs/heads/master@{#374371}
2016-02-09 14:24:04 +00:00
avi
90e658dde8 Switch to standard integer types in gin/.
BUG=138542
TBR=aa@chromium.org
Switch to standard integer types in gin/.

BUG=138542
TBR=aa@chromium.org

Review URL: https://codereview.chromium.org/1541743002

Cr-Commit-Position: refs/heads/master@{#366345}
2015-12-21 07:17:28 +00:00
yhirano
93150242a4 Set V8 extras mode in gin::V8Initializer.
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}
2015-12-07 12:29:43 +00:00
agrieve
fd2d44abf3 Take 2: Moved logic for mapping child process FDs for ICU and V8 into child_process_launcher.cc
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}
2015-06-19 04:33:36 +00:00
mek
39ae215990 Revert of Moved logic for mapping child process FDs for ICU and V8 into child_process_launcher.cc (patchset id:380001 of https://codereview.chromium.org/1182443003/)
Reason for revert:
Adds new static initializers in http://build.chromium.org/p/chromium/buildstatus?builder=Linux%20x64&number=4979

# icu_util.cc cc::VertexShaderQuadAA::VertexShaderQuadAA()
# icu_util.cc base::MemoryMappedFile::MemoryMappedFile()
# icu_util.cc base::i18n::(anonymous namespace)::g_icudtl_region
# icu_util.cc base::i18n::(anonymous namespace)::g_icudtl_mapped_file
# icu_util.cc operator new(unsigned long)

Original issue's description:
> Moved logic for mapping child process FDs for ICU and V8 into child_process_launcher.cc
>
> 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
>
> Committed: https://crrev.com/228414fc8870f88f11ada7512e88ea6999890f56
> Cr-Commit-Position: refs/heads/master@{#334702}

TBR=jochen@chromium.org,jam@chromium.org,jungshik@google.com,michaelbai@chromium.org,rmcilroy@chromium.org,thestig@chromium.org,agrieve@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=394502

Review URL: https://codereview.chromium.org/1187213002

Cr-Commit-Position: refs/heads/master@{#334719}
2015-06-16 22:32:31 +00:00
agrieve
228414fc88 Moved logic for mapping child process FDs for ICU and V8 into child_process_launcher.cc
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}
2015-06-16 21:40:36 +00:00
erikcorry
c94eff1e7e Allow startup with missing V8 snapshot file.
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}
2015-06-08 11:30:00 +00:00
agrieve
d31dd3fc2f Delete constant declarations from v8_initializer.h that have no definitions
BUG=

Review URL: https://codereview.chromium.org/1157383004

Cr-Commit-Position: refs/heads/master@{#331950}
2015-05-29 12:55:54 +00:00
jochen
a0b121b54f Pass the ArrayBuffer::Allocator via the Isolate::CreateParams
BUG=none
R=dcarney@chromium.org

Review URL: https://codereview.chromium.org/1110333003

Cr-Commit-Position: refs/heads/master@{#327699}
2015-04-30 12:56:51 +00:00
rmcilroy
54fab5e3b8 Add support to extension_shell and ash_shell to use external V8 snapshot files.
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}
2015-04-06 21:15:46 +00:00
oth
05c26fde42 Move V8 snapshot loading code from isolate_holder to gin/v8_startup_data.{h,cc}.
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}
2015-04-05 14:31:16 +00:00