v8/test/unittests
Leszek Swirski f888f48e4c [api] Add API for off-thread code cache deserialization
To consume a code cache off-thread

  1. The embedder creates a CachedData object wrapping the data blob.
  2. The embedder calls ScriptCompiler::StartConsumingCodeCache with the
     CachedData, and receives a ScriptCompiler::CodeCacheConsumeTask
     which takes ownership of the CachedData.
  3. The embedder calls ScriptCompiler::CodeCacheConsumeTask::Run
     on a different thread.
  4. Once this completes, the embedded passes the completed task as an
     optional argument into Source constructor, and calls Compile as
     before.

This is roughly similar to how streaming compilation works, with the
QoL improvement that Source owns the CodeCacheConsumeTask and therefore
we can reuse the same Compile method and do the off-thread finalization
behind the scenes inside Compile.

On the v8::internal side, ScriptCompiler::CodeCacheConsumeTask wraps a
v8::internal::BackgroundDeserializeTask, which has a Run and a Finish
method. The Run creates a LocalIsolate (again, similar to
BackgroundCompileTask), calls some helpers on CodeSerializer, and stores
the pre-finalization result in a OffThreadDeserializeData structure.
This stores Persistent Handles to the off-thread initialized SFI and
a vector of Scripts needing fixing up, and it owns the PersistentHandles
object which owns those Handles. Finally, the Finish method consumes
this OffThreadDeserializeData structure, fixes up Scripts, moves the
SFI Handle into the caller HandleScope, and that's it.

Since we don't yet have the source at off-thread deserialization time,
the various code cache sanity checks are done without the source hash
when deserializing, and the Finish method re-does them now that the
source is available.

Bug: chromium:1075999
Change-Id: If1faf35ba3ef840fa4e735581d0b29c96c1d5fc8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3067322
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76155}
2021-08-09 08:55:41 +00:00
..
api [api] Add API for off-thread code cache deserialization 2021-08-09 08:55:41 +00:00
asmjs
assembler Add RISC-V backend 2021-02-09 17:06:36 +00:00
base Revert "[counters] Fix reentrant timers for V8.Execute" 2021-08-06 14:31:44 +00:00
codegen Reland "[codegen] Add static interface descriptors" 2021-04-16 15:43:05 +00:00
compiler [compiler] Change all JS operators to hold TinyRefs instead of handles 2021-08-05 12:32:38 +00:00
compiler-dispatcher [cleanup] Rename CompilerDispatcher 2021-08-06 13:36:39 +00:00
date
debug Do not walk prototype chain of restricted object when displaying it in 2021-07-23 08:37:16 +00:00
diagnostics
execution CallDepthScope should track the current microtask scope 2021-04-30 14:08:49 +00:00
heap cppgc: Fix flaky crash due to used bytes counters mismatch 2021-07-29 10:11:42 +00:00
interpreter Fix most instances of -Wunreachable-code-aggressive. 2021-07-01 03:03:25 +00:00
libplatform [Jobs API]: Cleanup migration of missing Jobs pieces. 2020-09-02 20:51:29 +00:00
logging [test] Skip RuntimeCallStatsTest.GarbageCollection for gc stress tests 2021-05-31 12:10:56 +00:00
numbers [fastcall] Support JSArray as arguments 2021-06-23 14:01:40 +00:00
objects [regexp] Remove --harmony-regexp-match-indices 2021-07-22 02:28:42 +00:00
parser [cleanup] Remove DISALLOW_COPY_AND_ASSIGN in test/{common,unittests} 2020-11-06 06:07:54 +00:00
profiler [cpu-profiler] Implement basic refcounting of CodeEntry strings 2020-12-22 02:39:09 +00:00
regexp [web snapshot] Support RegExp 2021-05-14 10:27:57 +00:00
regress [heap] Remove Factory::NewUninitializedFixedArray 2021-04-26 13:52:38 +00:00
runtime Do not walk prototype chain of restricted object when displaying it in 2021-07-23 08:37:16 +00:00
strings [base] Move utils/vector.h to base/vector.h 2021-06-18 13:33:13 +00:00
tasks [test] Skip parallel compile tasks tests under off-thread 2020-11-16 15:50:20 +00:00
torque [torque] Invert the default for @generateCppClass 2021-07-21 15:21:00 +00:00
utils [base] Move utils/vector.h to base/vector.h 2021-06-18 13:33:13 +00:00
wasm [wasm] Fix initialization of block merge types 2021-08-04 10:45:20 +00:00
zone [zone] Final cleanup of zone allocations 2020-07-16 17:47:46 +00:00
BUILD.gn [api] Add API for off-thread code cache deserialization 2021-08-09 08:55:41 +00:00
DEPS
run-all-unittests.cc cppgc: Avoid initializing cppgc platform through V8 2021-02-09 08:26:11 +00:00
test-helpers.cc [runtime] Rename Builtins::Name to Builtin 1/2 2021-06-07 20:05:44 +00:00
test-helpers.h [cleanup] Remove DISALLOW_COPY_AND_ASSIGN in test/{common,unittests} 2020-11-06 06:07:54 +00:00
test-utils.cc [cleanup][test] Remove redundant NOLINT annotations 2021-04-30 11:46:14 +00:00
test-utils.h [cleanup][test] Remove redundant NOLINT annotations 2021-04-30 11:46:14 +00:00
testcfg.py
unittests.status PPC: skip some cppgc tests as PPC page size is too large 2021-07-12 20:24:14 +00:00