v8/test
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
..
benchmarks [test] Mark pdfjs as slow for TSAN builds 2021-07-28 14:03:46 +00:00
bigint [bigint] Define V8_ADVANCED_BIGINT_ALGORITHMS everywhere 2021-07-27 15:17:34 +00:00
cctest [api] Add API for off-thread code cache deserialization 2021-08-09 08:55:41 +00:00
common [wasm][eh] Add WebAssembly.Exception.getArg() 2021-08-03 14:25:50 +00:00
debugger [sparkplug] Add support to flush only baseline code 2021-08-04 08:22:18 +00:00
debugging
fuzzer [fuzzer][wasm] Add support for reftypes in test generator 2021-08-06 14:22:35 +00:00
fuzzilli
inspector [baseline] Update EstimateInstructionSize 2021-08-06 17:40:26 +00:00
intl [Intl] throw instead of DCHECK while long locale 2021-08-03 07:33:29 +00:00
js-perf-test A jump-table implementation for constant case switch statements 2021-06-23 09:26:23 +00:00
memory
message [wasm] Print hash of anonymous scripts in stack traces 2021-08-06 17:14:55 +00:00
mjsunit [baseline] Update EstimateInstructionSize 2021-08-06 17:40:26 +00:00
mkgrokdump
mozilla Reland "[test] Unmark TSAN tests as SLOW/SKIP" 2021-06-28 10:19:20 +00:00
test262 Fix bugs in DisplayNames v2 2021-08-06 21:37:39 +00:00
torque
unittests [api] Add API for off-thread code cache deserialization 2021-08-09 08:55:41 +00:00
wasm-api-tests [wasm] Make --wasm-trap-handler a d8-only flag 2021-06-30 09:32:55 +00:00
wasm-js [wasm] Update wasm spec tests 2021-07-08 12:46:48 +00:00
wasm-spec-tests [riscv64][wasm] Implement wasm function 2021-07-13 00:08:25 +00:00
webkit Revert "Reland "[build] Add V8-specific dcheck_always_on"" 2021-07-27 11:14:57 +00:00
BUILD.gn
OWNERS