• Andreas Haas's avatar
    [wasm][liftoff] Delay use counter decrement of PeekToRegister · 48ead1a8
    Andreas Haas authored
    This CL fixes a bug in the code generation for I32AtomicCompareExchange
    in Liftoff on ia32. The problem is the inconsistency that
    LiftoffAssembler::PeekToRegister(...) introduces to the cache state.
    PeekToRegister loads the value from the value stack into a register, but
    does not pop the value off the stack. When the value was already stored
    in a register, the use counter of that register gets decreased, even
    though the value is still on the stack.
    
    The problem arises when this register later gets reused, which is
    necessary unfortunately on ia32. When SpillRegister is called for this
    register, all stack values that are stored in this register get written
    to memory. SpillRegister uses the use counter of the register to detect
    when the register was spilled to all stack slots that were cached by
    this register. However, as described above, the value stack and the use
    counter are inconsistent at that moment, so SpillRegister finishes
    early and does not spill the register to all stack values, and this
    causes the bug later.
    
    With this CL the decrement of the use counter gets delayed until when
    the value actually gets popped off the stack.
    
    R=clemensb@chromium.org
    
    Bug: chromium:1145135
    Change-Id: I07cb256a7e5135dbce41b246c120650635ad2758
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2602464Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
    Commit-Queue: Andreas Haas <ahaas@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72018}
    48ead1a8
Name
Last commit
Last update
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...
.flake8 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...
COMMON_OWNERS Loading commit data...
DEPS Loading commit data...
DIR_METADATA Loading commit data...
ENG_REVIEW_OWNERS Loading commit data...
INFRA_OWNERS Loading commit data...
INTL_OWNERS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
MIPS_OWNERS Loading commit data...
OWNERS Loading commit data...
PPC_OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
S390_OWNERS Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...