1. 24 Jan, 2017 1 commit
  2. 21 Dec, 2016 1 commit
  3. 09 Dec, 2016 1 commit
    • clemensh's avatar
      [wasm] Fix location for error in asm.js ToNumber conversion · 890d28f3
      clemensh authored
      In the asm.js code translated to wasm, we call imported functions via a
      WASM_TO_JS stub, which first calls the function and then calls ToNumber
      on the return value. Exceptions can happen in both calls.
      We were only ever reporting the location of the function call, whereas
      asm.js code executed via turbofan reported the location of the type
      coercion operator ("+" on "+foo()" or "|" on "foo()|0").
      
      This CL implements the same behaviour for asm.js code translated to
      wasm. The following is changed:
      - the AsmWasmBuilder records the parent node when descending on a binary
        operator (also "+foo()" is represented by a binary operation).
      - it stores not one location per call in the source position side
        table, but two (one for the call, one for the parent which does the
        type coercion).
      - the wasm compiler annotates the source positions "0" and "1" to the
        two calls in the WASM_TO_JS wrapper (only if the module origin is
        asm.js).
      - the StackFrame::State struct now also holds the callee_pc_address,
        which is set in ComputeCallerState. The WASM frame uses this
        information to determine whether the callee frame is WASM_TO_JS, and
        whether that frame is at the ToNumber conversion call.
      - the same information is also stored in the FrameArray which is used
        to reconstruct the stack trace later.
      
      R=titzer@chromium.org, bradnelson@chromium.org
      CC=jgruber@chromium.org
      BUG=v8:4203,v8:5724
      
      Committed: https://crrev.com/94cd46b55e24fa2bb7b06b3da4d5ba7f029bc262
      Review-Url: https://codereview.chromium.org/2555243002
      Cr-Original-Commit-Position: refs/heads/master@{#41599}
      Cr-Commit-Position: refs/heads/master@{#41613}
      890d28f3
  4. 08 Dec, 2016 2 commits
    • clemensh's avatar
      Revert of [wasm] Fix location for error in asm.js ToNumber conversion... · d3d12541
      clemensh authored
      Revert of [wasm] Fix location for error in asm.js ToNumber conversion (patchset #5 id:80001 of https://codereview.chromium.org/2555243002/ )
      
      Reason for revert:
      gc-stress failures
      
      Original issue's description:
      > [wasm] Fix location for error in asm.js ToNumber conversion
      >
      > In the asm.js code translated to wasm, we call imported functions via a
      > WASM_TO_JS stub, which first calls the function and then calls ToNumber
      > on the return value. Exceptions can happen in both calls.
      > We were only ever reporting the location of the function call, whereas
      > asm.js code executed via turbofan reported the location of the type
      > coercion operator ("+" on "+foo()" or "|" on "foo()|0").
      >
      > This CL implements the same behaviour for asm.js code translated to
      > wasm. The following is changed:
      > - the AsmWasmBuilder records the parent node when descending on a binary
      >   operator (also "+foo()" is represented by a binary operation).
      > - it stores not one location per call in the source position side
      >   table, but two (one for the call, one for the parent which does the
      >   type coercion).
      > - the wasm compiler annotates the source positions "0" and "1" to the
      >   two calls in the WASM_TO_JS wrapper (only if the module origin is
      >   asm.js).
      > - during stack trace generation (in the StackTraceIterator), when we
      >   move from the WASM_TO_JS frame to the WASM frame, we remember at which
      >   call inside the WASM_TO_JS wrapper we are, and encode this information
      >   in the generated caller state, used for the WASM frame.
      > - the same information is also stored in the FrameArray which is used
      >   to reconstruct the stack trace later.
      >
      > R=titzer@chromium.org, bradnelson@chromium.org
      > CC=jgruber@chromium.org
      > BUG=v8:4203,v8:5724
      >
      > Committed: https://crrev.com/94cd46b55e24fa2bb7b06b3da4d5ba7f029bc262
      > Cr-Commit-Position: refs/heads/master@{#41599}
      
      TBR=bradnelson@chromium.org,mstarzinger@chromium.org,titzer@chromium.org
      # Skipping CQ checks because original CL landed less than 1 days ago.
      NOPRESUBMIT=true
      NOTREECHECKS=true
      NOTRY=true
      BUG=v8:4203,v8:5724
      
      Review-Url: https://codereview.chromium.org/2563613003
      Cr-Commit-Position: refs/heads/master@{#41601}
      d3d12541
    • clemensh's avatar
      [wasm] Fix location for error in asm.js ToNumber conversion · 94cd46b5
      clemensh authored
      In the asm.js code translated to wasm, we call imported functions via a
      WASM_TO_JS stub, which first calls the function and then calls ToNumber
      on the return value. Exceptions can happen in both calls.
      We were only ever reporting the location of the function call, whereas
      asm.js code executed via turbofan reported the location of the type
      coercion operator ("+" on "+foo()" or "|" on "foo()|0").
      
      This CL implements the same behaviour for asm.js code translated to
      wasm. The following is changed:
      - the AsmWasmBuilder records the parent node when descending on a binary
        operator (also "+foo()" is represented by a binary operation).
      - it stores not one location per call in the source position side
        table, but two (one for the call, one for the parent which does the
        type coercion).
      - the wasm compiler annotates the source positions "0" and "1" to the
        two calls in the WASM_TO_JS wrapper (only if the module origin is
        asm.js).
      - during stack trace generation (in the StackTraceIterator), when we
        move from the WASM_TO_JS frame to the WASM frame, we remember at which
        call inside the WASM_TO_JS wrapper we are, and encode this information
        in the generated caller state, used for the WASM frame.
      - the same information is also stored in the FrameArray which is used
        to reconstruct the stack trace later.
      
      R=titzer@chromium.org, bradnelson@chromium.org
      CC=jgruber@chromium.org
      BUG=v8:4203,v8:5724
      
      Review-Url: https://codereview.chromium.org/2555243002
      Cr-Commit-Position: refs/heads/master@{#41599}
      94cd46b5
  5. 30 Nov, 2016 1 commit
    • clemensh's avatar
      [wasm] Remove raw byte pointers from WasmModule · 6572b562
      clemensh authored
      These byte pointers (module_start and module_end) were only valid
      during decoding. During instantiation or execution, they can get
      invalidated by garbage collection.
      This CL removes them from the WasmModule struct, and introduces a new
      ModuleStorage struct as interface to the wasm wire bytes.
      Since the storage is often needed together with the ModuleEnv, a new
      ModuleStorageEnv struct holds both a ModuleEnv and a ModuleStorage.
      The pointers in the ModuleStorage should never escape the live range of
      this struct, as they might point into a SeqOneByteString or ArrayBuffer.
      Therefore, the WasmInterpreter needs to create its own copy of the
      whole module.
      Runtime functions that previously used the raw pointers in WasmModule
      (leading to memory errors) now have to use the SeqOneByteString in the
      WasmCompiledModule.
      
      R=titzer@chromium.org
      BUG=chromium:669518
      
      Review-Url: https://codereview.chromium.org/2540133002
      Cr-Commit-Position: refs/heads/master@{#41388}
      6572b562
  6. 15 Nov, 2016 1 commit
    • clemensh's avatar
      [wasm] Allocate a single script per wasm module · 32077e01
      clemensh authored
      Before, we allocated one script per function per instance, and each
      script referenced the wasm instance and the function index. Now we only
      allocate one script per compiled wasm module, so the script also only
      references this WasmCompiledModule, which causes changes to many interfaces.
      
      Instead of fixing the disassemble API only used via debug.js, I decided
      to drop it for now. Some later CL will reintroduce it via
      DebugInterface.
      
      BUG=v8:5530,chromium:659715
      R=yangguo@chromium.org, titzer@chromium.org
      CC=jgruber@chromium.org
      
      Review-Url: https://codereview.chromium.org/2493823003
      Cr-Commit-Position: refs/heads/master@{#41004}
      32077e01
  7. 19 Oct, 2016 1 commit
    • titzer's avatar
      [wasm] Use a Managed<WasmModule> to hold metadata about modules. · 418b239f
      titzer authored
      This CL refactors the handling of metadata associated with WebAssembly
      modules to reduce the duplicate marshalling of data from the C++ world
      to the JavaScript world. It does this by wrapping the C++ WasmModule*
      object in a Foreign that is rooted from the on-heap WasmCompiledModule
      (which is itself just a FixedArray). Upon serialization, the C++ object
      is ignored and the original WASM wire bytes are serialized. Upon
      deserialization, the C++ object is reconstituted by reparsing the bytes.
      
      This is motivated by increasing complications in implementing the JS
      API, in particular WebAssembly.Table, which must perform signature
      canonicalization across instances.
      
      Additionally, this CL implements the proper base + offset initialization
      behavior for tables.
      
      R=rossberg@chromium.org,bradnelson@chromium.org,mtrofin@chromium.org,yangguo@chromium.org
      BUG=v8:5507, chromium:575167, chromium:657316
      
      Review-Url: https://chromiumcodereview.appspot.com/2424623002
      Cr-Commit-Position: refs/heads/master@{#40434}
      418b239f
  8. 17 Oct, 2016 1 commit
  9. 12 Oct, 2016 1 commit
    • clemensh's avatar
      [wasm] Provide better stack traces for asm.js code · 5d9fa102
      clemensh authored
      For the asm.js to WASM pipeline, the current stack traces only show
      low-level WASM information.
      This CL maps this back to asm.js source positions.
      It does so by attaching the asm.js source Script to the compiled WASM
      module, and emitting a delta-encoded table which maps from WASM byte
      offsets to positions within that Script. As asm.js code does not throw
      exceptions, we only store a mapping for call instructions.
      
      The new AsmJsWasmStackFrame implementation inherits from
      WasmStackFrame, but contains the logic to provide the source script and
      the position inside of it.
      What is still missing is the JSFunction object returned by
      CallSite.getFunction(). We currently return null.
      
      R=jgruber@chromium.org, titzer@chromium.org
      BUG=v8:4203
      
      Review-Url: https://codereview.chromium.org/2404253002
      Cr-Commit-Position: refs/heads/master@{#40205}
      5d9fa102
  10. 11 Oct, 2016 1 commit
  11. 27 Sep, 2016 1 commit
    • titzer's avatar
      [wasm] Master CL for Binary 0xC changes. · 28392ab1
      titzer authored
      [0xC] Convert to stack machine semantics.
      [0xC] Use section codes instead of names.
      [0xC] Add elements section decoding.
      [0xC] Decoding of globals section.
      [0xC] Decoding of memory section.
      [0xC] Decoding of imports section.
      [0xC] Decoding of exports section.
      [0xC] Decoding of data section.
      [0xC] Remove CallImport bytecode.
      [0xC] Function bodies have an implicit block.
      [0xC] Remove the bottom label from loops.
      [0xC] Add signatures to blocks.
      [0xC] Remove arities from branches.
      Add tests for init expression decoding.
      Rework compilation of import wrappers and how they are patched.
      Rework function indices in debugging.
      Fix ASM->WASM builder for stack machine.
      Reorganize asm.js foreign functions due to import indices change.
      
      R=ahaas@chromium.org,rossberg@chromium.org,bradnelson@chromium.org
      BUG=chromium:575167
      LOG=Y
      
      Committed: https://crrev.com/76eb976a67273b8c03c744f64ad850b0432554b9
      Review-Url: https://codereview.chromium.org/2345593003
      Cr-Original-Commit-Position: refs/heads/master@{#39678}
      Cr-Commit-Position: refs/heads/master@{#39795}
      28392ab1
  12. 26 Sep, 2016 1 commit
    • jgruber's avatar
      Enable component builds for fuzzers · 22606f0c
      jgruber authored
      V8 is collecting a growing amount of fuzzers, all of which take substantial
      space on the bots and in chromium build archives. This CL improves that
      situation by allowing component (shared library) builds for almost all fuzzers.
      
      The parser fuzzer is handled as an exception since it would require exporting a
      large number of additional functions.
      
      A component build results in about a 50-100x improvement in file size for each
      fuzzer (~50M-100M to around 1.1M).
      
      BUG=chromium:648864
      CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_compile_dbg_ng;master.tryserver.chromium.android:android_clang_dbg_recipe
      
      Review-Url: https://codereview.chromium.org/2360983002
      Cr-Commit-Position: refs/heads/master@{#39709}
      22606f0c
  13. 23 Sep, 2016 2 commits
    • machenbach's avatar
      Revert of [wasm] Master CL for Binary 0xC changes. (patchset #26 id:490001 of... · e1eee748
      machenbach authored
      Revert of [wasm] Master CL for Binary 0xC changes. (patchset #26 id:490001 of https://codereview.chromium.org/2345593003/ )
      
      Reason for revert:
      Main suspect for tsan:
      https://build.chromium.org/p/client.v8/builders/V8%20Linux64%20TSAN/builds/11893
      
      Also changes layout tests:
      https://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Linux%2064/builds/10036
      
      +mips builder:
      https://build.chromium.org/p/client.v8.ports/builders/V8%20Mips%20-%20builder/builds/4032
      
      Original issue's description:
      > [wasm] Master CL for Binary 0xC changes.
      >
      > [0xC] Convert to stack machine semantics.
      > [0xC] Use section codes instead of names.
      > [0xC] Add elements section decoding.
      > [0xC] Decoding of globals section.
      > [0xC] Decoding of memory section.
      > [0xC] Decoding of imports section.
      > [0xC] Decoding of exports section.
      > [0xC] Decoding of data section.
      > [0xC] Remove CallImport bytecode.
      > [0xC] Function bodies have an implicit block.
      > [0xC] Remove the bottom label from loops.
      > [0xC] Add signatures to blocks.
      > [0xC] Remove arities from branches.
      > Add tests for init expression decoding.
      > Rework compilation of import wrappers and how they are patched.
      > Rework function indices in debugging.
      > Fix ASM->WASM builder for stack machine.
      > Reorganize asm.js foreign functions due to import indices change.
      >
      > R=ahaas@chromium.org,rossberg@chromium.org,bradnelson@chromium.org
      > BUG=chromium:575167
      > LOG=Y
      >
      > Committed: https://crrev.com/76eb976a67273b8c03c744f64ad850b0432554b9
      > Cr-Commit-Position: refs/heads/master@{#39678}
      
      TBR=ahaas@chromium.org,bradnelson@chromium.org,mtrofin@chromium.org,rossberg@chromium.org,bradnelson@google.com,titzer@chromium.org
      # Skipping CQ checks because original CL landed less than 1 days ago.
      NOPRESUBMIT=true
      NOTREECHECKS=true
      NOTRY=true
      BUG=chromium:575167
      
      Review-Url: https://codereview.chromium.org/2361053004
      Cr-Commit-Position: refs/heads/master@{#39685}
      e1eee748
    • titzer's avatar
      [wasm] Master CL for Binary 0xC changes. · 76eb976a
      titzer authored
      [0xC] Convert to stack machine semantics.
      [0xC] Use section codes instead of names.
      [0xC] Add elements section decoding.
      [0xC] Decoding of globals section.
      [0xC] Decoding of memory section.
      [0xC] Decoding of imports section.
      [0xC] Decoding of exports section.
      [0xC] Decoding of data section.
      [0xC] Remove CallImport bytecode.
      [0xC] Function bodies have an implicit block.
      [0xC] Remove the bottom label from loops.
      [0xC] Add signatures to blocks.
      [0xC] Remove arities from branches.
      Add tests for init expression decoding.
      Rework compilation of import wrappers and how they are patched.
      Rework function indices in debugging.
      Fix ASM->WASM builder for stack machine.
      Reorganize asm.js foreign functions due to import indices change.
      
      R=ahaas@chromium.org,rossberg@chromium.org,bradnelson@chromium.org
      BUG=chromium:575167
      LOG=Y
      
      Review-Url: https://codereview.chromium.org/2345593003
      Cr-Commit-Position: refs/heads/master@{#39678}
      76eb976a
  14. 16 Jun, 2016 1 commit
  15. 27 Feb, 2016 1 commit
  16. 11 Dec, 2015 1 commit
    • titzer's avatar
      Initial import of v8-native WASM. · 4c5b3609
      titzer authored
      As discussed in person, this adds the code from v8-native-prototype into
      V8 proper, guarded by GYP flags that do not build the code by default.
      Passing wasm=on to 'make' or setting v8_wasm as a GYP flag activates
      building of this code.
      
      An additional header file is added to and exported from the compiler
      directory, src/compiler/wasm-compiler.h. This exposes a limited interface
      with opaque Node and Graph types to the decoder to build TF graphs, as
      well as functions to compile WASM graphs.
      
      The mjsunit tests added are blacklisted because they fail without the
      WASM object exposed to JS, which is also disabled by the build config
      option.
      
      This corresponds closely to https://github.com/WebAssembly/v8-native-prototype/commit/5981e06ebc9b1e578831d03100f17ebb77970ee0, with some formatting fixes and moving some files into src/compiler.
      
      R=mstarzinger@chromium.org, bradnelson@chromium.org
      BUG=
      
      Review URL: https://codereview.chromium.org/1504713014
      
      Cr-Commit-Position: refs/heads/master@{#32794}
      4c5b3609