Commit Graph

2226 Commits

Author SHA1 Message Date
Dan Elphick
5c61eb67dd [snapshot] Rename the partial-* files to context-*
Now that PartialSerializer/Deserializer/etc have been renamed to
ContextSerializer/ContextDeserializer/etc, the files can now be renamed
hopefully leaving the full history available in code search.

Bug: v8:10416
Change-Id: I266c915f6d01a7e2913c4d34d9913fa551046dc1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144061
Auto-Submit: Dan Elphick <delphick@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67333}
2020-04-23 12:41:22 +00:00
Anton Bikineev
308914cc53 cppgc: Port FreeList implementation
- implemented as a single-linked list with head and tail
  pointers. The tail pointer is needed for freelist appending;
- stores entries in buckets, where bucket[log2(size)] stores
  entries >= size;
- implements worst fit allocation to amortize free list call;
- ported from Blink: https://bit.ly/2yC8XKJ.

Bug: chromium:1056170
Change-Id: I26cf62c948c95a7cbfecd5f7f22ad975e6b8c732
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2157376
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67310}
2020-04-22 13:03:45 +00:00
Jakob Gruber
d587f67af5 Reland "[snapshot] Extract more files"
This is a reland of 5c4b80566f

Original change's description:
> [snapshot] Extract more files
>
> This moves:
>
> - ExternalReferenceEncoder to codegen/external-reference-encoder.h
> - SerializerDeserializer to snapshot/serializer-deserializer.h
> - Checksum() to snapshot/snapshot-utils.h
>
> serializer-common.h and .cc are removed.
>
> Tbr: clemensb@chromium.org,ulan@chromium.org
> Bug: v8:10416
> Change-Id: I36a242dcc1ad8833374aa567f73e0d4a75632c58
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144118
> Commit-Queue: Jakob Gruber <jgruber@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Reviewed-by: Dan Elphick <delphick@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67281}

Tbr: delphick@chromium.org,clemensb@chromium.org,ulan@chromium.org
Bug: v8:10416
Change-Id: I6f6a1017435db185778ed931e1ddb13d8d5e920e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2157384
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Dan Elphick <delphick@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67298}
2020-04-22 06:09:18 +00:00
Ben Noordhuis
de6ef577af [heap] Fix TPH link-time errors with MSVC
Provide a stub `third_party_heap::Heap` implementation to work around
linker erors with Visual Studio.

cl.exe in debug mode seems to eliminate dead code not as aggressively
as clang or gcc, resulting in references to `third_party_heap::Heap`
remaining in unreachable code paths.

Refs: https://github.com/bnoordhuis/v8-cmake/issues/10
Bug: v8:10427
Change-Id: I61fde11697adc663b182f60c132eda435a7f11bd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2159490
Commit-Queue: Ben Noordhuis <info@bnoordhuis.nl>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Auto-Submit: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67293}
2020-04-21 20:24:49 +00:00
Sathya Gunasekaran
e87cd1788a Revert "[snapshot] Extract more files"
This reverts commit 5c4b80566f.

Reason for revert: https://ci.chromium.org/p/v8/builders/ci/V8%20Clusterfuzz%20Linux%20MSAN%20no%20origins/14661

Original change's description:
> [snapshot] Extract more files
> 
> This moves:
> 
> - ExternalReferenceEncoder to codegen/external-reference-encoder.h
> - SerializerDeserializer to snapshot/serializer-deserializer.h
> - Checksum() to snapshot/snapshot-utils.h
> 
> serializer-common.h and .cc are removed.
> 
> Tbr: clemensb@chromium.org,ulan@chromium.org
> Bug: v8:10416
> Change-Id: I36a242dcc1ad8833374aa567f73e0d4a75632c58
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144118
> Commit-Queue: Jakob Gruber <jgruber@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Reviewed-by: Dan Elphick <delphick@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67281}

TBR=ulan@chromium.org,jgruber@chromium.org,clemensb@chromium.org,delphick@chromium.org

Change-Id: I718ca43a31d3ca937d700eab9bacc163e4598283
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:10416
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2157383
Reviewed-by: Sathya Gunasekaran  <gsathya@chromium.org>
Commit-Queue: Sathya Gunasekaran  <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67282}
2020-04-21 13:59:25 +00:00
Jakob Gruber
5c4b80566f [snapshot] Extract more files
This moves:

- ExternalReferenceEncoder to codegen/external-reference-encoder.h
- SerializerDeserializer to snapshot/serializer-deserializer.h
- Checksum() to snapshot/snapshot-utils.h

serializer-common.h and .cc are removed.

Tbr: clemensb@chromium.org,ulan@chromium.org
Bug: v8:10416
Change-Id: I36a242dcc1ad8833374aa567f73e0d4a75632c58
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144118
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67281}
2020-04-21 13:50:53 +00:00
Jakob Gruber
cdb845b099 [snapshot] Hide private parts of snapshot.h
snapshot.h is intended to be the public header for the snapshot
component, and not the right place for private declarations. This moves
them into a new SnapshotImpl class in snapshot.cc (previously named
snapshot-common.cc).

Bug: v8:10416
Change-Id: If34ad8d6e189050686942488fb8e99c3d310beee
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144062
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67279}
2020-04-21 13:41:53 +00:00
Michael Lippautz
eefd5d31a2 cppgc: Add public target to build against
- Fixes includes to be relative to include/ which allows embedders
  to just add V8's include directory to get started.
- Adds public target for the library as "cppgc".

Bug: chromium:1056170
Change-Id: Iec9b644e20016a5d7281275b739821a050fd2540
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2157366
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67278}
2020-04-21 12:48:23 +00:00
Leszek Swirski
b814c1d572 [offthread] Refactor out an OffThreadHeap
Refactors out the allocation and space merging parts of OffThreadFactory
into a new OffThreadHeap class. This allows a separation of concerns
between allocating/merging and initializing, and future-proofs the
factory code against off-thread allocation implementation changes (e.g.
LocalHeap).

Bug: chromium:1011762
Change-Id: I876906dbfd50f8aafe56af2e63e5fe35e4f7f8e9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2157369
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67270}
2020-04-21 10:21:43 +00:00
Jakob Gruber
b39ee29d46 [snapshot] Dedicated files for snapshot data
The intent of this work is to create a clean interface header file for
the snapshot component. As a first step, move SerializedData and
SnapshotData into their own dedicated files.

Bug: v8:10416
Change-Id: I95af08508555a2ec3c2364094b81a76e3e6bb38a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144117
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67269}
2020-04-21 10:20:29 +00:00
Yu Yin
ec362684d4 [mips64][wasm-simd][liftoff] Support S128.
Port several CLs recorded in bug 9909.
We test this on 3A4000, and find many issues in MSA implement, but they are not related with this patch, will fix in another CL.
Looks like there is no 32-bit os for 3a4000, so we do not implements s128 for mips32.

Bug: v8:9909
Change-Id: Iad7569ebb92904bae66d420c8306cde24afb034a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2147575
Commit-Queue: Yu Yin <xwafish@gmail.com>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67259}
2020-04-21 02:56:47 +00:00
Jakob Kummerow
d68a48e53e [wasm-gc] Decode struct types
Behind --experimental-wasm-gc flag.

Bug: v8:7748
Change-Id: Ib96af9c5bde33f1b88862286a37872dbe70d856b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2154198
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67251}
2020-04-20 19:54:17 +00:00
Sami Kyostila
adb126109c tracing: Add new category group
This patch adds a new category group for v8.gc + devtools and adds a
missing dependency on Perfetto's generated headers.

Bug: chromium:1006766
Change-Id: Id92fdc0b938d25ab0df5ada936d3f987cc6ec5f3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2156767
Commit-Queue: Sami Kyöstilä <skyostil@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Auto-Submit: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67239}
2020-04-20 14:12:07 +00:00
Marja Hölttä
f5a31f0bf4 [Promise.any] Add AggregateError
Spec: https://github.com/tc39/proposal-promise-any

Bug: v8:9808
Change-Id: I568b2444df9f00f615f2cda1268e4ecc5b36667e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2139571
Commit-Queue: Marja Hölttä <marja@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67224}
2020-04-20 10:32:27 +00:00
Sami Kyostila
9dbab9bbdb [tracing] Migrate tracing to Perfetto track events
This patch replaces V8's tracing implementation (i.e., the TRACE_EVENT
macros) with the track event base implementation from Perfetto. The
advantages of doing this are:

1) This allows us to remove most tracing-related backend code from V8.

2) V8 can start writing strongly typed trace event arguments, which
   are more compact, easier to process and more extensible than legacy
   JSON-based trace arguments.

For the time being, we still support the old trace macros when V8 is
embedded into Chrome and other embedders.

Design doc: https://docs.google.com/document/d/1f7tt4cb-JcA5bQFR1oXk60ncJPpkL02_Hi_Bc6MfTQk/edit#heading=h.398p6b4eaen2

Bug: chromium:1006766
Change-Id: Ie71474fbe065821772b13d851487ebbca680c4ae
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1947688
Commit-Queue: Sami Kyöstilä <skyostil@chromium.org>
Auto-Submit: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67217}
2020-04-17 21:31:24 +00:00
Michael Lippautz
7d23e5abc0 cppgc: Remove conservative stack scan guard
Supported HW architectures:
ia32, x64, arm, arm64, ppc64, s390, mips, mips64

Compiler support:
- clang/gcc: all
- msvc tools: ia32, x64, arm64

Thanks all for porting!

Bug: chromium:1056170
Change-Id: I26ea7d727dc6d90929941668b8f115bdbaf226ab
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2153210
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67203}
2020-04-17 12:37:16 +00:00
Paolo Severini
e5e12a0598 Wasm debugging with LLDB: send and receive GDB-remote packets
This changelist adds the logic to format, decode, sends and receive packets in
the format specified by the GDB-remote protocol
(https://sourceware.org/gdb/onlinedocs/gdb/Overview.html#Overview).

Build with: v8_enable_wasm_gdb_remote_debugging = true
Run with: --wasm-gdb-remote

Bug: chromium:1010467
Change-Id: Ibc9c6713c561d06847b472fab591c208c193199f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1929409
Commit-Queue: Paolo Severini <paolosev@microsoft.com>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67196}
2020-04-17 09:08:45 +00:00
Richard Townsend
d6b8f0b399 cppgc: Implement PushAllRegistersAndIterateStack for MSVC
Adds an pure (not inline) assembly version of
PushAllRegistersAndIterateStack for the Microsoft Arm Assembler, which
uses slightly different syntax.

Bug: v8:10407
Change-Id: I539e2021bd86e17a2d023c061c9753b4bd96ce2c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2150600
Commit-Queue: Richard Townsend <richard.townsend@arm.com>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67177}
2020-04-16 14:49:17 +00:00
Zhao Jiazhong
c05fa9dadb [mips] cppgc: Conservative stack scanning
Port 1a7f568987
https://crrev.com/c/2129635

Change-Id: Iee46bdb05f1c412dcdb7299a8b74f9c8ce2e7d4d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2143985
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67162}
2020-04-16 04:26:14 +00:00
Shu-yu Guo
dbbacccaa3 [weakrefs] Port FinalizationRegistry cleanup loop to Torque
To avoid shrinking the unregister token map on each pop of the cleared
cell list, the Torque implementation of the cleanup loop avoids
shrinking the map until the end of the loop.

To support that, PopClearedCellHoldings is refactored to the Torque
PopClearedCell which calls the
JSFinalization::RemoveCellFromUnregisterTokenMap and the runtime
ShrinkFinalizationRegistryUnregisterTokenMap. The former cannot GC is
and is implemented in CSA as a fast C call. The latter can GC and is a
runtime call.

This also incidentally makes uses of FinalizationRegistry without
unregister token a fast path that doesn't have to leave Torque.

Bug: v8:8179
Change-Id: Ia0c3c5800d26e31319a818f164f6bd3267355aa6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2137950
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67161}
2020-04-16 03:31:04 +00:00
Anton Bikineev
db7c21e4c6 cppgc: Port Persistent
CrossThreadPersistent and friends are the followup.

Bug: chromium:1056170
Change-Id: Ide910062d80952da73b922398c281162b1861f47
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144957
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67153}
2020-04-15 15:10:10 +00:00
Dominik Inführ
d29f54bb9b [heap] Add ConcurrentAllocator
Add ConcurrentAllocator which can be used for concurrent allocation from a background thread in the old space. ConcurrentAllocator doesn't request a GC yet when an allocation fails. This will be implemented in later CLs.

Bug: v8:10315
Change-Id: I81260ebbd8863c143e93aedb93c66d0e7c28bddb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144066
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67150}
2020-04-15 14:06:49 +00:00
Anton Bikineev
3eefe03c51 cppgc: Add simple check/dcheck facilities
A few notes:
1) Oilpan is a generic library, meaning that it can work with arbitrary
user types. The library is split in type-aware (include/) and
type-erased (src/) parts. The former comprises a lot of code that still
needs to be defended with dchecks;
2) Macros are prefixed with CPPGC_, so that they don't clash in the user
code with similar macros from other libraries;
3) The macros simply forward requests to V8 so that dcheck handlers can
be configured uniformly;
4) The CL doesn't contain CHECK_EQ and friends, but they can be added
later if needed.

Bug: chromium:1056170
Change-Id: I68e6f663247705233eaf030384164d81e53071e1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2148774
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67129}
2020-04-14 16:37:42 +00:00
Omer Katz
28bc264947 cppgc: Add support for prefinalizers
This CL adds:
- Declaring and invoking prefinalizers
- NoAllocationScope

Bug: chromium:1056170
Change-Id: Ib0f688fa4a8bb5fde44b36597ce2d6d2664fdff5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2139588
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67125}
2020-04-14 16:03:15 +00:00
Gus Caplan
90140db622 Remove unused IsPromise builtin and is_promise context slot
Change-Id: I2183b08596874d41eece64d6bdecc8f174cd738e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144547
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67120}
2020-04-14 15:00:44 +00:00
Michael Lippautz
67ea621133 Reland "cppgc: Add page memory allocation backend"
This is a port of src/components/gc that was added recently.

Differences:
- Added back bucketing to the page pool, as that guarantees that
  arenas used for specific types do not have their pages used by other
  arenas.
- Replaced base::flat_map with std::map. This may cause performance
  regressions when using PageMemoryRegionTree in hot paths. A
  vector-like representation may be used to fix such a regression

This reverts commit a056cea51e.

Bug: chromium:1056170
Change-Id: Iffb8b0d91c8cca1815d7a1cda9486e7716aea75f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144060
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67117}
2020-04-14 14:22:09 +00:00
Michael Lippautz
bc12982d51 cppgc: LivenessBroker
Introduce LivenessBroker which is a temporary broker object to expose
liveness during specific garbage collection phases.

This broker can be used to handle:
- PreFinalizer
- Custom weak callbacks
- Internal weak callbacks used for WeakMember

Change-Id: I3870c2b89b2538f04feabf2eb7a4676ce2fe7d61
Bug: chromium:1056170
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144059
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67107}
2020-04-14 08:57:12 +00:00
Milad Farazmand
216e2f4d6f PPC/s390: cppgc: Conservative stack scanning
Port 1a7f568987

R=mlippautz@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I4db697c6a0fab9bd3c9dda4761c3af3ade509ffa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144691
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Reviewed-by: Joran Siu <joransiu@ca.ibm.com>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67093}
2020-04-09 22:37:06 +00:00
Nico Hartmann
a056cea51e Revert "Reland "cppgc: Add page memory allocation backend""
This reverts commit 3e1c70402e.

Reason for revert: https://ci.chromium.org/p/v8/builders/ci/V8%20Linux64%20TSAN%20-%20concurrent%20marking/12665

Original change's description:
> Reland "cppgc: Add page memory allocation backend"
> 
> This is a port of src/components/gc that was added recently.
> 
> Differences:
> - Added back bucketing to the page pool, as that guarantees that
>   arenas used for specific types do not have their pages used by other
>   arenas.
> - Replaced base::flat_map with std::map. This may cause performance
>   regressions when using PageMemoryRegionTree in hot paths. A
>   vector-like representation may be used to fix such a regression
> 
> This reverts commit 656c68a781.
> 
> Bug: chromium:1056170
> Change-Id: I638183c944255ebcaab47d2b94b1980d54479746
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2143814
> Reviewed-by: Maya Lekova <mslekova@chromium.org>
> Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67080}

TBR=mlippautz@chromium.org,mslekova@chromium.org

Change-Id: I04b048dd979c32e9275c972307796d5f75865037
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1056170
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144114
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67084}
2020-04-09 12:37:33 +00:00
Michael Lippautz
3e1c70402e Reland "cppgc: Add page memory allocation backend"
This is a port of src/components/gc that was added recently.

Differences:
- Added back bucketing to the page pool, as that guarantees that
  arenas used for specific types do not have their pages used by other
  arenas.
- Replaced base::flat_map with std::map. This may cause performance
  regressions when using PageMemoryRegionTree in hot paths. A
  vector-like representation may be used to fix such a regression

This reverts commit 656c68a781.

Bug: chromium:1056170
Change-Id: I638183c944255ebcaab47d2b94b1980d54479746
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2143814
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67080}
2020-04-09 10:57:03 +00:00
Michael Lippautz
66cfc31581 cppgc: Provide basic allocation to have access to Heap backref
This CL provides a basic allocator that allocates normal-sized objects
on pages without ever reusing them. This allows for already using the
backref from page to heap which is used in some critical places
(pre-finalizers, write barrier, Persistent).

Bug: chromium:1056170
Change-Id: Ifada9b7e984827906c267d1a3a521576587feaeb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2141736
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67076}
2020-04-09 08:00:23 +00:00
Maya Lekova
656c68a781 Revert "cppgc: Add page memory allocation backend"
This reverts commit d4056c61d5.

Reason for revert: Fails on GCC, please check https://ci.chromium.org/p/v8/builders/ci/V8%20Linux%20gcc/6184

Original change's description:
> cppgc: Add page memory allocation backend
> 
> This is a port of src/components/gc that was added recently.
> 
> Differences:
> - Added back bucketing to the page pool, as that guarantees that
>   arenas used for specific types do not have their pages used by other
>   arenas.
> - Replaced base::flat_map with std::map. This may cause performance
>   regressions when using PageMemoryRegionTree in hot paths. A
>   vector-like representation may be used to fix such a regression
> 
> Bug: chromium:1056170
> Change-Id: I03e3abe55faf7bb50c8011dafc23396889bf66db
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2139586
> Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> Reviewed-by: Omer Katz <omerkatz@chromium.org>
> Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> Reviewed-by: Hannes Payer <hpayer@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67073}

TBR=ulan@chromium.org,hpayer@chromium.org,mlippautz@chromium.org,bikineev@chromium.org,omerkatz@chromium.org

Change-Id: I1e421898bb8a08f32d8eb2355ed547e0ee38b429
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1056170
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2140949
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67074}
2020-04-09 07:36:13 +00:00
Michael Lippautz
d4056c61d5 cppgc: Add page memory allocation backend
This is a port of src/components/gc that was added recently.

Differences:
- Added back bucketing to the page pool, as that guarantees that
  arenas used for specific types do not have their pages used by other
  arenas.
- Replaced base::flat_map with std::map. This may cause performance
  regressions when using PageMemoryRegionTree in hot paths. A
  vector-like representation may be used to fix such a regression

Bug: chromium:1056170
Change-Id: I03e3abe55faf7bb50c8011dafc23396889bf66db
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2139586
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67073}
2020-04-09 07:03:53 +00:00
Anton Bikineev
c02258f01d cppgc: Refine Member a bit
This change comprises a few tiny changes wrt Member:
1) Move member policies to a separate file so that some of them
(CheckingPolicy) can be reused by Persistent;
2) SFINAE out incompatible pointers from heterogeneous ctor/asgnmt;
3) Rename kMemberSentinel to kSentinelPointer.

Bug: chromium:1056170
Change-Id: I4482998e6ba61005a5d0861dcae9fab2aa43702c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2139587
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67061}
2020-04-08 13:13:01 +00:00
Anton Bikineev
1277b5fa78 cppgc: Move implementation headers in internal/ dir
Headers containing only implementation details are better to stay in a
separate dir to indicate the user that they shouldn't be included.

Bug: chromium:1056170
Change-Id: I10f84ddf709b146396aadc820ec33bc6a49b2dac
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2139585
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67050}
2020-04-08 07:39:40 +00:00
Michael Lippautz
c4e7f6b697 cppgc: Provide Visitor and tracing infrastructure for Member
This CL adds the necessary traits to dispatch from Member through a
visitor implementation for GarabgeCollected and GarbageCollectedMixin.

Bug: chromium:1056170
Change-Id: I12680335044aaa842639fb5e8f9a3ac61587f51a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2138431
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67041}
2020-04-07 15:37:35 +00:00
Michael Lippautz
09b0aae81c Reland "cppgc: Stack scanning support for Windows native"
Assumes that (is_clang = false && is_win) => Windows native (MSVC).

Cross-compile builds will use clang and not the native tools and thus
not fall into this category.

This CL adds x86 and x64 MASM trampolines that can be used with the
native Windows toolchain (ml.exe, ml64.exe), when using is_clang =
false.

This reverts commit 8e4a5e973e.

Bug: chromium:1056170
Change-Id: I7204f15898ec5eddcc5892d4d08266a69d84ab85
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2139211
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67036}
2020-04-07 11:02:55 +00:00
Michael Lippautz
8e4a5e973e Revert "cppgc: Stack scanning support for Windows native"
This reverts commit cff2617bd1.

Reason for revert: Breaks https://ci.chromium.org/p/v8/builders/ci/V8%20Win64%20-%20msvc/13100?

Original change's description:
> cppgc: Stack scanning support for Windows native
> 
> Assumes that (is_clang = false && is_win) => Windows native (MSVC).
> 
> Cross-compile builds will use clang and not the native tools and thus
> not fall into this category.
> 
> This CL adds x86 and x64 MASM trampolines that can be used with the
> native Windows toolchain (ml.exe, ml64.exe), when using is_clang =
> false.
> 
> Bug: chromium:1056170
> Change-Id: Ic37ce721a76ce027ebf45bef441b8fba4789dc9b
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2137408
> Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> Reviewed-by: Anton Bikineev <bikineev@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67025}

TBR=mlippautz@chromium.org,bikineev@chromium.org

Change-Id: I86286d4f438468350a81b3965956d47ae35d1c6d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1056170
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2138432
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67028}
2020-04-06 21:56:25 +00:00
Michael Lippautz
cff2617bd1 cppgc: Stack scanning support for Windows native
Assumes that (is_clang = false && is_win) => Windows native (MSVC).

Cross-compile builds will use clang and not the native tools and thus
not fall into this category.

This CL adds x86 and x64 MASM trampolines that can be used with the
native Windows toolchain (ml.exe, ml64.exe), when using is_clang =
false.

Bug: chromium:1056170
Change-Id: Ic37ce721a76ce027ebf45bef441b8fba4789dc9b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2137408
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67025}
2020-04-06 19:40:55 +00:00
Michael Lippautz
ba4e864422 cppgc: Conservative stack scanning for arm64
Bug: chromium:1056170
Change-Id: I1d6f28f6bc569af75f6d378041f2c6fe94a538c6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2135635
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67023}
2020-04-06 18:42:45 +00:00
Michael Lippautz
9d4ca4ee6c cppgc: Support GCC for conservative stack scan
Assumes that (is_clang = false && !is_win) => GCC or other compiler with
inline assembly that is gas-compatible.

Bug: chromium:1056170
Change-Id: I1a2a2d13b7d4af630349d9194b64394c9736ad3c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2137405
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67014}
2020-04-06 14:41:44 +00:00
Michael Lippautz
1a7f568987 cppgc: Conservative stack scanning for arm32
Bug: chromium:1056170
Change-Id: I417a0f05bcd185e969fb087a6b132e88c3fa3a5d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2129635
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67011}
2020-04-06 13:34:44 +00:00
Dominik Inführ
744a1d23b2 [heap] Add PersistentHandles container
Adds the PersistentHandles class, which serves as a container for
handles that can be passed back and forth between threads. Allocation
and deallocation of this class is thread-safe and the isolate tracks
all PersistentHandles containers.

Design doc: https://docs.google.com/document/d/17yKs-6apE2rGEag7tDsoyeRxg99c1dXyXQ2MfHe65tY/edit?usp=sharing

Bug: v8:10315
Change-Id: I4b9c958c9a57d755ca68862197501f75274670fb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2128058
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67004}
2020-04-06 07:37:34 +00:00
Michael Lippautz
1e1323980f cppgc: Conservative stack for ia32 Windows using clang
Add support for ia32 Windows using clang. Change the callback
function from a member function to a free function. This the
compiler generating thiscall calling convention for the member
function which allows for keeping the asm trampoline uniform.

Bug: chromium:1056170
Change-Id: Ic8fcac27a628a0de026d8fe7d2e376c8f58a1737
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2134136
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66975}
2020-04-03 06:48:03 +00:00
Anton Bikineev
aecd1e5811 cppgc: Add SourceLocation class
SourceLocation is needed to track Persistents.

Bug: chromium:1056170
Change-Id: I4d5cf151a4d27b4c29582ff8195cdcb7453afe1c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2132790
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66974}
2020-04-03 02:00:23 +00:00
Michael Lippautz
f00a02bb8d cppgc: Conservative stack scan for non-Windows ia32 on clang
The difference to Chromium is that we support frame pointers and thus
integrate better with debugging in e.g. gdb.

Bug: chromium:1056170
Change-Id: I2109744d07a7b3af158ed3e0fe731f890b192eee
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2129630
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66967}
2020-04-02 15:25:37 +00:00
Michael Lippautz
be7e57665e cppgc: Use inline asm to generate x64 stack scanning trampoline
Use inline asm to generate the x64 PushAllRegistersAndIterateStack
which is the trampoline for conservative stack scanning. Keep the
function definition as C code to allow clang to generate the correct
mangling for each platform.

This approach has the benefit that it immediately works for all
platforms that support clang.

Bug: chromium:1056170
Change-Id: Ic7a1c1b57e67ae1442bd8bda4e55d89112facfc7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2132787
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66958}
2020-04-02 07:49:26 +00:00
Michael Lippautz
fc57d4e815 cppgc: Remove Win stack scanning support
Even though the default toolchain for assembly on Windows uses MASM
assemblers, we are not supposed to use them to support Linux/Win
cross-compile.

Bug: chromium:1056170, chromium:1066834
Change-Id: If17dbd68915f843e3fb47584560a4667d5c35bc7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2132250
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66951}
2020-04-01 14:52:44 +00:00
Anton Bikineev
d8936aac8f cppgc: Port Member
This CL introduces
 - Member
 - WeakMember
 - UntracedMember
interfaces. Remaining work is to add pointer verifier and write barrier
implementation.

Bug: chromium:1056170
Change-Id: Iddb8e4d002db0b1d1652f2946ddfa08a98a889c7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2124323
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66927}
2020-03-31 18:30:38 +00:00
Michael Lippautz
c10863153a cppgc: Conservative stack scanning
Adds support for conservative stack scanning on x64. The trampolines
saving callee-saved registers are compiled using clang (non-Windows)
and MASM (Windows). This is using the default toolchain for assembly
in Chromium/V8.

This differs from Oilpan in Chromium where x86 and x64 are compiled
using NASM [1]. V8 does not yet require this dependency and building
the trampolines natively avoids it. (NASM also requires separate
blocks for x64 Windows and non-Windows.) On non-x86/x64 platforms
Chromium also uses clang, so there's little benefit in keeping the
dependency.

The trampolines are tested when building with clang.

Other platforms follow in separate CLs.

[1] https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/platform/heap/asm/SaveRegisters_x86.asm

Change-Id: Ice2e23e44391aa94147abe75ee0b5afac458b8f8
Bug: chromium:1056170
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2124319
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66913}
2020-03-30 19:43:06 +00:00