• Andreas Haas's avatar
    [wasm] Construct WasmExportedFunctions for table elements lazily · 27540226
    Andreas Haas authored
    We have to create WasmExportedFunction objects for any WebAssembly
    function which may escape a WebAssembly instance. Up until now we
    created these WasmExportedFunction objects eagerly during instantiation
    time: for any exported function, and any element in an exported table we
    create such an object.
    
    With the anyref proposal, the table.get instruction can allow any
    function in a table to escape its instance. Therefore we would have to
    create a WasmExportedFunction object for any function which is put into
    a table.
    
    With this CL we create WasmExportedFunctions for table entries lazily.
    We initialize tables with placeholders consisting of the instance and
    the function index. If we encounter a placeholder in table.get, we
    create the WasmExportedFunction for the expected function to return it.
    
    R=mstarzinger@chromium.org
    CC=titzer@chromium.org
    
    Bug: v8:7581
    Change-Id: I4f32bd7433285d0b04a22c0fb70b736bac55b3f1
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1505575Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
    Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
    Commit-Queue: Andreas Haas <ahaas@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60115}
    27540226
module-instantiate.cc 68 KB