100 Commits
Author SHA1 Message Date
Victor Gomes fe1e217032 Reland "[maglev] Fix VirtualObject refactoring"
This is a reland of commit 86bc438834

Fix: we don't have a map for the rest parameter, so we only
allow to forward the arguments object if the map is a JSArray
and elements array is ArgumentsElements.

Original change's description:
> [maglev] Fix VirtualObject refactoring
>
> - VirtualObject::slot_count does not include the Map. We need to add +1
> when the map count should be included.
>
> - We forgot to patch the nested allocations back to the object
> graph.
>
> Fixed: 346042378
> Change-Id: I54e06a82a9324a55902b720e8188b6b8ec2c22bd
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5614730
> Commit-Queue: Victor Gomes <victorgomes@chromium.org>
> Auto-Submit: Victor Gomes <victorgomes@chromium.org>
> Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#94341}

Change-Id: Iaf6cd204c73ae6bd0b495af5196d1232b7d72ef9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5621050
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94366}
2024-06-11 11:19:32 +00:00
Victor Gomes 1439dfcbda [maglev] Fix clobbered register in StringCodePointAt
The {string} input and the result could register, which make the
StringLength calculation buggy.

If we are calculating the CodePointAt of a two byte string, we need
a second temporary (or we would need to support adding constrains
like input cannot alias with result in the register allocator).

Drive-by: Make BuiltinStringPrototypeCharCodeOrCodePointAt
arch-agnostic.

Fixed: 345547970
Change-Id: Id42fc7f244a0307699ee39707e7a5b892a4cedf2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5614410
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94343}
2024-06-10 16:00:44 +00:00
Victor Gomes 86bc438834 [maglev] Fix VirtualObject refactoring
- VirtualObject::slot_count does not include the Map. We need to add +1
when the map count should be included.

- We forgot to patch the nested allocations back to the object
graph.

Fixed: 346042378
Change-Id: I54e06a82a9324a55902b720e8188b6b8ec2c22bd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5614730
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94341}
2024-06-10 15:32:41 +00:00
Victor Gomes 84746d934e [maglev][cleanup] Remove CapturedValues and add VirtualObject
VirtualObjects are ValueNodes for convenience.
See http://doc/1W6m8pxwGE8hrkTIWt9p7o6UhK2chSh1y-rlssyxVKNI#heading=h.djws22xta9wz

Bug: v8:7700
Change-Id: Ie1acab388b8145e7195a7932e1ce10247e76375f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5595021
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94269}
2024-06-05 14:27:59 +00:00
Victor Gomes 90c5007dd9 [maglev] Disable ArrayIteratorProtoNext
... when insidea a loop and the iterated object is an
InlinedAllocation, since the map could change.

Fixed: 343069827
Change-Id: I0daa6806afc81f3a9aa94f034b589a81aa3faf7a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5580809
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94160}
2024-05-29 15:46:23 +00:00
Victor Gomes 39259936de Revert "[maglev] Avoid call to ObjectPrototypeHasOwnProperty builtin if possible."
This reverts commit aabb0de7fe.

Reason for revert: https://crbug.com/343069824

Original change's description:
> [maglev] Avoid call to ObjectPrototypeHasOwnProperty builtin if possible.
>
> If the input "key" of the "object.prototype.hasownproperty" JSCall
> comes from enum cache and the receiver is a heap constant, then we
> can replace the ObjectPrototypeHasOwnProperty builtin call with some
> compare and jump instructions.
>
> This CL can bring ~50% improvement on this micro case below:
> (just run maglev code with "--no-turbofan" flag)
> -----------------------------------
> const RESERVED_PROPS = {
>     key: true,
>     ref: true,
>     __self: true,
>     __source: true,
> };
>
> function foo(config) {
>     let i = 0;
>     let propName;
>     const props = {};
>     for (propName in config) {
>         if (!RESERVED_PROPS.hasOwnProperty(propName)) {
>             i = i + 1;
>         }
>     }
>     return i;
> }
> -----------------------------------
>
> Change-Id: I6023532ed839c348e5646adc7809719870b24375
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5517735
> Reviewed-by: Toon Verwaest <verwaest@chromium.org>
> Reviewed-by: Victor Gomes <victorgomes@chromium.org>
> Commit-Queue: Jialu Zhang <jialu.zhang@intel.com>
> Cr-Commit-Position: refs/heads/main@{#94109}

Change-Id: Iff77aa5b485eacc91fcdc7b2251d0342cbad6c8d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5577676
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#94144}
2024-05-29 07:14:39 +00:00
Victor Gomes 7065698464 Revert "[base] Change PointerWithPayload to accept incomplete types"
This reverts commit aadbcd5a98.

Reason for revert: static_assert about the alignment is
now incorrect.

Original change's description:
> [base] Change PointerWithPayload to accept incomplete types
>
> Currently PointerWithPayload is templatize by using a complete type,
> which means that we cannot define a PointerWithPayload of a not yet
> defined type, eg:
>
> class MyType;
> PointerWithPayload<MyType>; // Fails compilation
>
> However PointerWithPayload is essentially a pointer, so if we
> pass the pointer type instead, we can allow incomplete types.
>
> Change-Id: I3a273419599bdfbd2f21060d1fa749d82ce3adea
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5553986
> Commit-Queue: Igor Sheludko <ishell@chromium.org>
> Reviewed-by: Marja Hölttä <marja@chromium.org>
> Reviewed-by: Igor Sheludko <ishell@chromium.org>
> Commit-Queue: Victor Gomes <victorgomes@chromium.org>
> Auto-Submit: Victor Gomes <victorgomes@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#94025}

Change-Id: If82d69284c2f59410e9525d7f452d6c6f8bed86b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5573728
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94141}
2024-05-28 15:25:57 +00:00
Victor Gomes e0c86d2318 [maglev] Don't assume Smi range in ArrayIteratoryProtoNext
Usually we can assume array lengths are in Smi range since IC would
otherwise go Megamorphic. This is not the case for builtins.

Fixed: 343069823
Change-Id: I1625509b00845e941f68973559d19cd6fa84b57c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5572957
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94129}
2024-05-28 10:30:06 +00:00
Victor Gomes 98db5af5e1 [maglev] Use TryBuildElementLoad in ArrayIteratorProtoNext
... since it correctly deals with holes.

Fixed: 342460071
Change-Id: I603c361a65d1515f49344905cb2b9085d822c9d9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5572946
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94092}
2024-05-27 11:12:10 +00:00
Victor Gomes bc1263ec36 [maglev] Inline ArrayIteratorPrototypeNext
Bug: v8:7700
Change-Id: I99db77b9ecc468f95ca3e5362a0597ed3e1769aa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5554554
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94042}
2024-05-23 07:27:40 +00:00
Victor Gomes aadbcd5a98 [base] Change PointerWithPayload to accept incomplete types
Currently PointerWithPayload is templatize by using a complete type,
which means that we cannot define a PointerWithPayload of a not yet
defined type, eg:

class MyType;
PointerWithPayload<MyType>; // Fails compilation

However PointerWithPayload is essentially a pointer, so if we
pass the pointer type instead, we can allow incomplete types.

Change-Id: I3a273419599bdfbd2f21060d1fa749d82ce3adea
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5553986
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94025}
2024-05-22 10:59:37 +00:00
Victor Gomes 10eacfe5db [maglev] Improve static typing for inlined allocations
Bug: v8:7700
Change-Id: Icf6322d56a8c7e4a9d4ed3b102b06827d49687e6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5557064
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94020}
2024-05-22 08:54:26 +00:00
Victor Gomes edd66753fe [maglev] Fix BranchRootConstant for holey doubles
If we are not comparing to undefined, they should always return false.

Fixed: 341972221
Change-Id: I61aafc6a18682eb02fb0fa43bb5a77d19bb0552e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5555384
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Olivier Flückiger <olivf@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94018}
2024-05-22 08:45:44 +00:00
Victor Gomes ea03776b70 [maglev] Consider number values in BranchBuildIfRootConstant
Non-tagged values (and numbers) should always return false when
comparing to a root constant, except HoleyFloat64, which can be
undefined.

Drive-by: if iterator_method is untagged, then just throw an
exception in GetIterator.

Fixed: 341167196
Change-Id: Id6a20c3d6e3d40e7c03e0a8e877464ab29ac1fcb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5553851
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94006}
2024-05-21 12:17:28 +00:00
Victor Gomes 2550078856 [maglev] Add a BranchBuilder
This allows the subgraph builder to share the same BuildBranchXXXX
code with the main graph builder.

Bug: v8:7700
Change-Id: I695e8a1ae2fa13390091cf710dd635bec10a11aa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5547741
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93975}
2024-05-17 14:17:13 +00:00
Victor Gomes 66a0b7197d [maglev] Fix ToBoolean and TypeOf for Undetectable objects
Bug: v8:7700
Change-Id: I96cee619d204464b2466b3f78ed95d6130ddded8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5541828
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93910}
2024-05-15 10:13:19 +00:00
Victor Gomes 1e23407edb Reland "[maglev] Inline ArrayIterator"
This is a reland of commit af975a06e2

Fix: propagate the iteration kind.

Original change's description:
> [maglev] Inline ArrayIterator
>
> Bug: v8:7700
> Change-Id: Ia92c9256ed2ab209033aac37414dce6ef3166c53
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5528005
> Reviewed-by: Toon Verwaest <verwaest@chromium.org>
> Commit-Queue: Victor Gomes <victorgomes@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#93857}

Bug: v8:7700
Change-Id: I253ab06f099b6e9865d1ada35ea265b01bf445ee
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5541968
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93909}
2024-05-15 09:54:42 +00:00
Victor Gomes 24534cab9b Reland "[maglev] Inline GetIterator"
This is a reland of commit 2098e649b4

Fix: LazyContinuationFrameScope should be only considered for
lazy deopts. We can skip when emitting an eager frame.

Before this CL we would checkpoint the eager deopt frame, so that
it wouldn't be recreated with the lazy continuation frame on top.
However, this CL wraps a lazy deopt continuation to a call to
TryBuildLoadNamedProperty, which can split in multiple blocks
in case of polymorphic feedback and need to reconstruct the
deopt frame.

I also added the regression test.

Original change's description:
> [maglev] Inline GetIterator
>
> Bug: v8:7700
> Change-Id: I8bc9ac2bc884e4f02e159aaf1a9b04b91fc4be4e
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5531447
> Commit-Queue: Victor Gomes <victorgomes@chromium.org>
> Reviewed-by: Toon Verwaest <verwaest@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#93856}

Bug: v8:7700
Change-Id: I90fe9ac7fe6be7ffb64c35aa02f1c4c63c853c92
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5537911
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93906}
2024-05-15 09:01:41 +00:00
Victor Gomes 21fd4aa176 [maglev] Fix regression when refactoring ReduceArrayConstructor
Bug: v8:7700
Change-Id: Ie5328623170a1645ad2f955e69ed8ab4abc86b56
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5527022
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93892}
2024-05-14 12:32:46 +00:00
Victor Gomes 1c852249c7 [maglev] Extend NodeType with (un)detectables JS receivers
Undetectable objects should return false in ToBoolean, whereas any
other JSReceiver returns true. Since there is only one possible
JSReceiver and undetectable object (aka document.all), we track its
type separately.

Fixed: 340167165
Change-Id: I950f6390a3e42abe68e0de76106bae1fb0d0fb57
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5535008
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Olivier Flückiger <olivf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93877}
2024-05-14 07:37:39 +00:00
Victor Gomes 6615a7a9d0 [sandbox] Check array initial map was not corrupted
DependOnInitialMapInstanceSizePrediction uses the default initial
map for the array_function to calculate the slack size.

Later we update the initial map depending on the elements kind.
We assume that the slack calculated by this updated initial map
is the same.

So in the CL we add a check in CapturedObject::set to be sure
we don't overflow the CapturedObject.

Drive-by: We refactor ReduceArrayConstructor to make the
initial map logic more explicit.

Fixed: 339517309
Change-Id: Ib7de77738895c1ff2ccfced2d4bc5499c18a5ca2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5534744
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Olivier Flückiger <olivf@chromium.org>
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93860}
2024-05-13 14:20:32 +00:00
Victor Gomes af975a06e2 [maglev] Inline ArrayIterator
Bug: v8:7700
Change-Id: Ia92c9256ed2ab209033aac37414dce6ef3166c53
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5528005
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93857}
2024-05-13 14:00:35 +00:00
Victor Gomes 2098e649b4 [maglev] Inline GetIterator
Bug: v8:7700
Change-Id: I8bc9ac2bc884e4f02e159aaf1a9b04b91fc4be4e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5531447
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93856}
2024-05-13 13:59:31 +00:00
Victor Gomes 4eaaa2a2af [maglev] Optimize TypeOf based on KNA type info (Part II)
Add callables to https://crrev.com/c/5522226

Bug: v8:7700
Change-Id: Ib75fb2e43326c46ea08d544a109c61e8bca0d328
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5526297
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Commit-Queue: Olivier Flückiger <olivf@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93846}
2024-05-13 08:14:29 +00:00
Victor Gomes 8458aa9806 Partial revert: [maglev] Constant fold reference equal of constants
The check if the node is a boolean type different than one of the
boolean roots needs to be done with the original node.

Fixed: 339506922
Change-Id: I1fa981bbde8b9606722722efe0ca9669a835e6bb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5529237
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93821}
2024-05-10 10:16:43 +00:00
Victor Gomes 18572f3fb0 [sandbox] Emit the SBXCHECK_EQ before any CapturedObject::set
Fixed: 339310133
Change-Id: Ie808d65b83aec985e4652e487fcb7d3efcfa49d6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5526479
Reviewed-by: Samuel Groß <saelo@chromium.org>
Commit-Queue: Samuel Groß <saelo@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93804}
2024-05-08 15:46:51 +00:00
Victor Gomes 861a2eb699 [maglev] Constant fold reference equal of constants
Bug: v8:7700
Change-Id: I2fe8d69a68757ffa67179b0e60064e7944d8085c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5522445
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93802}
2024-05-08 14:41:54 +00:00
Victor Gomes 3e3f64bb64 [maglev] Optimize TypeOf based on KNA type info
Bug: v8:7700
Change-Id: I1d108052ca698262f15570efd9e6f09faddb2093
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5522226
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93794}
2024-05-08 11:22:28 +00:00
Victor Gomes 6898a582da [maglev] Don't call CallFunctionForwardVarargs for class constructors
Fixed: 338457105
Change-Id: I56b4b0d7b3fc04175f8a3562944fa9e02e4df5d5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5518454
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93760}
2024-05-07 11:13:17 +00:00
Victor Gomes 261e6044f5 [sandbox] Add sandbox checks when reading a map instance size (Part II)
Missed SBXCHECK in https://crrev.com/c/5471972.

Fixed: 336648007
Change-Id: I0c303737b35d316c3cab70e2643f871e78f70155
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5518174
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Samuel Groß <saelo@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Samuel Groß <saelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93737}
2024-05-06 14:27:54 +00:00
Victor Gomes 1f44d87277 [maglev] Fix typo CreateJSStringIterator
Change-Id: Ieb36db9637a37935c520dfaf9127a1b48171d24d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5501045
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93656}
2024-04-30 15:09:25 +00:00
Victor Gomes c42bda3ad3 [maglev] Inline JSCreateStringIterator allocation
Drive-By: Fix printing allocation input location before the
escape analysis pass.

Bug: v8:7700
Change-Id: I015ccb1698e5588968963bd980919103f9f5b382
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5498497
Reviewed-by: Patrick Thier <pthier@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93652}
2024-04-30 14:07:39 +00:00
Victor Gomes 57d51a6175 [maglev] Inline JSIteratorResult allocation
Bug: v8:7700
Change-Id: I10e20776f6e2e12690c1b284f5030bb08382a629
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5501495
Reviewed-by: Patrick Thier <pthier@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93651}
2024-04-30 13:57:03 +00:00
Victor Gomes 947ae8167a [maglev] Inline JSGeneratorObject allocation
Bug: v8:7700
Change-Id: Ibb1293f9409bf13d4607fbc0e81e143f635aea58
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5501037
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93649}
2024-04-30 13:25:07 +00:00
Victor Gomes c59baec10c [maglev] Set elements kind to holey if constructing array of possibly non-zero length
Fixed: 337069178
Change-Id: Ia065a0cd5f12c09dc0b48c2046f7f4bf784f4b15
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5490696
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93636}
2024-04-29 14:52:22 +00:00
Victor Gomes 5acaced039 [maglev] Improve printing of inlined allocations
We print the object map instead of its size and we print (elided)
instead of its location, when the object was elided by the escape
analysis.

Bug: v8:7700
Change-Id: I371f8f9901a834690511d7db2d4baa173bd84075
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5489040
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93582}
2024-04-25 14:05:24 +00:00
Victor Gomes adb027225a [maglev] Fix forwarding inline arguments that flows to toplevel
2 errors in the previous CL:
- Checking for is_inline() is not enough to check if the arguments
object were built in inlined function.
- We cannot reconstruct the arguments object elements from
the inlined_arguments_ array, we should read its captured
elements offset, since it could have been created by a different
function.

This CL adds tags to CapturedObject to identify its provenance.
It also adds support to RestParameters.

Fixed: 336833467
Bug: 326091155
Change-Id: I48763a817428952d7178bd1ec3bde76af5f1be82
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5487519
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93574}
2024-04-25 11:03:53 +00:00
Victor Gomes f7f5a26751 [maglev] Partially inline Array constructor
Inline calls to the array constructor like:
`new Array()` or `new Array(size)`

This does not consider argument count > 1 and calls to the
constructor without the keyword `new`.

Bug: v8:7700
Change-Id: I30aead1032f88a516823e2d6ca39eee8e0a72290
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5481578
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93572}
2024-04-25 10:06:27 +00:00
Victor Gomes eb56742fb4 [maglev] Support arguments object forwarding
... and avoid the arguments object allocation.

Bug: 326091155
Change-Id: I05ec73ed0a75f202108f5aadf136ff10afb8d1cd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5465510
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93563}
2024-04-24 15:20:22 +00:00
Victor Gomes e2a203b59f [maglev] Fix bug else-if condition in phi reprentation selector
It also changes the if-chain to a switch statement, since it is more explicit.

Fixed: 336681950
Change-Id: I94ecec0cf9f8d06340b3690c38bfb19f41aa50da
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5481792
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93554}
2024-04-24 11:59:03 +00:00
Victor Gomes 529f6a0a90 Reland "[maglev] Re-enable ReduceFunctionPrototypeApplyCallWithReceiver"
This is a reland of commit 38d8751be2

- Fixed Goto in SelectioReduction to use GotoOrTrim in case of abort
- Fixed to use tagged version of arg_list
- Added a test.

Original change's description:
> [maglev] Re-enable ReduceFunctionPrototypeApplyCallWithReceiver
>
> The reason this reduction was disabled is that we did not
> support the case when the second argument could be null or
> undefined.
>
> With the SubGraphBuilder, this is trivial to implement.
>
> Bug: v8:7700
> Change-Id: I8d880935c8bf7383c0307127c3f72b1b5cea168f
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5458171
> Auto-Submit: Victor Gomes <victorgomes@chromium.org>
> Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> Commit-Queue: Victor Gomes <victorgomes@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#93401}

Bug: v8:7700
Change-Id: I313a5db68958901631005ac294186f54920ff36d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5458397
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93527}
2024-04-23 12:29:27 +00:00
Victor Gomes 59b72d004c [maglev] ArgumentsElements cannot be deduplicated
The elements backing store of an arguments object participates in the
duplicate object counting, but can itself never appear duplicated.
In particular, mapped/unmapped arguments object cannot share the
same ArgumentsElements as the rest parameter.

Here, we replicate TF logic. See:
https://crsrc.org/c/v8/src/compiler/backend/instruction-selector.cc;drc=a3131051ccdd567a82ffe30d7068ba6d398766ab;l=1089

Fixed: 336179080
Change-Id: Iab8ae803efcfc6368a5150c497a5365e1cdbe831
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5473605
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93519}
2024-04-23 09:03:46 +00:00
Victor Gomes f30dd9be58 [sandbox] Add sandbox checks when reading a map instance size
Fixed: 335322609
Change-Id: I59461a82964008a95fc373e3cd6c83fc355b7673
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5471972
Commit-Queue: Samuel Groß <saelo@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Samuel Groß <saelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93501}
2024-04-22 13:54:08 +00:00
Victor Gomes 04a7ddbd35 [maglev] Deduplicate ArgumentsElements node
Fixed: 335704890
Bug: 326091155
Change-Id: If0f671bce69d88971eaac24e8a91df2b1de66674
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5471663
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93499}
2024-04-22 13:16:48 +00:00
Victor Gomes 38d8751be2 [maglev] Re-enable ReduceFunctionPrototypeApplyCallWithReceiver
The reason this reduction was disabled is that we did not
support the case when the second argument could be null or
undefined.

With the SubGraphBuilder, this is trivial to implement.

Bug: v8:7700
Change-Id: I8d880935c8bf7383c0307127c3f72b1b5cea168f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5458171
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93401}
2024-04-16 16:48:38 +00:00
Victor Gomes b2220f7a12 [maglev] One-way dependency for inlined allocations
Bug: 326091155
Change-Id: I5f0a1ad9988133c23592fe8cdc1f0b545ed9ae7b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5440158
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93385}
2024-04-16 10:52:30 +00:00
Victor Gomes 823a643ac7 [maglev] Store the hole in mapped argument object
... to indicate that the argument was not passed to the function.

This is a regression from the previous refactoring, we were
doing the same thing before.
https://crrev.com/c/5435076

Note this does not need to be done for inlined functions, since
we know exactly the correct mapped count.

Fixed: 334974242
Bug: 326091155
Change-Id: I004a7e6a7aea678147f3e0d4e2172ff2318bfe79
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5453873
Reviewed-by: Patrick Thier <pthier@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93383}
2024-04-16 09:55:50 +00:00
Victor Gomes 650668aea0 [maglev] Inline RegExpLiteral allocation
This shows off how to create a new inlined allocation in Maglev.
The allocation automatically participates in the escape analysis.

Bug: v8:7700
Change-Id: Idff4738186a38a958a4325315a85039f4c7933f1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5443264
Reviewed-by: Patrick Thier <pthier@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93372}
2024-04-15 15:45:01 +00:00
Victor Gomes 83fafb879c [maglev] Refactor FastObject machinery
... and allow the arguments object to participate in the
escape analysis.

This CL:

Creates CapturedObject, which is simply an array of CapturedValues.
CapturedObject abstracts the previous FastObject, FastContext,
FastFixedArray, FastArguments... Instead it provides functions
static creation functions. All objects automatically
participate in the escape analysis.

This avoids code duplication. For instance, allocation and
translate state creation is very similar for all these objects.

This also creates a single allocation function (which creates
InlinedAllocation node) and wrap all nested objects in
runtime values variant of CapturedValues.
This decouples the "escapeness" of the nested allocations.
This will allow the simplification of dependencies in a
follow up CL.

CaptureObject also deals with extra input locations
automatically.

InputLocations are also simplified: we walk the same input
locations in the same order if we escape or not the allocation.
We also always dedicate an input location to the InlinedAllocation
node even if it was captured.

This currently disables property load / element load caches.
These optimizations were not very useful for these kind of objects
anyways. However, a follow up CL will recreate these optimizations
by manipulating the CapturedObject directly.

Bug: 326091155

Change-Id: I245803d2a9a1a86fd085160c995d4efa5640652f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5435076
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93371}
2024-04-15 15:13:49 +00:00
Victor Gomes c40fc0cb4e [maglev] Fix DeepForEachInputAndDeoptObject to consider nested captured objects
The function passed as parameter to DeepForDeoptObject tree walker needs
to consider nested escaped objects. We use a recursive lambda for that.

In the test case, for instance, we should not try to apply argument `f`
(the node marker) to a captured context (InlinedAllocation) that is
the extension value of another captured context that will be
materialized when/if we deopt.

Fixed: 332947120
Bug: 326091155
Change-Id: Ibab8bb758cc7ce704cfeee4200f6fcab0eaf4728
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5431937
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93229}
2024-04-08 11:56:46 +00:00
Victor Gomes 45dc385fb3 [maglev] Fix duplicated object input location position
We don't need to use the input_locations for duplicated object, we
should skip them.

The input location size for an InlinedAllocation is either 1 when
escaped, or GetInputLocationsArraySize when captured.

Fixed: 332392668
Bug: 326091155
Change-Id: I3b8a1c8559a7feaef3bbf813dbdb27bcb081051e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5419174
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93144}
2024-04-03 13:46:52 +00:00
Victor Gomes 56fd7a8311 [maglev] Add source position for BuiltinContinuationFrame
Fixed: 332570754
Change-Id: I408febb75c2dacc18521b80e3d4a36fb47d4bbb7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5419398
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93143}
2024-04-03 13:08:58 +00:00
Victor Gomes c814d861f8 [bazel] Disable warning flags that have been added to Wextra in clang
Bug: b/330781959
Change-Id: I14cd40fff79f52d83e8b1f669419efcde11671fe
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5401791
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93117}
2024-04-02 13:49:52 +00:00
Victor Gomes d31dc5ecb1 [maglev] Remove FastField(ValueNode)
We want FastObjects to continue to be constants, ie. they don't
depend on generic ValueNodes.

This removes FastField and wire inlined arguments elements
differently.

Bug: 326091155
Change-Id: I91ca451d1a0c61ee11c94cab58325f5f44b0d938
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5401861
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93116}
2024-04-02 13:45:30 +00:00
Victor Gomes 27ebef493c [sandbox] Fix sandbox violation in maglev::VisitCreateBlockContext
ScopeInfo is assumed to be corrupted, we then create a FastContext
object that is smaller than Context::MIN_CONTEXT_SLOTS.

Since we always assume that a context has at least the mandatory slots,
we corrupt memory later.

Fixed: 331837303
Change-Id: I0b6e32b7457778777ade8257e907fe9d71bea206
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5412131
Reviewed-by: Samuel Groß <saelo@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93108}
2024-04-02 09:22:10 +00:00
Victor Gomes 70e69c6d0a [maglev] Add FastContexts to escape analysis
That is, it allows the allocation of contexts to be elided if
it does not escape.

This CL:
- simplifies FastContext, since most fields are just undefined. This
allows to easily identify runtime values. FastContext also does not
use FastField(ValueNode*) anymore, which makes it possible to
delete this constructor in a follow up CL.
- updates DeepForEachInputImpl to also visit DeoptObjects.
- adds InputLocations in DeoptInfos for value nodes in a DeoptObject
- extends the lifetime of value nodes that are fields in a DeoptObject
- allocates inputs for these value nodes during regalloc
- create a CAPTURE_OBJECT for non escaping contexts to materialize
them during deoptimization.

Bug: 326091155

Change-Id: I58a446bb17b702cb3dd90564c6793d16bcb7d43e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5392586
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93105}
2024-04-02 09:04:05 +00:00
Victor Gomes 3417c91e5f [maglev] Fix strict comparison HoleyFloat64 with constants
We assume that if we strict compare an untagged value to a constant,
then the comparison is false.

This is not true with HoleyFloat64, since they can compare
equal to the undefined value.

This adds HoleyFloat64IsHole node and the optimization to use
BranchIfFloat64IsHole.

Fixed: 331711028
Change-Id: I9e2ccbdeda1f12795406a1256b5a76e526453d27
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5401864
Reviewed-by: Patrick Thier <pthier@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93102}
2024-04-02 07:52:32 +00:00
Victor Gomes 6be14e97cc [maglev] Enable escape analysis
Bug: 326091155
Change-Id: I7b0b4712b9199de8fce067c2006e130508728517
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5400701
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93071}
2024-03-27 16:15:15 +00:00
Victor Gomes 661f05587f [maglev] Enable deopt verbose printing when --trace-deopt-verbose
Bug: v8:7700
Change-Id: Ia66ffd13f654d6fac3e6cf957292a86e5a16ce4c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5400700
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93064}
2024-03-27 12:46:28 +00:00
Victor Gomes 97166b301b [maglev] Fix wrong map in TryBuildInlinedAllocatedContext
Fixed: 331420133
Change-Id: I2e1eabd3d5357743a772fe8875f684d145f0410e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5400696
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93060}
2024-03-27 09:53:11 +00:00
Victor Gomes 1a541afcb8 [maglev] Inline context allocation
Bug: 326091155
Change-Id: I4c45e96a7fd13d550f09fe42dd4abcd7611a4c7d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5384034
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93046}
2024-03-26 15:11:21 +00:00
Victor Gomes 25f36d9c6f [maglev] Fix polymorphic named access
Finish basic block with a Goto to label done only if
TryBuildPropertyLoad finishes with a result.

Otherwise, if it fails, the basic block would be empty,
since we have Goto to the generic case.

Fixed: 330427711
Change-Id: I07078f52c0693fb954b2018e4380d0cec8012bf1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5387762
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93007}
2024-03-25 15:22:52 +00:00
Victor Gomes 29674d6f1c [maglev] Drop input use from stores to non-escaping allocations
Previously, inputs to initialization stores were often constants,
so optimizing them away had little impact. However, the escape
analysis of the arguments object introduces runtime values
(ArgumentsLength and ArgumentsElements) that can't be eliminated.

This change saves stores during the AnyUseMarkingProcessor phase,
allowing us to process their inputs after identifying allocations
that did not escaped.

The inputs to the store would then be eliminated in
DeadNodeSweepingProcessor if their use reaches zero.

Bug: 326091155
Change-Id: I8aeca146c03008fab285b4fc52f3ed74c2cf09a9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5383474
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92948}
2024-03-21 13:58:20 +00:00
Victor Gomes 87e9015d13 [maglev] Fix type when checking the equivalence with a known value
... where equivalence doesn't imply same NodeType.

For instance, we cannot assume that a TypeCombine with a HeapNumber
and a generic tagged value yields another HeapNumber.

In particular, the node Float64ToTagged may return a Smi instead of
a HeapNumber.

Fixed: 329476993
Change-Id: I3f1c06e0b870ba3c84a1f3ea19f8d2a7b03cdd8f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5383097
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92943}
2024-03-21 12:36:32 +00:00
Victor Gomes 0635970934 Reland^2 "[maglev] Support arguments object in inlined function"
This is a reland of commit 12c69e482d

This fixes the index of mapped parameters in the function context:
For the top function, mapped_count = parameter_count_without_receiver,
but this is not the case for inlined functions.

Original change's description:
> Reland "[maglev] Support arguments object in inlined function"
>
> This is a reland of commit 38554cc99f
>
> Original change's description:
> > [maglev] Support arguments object in inlined function
> >
> > We actually already support them via runtime function calls
> > We only need to enable them.
> >
> > Drive-by: if the number of rest parameters is zero (empty
> > fixed array), we could fail GetWriteBarrierMode.
> > So instead, we return the rest object earlier.
> >
> > Bug: v8:7700
> > Change-Id: Ib07c8b91cf9c0bc668358de47b1b9b74adb715ad
> > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5366455
> > Commit-Queue: Victor Gomes <victorgomes@chromium.org>
> > Reviewed-by: Patrick Thier <pthier@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#92819}
>
> Bug: v8:7700
> Change-Id: I7812c8da58ede3b66af4b5202587d070cd0b332b
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5382159
> Commit-Queue: Patrick Thier <pthier@chromium.org>
> Auto-Submit: Victor Gomes <victorgomes@chromium.org>
> Reviewed-by: Patrick Thier <pthier@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#92924}

Fixed: 330578127
Bug: v8:7700
Change-Id: Ic9be959cf3a16acb9cc8b1c7ec2adf5326849056
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5383081
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92934}
2024-03-21 10:24:04 +00:00
Victor Gomes 6503a987d9 [objects] Deal with large strings in NoSideEffectsErrorToString
If name is too big, StringBuilder will fail to even add
"<a very large string>" suffix.

In this case, we truncate name first.

Bug: 329699609
Change-Id: I6e4440c07eae84371f44b54f88127e2c70af0db5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5378286
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92932}
2024-03-21 09:45:51 +00:00
Victor Gomes 12c69e482d Reland "[maglev] Support arguments object in inlined function"
This is a reland of commit 38554cc99f

Original change's description:
> [maglev] Support arguments object in inlined function
>
> We actually already support them via runtime function calls
> We only need to enable them.
>
> Drive-by: if the number of rest parameters is zero (empty
> fixed array), we could fail GetWriteBarrierMode.
> So instead, we return the rest object earlier.
>
> Bug: v8:7700
> Change-Id: Ib07c8b91cf9c0bc668358de47b1b9b74adb715ad
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5366455
> Commit-Queue: Victor Gomes <victorgomes@chromium.org>
> Reviewed-by: Patrick Thier <pthier@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#92819}

Bug: v8:7700
Change-Id: I7812c8da58ede3b66af4b5202587d070cd0b332b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5382159
Commit-Queue: Patrick Thier <pthier@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92924}
2024-03-20 16:50:08 +00:00
Victor Gomes d50d68eaa7 Reland "[maglev] Inline allocation of arguments object inside inlined functions"
This is a reland of commit 85bc9e47a6

The bot issue was fixed on https://chromium-review.googlesource.com/c/v8/v8/+/5374908

This also adds a fix for 330095905 (emit empty fixed array when
arguments size equals to 0) and some test cases.

Original change's description:
> [maglev] Inline allocation of arguments object inside inlined functions
>
> Bug: 329474405, 326091155
> Change-Id: If984c6ab448ee85cafba7f7fccd1d767174ff79b
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5371987
> Commit-Queue: Leszek Swirski <leszeks@chromium.org>
> Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> Auto-Submit: Victor Gomes <victorgomes@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#92870}

Bug: 330095905, 329474405, 326091155
Change-Id: I67d1f38b69e119b5df5d8eec0633db0f5766d4c2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5378630
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92922}
2024-03-20 14:53:25 +00:00
Victor Gomes 3f0d50dc63 [maglev] Enable escape anlaysis on maglev-future
Bug: 326091155
Change-Id: Ic337d261281414c8430d574363bd26eef46eeab5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5372855
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92917}
2024-03-20 09:54:36 +00:00
Victor Gomes 14fc145702 [maglev] Add trace escape analysis flag
Bug: 326091155
Change-Id: Iec92db0791ccfc712bf2b7402f1586b22d1a645e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5378629
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92904}
2024-03-19 16:52:32 +00:00
Victor Gomes c08f399c16 [maglev] Use a DisjointSet for allocation dependencies
... and analyse them after AnyUseMarkingProcessor, which will
delete most of unused nodes.

The non escaped allocations and its stores are them removed from the
graph in DeadNodeSweepingProcessor.

If the store makes nodes unused, it is then too late to remove them.

This fixes the issue when we have 3 allocations (A, B, C)
and the dependencies (A, C) and (B, C).

Assuming A and C are not escaping, but B is.

If we process A first, we will remove the node, since it
is non-escaping.

But later, we process B, which forces C to escape.
Therefore, A needs to escape as well!

This CL also allows multiple dependencies.

This CL also simplifies the HasEscaped predicate:
After EscapeDependentAllocationsIfNeeded, we use a simple boolean
flag to denote escaped objects.

Bug: 329474361, 326091155
Change-Id: I4682c0b78f9514a2aef804d55a81ba9954209f79
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5374908
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92902}
2024-03-19 15:31:22 +00:00
Victor Gomes 6e89395d93 Revert "[maglev] Enable escape analysis"
This reverts commit ebf059d7fa.

Reason for revert: 328812070

Original change's description:
> [maglev] Enable escape analysis
>
> Bug: 326091155
> Change-Id: I876e0ff6f0f264f58a9bd849c9e25f8a464aad27
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5366029
> Commit-Queue: Patrick Thier <pthier@chromium.org>
> Auto-Submit: Victor Gomes <victorgomes@chromium.org>
> Commit-Queue: Victor Gomes <victorgomes@chromium.org>
> Reviewed-by: Patrick Thier <pthier@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#92809}

Bug: 326091155
Change-Id: I61e3b58317cbae6d269f961eaec2c29371b4841c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5378145
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92884}
2024-03-18 16:33:14 +00:00
Victor Gomes 825835364a Revert "[maglev] Support arguments object in inlined function"
This reverts commit 38554cc99f.

Reason for revert: Performance regressions.

Original change's description:
> [maglev] Support arguments object in inlined function
>
> We actually already support them via runtime function calls
> We only need to enable them.
>
> Drive-by: if the number of rest parameters is zero (empty
> fixed array), we could fail GetWriteBarrierMode.
> So instead, we return the rest object earlier.
>
> Bug: v8:7700
> Change-Id: Ib07c8b91cf9c0bc668358de47b1b9b74adb715ad
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5366455
> Commit-Queue: Victor Gomes <victorgomes@chromium.org>
> Reviewed-by: Patrick Thier <pthier@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#92819}

Bug: 330096622, v8:7700
Change-Id: Idd52f310c26e2476b372eced4a5da86a5bf6ddb9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5374912
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92883}
2024-03-18 16:16:35 +00:00
Victor Gomes 85bc9e47a6 [maglev] Inline allocation of arguments object inside inlined functions
Bug: 329474405, 326091155
Change-Id: If984c6ab448ee85cafba7f7fccd1d767174ff79b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5371987
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92870}
2024-03-18 10:50:53 +00:00
Victor Gomes 38554cc99f [maglev] Support arguments object in inlined function
We actually already support them via runtime function calls
We only need to enable them.

Drive-by: if the number of rest parameters is zero (empty
fixed array), we could fail GetWriteBarrierMode.
So instead, we return the rest object earlier.

Bug: v8:7700
Change-Id: Ib07c8b91cf9c0bc668358de47b1b9b74adb715ad
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5366455
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92819}
2024-03-13 15:39:57 +00:00
Victor Gomes 69c60d5cd0 [maglev] Support inlining allocation of mapped arguments
Bug: 326091155
Change-Id: I82c856938830f7510e9f5b6d8684842a70b41f11
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5366454
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92814}
2024-03-13 15:07:52 +00:00
Victor Gomes ebf059d7fa [maglev] Enable escape analysis
Bug: 326091155
Change-Id: I876e0ff6f0f264f58a9bd849c9e25f8a464aad27
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5366029
Commit-Queue: Patrick Thier <pthier@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92809}
2024-03-13 12:09:28 +00:00
Victor Gomes ab542a8ab7 [maglev] Fix sandbox vialotion when inlining functions
... with a corrupted formal parameter count.

Fixed: 329214797
Change-Id: I56d93528663ffd55e8dc1ad6441105ed23eb95e3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5367281
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Samuel Groß <saelo@chromium.org>
Commit-Queue: Samuel Groß <saelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92805}
2024-03-13 09:53:35 +00:00
Victor Gomes 3270515849 [maglev] Consider HoleNaNs when create deopt info
... for holey double fixed arrays.

Fixed: 328846303
Bug: 326091155
Change-Id: I8ab16fd190f1e680f77cbba4a30a684a0aecdcc8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5366200
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92790}
2024-03-12 15:30:31 +00:00
Victor Gomes 6ff81a19bc [maglev] Always escape inlined arguments
... since they might be accessed by an arguments object
later on, even if they don't have any uses in the inlined
function.

Fixed: 328680228
Bug: 326091155
Change-Id: I4c7929d1a7e3f130706bcdab3e9acb77bf566153
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5361782
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92784}
2024-03-12 13:09:23 +00:00
Victor Gomes 8ed9229d1e [maglev] Give fresh object ids in inlined functions
Object ids should be unique. In particular, object allocated
inside inlined functions should have different ids than the
ones allocated in the parent function. Otherwise we will
materialize the wrong object in the deoptimizer.

Fixed: 328868985
Bug: v8:7700, 326091155
Change-Id: Icfb803a38fd94520d5b4dae6d90cb72f67e119bc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5361455
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Commit-Queue: Olivier Flückiger <olivf@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92766}
2024-03-12 08:15:58 +00:00
Victor Gomes 59c8a4462e [maglev] Always escape receiver for inlined functions
This also unfortunately forces all inlined allocated constructors to
escape.

Fixed: 328676392
Bug: v8:7700, 326091155
Change-Id: Iec22c3f29ce445c3507d228600d0a3222d0ab430
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5361035
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92758}
2024-03-11 17:02:53 +00:00
Victor Gomes 953c993938 [maglev] Inline some arguments object allocation
Caveats:
- We do not inline the allocation for inlined functions.
- We do not support aliased/mapped arguments.
- Allocation currently always escape (we do not add the non escape uses).

Bug: v8:8800, 326091155
Change-Id: Ia4dc2d248169bef08fc25caf16f9d8f79d8c7e9f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5344756
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92748}
2024-03-11 11:04:18 +00:00
Victor Gomes 7f07d1a199 [maglev] Add flag and disable escape analysis
Temporarily disable escape analysis until all known
bugs are fixed.

Bug: v8:7700, 326091155, 328751844
Change-Id: Ib7d6fdaebe7e8018f650c883a0776e5ad18680b0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5358394
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92743}
2024-03-11 10:04:10 +00:00
Victor Gomes 05e95a69f3 [maglev] Avoid deopt loop when optimizing builtin calls
If we don't have a feedback source, we should always
disallow speculation. Otherwise we might create a deopt loop.

Bug: v8:8800
Change-Id: Iaaf334d07e5e71ae451f10f638d0ac1ab943f43d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5350602
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92708}
2024-03-07 10:54:46 +00:00
Victor Gomes 1b90bcf8c6 [maglev] Change overzealous DCHECK in GetDeoptFrameForLazyDeopt
Bug: 328483400
Change-Id: Ic575f8579b25f0ca835d86d6a448a1322f502e76
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5351785
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92704}
2024-03-07 10:19:50 +00:00
Victor Gomes 9f2083388e Reland "[maglev] Simple escape analysis for inlined allocated objects"
This is a reland of commit 576176291b

Fix 3 issues:
- Fix hole issue in Float64
- Always escape constructors that have any use in the inlined function
- Always escape if object is allocated inside a try-block, since
we do not currently support materialization of the object in the catch
block.

Original change's description:
> [maglev] Simple escape analysis for inlined allocated objects
>
> Only escape objects that have no use, other than its initializing
> stores.
>
> Bug: v8:8800, 326091155,
> Change-Id: I8c25fdd7da12058cf33501f03d43d4f357c2bc46
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5306934
> Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
> Commit-Queue: Victor Gomes <victorgomes@chromium.org>
> Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#92667}

Fixed: 328280144, 328096360, 328134548
Bug: v8:8800, 326091155
Change-Id: Ia1e18df1d5d807184cd3f05c0b9b1be5fbd0c4de
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5348997
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92701}
2024-03-07 08:25:26 +00:00
Victor Gomes 576176291b [maglev] Simple escape analysis for inlined allocated objects
Only escape objects that have no use, other than its initializing
stores.

Bug: v8:8800, 326091155
Change-Id: I8c25fdd7da12058cf33501f03d43d4f357c2bc46
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5306934
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92667}
2024-03-05 15:06:28 +00:00
Victor Gomes f081852241 [test] Skip turboshaft frontend in Google3
It currently fail during import:
http://sponge2/55b896b3-b51b-462c-93cc-013f6a2f2613

Bug: v8:14581
Change-Id: Icb4508b5fbea4d2fa6f1a316cf08856c6417bf2d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5340717
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92660}
2024-03-05 11:14:34 +00:00
Victor Gomes 5748834cc5 [bazel] Fix some bazel buildifier complains
Change-Id: Ic49ac7e647ce14081b271dc5baf0cfe8c5a7b438
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5342761
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92657}
2024-03-05 11:05:20 +00:00
Victor Gomes b26554ec36 [bazel] Remove deprecated _allowlist_function_transition
Change-Id: I52deb503ed1a8ab933d903b2212b85673fef59e9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5339880
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92649}
2024-03-04 16:11:38 +00:00
Victor Gomes 796b8bc6ff [bazel] Update prebuilt bazel to 7.1
Bug: v8:14110
Change-Id: Ie726b83c75c0008c54e118bbd4cee6b4b2095a6f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5339878
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92647}
2024-03-04 15:43:23 +00:00
Victor Gomes f5c2f14be0 [bazel] Update script to run bazel 7+
- Use label instead of relative paths.
- Remove ctx.workspace_name use.

Change-Id: Ifce2d9b6d6646e2a0f20f9e4d4fea7ffa675c03d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5339896
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92646}
2024-03-04 15:37:41 +00:00
Victor Gomes 5c7468289f [bazel] Remove glob directives
Change-Id: I952d8a0a0c777e67652865605b5ff6e5bce798f5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5339872
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92640}
2024-03-04 13:23:05 +00:00
Victor Gomes b1f3b1b10d Reland "[maglev] Cache elements array"
This is a reland of commit 94b71ec6f3

Original change's description:
> [maglev] Cache elements array
>
> Drive-by: also record JSArray::kLength in FastObjects
>
> Bug: v8:7700
> Change-Id: I0440f5682ada55cf9ee7a34a6f31c0895c8c3428
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5306756
> Auto-Submit: Victor Gomes <victorgomes@chromium.org>
> Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> Commit-Queue: Victor Gomes <victorgomes@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#92422}

Fixed: b/325992259, b/326142592
Bug: v8:7700
Change-Id: I137ea524a2fd42d2f0071224ab5072bd3ba145d5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5309912
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92460}
2024-02-21 17:04:21 +00:00
Victor Gomes bbaad9bf8a [maglev] Implement polymorphic loads using the sub graph builder
Bug: v8:7700
Change-Id: I406f55875ceb328961172fe87543300afc9e3531
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5272238
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92452}
2024-02-21 15:29:52 +00:00
Victor Gomes 94b71ec6f3 [maglev] Cache elements array
Drive-by: also record JSArray::kLength in FastObjects

Bug: v8:7700
Change-Id: I0440f5682ada55cf9ee7a34a6f31c0895c8c3428
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5306756
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92422}
2024-02-20 12:37:58 +00:00
Victor Gomes 74f5141e03 [maglev] Fix sandbox violation when allocating an empty array
Initial JSArray map shouldn't have any in-object properties,
we add a check to verify that this was not mutated by an
attacker.

Bug: b/324482838
Change-Id: Ia3ccf6f5cc00521ac154e3d6230a70603b455a72
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5291375
Reviewed-by: Samuel Groß <saelo@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92290}
2024-02-13 14:38:37 +00:00
Victor Gomes 549acb4d1a [maglev] Fix loading mutable heap number field
... from inlined allocated objects (FastObject).

Bug: b/41497204
Change-Id: I8209ae63bc9cdf2f548b6c9f52e0b352c93717a4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5289019
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92289}
2024-02-13 14:30:27 +00:00
Victor Gomes 32ca4fddfb [maglev] Negative index does not invalidate NoElements protector
When alllowing OOB access, we rely on no elements protector to
invalidate the optimization. But since negative index is not
consider an element access, it is transformed to a name and
loaded as a property, it does not invalidate the protector.

Here (as in TF) we force a deoptimization if index is negative.

Bug: v8:7700, chromium:41496337
Change-Id: I1eb7287f7a26e97e44df32cc63cc7aa633608532
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5286015
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92277}
2024-02-12 16:15:10 +00:00