1. 27 Jan, 2017 1 commit
  2. 25 Jan, 2017 1 commit
  3. 24 Jan, 2017 1 commit
    • clemensh's avatar
      [wasm] Implement stepping in wasm code · 3dea55b4
      clemensh authored
      Implement stepping by remembering the current step action in the wasm
      interpreter handle in WasmDebugInfo, and using it when continuing
      execution in the interpreter.
      The control flow is as follows: After module compilation, the user sets
      a breakpoint in wasm. The respective function is redirected to the
      interpreter and the breakpoint is set on the interpreter. When it is
      hit, we notify all debug event listeners, which might prepare stepping.
      When returning from these listeners, before continuing execution, we
      check whether stepping was requested and continue execution in the
      interpreter accordingly.
      
      Stepping from Wasm to JS and vice versa will be implemented and tested
      in a follow-up CL. Testing this requires breakpoints and stepping in
      Wasm to be exposed via the inspector interface, such that we can write
      an inspector test. This mixed JS-Wasm-execution is hard to set up in a
      cctest.
      
      R=titzer@chromium.org, yangguo@chromium.org
      BUG=
      
      Review-Url: https://codereview.chromium.org/2649533002
      Cr-Commit-Position: refs/heads/master@{#42624}
      3dea55b4
  4. 23 Jan, 2017 1 commit
  5. 20 Jan, 2017 2 commits
    • clemensh's avatar
      [wasm] Add tests for breakpoints · a1e04ef5
      clemensh authored
      Test that setting breakpoints works for wasm, and that they are hit
      correctly.
      This basically tests all the layers involved: Compiling and running
      wasm interpreter entries, passing arguments to the interpreter, storing
      break point infos in wasm objects, getting the right BreakLocation from
      wasm frames, and getting stack information from interpreted frames.
      
      BUG=v8:5822
      R=titzer@chromium.org, yangguo@chromium.org
      
      Review-Url: https://codereview.chromium.org/2629883002
      Cr-Commit-Position: refs/heads/master@{#42560}
      a1e04ef5
    • clemensh's avatar
      [wasm] Implement frame inspection for interpreted frames · 09525c8f
      clemensh authored
      Frame inspection is currently limited to locations of execution.
      Further details like local variables or stack content will follow later.
      
      The FrameInspector now stores a pointer to the interpreted wasm frame,
      and redirects certain requests there, just as for deoptimized frames.
      Hitting breakpoints is now also supported for wasm frames.
      
      R=yangguo@chromium.org, titzer@chromium.org
      BUG=v8:5822
      
      Review-Url: https://codereview.chromium.org/2629823003
      Cr-Commit-Position: refs/heads/master@{#42551}
      09525c8f
  6. 16 Jan, 2017 1 commit
    • clemensh's avatar
      [wasm] [codestyle] Fix pointer alignment in wasm-debug.cc · 2702d0fb
      clemensh authored
      Our .clang-format is derived on the Google style, which sets
      PointerAlignment to left (e.g. "Type* name"), but sets
      DerivePointerAlignment to true. Once we started with the wrong style,
      this made all new code in wasm-debug.cc use PointerAlignment=right,
      resulting in lots of code using the wrong style.
      
      For this CL, I ran
      clang-format -style="{DerivePointerAlignment: false, BasedOnStyle: \
        Google}" -i src/wasm/wasm-debug.cc
      
      R=titzer@chromium.org
      
      Review-Url: https://codereview.chromium.org/2635003002
      Cr-Commit-Position: refs/heads/master@{#42380}
      2702d0fb
  7. 13 Jan, 2017 1 commit
    • clemensh's avatar
      [wasm] Instantiate the interpreter on demand · eb04a25f
      clemensh authored
      If a breakpoint is set on a wasm function, compile an interpreter entry
      stub for it, and replace all calls to the original function by calls to
      this interpreter entry.
      Also, instantiate a wasm interpreter object on demand and set the
      breakpoint there.
      
      R=titzer@chromium.org
      BUG=v8:5822
      
      Review-Url: https://codereview.chromium.org/2625093004
      Cr-Commit-Position: refs/heads/master@{#42309}
      eb04a25f
  8. 11 Jan, 2017 1 commit
    • clemensh's avatar
      [wasm] Add support for compiling WASM_INTERPRETER_ENTRY stubs · a2efde46
      clemensh authored
      Also, add a runtime function to call the interpreter, passing a
      stack-allocated buffer holding the arguments.
      The WASM_INTERPRETER_ENTRY stub allocates the stack slot for the
      arguments, fills it, and calls to the wasm interpreter.
      It's abi is compatible with WASM functions, such that we can just
      replace a call to a WASM_FUNCTION with a call to
      WASM_INTERPRETER_ENTRY.
      See tracking bug to get the overall picture.
      
      BUG=v8:5822
      R=titzer@chromium.org
      
      Review-Url: https://codereview.chromium.org/2619803004
      Cr-Commit-Position: refs/heads/master@{#42242}
      a2efde46
  9. 20 Dec, 2016 1 commit
    • clemensh's avatar
      [wasm] Introduce WasmSharedModuleData and refactor other objects · 081ac370
      clemensh authored
      The new object will hold information which is shared by all clones of a
      WasmCompiledModule, e.g. the decoded asm.js offset table, and in the
      future also breakpoints. From there, we can set them on each new
      instantiation of any clone.
      
      While already changing lots of the code base, I also renamed all
      getters from "get_foo" to "foo", to conform to the style guide.
      
      R=titzer@chromium.org, yangguo@chromium.org
      BUG=v8:5732
      
      Review-Url: https://codereview.chromium.org/2591653002
      Cr-Commit-Position: refs/heads/master@{#41862}
      081ac370
  10. 28 Nov, 2016 1 commit
    • clemensh's avatar
      [wasm] Move asm.js offset table to compiled module · 916a5337
      clemensh authored
      Before, the encoded variant was stored in the compiled module, and the
      decoded one in the debug info (per instance).
      The decoded table was a FixedArray of ByteArrays.
      Now, also the decoded table is a flat ByteArray, and it encodes whether
      it is encoded or decoded. This saves memory and allows to store encoded
      and decoded variant in the same field. The table is automatically
      decoded on the first use.
      
      This CL also removes some unused and unimplemented methods from
      WasmDebugInfo (probably merge artifacts). That class is now pretty much
      empty, but we might still need it for breakpoint support.
      
      R=titzer@chromium.org, ahaas@chromium.org
      
      Review-Url: https://codereview.chromium.org/2522953002
      Cr-Commit-Position: refs/heads/master@{#41316}
      916a5337
  11. 24 Nov, 2016 2 commits
    • clemensh's avatar
      Revert of [base] Define CHECK comparison for signed vs. unsigned (patchset #5... · 0406620c
      clemensh authored
      Revert of [base] Define CHECK comparison for signed vs. unsigned (patchset #5 id:80001 of https://codereview.chromium.org/2526783002/ )
      
      Reason for revert:
      Need to revert previous CL because of Android compile error, and this one depends in it.
      
      Original issue's description:
      > [base] Define CHECK comparison for signed vs. unsigned
      >
      > The current CHECK/DCHECK implementation fails statically if a signed
      > value is compared against an unsigned value. The common solution is to
      > cast on each caller, which is tedious and error-prone (might hide bugs).
      > This CL implements signed vs. unsigned comparisons by executing up to
      > two comparisons. For example, if i is int32_t and u is uint_32_t, a
      > DCHECK_LE(i, u) would create the check
      > i <= 0 || static_cast<uint32_t>(i) <= u.
      > For checks against constants, at least one of the checks can be removed
      > by compiler optimizations.
      >
      > The tradeoff we have to make is to sometimes silently execute an
      > additional comparison. And we increase code complexity of course, even
      > though the usage is just as easy (or even easier) as before.
      >
      > The compile time impact seems to be minimal:
      > I ran 3 full compilations for Optdebug on my local machine, one time on
      > the current ToT, one time with this CL plus http://crrev.com/2524093002.
      > Before: 143.72 +- 1.21 seconds
      > Now: 144.18 +- 0.67 seconds
      >
      > In order to check that the new comparisons are working, I refactored
      > some DCHECKs in wasm to use the new magic.
      >
      > R=bmeurer@chromium.org, titzer@chromium.org
      >
      > Committed: https://crrev.com/5925074a9dab5a8577766545b91b62f2c531d3dc
      > Cr-Commit-Position: refs/heads/master@{#41275}
      
      TBR=ishell@chromium.org,titzer@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/2531533003
      Cr-Commit-Position: refs/heads/master@{#41277}
      0406620c
    • clemensh's avatar
      [base] Define CHECK comparison for signed vs. unsigned · 5925074a
      clemensh authored
      The current CHECK/DCHECK implementation fails statically if a signed
      value is compared against an unsigned value. The common solution is to
      cast on each caller, which is tedious and error-prone (might hide bugs).
      This CL implements signed vs. unsigned comparisons by executing up to
      two comparisons. For example, if i is int32_t and u is uint_32_t, a
      DCHECK_LE(i, u) would create the check
      i <= 0 || static_cast<uint32_t>(i) <= u.
      For checks against constants, at least one of the checks can be removed
      by compiler optimizations.
      
      The tradeoff we have to make is to sometimes silently execute an
      additional comparison. And we increase code complexity of course, even
      though the usage is just as easy (or even easier) as before.
      
      The compile time impact seems to be minimal:
      I ran 3 full compilations for Optdebug on my local machine, one time on
      the current ToT, one time with this CL plus http://crrev.com/2524093002.
      Before: 143.72 +- 1.21 seconds
      Now: 144.18 +- 0.67 seconds
      
      In order to check that the new comparisons are working, I refactored
      some DCHECKs in wasm to use the new magic.
      
      R=bmeurer@chromium.org, titzer@chromium.org
      
      Review-Url: https://codereview.chromium.org/2526783002
      Cr-Commit-Position: refs/heads/master@{#41275}
      5925074a
  12. 17 Nov, 2016 1 commit
    • clemensh's avatar
      [wasm] Remove two obsolete functions · a80d4d03
      clemensh authored
      With the new wasm object types, the GetCompiledModule and GetWasmBytes
      functions are not needed any more. The same functions are already
      public on the wasm objects.
      In order to use them properly, I changed a few more locations to make
      use of the new types.
      
      R=ahaas@chromium.org, titzer@chromium.org
      
      Review-Url: https://codereview.chromium.org/2503403005
      Cr-Commit-Position: refs/heads/master@{#41085}
      a80d4d03
  13. 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
  14. 11 Nov, 2016 1 commit
    • titzer's avatar
      [wasm] Move all heap-allocated WASM structures into wasm-objects.h. · fa9c25ce
      titzer authored
      This CL moves all heap-allocated WASM data structures, both ones
      that are bonafide JSObjects and ones that are FixedArrays only, into a
      consistent place with consistent layout. Note that not all accessors are complete, and I haven't fully spread the new static typing goodness
      to all places in the code.
      
      R=ahaas@chromium.org,rossberg@chromium.org
      CC=gdeepti@chromium.org,mtrofin@chromium.org,clemensh@chromium.org
      BUG=
      
      Review-Url: https://codereview.chromium.org/2490663002
      Cr-Commit-Position: refs/heads/master@{#40913}
      fa9c25ce
  15. 25 Oct, 2016 1 commit
  16. 19 Oct, 2016 1 commit
  17. 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
  18. 06 Oct, 2016 1 commit
  19. 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
  20. 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
  21. 20 Sep, 2016 1 commit
  22. 02 Sep, 2016 1 commit
  23. 30 Jun, 2016 1 commit
    • titzer's avatar
      [wasm] Disassemble wasm code from script · d249efd7
      titzer authored
      This stores the wasm object and the function index in the script, and
      adds functions to get the disassembled wasm code as well as the offset
      table mapping from byte position to line and column in the disassembly
      solely from the script.
      This will be used to show "ui source code" in DevTools, and map raw
      locations from the stack trace into this code view.
      
      R=yangguo@chromium.org, ahaas@chromium.org, titzer@chromium.org
      BUG=chromium:613110
      
      patch from issue 2063013004 at patchset 80001 (http://crrev.com/2063013004#ps80001)
      
      Review-Url: https://codereview.chromium.org/2105303002
      Cr-Commit-Position: refs/heads/master@{#37430}
      d249efd7
  24. 29 Jun, 2016 1 commit
  25. 20 Jun, 2016 1 commit
    • clemensh's avatar
      [wasm] Handlify WasmDebugInfo where needed · 48a96d17
      clemensh authored
      All function which potentially do heap allocations now take a Handle
      on a WasmDebugInfo. This unfortunately requires to make some function
      static, since otherwise the "this" pointer would not be handlified.
      
      R=ahaas@chromium.org, titzer@chromium.org
      BUG=chromium:613110
      
      Review-Url: https://codereview.chromium.org/2074933005
      Cr-Commit-Position: refs/heads/master@{#37099}
      48a96d17
  26. 17 Jun, 2016 1 commit
    • clemensh's avatar
      [wasm] Split off debug info from wasm object · b8238f89
      clemensh authored
      All debugging-related information is now stored inside a dedicated
      object, which is only allocated if debugging support is needed.
      This is also where later a reference to the interpreter will be stored
      for executing to-be-debugged functions and providing stack inspection.
      
      R=titzer@chromium.org, ahaas@chromium.org
      BUG=chromium:613110
      
      Review-Url: https://codereview.chromium.org/2050953003
      Cr-Commit-Position: refs/heads/master@{#37055}
      b8238f89