1. 28 Apr, 2017 1 commit
  2. 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
  3. 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
  4. 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
  5. 02 Feb, 2017 1 commit
  6. 24 Jan, 2017 1 commit
  7. 06 Jan, 2017 3 commits
  8. 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
  9. 11 Oct, 2016 1 commit
  10. 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
  11. 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
  12. 20 Sep, 2016 1 commit
  13. 25 Jul, 2016 2 commits
  14. 29 Jun, 2016 1 commit
  15. 27 Jun, 2016 1 commit
    • ddchen's avatar
      [wasm] improve handling of malformed inputs · fd2bf837
      ddchen authored
      When reading malformed input, the length of variable-length types can be very large. Computing operand length with this and adding it to PC will overflow and screw up decode.
      
      This patch switches to unsigned int for arity and lengths, terminates loop analysis on error, adds overflow checking to BranchTableOperand, and adds a unit test.
      
      Review-Url: https://codereview.chromium.org/2052623003
      Cr-Commit-Position: refs/heads/master@{#37301}
      fd2bf837
  16. 24 Jun, 2016 1 commit
  17. 20 Jun, 2016 1 commit
  18. 17 Jun, 2016 1 commit
    • ivica.bogosavljevic's avatar
      Implement WASM big-endian support. · d3f3f6c8
      ivica.bogosavljevic authored
      Implement WASM support on big-endian platforms. WASM has
      an implicit requirement that it is running on little-endian
      machine. We achieve WASM support on BE by keeping data
      in memory in little-endian order, and changing data
      endianness before storing to memory and after loading from
      memory.
      
      BUG=
      
      Review-Url: https://codereview.chromium.org/2034093002
      Cr-Commit-Position: refs/heads/master@{#37065}
      d3f3f6c8
  19. 16 Jun, 2016 1 commit
  20. 12 Apr, 2016 1 commit
  21. 11 Apr, 2016 2 commits
  22. 08 Apr, 2016 2 commits
    • jfb's avatar
      Revert of Fix printf formats (patchset #8 id:140001 of... · 4c4fdc2d
      jfb authored
      Revert of Fix printf formats (patchset #8 id:140001 of https://codereview.chromium.org/1869433004/ )
      
      Reason for revert:
      One small issue easily fixed here: https://codereview.chromium.org/1867333003/
      
      But it looks like MSVS 2013 doesn't like some of the formats and exists with the unhelpful:
      Stderr:
      f:\dd\vctools\crt\crtw32\stdio\output.c(1125) : Assertion failed: ("Incorrect
      format specifier", 0)
      
      It's easier to revert for now, I'll dig more into the docs:
      https://msdn.microsoft.com/en-us/library/56e442dc(v=vs.120).aspx
      https://msdn.microsoft.com/en-us/library/tcxf1dw6(v=vs.120).aspx
      
      And then resubmit, making sure I run these bots.
      
      Original issue's description:
      > Fix printf formats
      >
      > The usage of __attribute__((format(x, y)) was either wrong or missing from multiple functions, leading to erroneous formats. This CL:
      >
      >  - Imports PRINTF_FORMAT macro from Chrome's src/base/compiler-specific.h.
      >  - Uses it appropriately.
      >  - Imports Chrome's base/format_macros.h mainly to fix size_t formats (further cleanup could be done).
      >  - Fixes a bunch of incorrect formats.
      >
      > R= jochen@chromium.org, bmeurer@chromium.org, yangguo@chromium.org, ahaas@chromium.org
      >
      > Committed: https://crrev.com/6ebf9fbb93d31f9be41156a3325d58704ed4933d
      > Cr-Commit-Position: refs/heads/master@{#35365}
      
      TBR=jochen@chromium.org,bmeurer@chromium.org,yangguo@chromium.org,ahaas@chromium.org
      # Skipping CQ checks because original CL landed less than 1 days ago.
      NOPRESUBMIT=true
      NOTREECHECKS=true
      NOTRY=true
      
      Review URL: https://codereview.chromium.org/1867383002
      
      Cr-Commit-Position: refs/heads/master@{#35366}
      4c4fdc2d
    • jfb's avatar
      Fix printf formats · 6ebf9fbb
      jfb authored
      The usage of __attribute__((format(x, y)) was either wrong or missing from multiple functions, leading to erroneous formats. This CL:
      
       - Imports PRINTF_FORMAT macro from Chrome's src/base/compiler-specific.h.
       - Uses it appropriately.
       - Imports Chrome's base/format_macros.h mainly to fix size_t formats (further cleanup could be done).
       - Fixes a bunch of incorrect formats.
      
      R= jochen@chromium.org, bmeurer@chromium.org, yangguo@chromium.org, ahaas@chromium.org
      
      Review URL: https://codereview.chromium.org/1869433004
      
      Cr-Commit-Position: refs/heads/master@{#35365}
      6ebf9fbb
  23. 05 Apr, 2016 1 commit
  24. 10 Mar, 2016 1 commit
  25. 09 Mar, 2016 2 commits
  26. 07 Mar, 2016 1 commit
    • titzer's avatar
      [wasm] Rework encoding of local declarations. · 835c5e6b
      titzer authored
      Local declarations were previously encoded as an optional set of
      4 uint16 values as part of the function declaration. This CL
      implements the current design of moving these declarations to
      a list of pairs of (type, count) that is part of the body.
      
      R=bradnelson@chromium.org,binji@chromium.org
      BUG=
      
      Review URL: https://codereview.chromium.org/1763433002
      
      Cr-Commit-Position: refs/heads/master@{#34564}
      835c5e6b
  27. 04 Mar, 2016 3 commits
  28. 03 Mar, 2016 1 commit