1. 14 Apr, 2018 1 commit
    • Jakob Kummerow's avatar
      [ubsan] Change Address typedef to uintptr_t · 2459046c
      Jakob Kummerow authored
      The "Address" type is V8's general-purpose type for manipulating memory
      addresses. Per the C++ spec, pointer arithmetic and pointer comparisons
      are undefined behavior except within the same array; since we generally
      don't operate within a C++ array, our general-purpose type shouldn't be
      a pointer type.
      
      Bug: v8:3770
      Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;master.tryserver.blink:linux_trusty_blink_rel
      Change-Id: Ib96016c24a0f18bcdba916dabd83e3f24a1b5779
      Reviewed-on: https://chromium-review.googlesource.com/988657
      Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
      Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#52601}
      2459046c
  2. 16 Mar, 2018 1 commit
  3. 19 Dec, 2017 3 commits
  4. 13 Dec, 2017 1 commit
  5. 06 Dec, 2017 1 commit
  6. 16 Oct, 2017 1 commit
  7. 28 Sep, 2017 1 commit
  8. 15 Sep, 2017 1 commit
    • Andreas Haas's avatar
      [wasm] Streaming compilation for WebAssembly. · 549692cb
      Andreas Haas authored
      In this CL I implement streaming compilation for WebAssembly,
      as described in the design doc I have sent out already.
      
      In this implementation the decoding of sections other than the
      code section is done immediately on the foreground thread.
      Eventually all decoding should happen in the background. I
      think it is acceptable to do the decoding on the foreground
      thread for now because I have finished it already, and
      decoding in the background would add even more complexity to
      this CL.
      
      Bug:v8:6785
      
      Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
      Change-Id: I285e1e5e1a5a243113c92571b25ee9bae551d0ed
      Reviewed-on: https://chromium-review.googlesource.com/631721Reviewed-by: 's avatarMircea Trofin <mtrofin@chromium.org>
      Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
      Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Commit-Queue: Andreas Haas <ahaas@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#48022}
      549692cb
  9. 08 Aug, 2017 1 commit
  10. 31 Jul, 2017 1 commit
    • Clemens Hammacher's avatar
      Revert "[wasm] Allow for arbitrarily long error messages" · 20d25f40
      Clemens Hammacher authored
      This reverts commit 072d0e3e.
      
      Reason for revert: Performance regressions (https://crbug.com/749041).
      
      Original change's description:
      > [wasm] Allow for arbitrarily long error messages
      > 
      > We currently have a fixed limit of 256 characters for error messages
      > generated in the decoder. However, we sometimes embed names in it,
      > which makes it easy to generate a crash by using long names (e.g. for
      > exports) in invalid wasm modules.
      > This CL fixes this by switching to a stream based interface, allowing
      > to pass arbitrary objects to be printed. With this interface, we can
      > easily limit the length of output later.
      > 
      > R=​titzer@chromium.org
      > 
      > Bug: chromium:740023
      > Change-Id: I2848c31c63a015157e2a3a9458b54e523060cd69
      > Reviewed-on: https://chromium-review.googlesource.com/565282
      > Reviewed-by: Ben Titzer <titzer@chromium.org>
      > Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#46860}
      
      TBR=titzer@chromium.org,clemensh@chromium.org
      
      # Not skipping CQ checks because original CL landed > 1 day ago.
      
      Bug: chromium:740023, chromium:749041
      Change-Id: I005a60d55dcf01d350230f8d98f715bab9c43886
      Reviewed-on: https://chromium-review.googlesource.com/593807
      Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
      Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
      Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#47008}
      20d25f40
  11. 25 Jul, 2017 1 commit
    • Clemens Hammacher's avatar
      [wasm] Allow for arbitrarily long error messages · 072d0e3e
      Clemens Hammacher authored
      We currently have a fixed limit of 256 characters for error messages
      generated in the decoder. However, we sometimes embed names in it,
      which makes it easy to generate a crash by using long names (e.g. for
      exports) in invalid wasm modules.
      This CL fixes this by switching to a stream based interface, allowing
      to pass arbitrary objects to be printed. With this interface, we can
      easily limit the length of output later.
      
      R=titzer@chromium.org
      
      Bug: chromium:740023
      Change-Id: I2848c31c63a015157e2a3a9458b54e523060cd69
      Reviewed-on: https://chromium-review.googlesource.com/565282Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
      Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#46860}
      072d0e3e
  12. 13 Jul, 2017 2 commits
  13. 29 May, 2017 1 commit
    • Clemens Hammacher's avatar
      [wasm] Avoid reporting of unrelated compiler errors · ff7bf332
      Clemens Hammacher authored
      It happens frequently that unrelated compiler errors lead to the
      instantiation of {read_leb_tail} with an invalid {byte_index}, which
      again triggers compiler errors.
      This change fixes this, such that illegal instantiation just triggers a
      static_assert and nothing more. This helps to spot the actual error.
      
      Drive-by: Mark {Min} and {Max} constexpr, such that they can produce
      constexpr results. Note that the result will only be constexpr if both
      arguments are constexpr.
      
      R=ahaas@chromium.org
      
      Change-Id: I35d6865a7f569d72ace0debb045ac615cfd87d92
      Reviewed-on: https://chromium-review.googlesource.com/518005Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#45558}
      ff7bf332
  14. 17 May, 2017 1 commit
    • Andreas Haas's avatar
      [wasm] Refactor the module decoder to work with section bytes · a8424d59
      Andreas Haas authored
      This CL refactors the module decoder so that it can process a list of
      section buffers instead of one module buffer. This change is needed for
      streaming compilation. Streaming compilation may require additional
      changes.
      
      This CL introduces the following interface to the module decoder:
      StartDecoding -- starts the decoding
      DecodeModuleHeader -- decodes the module header
      DecodeSection -- decodes the section
      FinishDecoding -- finishes the decoding and returns the WasmModule
      
      Aside from the different interface the biggest change to the module
      decoder is the introduction of a buffer_offset, which is the offset
      of the current section buffer of the module decoder in the module bytes.
      This buffer_offset is used to translate from section offsets to module
      offsets and back.
      
      Another nice change is that the module decoder does not have a zone
      anymore. Instead the zone is stored directly in the WasmModule where
      it belongs. Zone ownership is also more obvious now.
      
      R=mtrofin@chromium.org, clemensh@chromium.org
      
      Change-Id: I815d777ec380f4c617c39e828ea0c9746c0bae20
      Reviewed-on: https://chromium-review.googlesource.com/505490
      Commit-Queue: Andreas Haas <ahaas@chromium.org>
      Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#45374}
      a8424d59
  15. 15 May, 2017 1 commit
    • Clemens Hammacher's avatar
      [wasm] Speed up LEB decoding · 79b075be
      Clemens Hammacher authored
      Speed up LEB decoding by forcing the decoding loop to be unrolled.
      Even though the compiler was free to unroll the loop before, clang did
      not do so. We now manually unroll by using a template function which
      calls itself recursively, passing the byte index to be decoded next.
      For efficient execution, we still depend on the compiler to inline the
      recursive calls (which clang does).
      
      This optimization speeds up interpreted execution of the Jetstream
      benchmarks by 15 percent.
      Speedup on module decoding is negligible though.
      
      Drive-by: Change "unsigned" to "uint32_t".
      
      R=ahaas@chromium.org
      BUG=v8:5822
      
      Change-Id: I06d4230f92bfb2a80cdc5029d965fc3bf84ca1cc
      Reviewed-on: https://chromium-review.googlesource.com/506188
      Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
      Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#45308}
      79b075be
  16. 11 May, 2017 1 commit
    • Andreas Haas's avatar
      [wasm] Change the error_pc in the decoder to error_offset · 47e6e260
      Andreas Haas authored
      The error_pc was only used to calculated the relative error offset.
      Switching to an error_offset directly will allow us later to give the
      decoder a base offset. Thereby we can get correct error
      positions even when the decoder is executed on multiple memory chunks,
      which will happen with streaming compilation. With this change I also
      had to provide "kind of" reasonable error position in the
      StreamingDecoder.
      
      R=clemensh@chromium.org
      
      Change-Id: I736fa082c51c64334d23771061acf97e2c47778e
      Reviewed-on: https://chromium-review.googlesource.com/502909
      Commit-Queue: Andreas Haas <ahaas@chromium.org>
      Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#45264}
      47e6e260
  17. 28 Apr, 2017 1 commit
  18. 11 Apr, 2017 1 commit
    • kmackay's avatar
      Add some missing stdarg includes · f7e76cde
      kmackay authored
      One of our internal Chromecast builds was failing due to undefined
      va_list in wasm-result.h. I also searched for other files where va_list
      was used without including stdarg.h and added it as necessary (since
      include-what-you-use is a thing).
      
      BUG=chromium:706443
      
      Review-Url: https://codereview.chromium.org/2780913002
      Cr-Commit-Position: refs/heads/master@{#44588}
      f7e76cde
  19. 10 Apr, 2017 3 commits
    • Clemens Hammacher's avatar
      [wasm] Stop decoding sections once an error occured · 88e169dc
      Clemens Hammacher authored
      We went on decoding the next section, which happened to be the start
      section. But since the function section had an error, the signature
      pointer was not still {nullptr} on the start function, leading to a
      segfault.
      
      Drive-by fix: Improve decoder trace output.
      
      R=ahaas@chromium.org
      BUG=chromium:708714, chromium:708787
      
      Change-Id: I5ae2adb32764b9d154f1ca878019f26ac31839b4
      Reviewed-on: https://chromium-review.googlesource.com/472847Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#44521}
      88e169dc
    • Clemens Hammacher's avatar
      [wasm] Refactor wasm::Result type · d50ebde7
      Clemens Hammacher authored
      - Store std::string instead of std::unique_ptr<char[]> for the error
        message.
      - Remove ErrorCode, which was just kSuccess and kError anyway. Error is
        now detected on whether error_msg_ is empty or not.
      - Refactor constructors for perfect forwarding; this will allow us to
        implement Result<std::unique_ptr<X*>>.
      - Refactor Decoder::toResult for perfect forwarding.
      - Remove output operators (operator<<) for Result; it was only used in
        the error case anyway. Print error message directly instead.
        The operator was problematic since it assumed the existence of an
        output operator for every T which is used in Result<T>.
      - Remove ModuleError and FunctionError, introduce general static
        Result<T>::Error method instead.
      
      R=ahaas@chromium.org
      
      Change-Id: I1e0f602a61ee9780fee2a3ed33147d431fb092ba
      Reviewed-on: https://chromium-review.googlesource.com/472748
      Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
      Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#44518}
      d50ebde7
    • Andreas Haas's avatar
      [wasm] Refactor the Result object · e313bc17
      Andreas Haas authored
      Instead of storing {start} and {error_pc} we now store the
      {error_offset}, which is anyways the only value we use.
      
      R=clemensh@chromium.org
      
      Change-Id: Ifd9791eff5c9efce2e7e2a1989bf3b5eaa464a02
      Reviewed-on: https://chromium-review.googlesource.com/471527
      Commit-Queue: Andreas Haas <ahaas@chromium.org>
      Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#44510}
      e313bc17
  20. 05 Apr, 2017 2 commits
    • Clemens Hammacher's avatar
      [wasm] [decoder] Templatize decode function for unchecked decoding · eeaceccb
      Clemens Hammacher authored
      In the C++ wasm interpreter, we decode LEB encoded immediates each time
      we execute the respective instruction. The whole instruction sequence
      was validated before, thus we know that all integers are valid.
      This CL refactors several Decoder methods to allow for either checked
      or unchecked decoding. In the checked case, an error is set if a check
      fails, in the unchecked case, a DCHECK will fail.
      
      This improves performance of the interpreter by 20.5%.
      
      R=ahaas@chromium.org
      BUG=v8:5822
      
      Change-Id: If69efd4f6fbe19d84bfc2f4aa000f429a8e22bf5
      Reviewed-on: https://chromium-review.googlesource.com/468786
      Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
      Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#44406}
      eeaceccb
    • Clemens Hammacher's avatar
      [wasm] [decoder] Merge checked_read_leb and consume_leb · 02b4d0e6
      Clemens Hammacher authored
      Both methods decoded a LEB128 encoded integer, but only consume_leb
      incremented the pc pointer accordingly.
      This CL implements consume_leb by using checked_read_leb.
      
      It also refactors a few things:
      1) It removes error_pt, which was only avaible in checked_read_leb.
      2) It renames the error method to errorf, since it receives a format
         string. This also avoids a name clash.
      3) It implements sign extension directly in checked_read_leb instead of
         doing this in the caller.
      
      R=ahaas@chromium.org
      BUG=v8:5822
      
      Change-Id: I8058f57418493861e5df26d4949041f6766d5138
      Reviewed-on: https://chromium-review.googlesource.com/467150
      Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
      Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#44405}
      02b4d0e6
  21. 02 Feb, 2017 1 commit
  22. 24 Jan, 2017 1 commit
  23. 06 Jan, 2017 3 commits
  24. 12 Oct, 2016 1 commit
    • clemensh's avatar
      [wasm] Fix decoder for null data · e7a00891
      clemensh authored
      If passing <nullptr, 0> to the decoder and trying to decode something,
      it correctly detects the error and sets an error message, but still
      returns true on ok(), and returns a valid result.
      I triggered this error by passing a null Vector, returned by FindSection(), to
      the decoder.
      
      R=titzer@chromium.org
      
      Review-Url: https://codereview.chromium.org/2410913002
      Cr-Commit-Position: refs/heads/master@{#40204}
      e7a00891
  25. 11 Oct, 2016 1 commit
  26. 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
  27. 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
  28. 20 Sep, 2016 1 commit
  29. 25 Jul, 2016 2 commits
  30. 29 Jun, 2016 1 commit