• Clemens Hammacher's avatar
    [wasm] Split adding code from publishing it · 25d8a157
    Clemens Hammacher authored
    This prepares a refactoring to add and publish compilation results in
    batches. For this, we need to separate the two phases, so that we can
    lock the module, allocate all the code space, release the lock, copy
    the code, lock the module, publish the code, and release the lock
    again.
    In particular, this CL does the following:
    1) It removes the {AddOwnedCode} method. The functionality of creating
       the {WasmCode} and memcpy'ing the instruction into that is done in
       the other {Add*Code} methods. Adding to {owned_code_} is done in
       {PublishCode}.
    2) {PublishInterpreterEntry} is now functionally equivalent to
       {PublishCode}, so it's removed.
    3) After {AddCode}, the caller has to call {PublishCode}. In a
       follow-up CL, this will be called in batches (first {AddCode} them
       all, then {PublishCode} them all).
    4) {AddCompiledCode} now assumes that the {WasmCompilationResult}
       succeeded. Otherwise, the caller should directly call {SetError} on
       the {CompilationState}.
    5) {PublishCode} is now the chokepoint for installing code to the code
       table, the owned code vector, the jump table, and setting interpreter
       redirections. It replaces previous direct calls to {InstallCode} or
       explicitly adding to {owned_code_}.
    6) Increasing the {generated_code_size_} counter is now done in
       {AllocateForCode}, which is the chokepoint for allocating space for
       generated code. This way, we will only increase this counter once
       once we allocate in batches.
    
    R=titzer@chromium.org
    
    Bug: v8:8916
    Change-Id: I71e02e3a838f21797915cee3ebd373804fb12237
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1530817
    Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
    Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60369}
    25d8a157
Name
Last commit
Last update
benchmarks Loading commit data...
build_overrides Loading commit data...
custom_deps Loading commit data...
docs Loading commit data...
gni Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.clang-tidy Loading commit data...
.editorconfig Loading commit data...
.git-blame-ignore-revs Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.vpython Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
ChangeLog Loading commit data...
DEPS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LICENSE.valgrind Loading commit data...
OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...
snapshot_toolchain.gni Loading commit data...