1. 28 Nov, 2019 1 commit
    • Clemens Backes's avatar
      [wasm] Clean up WASM_CALL_INDIRECT macros · a183b8be
      Clemens Backes authored
      Fix a TODO from Ben to change the macro argument order to match the
      actual order in wasm code.
      After this fix, we can remove the individual {WASM_CALL_INDIRECT[0-5]}
      macros and implement them via a common variadic macro.
      
      Also, rename {WASM_CALL_INDIRECT_TABLE0} to {WASM_CALL_INDIRECT_TABLE}.
      The name was confusing, because this macro explictly allows to set a
      table index different from 0. Thus, just drop the "0" in the name.
      
      The individual test changes were done via a vim macro, to avoid manual
      errors.
      
      R=mstarzinger@chromium.org
      
      Bug: v8:10021
      Change-Id: I9f0f31511c5c6e20a0b07524bf75fe9cf1598eba
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1940265Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65242}
      a183b8be
  2. 15 Nov, 2019 1 commit
  3. 06 Nov, 2019 1 commit
  4. 08 Oct, 2019 1 commit
  5. 22 May, 2019 1 commit
    • Andreas Haas's avatar
      [wasm][anyref] Cache export wrappers per signature · d56ee2e3
      Andreas Haas authored
      Up until now, we cached export wrappers per export index. With the
      anyref proposal potentially many more functions will need export
      wrappers, e.g. any function that is stored in a table, and any
      function accessed by the new ref.func instruction.
      
      With this CL, we change the caching scheme an do the caching per
      signature. Thereby we can guarantee that any export wrapper which
      potentially exists can be stored in the cache.
      
      For cctests which use wasm-run-utils, we don't know the size of the
      cache anymore ahead of time. However, we assume that no more than
      5 signatures will be used in any cctest. If this assumption is not
      true, we can just adjust the number.
      
      The cache is now accessed in all code paths where we need an export
      wrapper.
      
      Bug: chromium:962850
      
      Change-Id: I32df60dfa7801d1e71f7d837da091f388198af1f
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1615247
      Commit-Queue: Andreas Haas <ahaas@chromium.org>
      Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#61752}
      d56ee2e3
  6. 21 May, 2019 1 commit
  7. 05 Apr, 2019 1 commit
    • Michael Starzinger's avatar
      [wasm] Fix lifetime of reference values on interpreter stack. · 2b7fdbfc
      Michael Starzinger authored
      This ensures the lifetime of reference values on the simulated operand
      stack of the interpreter is coupled to a lifetime of the {ThreadImpl}.
      We no longer directly store reference values on the stack, but maintain
      a separate "reference stack" on the GC'ed heap. This will ensure the GC
      traces such references properly.
      
      The new {StackValue} safety wrapper makes sure all use-sites that access
      the operand stack properly convert to/from handles when dealing with
      reference values.
      
      R=clemensh@chromium.org
      TEST=mjsunit/wasm/exceptions-interpreter
      BUG=v8:8091,v8:7581
      
      Change-Id: I8c05f2d945a6def943b89be0cfca538a73df8855
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1552791
      Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
      Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#60650}
      2b7fdbfc
  8. 03 Apr, 2019 1 commit
    • Michael Starzinger's avatar
      [wasm] Add support for "br_on_exn" in the interpreter. · 46a99b07
      Michael Starzinger authored
      This adds preliminary support for handling the "br_on_exn" opcode in the
      interpreter. It also makes "catch" and "rethrow" use a proper exception
      reference instead of a dummy value.
      
      To that end this also adds {Handle<>} as a new kind of {WasmValue} which
      is intended to pass reference values (e.g. "anyref" or "except_ref") to
      the runtime system. Therefore lifetime of such a {WasmValue} is directly
      coupled to any surrounding {HandleScope}.
      
      For now we just store {Handle<>} directly on the simulated operand stack
      of the interpreter. This is of course bogus, since the surrounding scope
      does not outlive the interpreter activation. Decoupling the lifetime of
      the operand stack from a {HandleScope} will be done in a follow-up CL.
      
      As a drive-by this change also implements support for the "ref_null" and
      the "ref_is_null" opcodes as a proof-of-concept that the new {WasmValue}
      is also applicable to the "anyref" reference type.
      
      R=clemensh@chromium.org
      TEST=cctest/test-run-wasm-interpreter/ReferenceTypeLocals
      BUG=v8:8091,v8:7581
      
      Change-Id: I2307e0689a19c4aab1d67f1ba6742cb3cc31aa3c
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1550299
      Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
      Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#60598}
      46a99b07
  9. 21 Mar, 2019 1 commit
    • Ben Smith's avatar
      [wasm] Call through dispatch table in interpreter · 1a88414c
      Ben Smith authored
      When running wasm tests, the interpreter previously used a static
      collection of function indexes stored in WasmTable to perform
      call_indirect calls internal to that module. This has the wrong behavior
      if the table is changed (via WasmTableObject::Set, `table.copy`, or
      `table.init`).
      
      This CL changes the cctests to always generate an intepreter entry for
      all functions, and stores those entries in the dispatch table. This
      allows us to use the same execution path as for non-testing code.
      
      The interpreter entry compiler needed to be changed to support
      multi-value returns too, since a 64-bit integer return value may be
      lowered to two 32-bit integer returns.
      
      Bug: v8:9016
      Change-Id: I277df21ffde5c2eee0b691fcc9bab2b1a43eeffc
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1531137
      Commit-Queue: Andreas Haas <ahaas@chromium.org>
      Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#60380}
      1a88414c
  10. 27 Feb, 2019 1 commit
  11. 22 Feb, 2019 2 commits
  12. 07 Feb, 2019 1 commit
  13. 01 Feb, 2019 1 commit
    • Clemens Hammacher's avatar
      [test] Modernize value helpers · f0d69fc9
      Clemens Hammacher authored
      This CL changes the usage pattern from
      FOR_XXX_VALUES(i) { Use(*i); }
      to
      FOR_XXX_VALUES(i) { Use(i); }
      which is way more intuitive.
      
      Note that the replacement in the uses was done via regular expression,
      so it's purely mechanical. In two locations I removed unneeded braces
      around the macro, because they confused clang-format.
      I plan to do more cleanups (remove redundant assignments within the
      FOR_XXX_VALUES body) in a follow-up CL.
      
      R=mstarzinger@chromium.org
      
      Bug: v8:8562
      Change-Id: I4329bfcf34e5b077d19b50f4204ceb3b4340fe61
      Reviewed-on: https://chromium-review.googlesource.com/c/1449615
      Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
      Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#59287}
      f0d69fc9
  14. 29 Oct, 2018 1 commit
  15. 21 Aug, 2018 1 commit
  16. 27 Apr, 2018 1 commit
    • Clemens Hammacher's avatar
      [wasm] Split off wasm-linkage.h · 8466b71a
      Clemens Hammacher authored
      Linkage-related methods were declared in wasm-compiler.h and
      implemented in wasm-linkage.cc. This required all users of e.g. wasm
      call descriptors to include the whole wasm compiler header. Also, some
      wasm linkage information is independent of turbofan and also used
      outside of the compiler directory.
      
      This CL splits off wasm-linkage.h (with minimal includes) and puts it
      in src/wasm. This allows to use that information without including
      compiler headers (will clean up several uses in follow-up CLs).
      
      R=mstarzinger@chromium.org, titzer@chromium.org
      
      Bug: v8:7570
      Change-Id: Ifcae70b4ea7932cda30953b325c2b87c4176c598
      Reviewed-on: https://chromium-review.googlesource.com/1013701Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
      Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
      Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#52849}
      8466b71a
  17. 16 Apr, 2018 1 commit
  18. 11 Jan, 2018 1 commit
  19. 02 Nov, 2017 1 commit
  20. 26 Oct, 2017 1 commit
    • Clemens Hammacher's avatar
      [wasm] [interpreter] Tighten possible nondeterminism · a74ee933
      Clemens Hammacher authored
      The current implementation overapproximates the
      possible_nondeterminism_ bit by setting it whenever a NaN value is
      reinterpreted as integer, or stored to memory. This hides bugs in the
      interpreter that are handled as possible nondeterminism even though
      they are not.
      This CL fixes this by only setting the bit if a binary floating point
      operation is executed and one of the inputs is a NaN.
      
      R=ahaas@chromium.org
      
      Bug: v8:6954
      Change-Id: Ib937ae7730dbb140c012d07fae23b40ae7ed3d6b
      Reviewed-on: https://chromium-review.googlesource.com/735599
      Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
      Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#48954}
      a74ee933
  21. 21 Sep, 2017 1 commit
  22. 01 Sep, 2017 1 commit
  23. 19 Aug, 2017 2 commits
    • Mircea Trofin's avatar
      Revert "Revert "[wasm] Rename TestingModule to TestingModuleBuilder."" · 5eb1aa48
      Mircea Trofin authored
      This reverts commit 3913bde1.
      
      Reason for revert: Reason for revert fixed.
      
      Original change's description:
      > Revert "[wasm] Rename TestingModule to TestingModuleBuilder."
      > 
      > This reverts commit ed06fc91.
      > 
      > Reason for revert: Need to revert previous CL
      > 
      > Original change's description:
      > > [wasm] Rename TestingModule to TestingModuleBuilder.
      > > 
      > > This is a followup to moving the ModuleEnv to the compiler directory and
      > > making it immutable.
      > > 
      > > R=​mtrofin@chromium.org, ahaas@chromium.org
      > > 
      > > Bug: 
      > > Change-Id: I0f5ec1b697bdcfad0b4dc2bca577cc0f40de8dc0
      > > Reviewed-on: https://chromium-review.googlesource.com/616762
      > > Commit-Queue: Ben Titzer <titzer@chromium.org>
      > > Reviewed-by: Mircea Trofin <mtrofin@chromium.org>
      > > Reviewed-by: Andreas Haas <ahaas@chromium.org>
      > > Cr-Commit-Position: refs/heads/master@{#47419}
      > 
      > TBR=titzer@chromium.org,mtrofin@chromium.org,ahaas@chromium.org
      > 
      > Change-Id: I9b3b379e89f523c2fcf205a1d268aa294bbc44ff
      > No-Presubmit: true
      > No-Tree-Checks: true
      > No-Try: true
      > Reviewed-on: https://chromium-review.googlesource.com/622567
      > Reviewed-by: Michael Achenbach <machenbach@chromium.org>
      > Commit-Queue: Michael Achenbach <machenbach@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#47448}
      
      TBR=machenbach@chromium.org,titzer@chromium.org,mtrofin@chromium.org,ahaas@chromium.org
      
      Change-Id: Idce6f1ca8ed0ea80edb50292e9b6e2d7712f29cf
      No-Presubmit: true
      No-Tree-Checks: true
      No-Try: true
      Reviewed-on: https://chromium-review.googlesource.com/622034Reviewed-by: 's avatarMircea Trofin <mtrofin@chromium.org>
      Commit-Queue: Mircea Trofin <mtrofin@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#47454}
      5eb1aa48
    • Michael Achenbach's avatar
      Revert "[wasm] Rename TestingModule to TestingModuleBuilder." · 3913bde1
      Michael Achenbach authored
      This reverts commit ed06fc91.
      
      Reason for revert: Need to revert previous CL
      
      Original change's description:
      > [wasm] Rename TestingModule to TestingModuleBuilder.
      > 
      > This is a followup to moving the ModuleEnv to the compiler directory and
      > making it immutable.
      > 
      > R=​mtrofin@chromium.org, ahaas@chromium.org
      > 
      > Bug: 
      > Change-Id: I0f5ec1b697bdcfad0b4dc2bca577cc0f40de8dc0
      > Reviewed-on: https://chromium-review.googlesource.com/616762
      > Commit-Queue: Ben Titzer <titzer@chromium.org>
      > Reviewed-by: Mircea Trofin <mtrofin@chromium.org>
      > Reviewed-by: Andreas Haas <ahaas@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#47419}
      
      TBR=titzer@chromium.org,mtrofin@chromium.org,ahaas@chromium.org
      
      Change-Id: I9b3b379e89f523c2fcf205a1d268aa294bbc44ff
      No-Presubmit: true
      No-Tree-Checks: true
      No-Try: true
      Reviewed-on: https://chromium-review.googlesource.com/622567Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
      Commit-Queue: Michael Achenbach <machenbach@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#47448}
      3913bde1
  24. 18 Aug, 2017 1 commit
  25. 18 Jul, 2017 1 commit
  26. 28 Apr, 2017 1 commit
    • Clemens Hammacher's avatar
      [wasm] Reduce test-specific code · 1a8e7d13
      Clemens Hammacher authored
      This reduces the amount of special paths for testing.
      Setup the memory used for testing exactly the same way as in real world.
      Also, always connect the interpreter to the instance being executed,
      and to the existing WasmInstance struct. This keeps information
      synchronized between interpreter and test runner.
      These changes allow us to execute e.g. GrowMemory from cctests either
      in the interpreter or in compiled code.
      
      R=ahaas@chromium.org
      
      Change-Id: Id4726d061f3cdba789275350f500d769d27d2d63
      Reviewed-on: https://chromium-review.googlesource.com/488561
      Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
      Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#44966}
      1a8e7d13
  27. 25 Apr, 2017 1 commit
  28. 03 Apr, 2017 1 commit
    • Clemens Hammacher's avatar
      [wasm] [interpreter] Fix integer underflow in mem access · d38334c5
      Clemens Hammacher authored
      For OOB checks on memory accesses, we first subtracted the size of the
      type to load/store from the memory size, and then compared against this
      effective_size. If the memory size is smaller than the size of the type,
      this would lead to an integer underflow, and we would try to load the
      value.
      This CL fixes this, and adds a test case for this.
      
      R=ahaas@chromium.org
      BUG=v8:5822
      
      Change-Id: I26fcba0be7343c88b8459d029b0c0af095d2466a
      Reviewed-on: https://chromium-review.googlesource.com/465946
      Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
      Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#44345}
      d38334c5
  29. 21 Mar, 2017 1 commit
    • Clemens Hammacher's avatar
      [wasm] [interpreter] Allow different activations · 3214ccf3
      Clemens Hammacher authored
      This CL makes the interpreter reentrant by allowing different
      activations to be live at the same time. The wasm interpreter keeps a
      list of activations and stores the stack height at the start of each
      activation. This information is used to unwind just one activation, or
      show the right portion of the interpreter stack for each interpreter
      entry frame.
      The WasmDebugInfo object stores a mapping from frame pointer (of the
      interpreter entry) to the activation id in order to identify the
      activation based on the physical interpreter entry frame.
      
      R=titzer@chromium.org, ahaas@chromium.org
      BUG=v8:5822
      
      Change-Id: Ibbf93f077f907213173a92e0a2f7f3556515e8eb
      Reviewed-on: https://chromium-review.googlesource.com/453958
      Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
      Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#43976}
      3214ccf3
  30. 14 Mar, 2017 1 commit
    • Clemens Hammacher's avatar
      [wasm] Cleanup wasm interpreter · 0a4c5c44
      Clemens Hammacher authored
      This is a cleanup in preparation to implement calling imported
      functions via the wasm interpreter.
      For imported functions, we do not create entries in the
      interpreter_code_ vector any more.
      
      I also simplified the interface and removed unused or redundant return
      values. More things are now DCHECKed instead of bailing out.
      
      Also, we previously had two PushFrame methods: One is supposed to
      initialize the interpreter from external code (i.e. adds the first
      frame to the stack), the other one is used to push new frames on the
      frame stack for called functions. This CL renames the first to
      InitFrame, and makes it use the second one. The other remaining user is
      the DoCall method.
      
      R=titzer@chromium.org
      BUG=v8:5822
      
      Change-Id: Id09ff1e3256428fbd8c955e4664507a0c3167e53
      Reviewed-on: https://chromium-review.googlesource.com/453482
      Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
      Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
      Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#43793}
      0a4c5c44
  31. 23 Feb, 2017 1 commit
  32. 03 Feb, 2017 1 commit
    • ahaas's avatar
      [wasm] Refactor the non-determinism detection in the interpreter. · ac187c03
      ahaas authored
      Apparently it happens quite easily that different NaNs are produced in
      the interpreter than in the execution of the compiled code. This
      non-determinism caused problems for the fuzzer which compares the
      equality of the results of the interpreter and the compiled code.
      
      I decided therefore to refactor the detection of non-determinism in the
      interpreter. Instead of tracking whether potentially non-deterministic
      NaNs were produced, I track now whether potentially non-deterministic
      NaNs could have been observed. The only way the NaN non-determinism can
      be observed is by observing the non-deterministic bit pattern of the
      NaN. AFAICT the only way to observe the bit pattern is with a
      I(32|64)_REINTERPRET_F(32|64) instruction or with a F(32|64)_STORE
      followed by a load. Therefore I flag an execution as potentially
      non-deterministic when either a NaN is reinterpreted to an int, or when
      a NaN is stored to memory.
      
      R=titzer@chromium.org, eholk@chromium.org
      BUG=682180
      
      Review-Url: https://codereview.chromium.org/2671803002
      Cr-Commit-Position: refs/heads/master@{#42917}
      ac187c03
  33. 27 Jan, 2017 1 commit
  34. 15 Jan, 2017 1 commit
  35. 13 Jan, 2017 2 commits
  36. 12 Jan, 2017 2 commits