1. 27 Jan, 2020 10 commits
    • Ben Noordhuis's avatar
      [api] Fix DCHECK on API failure · 872bc2d1
      Ben Noordhuis authored
      Utils::ReportApiFailure() contains logic to handle the case where no
      isolate has been entered but it called Isolate::Current(), which DCHECks
      when there is no active isolate. Switch to Isolate::TryGetCurrent().
      
      See https://github.com/denoland/rusty_v8/issues/253 for background.
      
      Change-Id: I73c28c31102c0c4ab216a925d22ad54174c7911d
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2020943Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65995}
      872bc2d1
    • Clemens Backes's avatar
      [wasm] Introduce declared_function_index helper · 4299cb69
      Clemens Backes authored
      We often only need to store information about declared (i.e.
      non-imported) functions in a wasm module. Thus we remove the number of
      imported function from a function index. We do this in several places,
      with different amount of checking.
      
      This CL extracts this logic to a new {declared_function_index} helper
      and uses it wherever we do this translation. This more or less
      establishes the concept of "declared function index" and hopefully
      prevents errors in the future.
      
      R=jkummerow@chromium.org
      
      Bug: chromium:1045767
      Change-Id: I7e957401495a2a8cb5d2c51031f9c69fe46195d8
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2020763
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65994}
      4299cb69
    • Clemens Backes's avatar
      [wasm] Fix asm.js toString for modules with imports · dd11f979
      Clemens Backes authored
      Fix the string representation of functions exported from asm.js modules
      in the presence of imported functions.
      
      R=jkummerow@chromium.org
      
      Bug: chromium:1045767, chromium:667678
      Change-Id: I55714252036511598eeec7fe7b81985213f7e4f2
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2022142Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65993}
      dd11f979
    • Steve Blackburn's avatar
      Refactor deserialization allocation. · 49f60a3b
      Steve Blackburn authored
      Deserialization bypasses the heap allocators, bumping pointers into the
      spaces directly, instead.  So the deserializer is tightly coupled to the
      implementation of the existing collector.
      
      Here I've added an interface to heap.h for this purpose.  This CL
      leaves things as-is unless the TPH is enabled, in which case the new
      interface is used.
      
      Future work: use the heap.h interface in all cases.
      
      Bug: v8:9533
      
      Change-Id: I3b1cc81870b347fbfb509ddb4031bd3781710240
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2019482
      Commit-Queue: Steve Blackburn <steveblackburn@google.com>
      Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
      Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65992}
      49f60a3b
    • Peter Marshall's avatar
      [inspector] Add a test for const declaration and side effects · 73f4ac62
      Peter Marshall authored
      Add a test that does the same thing the devtools-frontend does when
      evaluating console inputs.
      
      1) Declare a const variable with throwOnSideEffect=true. This should
      throw.
      2) Declare the same const variable with throwOnSideEffect=false.
      This should successfully declare the variable.
      
      Previously it could be the case that even though we threw in 1), the
      variable would fail to be initialized in 2) with a re-declaration
      error.
      
      Bug: chromium:1043151
      Change-Id: I1a6126b518f7bb3788c39b9f8e3adb8850aa962a
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2016587
      Commit-Queue: Peter Marshall <petermarshall@chromium.org>
      Reviewed-by: 's avatarSimon Zünd <szuend@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65991}
      73f4ac62
    • Liviu Rau's avatar
      [fuchsia] Finalize rename & add test configuration for test runner · d7a2973f
      Liviu Rau authored
      Bug: chromium:1033865
      Change-Id: I63999575d4962124a4d9a64c4e661900aec5fa6d
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2019167Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
      Commit-Queue: Liviu Rau <liviurau@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65990}
      d7a2973f
    • Andreas Haas's avatar
      [x64] Introduce negb and negw instructions · 911f38c4
      Andreas Haas authored
      This CL introduces the negb and negw instructions (8-bit and 16-bit
      versions of neg) in the x64 assembler. These instructions are needed to
      implement I32AtomicSub8U and similar WebAssembly instructions
      efficiently.
      
      The existing implementation was embedded in a generic macro, and it was
      difficult to change it without introducing also the 8-bit and 16-bit
      versions of many other instructions. This would have introduced a lot
      of dead code. Instead this CL extracted the neg instructions from the
      macro and implements them directly. This should be fine because the
      assembler does not change much, and approachability of the code is
      improved.
      
      R=clemensb@chromium.org
      
      Bug: v8:10108
      Change-Id: I46099bbebd47f864311a67da3ba8ddc4fe4cd35d
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2019165
      Commit-Queue: Andreas Haas <ahaas@chromium.org>
      Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65989}
      911f38c4
    • Clemens Backes's avatar
      [wasm] Pass breakpoints to Liftoff compiler · 261a22e2
      Clemens Backes authored
      This extends the API to pass breakpoint information to Liftoff. The
      Liftoff compiler identifies the places where breakpoints should be set,
      but does not emit breakpoints yet.
      This allows us to see the performance overhead of just checking where to
      emit breakpoints (which should be negligible).
      
      R=thibaudm@chromium.org
      
      Bug: v8:10147
      Change-Id: I3fd40ab9009e9c317a26f70b4f06db512f96a763
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2019169Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65988}
      261a22e2
    • Justin Ridgewell's avatar
      Fix two overflow cases in SourceMap VLQ decoding · 615ecdf8
      Justin Ridgewell authored
      These both have to do with extremely large numbers, so it's unlikely to cause a problem in practice. Still, correctness.
      
      First, encoding `-2147483648` in VLQ returns the value `"B"`. When decoding, we get the value `1` after reading the base64. We then check if the first bit is set (it is) to see if we should negate it, then we shift all bits right once. Now, `value` will be `0` and `negate` will be `true`. So, we'd return `-0`. Which is a bug! `-0` isn't `-2147483648`, and we've broken a round trip.
      
      Second, encoding any number with the 31st bit set, we'd return the opposite sign. Let's use `1073741824`. Encoding, we get `"ggggggC"`. When decoding, we get the value `-2147483648` after reading the base64. Notice, it's already negative (the 32nd bit is set, because the 31st was set and we shifted everything left once). We'd then check the first bit (it's not) and shift right. But we used `>>`, which does not shift the sign bit. We actually wanted `>>>`, which will. Because of that bug, we get back `-1073741824` instead of the positive `1073741824`. It's even worse if the 32nd and 31st bits are set, `-1610612736` becomes `536870912` after a round trip.
      
      I recently fixed the same two bugs in Closure Compiler: https://github.com/google/closure-compiler/commit/584418eb
      
      Change-Id: Ib6592ad50ae3764479c1a766bbb19042ee83b99d
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2018882
      Auto-Submit: Justin Ridgewell <jridgewell@google.com>
      Commit-Queue: Mathias Bynens <mathias@chromium.org>
      Reviewed-by: 's avatarMathias Bynens <mathias@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65987}
      615ecdf8
    • Jakob Gruber's avatar
      [regexp] Correctly escape a backslash-newline sequence · 7d1f95d6
      Jakob Gruber authored
      When printing the source string, a backslash-newline sequence ('\\\n',
      '\\\r', '\\\u2028', '\\\u2029') should be formatted as '\n', '\r',
      '\u2028', '\u2029', respectively. Prior to this CL it was formatted as
      a backslash followed by the literal newline character.
      
      Bug: v8:8615
      Change-Id: Iac90195c56ea1707ea8469066b0cc967ea87fc73
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2016583
      Commit-Queue: Jakob Gruber <jgruber@chromium.org>
      Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
      Auto-Submit: Jakob Gruber <jgruber@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65986}
      7d1f95d6
  2. 24 Jan, 2020 23 commits
  3. 23 Jan, 2020 7 commits
    • Seth Brenith's avatar
      [torque] Check pointer size when generating debug helper code · 867a2040
      Seth Brenith authored
      This fixes an issue found by the upcoming change that verifies a match
      between 32-bit Torque output from a 32-bit build and 32-bit output from
      a 64-bit build: https://crrev.com/c/v8/v8/+/1998078 . 32-bit output
      never needs to deal with pointer compression.
      
      Bug: v8:10124
      
      Change-Id: I0e04728dafc4118a8816a3afa98651dddea7a574
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2001460Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
      Cr-Commit-Position: refs/heads/master@{#65962}
      867a2040
    • Seth Brenith's avatar
      [tools] Show contents of cached external strings from crash dumps · 534482b3
      Seth Brenith authored
      This change adds support for the postmortem inspection library to show
      the content of cached external strings if that content is available. It
      also fixes a minor annoyance where strings with unavailable data would
      show up as "...". Now, if fetching the very first character fails, we
      omit the literal value from the output.
      
      Bug: v8:9376
      Change-Id: Id694a774c231ab3467fb59b1c149284729acfb20
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1987922Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
      Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
      Cr-Commit-Position: refs/heads/master@{#65961}
      534482b3
    • Clemens Backes's avatar
      Revert "[wasm-simd][liftoff] Add S128 case for stack movements" · f3a5c36a
      Clemens Backes authored
      This reverts commit 5cfe053e.
      
      Reason for revert: "liftoff-simd-params" also fails on no-sse :/
      
      Original change's description:
      > [wasm-simd][liftoff] Add S128 case for stack movements
      > 
      > The two cases we are fixing here are Construct and
      > LoadCallerFrameSlot, which are closely related.
      > 
      > Construct is called during PrepareCall, where we build up
      > LiftoffStackSlots when we need to move an arg from caller's stack frame
      > into callee's stack frame. LoadCallerFrameSlot is the parallel to
      > this, called in ProcessParameter during decoding of the callee's
      > function body.
      > 
      > In most cases, Construct needs a new case to handle kWasmS128, and calls
      > the relevant assembler to push a s128 onto the stack.
      > 
      > ARM64 requires 16-byte alignment of sp, so we need to Claim the right
      > number of kXRegSize slots first, which requires
      > us traversing the list of slots to figure out how many s128 values there
      > are. This is a straightforward way to fix this, if efficiency is a
      > problem, we can change LiftOffStackSlots::Add to sum up the slot sizes.
      > 
      > On IA32, pushing s128 values will require 4 calls to push. Instead, we
      > use a sub and two movdqu, which will generate less code in most cases.
      > 
      > On x64, there is no 128-bit push, so we call push twice.
      > 
      > Bug: v8:9909
      > Change-Id: I3af35b8462ea9c3b9b2d90800c37d11b5e95be59
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2015945
      > Commit-Queue: Zhi An Ng <zhin@chromium.org>
      > Reviewed-by: Clemens Backes <clemensb@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#65956}
      
      TBR=clemensb@chromium.org,zhin@chromium.org,joey.gouly@arm.com
      
      Change-Id: Ib3c5a088e2d85baf1d8b143272844fb5ebb33c57
      No-Presubmit: true
      No-Tree-Checks: true
      No-Try: true
      Bug: v8:9909
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2017724Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65960}
      f3a5c36a
    • Zhao Jiazhong's avatar
      [mips][wasm-simd] Implement v128.andnot · b6cc74e0
      Zhao Jiazhong authored
      Port aa12b60b  https://crrev.com/c/1980835
      
      Change-Id: Idb82375e3bab94aed2b613d3f32e436fccb4fe53
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2008982Reviewed-by: 's avatarZhi An Ng <zhin@chromium.org>
      Reviewed-by: 's avatarDeepti Gandluri <gdeepti@chromium.org>
      Commit-Queue: Zhi An Ng <zhin@chromium.org>
      Auto-Submit: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
      Cr-Commit-Position: refs/heads/master@{#65959}
      b6cc74e0
    • Clemens Backes's avatar
      Revert "[liftoff][wasm-simd] Implement f32x4.splat" · 6ef434ca
      Clemens Backes authored
      This reverts commit 009993ad.
      
      Reason for revert: New test fails, see https://ci.chromium.org/p/v8/builders/ci/V8%20Linux/35534 and https://ci.chromium.org/p/v8/builders/ci/V8%20Win32%20-%20debug/23778
      
      Original change's description:
      > [liftoff][wasm-simd] Implement f32x4.splat
      > 
      > Implement f32x4.splat and enable handling this in Liftoff.
      > 
      > We add a new macro for defining test cases to run on TurboFan, Liftoff,
      > interpreter, and scalar lowering.
      > 
      > Also add an assertion that the execution tier used is what we expected
      > it to be. This is useful for Liftoff, because by default it falls back
      > to TurboFan when it encounters an unimplemented opcode.
      > 
      > Bug: v8:9909
      > Change-Id: I594955fce778173191fc44c38c4f956a05e77839
      > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2014753
      > Commit-Queue: Zhi An Ng <zhin@chromium.org>
      > Reviewed-by: Clemens Backes <clemensb@chromium.org>
      > Cr-Commit-Position: refs/heads/master@{#65954}
      
      TBR=clemensb@chromium.org,zhin@chromium.org
      
      Change-Id: Ie6970a8c29baab149150dd734a95f89be5fd89ff
      No-Presubmit: true
      No-Tree-Checks: true
      No-Try: true
      Bug: v8:9909
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2017722Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Commit-Queue: Clemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65958}
      6ef434ca
    • Ben Smith's avatar
      [wasm] Fix decoding of bulk memory instructions · 91adb038
      Ben Smith authored
      The following instructions are affected: memory.init, data.drop,
      table.init, table.drop. A segment index should be decoded as an unsigned
      number, but these instructions were decoding as signed. This works
      properly up to 63, but fails at 64 (which is decoded as -64 =
      4294967232).
      
      Bug: v8:10151
      Change-Id: I742b74cf0bcadf2ff2f606beb65b7bae3e816530
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2015960Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
      Commit-Queue: Ben Smith <binji@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65957}
      91adb038
    • Ng Zhi An's avatar
      [wasm-simd][liftoff] Add S128 case for stack movements · 5cfe053e
      Ng Zhi An authored
      The two cases we are fixing here are Construct and
      LoadCallerFrameSlot, which are closely related.
      
      Construct is called during PrepareCall, where we build up
      LiftoffStackSlots when we need to move an arg from caller's stack frame
      into callee's stack frame. LoadCallerFrameSlot is the parallel to
      this, called in ProcessParameter during decoding of the callee's
      function body.
      
      In most cases, Construct needs a new case to handle kWasmS128, and calls
      the relevant assembler to push a s128 onto the stack.
      
      ARM64 requires 16-byte alignment of sp, so we need to Claim the right
      number of kXRegSize slots first, which requires
      us traversing the list of slots to figure out how many s128 values there
      are. This is a straightforward way to fix this, if efficiency is a
      problem, we can change LiftOffStackSlots::Add to sum up the slot sizes.
      
      On IA32, pushing s128 values will require 4 calls to push. Instead, we
      use a sub and two movdqu, which will generate less code in most cases.
      
      On x64, there is no 128-bit push, so we call push twice.
      
      Bug: v8:9909
      Change-Id: I3af35b8462ea9c3b9b2d90800c37d11b5e95be59
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2015945
      Commit-Queue: Zhi An Ng <zhin@chromium.org>
      Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#65956}
      5cfe053e