This uses an optimized single-byte encoding for WASM_STUB_CALL reloc
entries when possible, by sacrificing size from DEOPT_REASON. Note that
stub calls in WebAssembly are used for trap handlers, which are fairly
common on regular WasmCode.
R=clemensh@chromium.org
BUG=chromium:850111,chromium:850413
Change-Id: I153fdd775290dece2884d438d5defd441486b369
Reviewed-on: https://chromium-review.googlesource.com/1090831
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53587}
This CL extracts code for loading a NumberDictionary element
from "EmitElementLoad" to its own function in the CSA.
This is done in preparation for a fast path in Torque for dictionary
elements.
R=jgruber@chromium.org
Change-Id: I3bb9897910183cd50be127bae771e531a61d57be
Reviewed-on: https://chromium-review.googlesource.com/1090832
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Simon Zünd <szuend@google.com>
Cr-Commit-Position: refs/heads/master@{#53586}
JSWeakCollection does not have any weak references anymore. Special
handling of Ephemerons can now be implemented in
VisitEphemeronHashTable.
Bug: chromium:844008
Change-Id: I9f4d8ad6a32cc7a55b715803f6a83ff8d2743ce8
Reviewed-on: https://chromium-review.googlesource.com/1090274
Commit-Queue: Dominik Inführ <dinfuehr@google.com>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53584}
This is a reland of 91bab5588c
This CL contains two major changes w.r.t to the original CL:
The random state is removed from the Smi root list and we pre-seed the RNG
on each sort with the length of the array.
To cut down on the length of the arguments list and to keep track of the
random state across recursive calls, we move most of the sort arguments into
a FixedArray and reload from the array for each recursion.
Original change's description:
> [array] Use random middle element to determine pivot during sorting
>
> This CL adds a "random state" to the Smi Root list and implements a
> basic Linear congruential pseudo random number generator in Torque.
>
> The RNG is used to determine the pivot element for sorting. This will
> prevent the worst cases for certain data layouts.
>
> Drive-by-fix: Make sorting of ranges and execution pauses for profviz
> deterministic by adding a secondary sorting criteria.
>
> Bug: v8:7382
> Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
> Change-Id: Ieb871e98e74bdb803f821b0cd35d2f67ee0f2868
> Reviewed-on: https://chromium-review.googlesource.com/1082193
> Reviewed-by: Hannes Payer <hpayer@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Reviewed-by: Camillo Bruni <cbruni@chromium.org>
> Commit-Queue: Simon Zünd <szuend@google.com>
> Cr-Commit-Position: refs/heads/master@{#53524}
Bug: v8:7382
Change-Id: Ia7bef7ed1c0e904ffe43bc428e702f64f9c6a60b
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Reviewed-on: https://chromium-review.googlesource.com/1087888
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Simon Zünd <szuend@google.com>
Cr-Commit-Position: refs/heads/master@{#53583}
Struct fields should not end in an underscore according to the style
guide.
Drive-by: Add {TurboAssembler} constructor which receives an
{IsolateData} directly, to allow creating a {TurboAssembler} in a
background thread.
R=mstarzinger@chromium.org
Change-Id: I32800476690f4c8619059519b7d27b06f5d4be95
Reviewed-on: https://chromium-review.googlesource.com/1090278
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53582}
This makes all runtime calls compiled by Liftoff load the respective
CEntry builtin from the instance object instead of embedding it into the
instruction stream. Another step towards making the code independent of
the originating Isolate.
As a drive-by this also changes one implicit runtime call in the stack
check in the TurboFan backend in a similar fashion.
R=clemensh@chromium.org
BUG=v8:7424
Change-Id: Ifab5995aa95250d6fae60ef5debb98aee2b6fc0c
Reviewed-on: https://chromium-review.googlesource.com/1089067
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53578}
With lazy compilation, not every exported function has code assiciated
with it. {WasmExportedFunction} provides the function index though,
which can be used to check whether code exists and access that code.
R=mstarzinger@chromium.org
Bug: v8:7758
Change-Id: Id80285fec46bf5be4af49875734aa0fe28d732c9
Reviewed-on: https://chromium-review.googlesource.com/1090273
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53576}
This makes the WebAssembly runtime stubs load the correct CEntry stub
from the instance object instead of embedding the address within the
instruction stream. It effectively makes those stubs independent of the
underlying Isolate.
R=clemensh@chromium.org
BUG=v8:7424
Change-Id: I0e7f3ecf7642d3fb1ee7adf83a8f0e6cc4d38fdf
Reviewed-on: https://chromium-review.googlesource.com/1086997
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53575}
This reads much nicer than the for loop with {num_imported_functions_}
and {num_functions}, and is potentially even faster, because we access
the code table directly and not via function index.
R=mstarzinger@chromium.org
Bug: v8:7754
Change-Id: I83e5c0253d8f78c22982a79d878431ba75cfc027
Reviewed-on: https://chromium-review.googlesource.com/1090271
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53574}
This reverts commit ceb9c8127f.
Reason for revert: Tanks compile time
Original change's description:
> [sfi] Remove SFI function literal id field
>
> SharedFunctionInfos store their original function literal's id. This is
> also their index in the Script's SFI list.
>
> Since the function literal id is only needed for lazy compilation and live
> edit, we can calculate it on-the-fly by linear search in the Script SFI list,
> and save a field on the SFI.
>
> If this regresses compile performance, we could alternatively store the
> function literal id on the preparsed scope data as future work.
>
> Bug: chromium:818642
> Change-Id: I5468cea0e115921f1c864d94e567d749a4349882
> Reviewed-on: https://chromium-review.googlesource.com/1082480
> Commit-Queue: Leszek Swirski <leszeks@chromium.org>
> Reviewed-by: Hannes Payer <hpayer@chromium.org>
> Reviewed-by: Toon Verwaest <verwaest@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53523}
TBR=hpayer@chromium.org,leszeks@chromium.org,verwaest@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:818642
Bug: chromium:850417
Change-Id: If2fd21331b7062532c04004a51e705f7e9d0a151
Reviewed-on: https://chromium-review.googlesource.com/1090494
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53573}
JSWeakCollection should use EphemeronHashTable as backing store instead of
ObjectHashTable such that the GC can handle these structures differently in
the future.
Bug: chromium:844008
Change-Id: Icc6df60c975a942877e2507ef45e0d235e5f72be
Reviewed-on: https://chromium-review.googlesource.com/1089063
Commit-Queue: Dominik Inführ <dinfuehr@google.com>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53572}
As a first step towards moving accesses to the broker, this moves
heap accesses from BitsetType::Lub to the broker.
Bug: v8:7790
Change-Id: Ie240b84b979717caae42cb8aa06ee8d9877a446d
Reviewed-on: https://chromium-review.googlesource.com/1088695
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53571}
Use a passed in Isolate/Heap directly rather than using GetIsolate() on
HeapObjects which may not in future be tied to an isolate.
Bug: v8:7786
Change-Id: I89d8706544aa135049434cf20c4e1308474c678b
Reviewed-on: https://chromium-review.googlesource.com/1089334
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53569}
This CL adds the simplest version of a trap handler fallback. At
instantiation time, we check whether the module was compiled to use
trap handlers and the memory is guarded. If the memory is not guarded
but the module is supposed to use trap handlers, we recompile the
module with bounds checks so that we can use an unguarded memory.
The compiled module is replaced with a bounds checking version, meaning
future instances from this module will also use bounds checks.
Some likely desirable features that are current missing but can be
added future CLs include:
* Disabling trap handler mode entirely.
* Recompiling all old instances so that trap handler and bounds checked
code does not coexist in the same process.
Bug: v8:7143
Change-Id: I161fc0d544133b07dc4a93cc6af813369aaf3efe
Reviewed-on: https://chromium-review.googlesource.com/1018182
Commit-Queue: Eric Holk <eholk@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53566}
Removes most explicit calls to GetIsolate/GetHeap from heap/ and implicit
calls via the single argument Handle constructor and handle function by
passing it in through calling functions.
(One GetHeap remains in FreeList in heap/spaces.cc for now).
Bug: v8:7786
Change-Id: I14fd099d26f94b9afbcfad41aa873c8f843297dd
Reviewed-on: https://chromium-review.googlesource.com/1087002
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53565}
Explicitly pass Isolate* to the Handle constructor even if it means
calling GetIsolate. (Shortly, I want to remove that constructor
completely since its an invisible source of implicit GetIsolates).
Bug: v8:7786
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: I3454e8c92e12bf5c5eb1d4e2018dff7c42949d26
Reviewed-on: https://chromium-review.googlesource.com/1089058
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53564}
This allows redifinitions of generics with the same name but differing parameter
type lists, e.g.
macro coerce<Dest: type>(from: HeapObject): Dest;
coerce<int32>(from: HeapObject): int32 {...}
macro coerce<Dest: type>(from: Smi): Dest;
coerce<int32>(from: Smi): int32 {...}
In order to allow multiple overloads of generic macros with the same name,
a more nuanced lookup of calls has been implemented using the
ParameterDifference utility class. There is still work to be done to unify
when ParameterDifference is used for lookup (e.g. removing it from operator
lookup when operators become simple aliases for macro names), but that work
will be done in a separate CL.
As part of this CL, the custom handling of "cast<>" operator in the .g4
grammar has been removed and replaced by a handful of equivalent overloads of
a generic "cast" macro.
Bug: v8:7793
Change-Id: Ibb2cdd3d58632b7f7f7ba683499f9688ae07f4f8
Reviewed-on: https://chromium-review.googlesource.com/1087873
Commit-Queue: Daniel Clifford <danno@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53562}
This lead to link errors in an unrelated CL. The function was declared
with "const PrintableInstructionBlock&", but defined with
"PrintableInstructionBlock&".
R=mstarzinger@chromium.org
Change-Id: I08a9837dc44dc9d8f508c914da92549179a6790e
Reviewed-on: https://chromium-review.googlesource.com/1088910
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53560}
On Android, %DebugPrint should output to the Android log instead of
stdout.
R=mstarzinger@chromium.org
Bug: v8:7820
Change-Id: Ia2ab14f1e4ae15914a1e0e721457f83b288683ff
Reviewed-on: https://chromium-review.googlesource.com/1088691
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53559}
This avoids embedding {RelocInfo::CODE_TARGET} addresses into WasmCode
by calling a WebAssembly runtime stub instead. The stubs themselves are
not yet independent of the Isolate, but will be made so soon.
Note that this also introduces a proper {compiler::TrapId} to avoid
accidental parameter type confusion with {TrapIf} and {TrapUnless}
operators.
R=clemensh@chromium.org
BUG=v8:7424
Change-Id: I32ef5a1253f336fc739d2192247826e9458456df
Reviewed-on: https://chromium-review.googlesource.com/1086937
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53557}
The typical use of assertThrowsEquals is to check that a specific
object is thrown. However, assertEquals only does a proper equality
check for primitive types, not for complex types. Using assertSame
does a reference equality check on objects, which is more what you
would expect from assertThrowsEquals. For exception kind testing,
assertThrowsEquals actually did not work correctly, assertThrows is
better for that case.
R=clemensh@chromium.org, mythria@chromium.org
Change-Id: I24fb22e75fa33ebe90eb4bae40825119a054bba5
Reviewed-on: https://chromium-review.googlesource.com/1087952
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53556}
Using DCHECK seems to be the common V8 style.
Change-Id: I6dab91e5225a222cbfe07ebeeec4ed1b274fe5bd
Reviewed-on: https://chromium-review.googlesource.com/1088698
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Stephan Herhut <herhut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53554}
This CL fully implements the DataView getters for the Uint8, Int8,
Uint16, Int16, Uint32 and Int32 types in Torque, and removes
the runtime implementation that is not needed anymore.
There should be a light but visible performance increase compared to
the former runtime implementation.
Change-Id: I7d85097fd5953b9629f3ac6bed93b068889712b2
Reviewed-on: https://chromium-review.googlesource.com/1078349
Commit-Queue: Théotime Grohens <theotime@google.com>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53553}
This makes sure {WasmCode} object are printed right after they have been
added to a {NativeModule} instead of waiting until the module is done.
This way debug output can be inspected as early as possible and works
even when there are issues later before the module is finished.
R=herhut@chromium.org
BUG=chromium:849713
Change-Id: Icced39cfaad7c033de569fbec21c26506f5796a6
Reviewed-on: https://chromium-review.googlesource.com/1088614
Reviewed-by: Stephan Herhut <herhut@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53549}
Test ThreadTicks.ThreadNow fails on systems with low resolution
thread timers because the tests detects that no time elapsed
since the beginning of the test.
This CL adds a counting loop that makes sure the thread
timer has progressed by at least one tick.
TEST=unittests/ThreadTicks.ThreadNow
Change-Id: I910309208b3a154798cbc43813d41d3755ab819d
Reviewed-on: https://chromium-review.googlesource.com/1082352
Commit-Queue: Ivica Bogosavljevic <ivica.bogosavljevic@mips.com>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53548}
`SetBuildEmbedderGraphCallback`, unlike `SetWrapperClassInfoProvider`,
assumes a monolithic embedder that can provide all necessary information.
That is not the case for e.g. Node.js, which can e.g. provide multiple Node.js
instances per V8 Isolate, as well as native addons that may allocate resources
on their own.
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: Ib53dfde82416dd69934b08623e27d674a483ac2d
Reviewed-on: https://chromium-review.googlesource.com/1082441
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53545}
Enabling once again post-branch point. This CL is expected to come
with major memory improvements and slight performance regressions.
Recent work on performance improvements has focused on x64, hence only
enabling there for now.
Bug: v8:6666
Change-Id: I29dc55eb4e592465073559647e280f74253b73e1
Reviewed-on: https://chromium-review.googlesource.com/1076247
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53544}
In order to port CompileLazy and DeserializeLazy builtins to CSA we need to
support this mode to be able to tail call to compiled or deserialized JS code
object.
Bug: v8:5269, v8:7703
Change-Id: I6abdc989af16774f6454b2ea0a97b1ce5ece5125
Reviewed-on: https://chromium-review.googlesource.com/1087452
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53543}
This reverts commit 91bab5588c.
Reason for revert: Seems to break a layout test:
https://ci.chromium.org/buildbot/client.v8.fyi/V8-Blink%20Linux%2064/23895
See also:
https://github.com/v8/v8/wiki/Blink-layout-tests
Original change's description:
> [array] Use random middle element to determine pivot during sorting
>
> This CL adds a "random state" to the Smi Root list and implements a
> basic Linear congruential pseudo random number generator in Torque.
>
> The RNG is used to determine the pivot element for sorting. This will
> prevent the worst cases for certain data layouts.
>
> Drive-by-fix: Make sorting of ranges and execution pauses for profviz
> deterministic by adding a secondary sorting criteria.
>
> Bug: v8:7382
> Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
> Change-Id: Ieb871e98e74bdb803f821b0cd35d2f67ee0f2868
> Reviewed-on: https://chromium-review.googlesource.com/1082193
> Reviewed-by: Hannes Payer <hpayer@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Reviewed-by: Camillo Bruni <cbruni@chromium.org>
> Commit-Queue: Simon Zünd <szuend@google.com>
> Cr-Commit-Position: refs/heads/master@{#53524}
TBR=hpayer@chromium.org,cbruni@chromium.org,jgruber@chromium.org,szuend@google.com
Change-Id: I54f5d3f719428fd089ff12ff217d1c819f9ad1f7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:7382
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Reviewed-on: https://chromium-review.googlesource.com/1088506
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53542}
Merge sub with lea if pc_offset is not zero when computing code start address.
Change-Id: I20df6bc1b9a6c1d1f2c97b3de3e85252cea7caec
Reviewed-on: https://chromium-review.googlesource.com/1088318
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Shiyu Zhang <shiyu.zhang@intel.com>
Cr-Commit-Position: refs/heads/master@{#53541}
Fix instance of PrintRegisters only seen by compiler if
V8_TRACE_IGNITION is set.
Bug: v8:7786
Change-Id: I512e0ac111d61ff586c6cfa4a41878792a834602
Reviewed-on: https://chromium-review.googlesource.com/1087458
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53540}