Commit Graph

30492 Commits

Author SHA1 Message Date
Leszek Swirski
2253d9c523 Revert "[pku][wasm] Refactor PKU usage in Wasm"
This reverts commit 4e935c7ffb.

Reason for revert: Breaking on mac arm64: https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Mac%20-%20arm64%20-%20release/10926/overview

Original change's description:
> [pku][wasm] Refactor PKU usage in Wasm
>
> RwxMemoryWriteScope becomes the bottleneck for both MAP_JIT and PKU
> machinery.
> Wasm and V8 code space will use the same memory protection key.
>
> This is a next step towards adding PKU support for V8 code space.
>
> Bug: v8:13023
> Change-Id: I647f8c09bc41e5ef8a1d74b58a48a43e08454e0d
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3702213
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Commit-Queue: Wenqin Yang <wenqin.yang@intel.com>
> Reviewed-by: Igor Sheludko <ishell@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#81947}

Bug: v8:13023
Change-Id: I11c52ac101804ab75b1bb1d4814f083cb1083d5b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3780498
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Owners-Override: Leszek Swirski <leszeks@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#81949}
2022-07-26 07:48:17 +00:00
wenqin.yang
4e935c7ffb [pku][wasm] Refactor PKU usage in Wasm
RwxMemoryWriteScope becomes the bottleneck for both MAP_JIT and PKU
machinery.
Wasm and V8 code space will use the same memory protection key.

This is a next step towards adding PKU support for V8 code space.

Bug: v8:13023
Change-Id: I647f8c09bc41e5ef8a1d74b58a48a43e08454e0d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3702213
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Wenqin Yang <wenqin.yang@intel.com>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81947}
2022-07-26 05:32:30 +00:00
Deepti Gandluri
44fc1fdac2 Revert "Background merging of deserialized scripts"
This reverts commit e895b7af73.

Reason for revert: TSAN failures: https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux64%20TSAN%20-%20stress-incremental-marking/8468/overview

Original change's description:
> Background merging of deserialized scripts
>
> Recently, https://crrev.com/c/v8/v8/+/3681880 added new API functions
> with which an embedder could request that V8 merge newly deserialized
> script data into an existing Script from the Isolate's compilation
> cache. This change implements those new functions. This functionality is
> still disabled by default due to the flag
> merge_background_deserialized_script_with_compilation_cache.
>
> The goal of this new functionality is to reduce memory usage when
> multiple frames load the same script with a long delay between (long
> enough for the script to have been evicted from Blink's in-memory cache
> and for the top-level SharedFunctionInfo to be flushed). In that case,
> there are two Script objects for the same script: one which was found in
> the Isolate compilation cache (the "old" script), and one which was
> recently deserialized (the "new" script). The new script's object graph
> is essentially standalone: it may point to internalized strings and
> readonly objects such as the empty feedback metadata, but otherwise
> it is unconnected to the rest of the heap. The merging logic takes any
> useful data from the new script's object graph and attaches it into the
> old script's object graph, so that the new Script object and any other
> duplicated objects can be discarded. More specifically:
>
> 1. If the new Script has a SharedFunctionInfo for a particular function
>    literal, and the old Script does not, then the old Script is updated
>    to refer to the new SharedFunctionInfo.
> 2. If the new Script has a compiled SharedFunctionInfo for a particular
>    function literal, and the old Script has an uncompiled
>    SharedFunctionInfo, then the old SharedFunctionInfo is updated to
>    point to the function_data and feedback_metadata from the new
>    SharedFunctionInfo.
> 3. If any used object from the new object graph points to a
>    SharedFunctionInfo, where the old object graph contains a matching
>    SharedFunctionInfo for the same function literal, then that pointer
>    is updated to point to the old SharedFunctionInfo.
>
> The document at [0] includes diagrams showing an example merge on a very
> small script.
>
> Steps 1 and 2 above are pretty simple, but step 3 requires walking a
> possibly large set of objects, so this new API lets the embedder run
> step 3 from a background thread. Steps 1 and 2 are performed later, on
> the main thread.
>
> The next important question is: in what ways can the old script's object
> graph be modified during the background execution of step 3, or during
> the time after step 3 but before steps 1 and 2?
>
> A. SharedFunctionInfos can go from compiled to uncompiled due to
>    flushing. This is okay; the worst outcome is that the function would
>    need to be compiled again later. Such a risk is already present,
>    since V8 doesn't keep IsCompiledScopes for every compiled function in
>    a background-deserialized script.
> B. SharedFunctionInfos can go from uncompiled to compiled due to lazy
>    compilation. This is also okay; the merge completion logic on the
>    main thread will just keep this lazily compiled data rather than
>    inserting compiled data from the newly deserialized object graph.
> C. SharedFunctionInfos can be cleared from the Script's weak array if
>    they are no longer referenced. This is mostly okay, because any
>    SharedFunctionInfo that is needed by the background merge is strongly
>    referenced and therefore can't be cleared. The only problem arises if
>    the top-level SharedFunctionInfo gets cleared, so the merge task must
>    deliberately keep a reference to that one.
> D. SharedFunctionInfos can be created if they are needed due to lazy
>    compilation of a parent function. This change is somewhat troublesome
>    because it invalidates the background thread's work and requires a
>    re-traversal on the main thread to update any pointers that should
>    point to this lazily compiled SharedFunctionInfo.
>
> At a high level, this change implements three previously unimplemented
> functions in BackgroundDeserializeTask (in compiler.cc) and updates one:
>
> - BackgroundDeserializeTask::SourceTextAvailable, run on the main
>   thread, checks whether there is a matching Script in the Isolate
>   compilation cache which doesn't already have a top-level
>   SharedFunctionInfo. If so, it saves that Script in a persistent
>   handle.
> - BackgroundDeserializeTask::ShouldMergeWithExistingScript checks
>   whether the persistent handle from the first step exists (a fast
>   operation which can be called from any thread).
> - BackgroundDeserializeTask::MergeWithExistingScript, run on a
>   background thread, performs step 3 of the merge described above and
>   generates lists of persistent data describing how the main thread can
>   complete the merge.
> - BackgroundDeserializeTask::Finish is updated to perform the merge
>   steps 1 and 2 listed above, as well as a possible re-traversal of the
>   graph if required due to newly created SharedFunctionInfos in the old
>   Script.
>
> The merge logic has nothing to do with deserialization, and indeed I
> hope to reuse it for background compilation tasks as well, so it is all
> contained within a new class BackgroundMergeTask (in compiler.h,cc). It
> uses a second class, ForwardPointersVisitor (in compiler.cc) to perform
> the object visitation that updates pointers to SharedFunctionInfos.
>
> [0] https://docs.google.com/document/d/1UksB5Vm7TT1-f3S9W1dK_rP9jKn_ly0WVm_UDPpWuBw/edit
>
> Bug: v8:12808
> Change-Id: Id405869e9d5b106ca7afd9c4b08cb5813e6852c6
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3739232
> Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
> Cr-Commit-Position: refs/heads/main@{#81941}

Bug: v8:12808
Change-Id: I82a080e6287828445293cb6b4b94a5e8f15eb8f3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3787213
Auto-Submit: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Deepti Gandluri <gdeepti@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#81943}
2022-07-25 23:01:07 +00:00
Frank Tang
f527622546 [Temporal] Add compare, round and total to Duration
Also add AOs:
ParseTemporalRelativeToString, DefaultTemporalLargestUnit, CalculateOffsetShift, UnbalanceDurationRelative, BalanceDurationRelative,


Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.duration.compare
https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype.round
https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype.total
https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalrelativetostring
https://tc39.es/proposal-temporal/#sec-temporal-defaulttemporallargestunit
https://tc39.es/proposal-temporal/#sec-temporal-calculateoffsetshift
https://tc39.es/proposal-temporal/#sec-temporal-unbalancedurationrelative
https://tc39.es/proposal-temporal/#sec-temporal-balancedurationrelative

Bug: v8:11544
Change-Id: I3b20bdb7cec30f6a8503603169643678988f4dcf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3750322
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81942}
2022-07-25 21:07:56 +00:00
Seth Brenith
e895b7af73 Background merging of deserialized scripts
Recently, https://crrev.com/c/v8/v8/+/3681880 added new API functions
with which an embedder could request that V8 merge newly deserialized
script data into an existing Script from the Isolate's compilation
cache. This change implements those new functions. This functionality is
still disabled by default due to the flag
merge_background_deserialized_script_with_compilation_cache.

The goal of this new functionality is to reduce memory usage when
multiple frames load the same script with a long delay between (long
enough for the script to have been evicted from Blink's in-memory cache
and for the top-level SharedFunctionInfo to be flushed). In that case,
there are two Script objects for the same script: one which was found in
the Isolate compilation cache (the "old" script), and one which was
recently deserialized (the "new" script). The new script's object graph
is essentially standalone: it may point to internalized strings and
readonly objects such as the empty feedback metadata, but otherwise
it is unconnected to the rest of the heap. The merging logic takes any
useful data from the new script's object graph and attaches it into the
old script's object graph, so that the new Script object and any other
duplicated objects can be discarded. More specifically:

1. If the new Script has a SharedFunctionInfo for a particular function
   literal, and the old Script does not, then the old Script is updated
   to refer to the new SharedFunctionInfo.
2. If the new Script has a compiled SharedFunctionInfo for a particular
   function literal, and the old Script has an uncompiled
   SharedFunctionInfo, then the old SharedFunctionInfo is updated to
   point to the function_data and feedback_metadata from the new
   SharedFunctionInfo.
3. If any used object from the new object graph points to a
   SharedFunctionInfo, where the old object graph contains a matching
   SharedFunctionInfo for the same function literal, then that pointer
   is updated to point to the old SharedFunctionInfo.

The document at [0] includes diagrams showing an example merge on a very
small script.

Steps 1 and 2 above are pretty simple, but step 3 requires walking a
possibly large set of objects, so this new API lets the embedder run
step 3 from a background thread. Steps 1 and 2 are performed later, on
the main thread.

The next important question is: in what ways can the old script's object
graph be modified during the background execution of step 3, or during
the time after step 3 but before steps 1 and 2?

A. SharedFunctionInfos can go from compiled to uncompiled due to
   flushing. This is okay; the worst outcome is that the function would
   need to be compiled again later. Such a risk is already present,
   since V8 doesn't keep IsCompiledScopes for every compiled function in
   a background-deserialized script.
B. SharedFunctionInfos can go from uncompiled to compiled due to lazy
   compilation. This is also okay; the merge completion logic on the
   main thread will just keep this lazily compiled data rather than
   inserting compiled data from the newly deserialized object graph.
C. SharedFunctionInfos can be cleared from the Script's weak array if
   they are no longer referenced. This is mostly okay, because any
   SharedFunctionInfo that is needed by the background merge is strongly
   referenced and therefore can't be cleared. The only problem arises if
   the top-level SharedFunctionInfo gets cleared, so the merge task must
   deliberately keep a reference to that one.
D. SharedFunctionInfos can be created if they are needed due to lazy
   compilation of a parent function. This change is somewhat troublesome
   because it invalidates the background thread's work and requires a
   re-traversal on the main thread to update any pointers that should
   point to this lazily compiled SharedFunctionInfo.

At a high level, this change implements three previously unimplemented
functions in BackgroundDeserializeTask (in compiler.cc) and updates one:

- BackgroundDeserializeTask::SourceTextAvailable, run on the main
  thread, checks whether there is a matching Script in the Isolate
  compilation cache which doesn't already have a top-level
  SharedFunctionInfo. If so, it saves that Script in a persistent
  handle.
- BackgroundDeserializeTask::ShouldMergeWithExistingScript checks
  whether the persistent handle from the first step exists (a fast
  operation which can be called from any thread).
- BackgroundDeserializeTask::MergeWithExistingScript, run on a
  background thread, performs step 3 of the merge described above and
  generates lists of persistent data describing how the main thread can
  complete the merge.
- BackgroundDeserializeTask::Finish is updated to perform the merge
  steps 1 and 2 listed above, as well as a possible re-traversal of the
  graph if required due to newly created SharedFunctionInfos in the old
  Script.

The merge logic has nothing to do with deserialization, and indeed I
hope to reuse it for background compilation tasks as well, so it is all
contained within a new class BackgroundMergeTask (in compiler.h,cc). It
uses a second class, ForwardPointersVisitor (in compiler.cc) to perform
the object visitation that updates pointers to SharedFunctionInfos.

[0] https://docs.google.com/document/d/1UksB5Vm7TT1-f3S9W1dK_rP9jKn_ly0WVm_UDPpWuBw/edit

Bug: v8:12808
Change-Id: Id405869e9d5b106ca7afd9c4b08cb5813e6852c6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3739232
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#81941}
2022-07-25 17:29:06 +00:00
Michael Achenbach
4af624591b [test] Skip flaky test
No-Try: true
Bug: v8:13107
Change-Id: I18ed93605594c7d2baba6fb744439df0eb4cb3ba
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3785146
Auto-Submit: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81940}
2022-07-25 16:54:56 +00:00
jameslahm
e8f9ff8507 [test] Move cctest/test-api-wasm to unittests/
... api/api-wasm-unittest.

Bug: v8:12781
Change-Id: I6d6eafcbc67e114fc1fa9b1f1f8dea21ab831ee6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3748165
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: 王澳 <wangao.james@bytedance.com>
Cr-Commit-Position: refs/heads/main@{#81937}
2022-07-25 16:10:47 +00:00
jameslahm
09bf4f272f [test] Move cctest/test-weaksets to unittests/
... objects/weaksets-unittest.

Bug: v8:12781
Change-Id: I355deaff33e4bfe7125af587654cae39f2d719d8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3784616
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: 王澳 <wangao.james@bytedance.com>
Cr-Commit-Position: refs/heads/main@{#81928}
2022-07-25 15:00:08 +00:00
Jakob Kummerow
ce4e9911a4 [wasm-gc] Non-nullable locals with end-of-block semantics
a.k.a. "option 1a". Reflects the resolution of this discussion:
https://github.com/WebAssembly/function-references/issues/44

Bug: v8:7748
Change-Id: I6b53c353a1ace2aaf5b852addead51b9f76c9d64
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3782674
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81925}
2022-07-25 13:31:56 +00:00
Clemens Backes
588fa294ef [API] Prepare deprecation of second OnCriticalMemoryPressure
The new method is not implemented in Chrome or Node, and the issue has
no activity since 2018, so let's rip out the incomplete new API.

Drive-by: Sprinke a few V8_LIKELY and V8_UNLIKELY.

R=mlippautz@chromium.org

Bug: chromium:634547
Change-Id: I0dabad520d459277d7196fa69c1bbceaf4d53596
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3780528
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81923}
2022-07-25 12:59:56 +00:00
jameslahm
e2f6641359 [test] Skip flaky tests in LogMapsTest
... including LogMapsCodeTest.LogMapsDetailsCode, LogMapsTest.LogMapsDetailsStartup
and LogMapsTest.LogMapsDetailsContexts.

Bug: v8:12997
Change-Id: I9dc315d7361efb8c58bf7ad3be8e324cdd456184
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3784617
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: 王澳 <wangao.james@bytedance.com>
Cr-Commit-Position: refs/heads/main@{#81922}
2022-07-25 12:58:36 +00:00
Clemens Backes
d261567f25 [wasm][fuzzer] Make ClusterFuzz recognise OOM exceptions
Sometimes the second Wasm instantiation fails because we run out of
memory. This raises a RangeError, which is not recognized by ClusterFuzz
as OOM.
Thus turn it into a proper OOM crash.

R=ahaas@chromium.org

Bug: chromium:1347024
Change-Id: I39f7789cc85a9ba9b4217764fbbcef15c6c6ed76
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3784602
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81920}
2022-07-25 12:29:56 +00:00
Omer Katz
262d5fc3ae [heap] Fix PagedNewSpace initialization
Whenever PagedNewSpace allocates a page, the page is added to the free
list. Preallocating pages on space initialization means the pages are
added to the free list before the map for free space is initialized.
Then, when allocating from the free list, a DCHECK fails
(free-list.cc:508).

This CL delays page preallocation until `EnsureCurrentCapacity` is
called. When using PagedNewSpace, we will call this method from
`Heap::CreateHeapObjects` after the maps are allocated and before any
allocations in new space are attempted.

Bug: v8:12612
Change-Id: I33f825ddd831640b12e4c0f7b849262a335df51e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3780541
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81919}
2022-07-25 12:16:46 +00:00
Clemens Backes
18751c5b46 [include] Make Platform::GetPageAllocator abstract
All embedders override this method now, so it can be abstract.

R=mlippautz@chromium.org

Bug: v8:12425
Change-Id: I4db5d74341c9519222592a88d247bc2aa2be03a9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3780538
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81910}
2022-07-25 08:59:56 +00:00
Matthias Liedtke
48ae9bb6c9 [wasm-gc] Remove obsolete RTT statements from internal processing
This is a follow up to Iadf73c294904ec20cefe1053a2969aa1dbb91a39.

Bug: v8:7748
Change-Id: I59390b8c82c4ebed58f2d3130cd9b1578bffdd4b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3780535
Commit-Queue: Matthias Liedtke <mliedtke@google.com>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@google.com>
Cr-Commit-Position: refs/heads/main@{#81908}
2022-07-25 08:19:36 +00:00
Clemens Backes
11de0762dc [utils] Improve BitVector performance
Avoid most of the {is_inline()} checks by having a {data_begin_} pointer
which either points at the inline storage or at the zone-allocated
memory.
This replaces a dynamic branch by a memory indirection, which is
beneficial for big (non-inline) BitVectors. For small BitVectors we will
have to see what the bots say; the hypothesis is that a memory load is
still faster than a dynamic branch.

Apart from better performance, this change allows for simpler code in
many places, including the iterator implementation.

R=jkummerow@chromium.org

Bug: v8:13063
Change-Id: I1e28279d1a438598e0b8403a6a4078c2cd2a4c48
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3776685
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81902}
2022-07-24 07:07:05 +00:00
ishell@chromium.org
b71b8887e2 [heap-snapshot] Prepare for Code-less builtins
Drive-by fixes:
* categorize CodeDataContainer objects as kCode,
* when external code space is enabled report CodeDataContainers as
  (%s builtin handle),
* replace a sequence of obj.IsXXX() with a respective sequence of
  InstanceTypeChecker::IsXXX().

Bug: v8:11880
Change-Id: Ib50b168eb28af5f8388be7f9b9f4feba2ee784af
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3780534
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81898}
2022-07-22 21:22:41 +00:00
Paolo Severini
ccf308a08d [fastcall] Harden function AddAllSequenceSlowCallback
Make sure AddAllSequenceSlowCallback works on arrays where some
elements cannot be accessed.

Bug: chromium:1338877
Change-Id: Icdf61a305fb208a91832d03ebc47201d8941e41a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3778410
Commit-Queue: Paolo Severini <paolosev@microsoft.com>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81896}
2022-07-22 17:43:12 +00:00
Shu-yu Guo
73812f968e Revert "[heap] Filter new test for single generation mode"
This reverts commit edbe337397.

Reason for revert: Breaking presubmit
https://logs.chromium.org/logs/v8/buildbucket/cr-buildbucket/8807931292038216513/+/u/Presubmit/stdout

/b/s/w/ir/cache/builder/v8/test/mjsunit/mjsunit.status: Error: missing file for mjsunit test wasm/stack-switching-export


Original change's description:
> [heap] Filter new test for single generation mode
>
> R=​dinfuehr@chromium.org
>
> Bug: v8:11644, v8:12191
> Change-Id: I60c6426851bb46510ec0b0df132e460bed6d6e80
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3782801
> Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
> Reviewed-by: Omer Katz <omerkatz@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#81893}

Bug: v8:11644, v8:12191
Change-Id: I52caf104ed3f13bb03dbeb009199c67e34b63732
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3782199
Auto-Submit: Shu-yu Guo <syg@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#81895}
2022-07-22 15:38:27 +00:00
Thibaud Michaud
edbe337397 [heap] Filter new test for single generation mode
R=dinfuehr@chromium.org

Bug: v8:11644, v8:12191
Change-Id: I60c6426851bb46510ec0b0df132e460bed6d6e80
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3782801
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81893}
2022-07-22 14:05:42 +00:00
Nico Hartmann
14262e04d8 Revert "[wasm] Materialize suspender in JS-to-wasm wrapper"
This reverts commit 8cb027531c.

Reason for revert: https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux64%20TSAN%20-%20isolates/20736/overview

Original change's description:
> [wasm] Materialize suspender in JS-to-wasm wrapper
>
> Instead of creating the Suspender object in JS and passing it to the
> stack-switching js-to-wasm wrapper, the wrapper now automatically
> creates the Suspender object and forwards it as an extra parameter to
> the wasm function. See:
> https://github.com/WebAssembly/js-promise-integration/pull/1/files
>
> R=​ahaas@chromium.org
>
> Bug: v8:12191
> Change-Id: I2badee823f4223a293632f93e7e59f24c49d0820
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3779688
> Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
> Reviewed-by: Andreas Haas <ahaas@chromium.org>
> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#81890}

Bug: v8:12191
Change-Id: Id22ed357e3a59bd1569687eadbc9b007d3da995c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3780816
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Nico Hartmann <nicohartmann@chromium.org>
Owners-Override: Nico Hartmann <nicohartmann@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#81891}
2022-07-22 14:02:18 +00:00
Thibaud Michaud
8cb027531c [wasm] Materialize suspender in JS-to-wasm wrapper
Instead of creating the Suspender object in JS and passing it to the
stack-switching js-to-wasm wrapper, the wrapper now automatically
creates the Suspender object and forwards it as an extra parameter to
the wasm function. See:
https://github.com/WebAssembly/js-promise-integration/pull/1/files

R=ahaas@chromium.org

Bug: v8:12191
Change-Id: I2badee823f4223a293632f93e7e59f24c49d0820
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3779688
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81890}
2022-07-22 12:23:01 +00:00
Matthias Liedtke
86da4f8f60 [test][wasm-gc] remove remaining rtt canon tests
Bug: v8:7748
Change-Id: I067e9d6a56dd58dbd0f45607f62b5ef36c69ff6f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3776690
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@google.com>
Commit-Queue: Matthias Liedtke <mliedtke@google.com>
Cr-Commit-Position: refs/heads/main@{#81888}
2022-07-22 11:39:21 +00:00
Jakob Kummerow
d180d40d28 [wasm][devtools] Fix reported function body offsets
The DevTools frontend doesn't want the Wasm module's understanding of
function body offsets (i.e. including locals), but the ranges of
offsets where breakpoints can be set (i.e. only where instructions are).
This patch adjusts the reported offsets accordingly.
A consequence is that we have to report full (start,end) pairs for each
function, instead of being able to dedupe end1==start2 etc.

Bug: v8:12917
Change-Id: I0c7d2d96435cdac2c4553647b7bcc8783bc1798b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3780526
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81887}
2022-07-22 10:08:32 +00:00
Divy Srivastava
376813dfeb [fastcall] Implement support for Uint8Array arguments
This CL adds Uint8Array as supported arguments for fast API calls.
It introduces a kUint8 variant to CTypeInfo for use with TypedArrays
only.

Bug: v8:13080
Change-Id: Ie65206078a18acabaafa9c95793f400b8e95373d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3767098
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81886}
2022-07-22 09:05:41 +00:00
jameslahm
323ce8bfd2 [test] Move cctest/test-api-icu to unittests/
... api/api-icu-unittest.

Bug: v8:12781
Change-Id: Ibfc420e9d5ff0fce67f710b89a214332c7be65cc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3748164
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: 王澳 <wangao.james@bytedance.com>
Cr-Commit-Position: refs/heads/main@{#81883}
2022-07-22 08:36:41 +00:00
Simon Zünd
c53c20fe64 [inspector] Implement Async Stack Tagging API v2
This CL adds a new method to the `console` that is available
when DevTools is open. In TypeScript notation the API is:

```
namespace console {
  // Creates a new `Task` and associates the current async
  // stack trace with the created `Task`.
  scheduleTask(name: string): Task;
}

interface Task {
  // Executes an arbitrary payload and forwards the return value
  // back to the caller. Any async stack trace captured during
  // 'f' has the site of the corresponding `scheduleTask` as
  // its parent.
  run<T>(f: () => T): T;
}
```

The API is a saner user-facing API for our async stack trace
mechanism:
  * scheduleAsyncTask corresponds to scheduleTask
  * startAsyncTask/stopAsyncTask are called implicitly before `f`
    is executed.
  * cancelAsyncTask is called implicitly when `Task` is GC'ed

The API is behind the flag --experimental-async-stack-tagging-api

Bug: chromium:1334585
Change-Id: Ic6054279a108756caed6b4b5f2d1fe4a1bdbaf78
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3776678
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81881}
2022-07-22 06:28:24 +00:00
Frank Tang
2a609e4592 [Temporal] Add special version of BalanceDuration
Add a second implementation of BalanceDuration which
the nanoseconds could be very large and beyong the precision
could be handled by double and passed in by BigInt, and values
of other time fields are 0.

Bug: v8:11544
Change-Id: Ib794c6c78b81b8338434314fa5033cf1e991d32b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3781117
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81876}
2022-07-22 01:08:48 +00:00
Omer Katz
8211602c33 [heap] Replace non-null pointers in Space with references
Bug: v8:12612
Change-Id: I4d9de4446d343040ae29e25d23a09cf4c740bde0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3743448
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81874}
2022-07-21 17:24:27 +00:00
Thibaud Michaud
62b4d3c13d [wasm] Fix ReturnPromiseOnSuspend frame visiting
Add a test where the GC gets called during parameter conversion, and fix
two related issues:
- Reorder spilled references so that they are at the top of the stack
  before the builtin call
- Add the missing frame marker on the new stack

R=ahaas@chromium.org

Bug: v8:12191
Change-Id: I3f68c675123c726543df6942d110fe06bc6c0efb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3780530
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81873}
2022-07-21 16:12:51 +00:00
Omer Katz
ce570aa526 [heap] Implement PagedNewSpace
See a description of the different classes and how they integrate in
https://docs.google.com/document/d/1wNj_akGSh6RBMC2RvH8HIlSUqkjWrpGkxI_BTZ-zdXE/edit#

Bug: v8:12612
Change-Id: I0f2141f4ada5c964e985d109133902172d1ab605
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3641178
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81872}
2022-07-21 14:33:47 +00:00
ishell@chromium.org
91f98a8f7c [ext-code-space] Remove more Code <-> CodeT roundtrips
... in various components.

Bug: v8:11880
Change-Id: I1e4411ec38a4b15e505bda35a92987972e89d9d0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3777718
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81863}
2022-07-21 10:16:13 +00:00
Manos Koukoutos
af39b32154 [wasm-gc] Remove nominal types
Some tests and testing infrastructure had to be changed because it
relied on nominal types.
Drive-by: Support function supertypes in wasm-module-builder.js.

Bug: v8:7748
Change-Id: Ife92431d1842ff9de91e296a50421aa48f02c0de
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3776197
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81862}
2022-07-21 09:13:12 +00:00
Lu Yahan
90c0b95860 [riscv64] Fix popcount
Change-Id: I0b7b4daf5b88341ba56076137b8d34bdfcd45c1a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3773329
Reviewed-by: ji qiu <qiuji@iscas.ac.cn>
Commit-Queue: ji qiu <qiuji@iscas.ac.cn>
Cr-Commit-Position: refs/heads/main@{#81860}
2022-07-21 06:00:42 +00:00
Dominik Inführ
aee4f59521 [heap] Add thread-safe shared barrier for code objects
In order to make the shared code write barrier thread-safe, we simply
lock the page mutex when appending to the typed_slot_set. We can later
improve this when performance isn't good enough.

Bug: v8:13018
Change-Id: I5e12f83f459f8976c22ec488cfa9b6f16d4a8a8e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3763867
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81855}
2022-07-20 14:12:45 +00:00
ishell@chromium.org
b3179fe760 [cleanup] Remove Interpreter::LookupNameOfBytecodeHandler
... in favour of Builtins::name().

Bug: v8:11880
Change-Id: I1e06314aec71ea367cd8096316e8fb9aceb63feb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3776686
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81854}
2022-07-20 13:41:02 +00:00
Clemens Backes
06383fa182 [test] Split BitVectorTest unittest in multiple tests
Instead of one big test which tests multiple functions, split the unit
test into multiple smaller tests.
Also, use TestWithZone instead of TestWithIsolate, because the isolate
is never used.

R=jkummerow@chromium.org

Bug: v8:12425
Change-Id: I32148e40b5ed2b006cc647d42bdfe564ccc6d0ed
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3776676
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81852}
2022-07-20 13:23:21 +00:00
Matthias Liedtke
b9768c0d53 [test][wasm-gc] replace remaining new and cast instructions using rtt
Bug: v8:7748
Change-Id: I09e9d919751945e99e0178168358a3f269fa34a3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3776679
Auto-Submit: Matthias Liedtke <mliedtke@google.com>
Commit-Queue: Matthias Liedtke <mliedtke@google.com>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81850}
2022-07-20 12:21:15 +00:00
Manos Koukoutos
684c046cc9 [wasm-gc] Fix loop limit for typedef validity checks
Bug: v8:7748
Change-Id: I62b5d90dac8f4424488aa89569494fccff09ca89
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3776196
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81847}
2022-07-20 10:47:30 +00:00
Manos Koukoutos
cd0c116e3b [stringrefs][test] Use regexes in error messages
This way we make tests more flexible wrt. future changes, especially
when it comes to module offsets.

Bug: v8:12868
Change-Id: Ie99806603603e5c731c61267469b14f81c88ffac
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3776195
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81846}
2022-07-20 10:02:30 +00:00
Maya Lekova
ef5934792f [fastcall] Fix UB when floating point test argument is OOB
This CL hardens a test to avoid static_cast-ing doubles that don't fit
into the 32-bit integer range.

Bug: chromium:1344965
Change-Id: I1f3a05800158cda9dc582bfa4427516932db9679
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3776337
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81843}
2022-07-20 08:56:47 +00:00
Peter Kasting
1013ce9e59 Make CompilationResult an aggregate in C++20.
Bug: chromium:1284275
Change-Id: Id429806b802282b7b045628fd8a3371618eb9f7f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3774123
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81842}
2022-07-20 08:20:27 +00:00
Michael Lippautz
eb4e0241d7 cppgc: Deprecate (soon) cppgc::Visitor::Trace(T*)
We will provide a replacement for raw pointers in future which should
only be used by backing stores. Any other callsite must go through
Trace(BasicMember<>).

Bug: v8:13089
Change-Id: Ibdae439b44ad94bd7af2532855be941c5334db99
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3772328
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81833}
2022-07-19 22:18:46 +00:00
Jakob Kummerow
966e6f02c1 [wasm] Expose disassembler to DevTools
Bug: v8:12917
Change-Id: I8942664831c591f9b5566ee5b1609f68948601e7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3749208
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81826}
2022-07-19 17:43:16 +00:00
Matthias Liedtke
81bd4a559b [test][wasm-gc] Replace ref.(cast|test) usages with static variant
Bug: v8:7748
Change-Id: Iec95162ec86a0d96fdd64764864604fc3e26cc39
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3771902
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@google.com>
Commit-Queue: Matthias Liedtke <mliedtke@google.com>
Cr-Commit-Position: refs/heads/main@{#81821}
2022-07-19 16:18:41 +00:00
Thibaud Michaud
5c02c29097 [wasm] Drop suspender param in wasm-to-JS wrapper
The suspender is only needed by the wrapper, do not forward it to the JS
import.

R=ahaas@chromium.org

Bug: v8:12191
Change-Id: Id8e9a820491588b40fffb5dfd8706e85a16b8b23
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3768410
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81818}
2022-07-19 15:43:31 +00:00
Michael Lippautz
509ee760d9 cppgc: Avoid decompression for Member write barriers
Thread through compressed pointer into write barrier to allow to delay
compression after checking whether a write barrier is actually needed.

Change-Id: If7e6cbb69a57cc9aeeb551c11f685bace4e56c4c
Bug: chromium:1325007
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3769826
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81816}
2022-07-19 15:23:16 +00:00
ishell@chromium.org
c02a9fb179 [ext-code-space] Allow AbstractCode to be CodeDataContainer
... when external code space is enabled.
Currently this mode is guarded by V8_REMOVE_BUILTINS_CODE_OBJECTS flag
which is set to false until Code-less builtins are supported.

Drive-by:
* remove unnecessary methods from AbstractCode,
* avoid CodeDataContainer <-> Code roundtrips when accessing writable
  state of Code objects via CodeT.

Bug: v8:11880
Change-Id: Iae3ff3b2feae68d875cbe9f82a6bb076460dd2f8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3769832
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81814}
2022-07-19 14:37:56 +00:00
Jakob Kummerow
0460e63f33 [wasm] Fix/improve StringBuilder buffer growth
This includes several changes:
- avoid a very-unlikely-but-theoretically-possible OOB write
- avoid a somewhat-likely memory leak
- grow the buffer less aggressively for medium-length strings

Change-Id: I877f43d7e2e7cd4778ba8c7c7525ba988301f750
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3771900
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81808}
2022-07-19 13:02:36 +00:00
Manos Koukoutos
009bffc9c3 Add missing include for perfetto builds
Bug: v8:13006
Change-Id: Ia59bf5ca93403e055c65e4f28afc1b0f803bc531
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3771901
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81807}
2022-07-19 12:55:16 +00:00