• Ng Zhi An's avatar
    [wasm] Fix wasm decoder for multi-byte opcodes · b48b82e7
    Ng Zhi An authored
    SIMD opcodes consist of the prefix byte, then an LEB128 encoded int. We
    were decoding this incorrectly as a fixed uint8. This fixes the decoder
    to properly handle multi bytes.
    
    In some cases, the multi byte logic is applied to all prefixed opcodes.
    This is not a problem, since for values < 0x80, the LEB encoding is a
    single byte, and decodes to the same int. If the prefix opcode has
    instructions with index >= 0x80, it would be required to be LEB128
    encoded anyway.
    
    There are a bunch of trivial changes to test-run-wasm-simd, to change
    the macro from BUILD to BUILD_V, the former only works for single byte
    opcodes, the latter is a new template-based macro that correct handles
    multi-byte opcodes. The only unchanged test is the shuffle fuzzer test,
    which builds its own sequence of bytes without using the BUILD macro.
    
    Bug: v8:10258
    Change-Id: Ie7377e899a7eab97ecf28176fd908babc08d0f19
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2118476
    Commit-Queue: Zhi An Ng <zhin@chromium.org>
    Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
    Reviewed-by: 's avatarDeepti Gandluri <gdeepti@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#67186}
    b48b82e7
function-body-decoder-impl.h 117 KB