• mtrofin's avatar
    [wasm] reuse the first compiled module. · b4dc310a
    mtrofin authored
    This change avoids needing to keep around an unused compiled
    module. Instead, the result of compiling the wasm bytes is
    given to the first instance. The module object and that instance object
    point to the same compiled module. Instances are, then, cloned from
    the compiled module the module object points to. When an instance is
    collected, we make sure that the module object still has a clone
    available, and, if the last instance is GC-ed, we also reset the compiled
    module so that it does not reference its heap, so that it (==heap) may
    be collected.
    
    This is achieved by linking the clones in a double-linked list and
    registering a finalizer for each. When we create an instance, we tie it
    in the front of the list, making the module object point to it (O(1)). When
    the finalizer is called, we relink the list over the dying object (O(1)). The
    costliest operation is finalizing the last instance, since we need to visit
    all wasm functions and reset heap references.
    
    BUG=v8:5316
    
    Committed: https://crrev.com/01f5af515728aebe6c5246f4f7dd6c573e8748af
    Review-Url: https://codereview.chromium.org/2305903002
    Cr-Original-Commit-Position: refs/heads/master@{#39153}
    Cr-Commit-Position: refs/heads/master@{#39361}
    b4dc310a
Name
Last commit
Last update
..
embenchen Loading commit data...
OWNERS Loading commit data...
adapter-frame.js Loading commit data...
asm-wasm-copy.js Loading commit data...
asm-wasm-deopt.js Loading commit data...
asm-wasm-f32.js Loading commit data...
asm-wasm-f64.js Loading commit data...
asm-wasm-heap.js Loading commit data...
asm-wasm-i32.js Loading commit data...
asm-wasm-literals.js Loading commit data...
asm-wasm-stdlib.js Loading commit data...
asm-wasm-switch.js Loading commit data...
asm-wasm-u32.js Loading commit data...
asm-wasm.js Loading commit data...
calls.js Loading commit data...
compiled-module-management.js Loading commit data...
compiled-module-serialization.js Loading commit data...
debug-disassembly.js Loading commit data...
divrem-trap.js Loading commit data...
ensure-wasm-binaries-up-to-date.js Loading commit data...
export-table.js Loading commit data...
ffi-error.js Loading commit data...
ffi.js Loading commit data...
frame-inspection.js Loading commit data...
function-names.js Loading commit data...
function-prototype.js Loading commit data...
gc-frame.js Loading commit data...
grow-memory.js Loading commit data...
import-table.js Loading commit data...
incrementer.wasm Loading commit data...
indirect-calls.js Loading commit data...
instantiate-module-basic.js Loading commit data...
instantiate-run-basic.js Loading commit data...
module-memory.js Loading commit data...
no-wasm-by-default.js Loading commit data...
parallel_compilation.js Loading commit data...
params.js Loading commit data...
receiver.js Loading commit data...
regression-644682.js Loading commit data...
stack.js Loading commit data...
stackwalk.js Loading commit data...
start-function.js Loading commit data...
test-import-export-wrapper.js Loading commit data...
test-wasm-module-builder.js Loading commit data...
trap-location.js Loading commit data...
unicode-validation.js Loading commit data...
unreachable.js Loading commit data...
verify-function-basic-errors.js Loading commit data...
verify-function-simple.js Loading commit data...
verify-module-basic-errors.js Loading commit data...
wasm-constants.js Loading commit data...
wasm-module-builder.js Loading commit data...
wasm-object-api.js Loading commit data...