• Enrico Bacis's avatar
    [wasm] Fix grow-memory on exported memory · 8ee06838
    Enrico Bacis authored
    The WASM spec maximum memory size is higher than internal V8 maximum object
    size. When a memory object grows above this limit (and only in that case), we
    should signal an error.
    
    This worked for not-exported memory; however when growing exported memory, the
    code was comparing the V8 memory limit with the maximum number of pages defined
    in the module, instead of the current number of pages + the number of new
    required pages. This lead to signaling errors even when growing exported memory
    below the V8 limit if the maximum number of pages specified in the module was
    higher than the V8 limit.
    
    GrowMemoryBuffer already checks that we do not grow a memory buffer past the
    maximum size specified as parameter, so we can pass it the minimum between the
    the V8 limit and the maximum number of pages specified in the module.
    
    This CL introduces a test in test/mjsunit/wasm/import-memory.js that triggers
    the problematic path and a patch to fix it.
    
    R=ahaas@chromium.org,clemensh@chromium.org,gdeepti@chromium.org
    
    Change-Id: I5a8da420418b394d61e1ba3cdf4408c3c09e61b6
    Reviewed-on: https://chromium-review.googlesource.com/600217Reviewed-by: 's avatarDeepti Gandluri <gdeepti@chromium.org>
    Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
    Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
    Commit-Queue: Enrico Bacis <enricobacis@google.com>
    Cr-Commit-Position: refs/heads/master@{#47395}
    8ee06838
Name
Last commit
Last update
..
benchmarks Loading commit data...
cctest Loading commit data...
common Loading commit data...
debugger Loading commit data...
fuzzer Loading commit data...
inspector Loading commit data...
intl Loading commit data...
js-perf-test Loading commit data...
memory Loading commit data...
message Loading commit data...
mjsunit Loading commit data...
mkgrokdump Loading commit data...
mozilla Loading commit data...
preparser Loading commit data...
promises-aplus Loading commit data...
test262 Loading commit data...
unittests Loading commit data...
wasm-spec-tests Loading commit data...
webkit Loading commit data...
BUILD.gn Loading commit data...
bot_default.gyp Loading commit data...
bot_default.isolate Loading commit data...
default.gyp Loading commit data...
default.isolate Loading commit data...
optimize_for_size.gyp Loading commit data...
optimize_for_size.isolate Loading commit data...
perf.gyp Loading commit data...
perf.isolate Loading commit data...