diff --git a/README.md b/README.md index 14add86124b..76c5b4d46ec 100644 --- a/README.md +++ b/README.md @@ -1,613 +1,12 @@ - -

- - Node.js - -

+This is an automatically updated **experimental** +version of [Node.js](https://github.com/nodejs/node) +with the lkgr (last known good revision) of V8. -Node.js is an open-source, cross-platform, JavaScript runtime environment. It -executes JavaScript code outside of a browser. For more information on using -Node.js, see the [Node.js Website][]. +The daily builds of this repo can be found at +[`v8-canary`](https://nodejs.org/download/v8-canary/). +**Do not use this in production!** -The Node.js project uses an [open governance model](./GOVERNANCE.md). The -[OpenJS Foundation][] provides support for the project. +This repository is not owned by `@nodejs/v8`, but they might be able to +help with issues. -**This project is bound by a [Code of Conduct][].** - -# Table of Contents - -* [Support](#support) -* [Release Types](#release-types) - * [Download](#download) - * [Current and LTS Releases](#current-and-lts-releases) - * [Nightly Releases](#nightly-releases) - * [API Documentation](#api-documentation) - * [Verifying Binaries](#verifying-binaries) -* [Building Node.js](#building-nodejs) -* [Security](#security) -* [Contributing to Node.js](#contributing-to-nodejs) -* [Current Project Team Members](#current-project-team-members) - * [TSC (Technical Steering Committee)](#tsc-technical-steering-committee) - * [Collaborators](#collaborators) - * [Release Keys](#release-keys) - -## Support - -Looking for help? Check out the -[instructions for getting support](.github/SUPPORT.md). - -## Release Types - -* **Current**: Under active development. Code for the Current release is in the - branch for its major version number (for example, - [v10.x](https://github.com/nodejs/node/tree/v10.x)). Node.js releases a new - major version every 6 months, allowing for breaking changes. This happens in - April and October every year. Releases appearing each October have a support - life of 8 months. Releases appearing each April convert to LTS (see below) - each October. -* **LTS**: Releases that receive Long-term Support, with a focus on stability - and security. Every even-numbered major version will become an LTS release. - LTS releases receive 12 months of _Active LTS_ support and a further 18 months - of _Maintenance_. LTS release lines have alphabetically-ordered codenames, - beginning with v4 Argon. There are no breaking changes or feature additions, - except in some special circumstances. -* **Nightly**: Code from the Current branch built every 24-hours when there are - changes. Use with caution. - -Current and LTS releases follow [Semantic Versioning](https://semver.org). A -member of the Release Team [signs](#release-keys) each Current and LTS release. -For more information, see the -[Release README](https://github.com/nodejs/Release#readme). - -### Download - -Binaries, installers, and source tarballs are available at -. - -#### Current and LTS Releases - - -The [latest](https://nodejs.org/download/release/latest/) directory is an -alias for the latest Current release. The latest-_codename_ directory is an -alias for the latest release from an LTS line. For example, the -[latest-carbon](https://nodejs.org/download/release/latest-carbon/) directory -contains the latest Carbon (Node.js 8) release. - -#### Nightly Releases - - -Each directory name and filename contains a date (in UTC) and the commit -SHA at the HEAD of the release. - -#### API Documentation - -Documentation for the latest Current release is at . -Version-specific documentation is available in each release directory in the -_docs_ subdirectory. Version-specific documentation is also at -. - -### Verifying Binaries - -Download directories contain a `SHASUMS256.txt` file with SHA checksums for the -files. - -To download `SHASUMS256.txt` using `curl`: - -```console -$ curl -O https://nodejs.org/dist/vx.y.z/SHASUMS256.txt -``` - -To check that a downloaded file matches the checksum, run -it through `sha256sum` with a command such as: - -```console -$ grep node-vx.y.z.tar.gz SHASUMS256.txt | sha256sum -c - -``` - -For Current and LTS, the GPG detached signature of `SHASUMS256.txt` is in -`SHASUMS256.txt.sig`. You can use it with `gpg` to verify the integrity of -`SHASUM256.txt`. You will first need to import -[the GPG keys of individuals authorized to create releases](#release-keys). To -import the keys: - -```console -$ gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D -``` - -See the bottom of this README for a full script to import active release keys. - -Next, download the `SHASUMS256.txt.sig` for the release: - -```console -$ curl -O https://nodejs.org/dist/vx.y.z/SHASUMS256.txt.sig -``` - -Then use `gpg --verify SHASUMS256.txt.sig SHASUMS256.txt` to verify -the file's signature. - -## Building Node.js - -See [BUILDING.md](BUILDING.md) for instructions on how to build Node.js from -source and a list of supported platforms. - -## Security - -For information on reporting security vulnerabilities in Node.js, see -[SECURITY.md](./SECURITY.md). - -## Contributing to Node.js - -* [Contributing to the project][] -* [Working Groups][] -* [Strategic Initiatives][] - -## Current Project Team Members - -For information about the governance of the Node.js project, see -[GOVERNANCE.md](./GOVERNANCE.md). - -### TSC (Technical Steering Committee) - -* [addaleax](https://github.com/addaleax) - -**Anna Henningsen** <anna@addaleax.net> (she/her) -* [apapirovski](https://github.com/apapirovski) - -**Anatoli Papirovski** <apapirovski@mac.com> (he/him) -* [BethGriggs](https://github.com/BethGriggs) - -**Beth Griggs** <Bethany.Griggs@uk.ibm.com> (she/her) -* [BridgeAR](https://github.com/BridgeAR) - -**Ruben Bridgewater** <ruben@bridgewater.de> (he/him) -* [ChALkeR](https://github.com/ChALkeR) - -**Сковорода Никита Андреевич** <chalkerx@gmail.com> (he/him) -* [cjihrig](https://github.com/cjihrig) - -**Colin Ihrig** <cjihrig@gmail.com> (he/him) -* [codebytere](https://github.com/codebytere) - -**Shelley Vohr** <codebytere@gmail.com> (she/her) -* [danbev](https://github.com/danbev) - -**Daniel Bevenius** <daniel.bevenius@gmail.com> (he/him) -* [fhinkel](https://github.com/fhinkel) - -**Franziska Hinkelmann** <franziska.hinkelmann@gmail.com> (she/her) -* [gabrielschulhof](https://github.com/gabrielschulhof) - -**Gabriel Schulhof** <gabriel.schulhof@intel.com> -* [gireeshpunathil](https://github.com/gireeshpunathil) - -**Gireesh Punathil** <gpunathi@in.ibm.com> (he/him) -* [jasnell](https://github.com/jasnell) - -**James M Snell** <jasnell@gmail.com> (he/him) -* [joyeecheung](https://github.com/joyeecheung) - -**Joyee Cheung** <joyeec9h3@gmail.com> (she/her) -* [mcollina](https://github.com/mcollina) - -**Matteo Collina** <matteo.collina@gmail.com> (he/him) -* [mhdawson](https://github.com/mhdawson) - -**Michael Dawson** <michael_dawson@ca.ibm.com> (he/him) -* [mmarchini](https://github.com/mmarchini) - -**Matheus Marchini** <mat@mmarchini.me> -* [MylesBorins](https://github.com/MylesBorins) - -**Myles Borins** <myles.borins@gmail.com> (he/him) -* [sam-github](https://github.com/sam-github) - -**Sam Roberts** <vieuxtech@gmail.com> -* [targos](https://github.com/targos) - -**Michaël Zasso** <targos@protonmail.com> (he/him) -* [tniessen](https://github.com/tniessen) - -**Tobias Nießen** <tniessen@tnie.de> -* [Trott](https://github.com/Trott) - -**Rich Trott** <rtrott@gmail.com> (he/him) - -### TSC Emeriti - -* [bnoordhuis](https://github.com/bnoordhuis) - -**Ben Noordhuis** <info@bnoordhuis.nl> -* [chrisdickinson](https://github.com/chrisdickinson) - -**Chris Dickinson** <christopher.s.dickinson@gmail.com> -* [evanlucas](https://github.com/evanlucas) - -**Evan Lucas** <evanlucas@me.com> (he/him) -* [Fishrock123](https://github.com/Fishrock123) - -**Jeremiah Senkpiel** <fishrock123@rocketmail.com> (he/they) -* [gibfahn](https://github.com/gibfahn) - -**Gibson Fahnestock** <gibfahn@gmail.com> (he/him) -* [indutny](https://github.com/indutny) - -**Fedor Indutny** <fedor.indutny@gmail.com> -* [isaacs](https://github.com/isaacs) - -**Isaac Z. Schlueter** <i@izs.me> -* [joshgav](https://github.com/joshgav) - -**Josh Gavant** <josh.gavant@outlook.com> -* [mscdex](https://github.com/mscdex) - -**Brian White** <mscdex@mscdex.net> -* [nebrius](https://github.com/nebrius) - -**Bryan Hughes** <bryan@nebri.us> -* [ofrobots](https://github.com/ofrobots) - -**Ali Ijaz Sheikh** <ofrobots@google.com> (he/him) -* [orangemocha](https://github.com/orangemocha) - -**Alexis Campailla** <orangemocha@nodejs.org> -* [piscisaureus](https://github.com/piscisaureus) - -**Bert Belder** <bertbelder@gmail.com> -* [rvagg](https://github.com/rvagg) - -**Rod Vagg** <r@va.gg> -* [shigeki](https://github.com/shigeki) - -**Shigeki Ohtsu** <ohtsu@ohtsu.org> (he/him) -* [thefourtheye](https://github.com/thefourtheye) - -**Sakthipriyan Vairamani** <thechargingvolcano@gmail.com> (he/him) -* [TimothyGu](https://github.com/TimothyGu) - -**Tiancheng "Timothy" Gu** <timothygu99@gmail.com> (he/him) -* [trevnorris](https://github.com/trevnorris) - -**Trevor Norris** <trev.norris@gmail.com> - -### Collaborators - -* [addaleax](https://github.com/addaleax) - -**Anna Henningsen** <anna@addaleax.net> (she/her) -* [ak239](https://github.com/ak239) - -**Aleksei Koziatinskii** <ak239spb@gmail.com> -* [AndreasMadsen](https://github.com/AndreasMadsen) - -**Andreas Madsen** <amwebdk@gmail.com> (he/him) -* [antsmartian](https://github.com/antsmartian) - -**Anto Aravinth** <anto.aravinth.cse@gmail.com> (he/him) -* [apapirovski](https://github.com/apapirovski) - -**Anatoli Papirovski** <apapirovski@mac.com> (he/him) -* [bcoe](https://github.com/bcoe) - -**Ben Coe** <bencoe@gmail.com> (he/him) -* [bengl](https://github.com/bengl) - -**Bryan English** <bryan@bryanenglish.com> (he/him) -* [benjamingr](https://github.com/benjamingr) - -**Benjamin Gruenbaum** <benjamingr@gmail.com> -* [BethGriggs](https://github.com/BethGriggs) - -**Beth Griggs** <Bethany.Griggs@uk.ibm.com> (she/her) -* [bmeck](https://github.com/bmeck) - -**Bradley Farias** <bradley.meck@gmail.com> -* [bmeurer](https://github.com/bmeurer) - -**Benedikt Meurer** <benedikt.meurer@gmail.com> -* [bnoordhuis](https://github.com/bnoordhuis) - -**Ben Noordhuis** <info@bnoordhuis.nl> -* [boneskull](https://github.com/boneskull) - -**Christopher Hiller** <boneskull@boneskull.com> (he/him) -* [BridgeAR](https://github.com/BridgeAR) - -**Ruben Bridgewater** <ruben@bridgewater.de> (he/him) -* [bzoz](https://github.com/bzoz) - -**Bartosz Sosnowski** <bartosz@janeasystems.com> -* [cclauss](https://github.com/cclauss) - -**Christian Clauss** <cclauss@me.com> (he/him) -* [ChALkeR](https://github.com/ChALkeR) - -**Сковорода Никита Андреевич** <chalkerx@gmail.com> (he/him) -* [cjihrig](https://github.com/cjihrig) - -**Colin Ihrig** <cjihrig@gmail.com> (he/him) -* [codebytere](https://github.com/codebytere) - -**Shelley Vohr** <codebytere@gmail.com> (she/her) -* [danbev](https://github.com/danbev) - -**Daniel Bevenius** <daniel.bevenius@gmail.com> (he/him) -* [davisjam](https://github.com/davisjam) - -**Jamie Davis** <davisjam@vt.edu> (he/him) -* [devnexen](https://github.com/devnexen) - -**David Carlier** <devnexen@gmail.com> -* [devsnek](https://github.com/devsnek) - -**Gus Caplan** <me@gus.host> (he/him) -* [digitalinfinity](https://github.com/digitalinfinity) - -**Hitesh Kanwathirtha** <digitalinfinity@gmail.com> (he/him) -* [edsadr](https://github.com/edsadr) - -**Adrian Estrada** <edsadr@gmail.com> (he/him) -* [eugeneo](https://github.com/eugeneo) - -**Eugene Ostroukhov** <eostroukhov@google.com> -* [evanlucas](https://github.com/evanlucas) - -**Evan Lucas** <evanlucas@me.com> (he/him) -* [fhinkel](https://github.com/fhinkel) - -**Franziska Hinkelmann** <franziska.hinkelmann@gmail.com> (she/her) -* [Fishrock123](https://github.com/Fishrock123) - -**Jeremiah Senkpiel** <fishrock123@rocketmail.com> (he/they) -* [Flarna](https://github.com/Flarna) - -**Gerhard Stöbich** <deb2001-github@yahoo.de> (he/they) -* [gabrielschulhof](https://github.com/gabrielschulhof) - -**Gabriel Schulhof** <gabriel.schulhof@intel.com> -* [gdams](https://github.com/gdams) - -**George Adams** <george.adams@uk.ibm.com> (he/him) -* [geek](https://github.com/geek) - -**Wyatt Preul** <wpreul@gmail.com> -* [gengjiawen](https://github.com/gengjiawen) - -**Jiawen Geng** <technicalcute@gmail.com> -* [GeoffreyBooth](https://github.com/geoffreybooth) - -**Geoffrey Booth** <webmaster@geoffreybooth.com> (he/him) -* [gibfahn](https://github.com/gibfahn) - -**Gibson Fahnestock** <gibfahn@gmail.com> (he/him) -* [gireeshpunathil](https://github.com/gireeshpunathil) - -**Gireesh Punathil** <gpunathi@in.ibm.com> (he/him) -* [guybedford](https://github.com/guybedford) - -**Guy Bedford** <guybedford@gmail.com> (he/him) -* [hashseed](https://github.com/hashseed) - -**Yang Guo** <yangguo@chromium.org> (he/him) -* [himself65](https://github.com/himself65) - -**Zeyu Yang** <himself65@outlook.com> (he/him) -* [hiroppy](https://github.com/hiroppy) - -**Yuta Hiroto** <hello@hiroppy.me> (he/him) -* [indutny](https://github.com/indutny) - -**Fedor Indutny** <fedor.indutny@gmail.com> -* [JacksonTian](https://github.com/JacksonTian) - -**Jackson Tian** <shyvo1987@gmail.com> -* [jasnell](https://github.com/jasnell) - -**James M Snell** <jasnell@gmail.com> (he/him) -* [jdalton](https://github.com/jdalton) - -**John-David Dalton** <john.david.dalton@gmail.com> -* [jkrems](https://github.com/jkrems) - -**Jan Krems** <jan.krems@gmail.com> (he/him) -* [joaocgreis](https://github.com/joaocgreis) - -**João Reis** <reis@janeasystems.com> -* [joyeecheung](https://github.com/joyeecheung) - -**Joyee Cheung** <joyeec9h3@gmail.com> (she/her) -* [juanarbol](https://github.com/juanarbol) - -**Juan José Arboleda** <soyjuanarbol@gmail.com> (he/him) -* [JungMinu](https://github.com/JungMinu) - -**Minwoo Jung** <nodecorelab@gmail.com> (he/him) -* [kfarnung](https://github.com/kfarnung) - -**Kyle Farnung** <kfarnung@microsoft.com> (he/him) -* [lance](https://github.com/lance) - -**Lance Ball** <lball@redhat.com> (he/him) -* [legendecas](https://github.com/legendecas) - -**Chengzhong Wu** <legendecas@gmail.com> (he/him) -* [Leko](https://github.com/Leko) - -**Shingo Inoue** <leko.noor@gmail.com> (he/him) -* [lpinca](https://github.com/lpinca) - -**Luigi Pinca** <luigipinca@gmail.com> (he/him) -* [lundibundi](https://github.com/lundibundi) - -**Denys Otrishko** <shishugi@gmail.com> (he/him) -* [mafintosh](https://github.com/mafintosh) - -**Mathias Buus** <mathiasbuus@gmail.com> (he/him) -* [mcollina](https://github.com/mcollina) - -**Matteo Collina** <matteo.collina@gmail.com> (he/him) -* [mhdawson](https://github.com/mhdawson) - -**Michael Dawson** <michael_dawson@ca.ibm.com> (he/him) -* [mildsunrise](https://github.com/mildsunrise) - -**Alba Mendez** <me@alba.sh> (she/her) -* [misterdjules](https://github.com/misterdjules) - -**Julien Gilli** <jgilli@nodejs.org> -* [mmarchini](https://github.com/mmarchini) - -**Matheus Marchini** <mat@mmarchini.me> -* [mscdex](https://github.com/mscdex) - -**Brian White** <mscdex@mscdex.net> -* [MylesBorins](https://github.com/MylesBorins) - -**Myles Borins** <myles.borins@gmail.com> (he/him) -* [ofrobots](https://github.com/ofrobots) - -**Ali Ijaz Sheikh** <ofrobots@google.com> (he/him) -* [oyyd](https://github.com/oyyd) - -**Ouyang Yadong** <oyydoibh@gmail.com> (he/him) -* [psmarshall](https://github.com/psmarshall) - -**Peter Marshall** <petermarshall@chromium.org> (he/him) -* [puzpuzpuz](https://github.com/puzpuzpuz) - -**Andrey Pechkurov** <apechkurov@gmail.com> (he/him) -* [Qard](https://github.com/Qard) - -**Stephen Belanger** <admin@stephenbelanger.com> (he/him) -* [refack](https://github.com/refack) - -**Refael Ackermann (רפאל פלחי)** <refack@gmail.com> (he/him/הוא/אתה) -* [richardlau](https://github.com/richardlau) - -**Richard Lau** <riclau@uk.ibm.com> -* [ronag](https://github.com/ronag) - -**Robert Nagy** <ronagy@icloud.com> -* [ronkorving](https://github.com/ronkorving) - -**Ron Korving** <ron@ronkorving.nl> -* [rubys](https://github.com/rubys) - -**Sam Ruby** <rubys@intertwingly.net> -* [rvagg](https://github.com/rvagg) - -**Rod Vagg** <rod@vagg.org> -* [ryzokuken](https://github.com/ryzokuken) - -**Ujjwal Sharma** <ryzokuken@disroot.org> (he/him) -* [saghul](https://github.com/saghul) - -**Saúl Ibarra Corretgé** <saghul@gmail.com> -* [sam-github](https://github.com/sam-github) - -**Sam Roberts** <vieuxtech@gmail.com> -* [santigimeno](https://github.com/santigimeno) - -**Santiago Gimeno** <santiago.gimeno@gmail.com> -* [sebdeckers](https://github.com/sebdeckers) - -**Sebastiaan Deckers** <sebdeckers83@gmail.com> -* [seishun](https://github.com/seishun) - -**Nikolai Vavilov** <vvnicholas@gmail.com> -* [shigeki](https://github.com/shigeki) - -**Shigeki Ohtsu** <ohtsu@ohtsu.org> (he/him) -* [shisama](https://github.com/shisama) - -**Masashi Hirano** <shisama07@gmail.com> (he/him) -* [silverwind](https://github.com/silverwind) - -**Roman Reiss** <me@silverwind.io> -* [srl295](https://github.com/srl295) - -**Steven R Loomis** <srloomis@us.ibm.com> -* [starkwang](https://github.com/starkwang) - -**Weijia Wang** <starkwang@126.com> -* [targos](https://github.com/targos) - -**Michaël Zasso** <targos@protonmail.com> (he/him) -* [thefourtheye](https://github.com/thefourtheye) - -**Sakthipriyan Vairamani** <thechargingvolcano@gmail.com> (he/him) -* [TimothyGu](https://github.com/TimothyGu) - -**Tiancheng "Timothy" Gu** <timothygu99@gmail.com> (he/him) -* [tniessen](https://github.com/tniessen) - -**Tobias Nießen** <tniessen@tnie.de> -* [trivikr](https://github.com/trivikr) - -**Trivikram Kamat** <trivikr.dev@gmail.com> -* [Trott](https://github.com/Trott) - -**Rich Trott** <rtrott@gmail.com> (he/him) -* [vdeturckheim](https://github.com/vdeturckheim) - -**Vladimir de Turckheim** <vlad2t@hotmail.com> (he/him) -* [watilde](https://github.com/watilde) - -**Daijiro Wachi** <daijiro.wachi@gmail.com> (he/him) -* [watson](https://github.com/watson) - -**Thomas Watson** <w@tson.dk> -* [XadillaX](https://github.com/XadillaX) - -**Khaidi Chu** <i@2333.moe> (he/him) -* [yhwang](https://github.com/yhwang) - -**Yihong Wang** <yh.wang@ibm.com> -* [yorkie](https://github.com/yorkie) - -**Yorkie Liu** <yorkiefixer@gmail.com> -* [yosuke-furukawa](https://github.com/yosuke-furukawa) - -**Yosuke Furukawa** <yosuke.furukawa@gmail.com> -* [ZYSzys](https://github.com/ZYSzys) - -**Yongsheng Zhang** <zyszys98@gmail.com> (he/him) - -### Collaborator Emeriti - -* [andrasq](https://github.com/andrasq) - -**Andras** <andras@kinvey.com> -* [AnnaMag](https://github.com/AnnaMag) - -**Anna M. Kedzierska** <anna.m.kedzierska@gmail.com> -* [aqrln](https://github.com/aqrln) - -**Alexey Orlenko** <eaglexrlnk@gmail.com> (he/him) -* [brendanashworth](https://github.com/brendanashworth) - -**Brendan Ashworth** <brendan.ashworth@me.com> -* [calvinmetcalf](https://github.com/calvinmetcalf) - -**Calvin Metcalf** <calvin.metcalf@gmail.com> -* [chrisdickinson](https://github.com/chrisdickinson) - -**Chris Dickinson** <christopher.s.dickinson@gmail.com> -* [claudiorodriguez](https://github.com/claudiorodriguez) - -**Claudio Rodriguez** <cjrodr@yahoo.com> -* [DavidCai1993](https://github.com/DavidCai1993) - -**David Cai** <davidcai1993@yahoo.com> (he/him) -* [eljefedelrodeodeljefe](https://github.com/eljefedelrodeodeljefe) - -**Robert Jefe Lindstaedt** <robert.lindstaedt@gmail.com> -* [estliberitas](https://github.com/estliberitas) - -**Alexander Makarenko** <estliberitas@gmail.com> -* [firedfox](https://github.com/firedfox) - -**Daniel Wang** <wangyang0123@gmail.com> -* [glentiki](https://github.com/glentiki) - -**Glen Keane** <glenkeane.94@gmail.com> (he/him) -* [iarna](https://github.com/iarna) - -**Rebecca Turner** <me@re-becca.org> -* [imran-iq](https://github.com/imran-iq) - -**Imran Iqbal** <imran@imraniqbal.org> -* [imyller](https://github.com/imyller) - -**Ilkka Myller** <ilkka.myller@nodefield.com> -* [isaacs](https://github.com/isaacs) - -**Isaac Z. Schlueter** <i@izs.me> -* [italoacasas](https://github.com/italoacasas) - -**Italo A. Casas** <me@italoacasas.com> (he/him) -* [jasongin](https://github.com/jasongin) - -**Jason Ginchereau** <jasongin@microsoft.com> -* [jbergstroem](https://github.com/jbergstroem) - -**Johan Bergström** <bugs@bergstroem.nu> -* [jhamhader](https://github.com/jhamhader) - -**Yuval Brik** <yuval@brik.org.il> -* [joshgav](https://github.com/joshgav) - -**Josh Gavant** <josh.gavant@outlook.com> -* [julianduque](https://github.com/julianduque) - -**Julian Duque** <julianduquej@gmail.com> (he/him) -* [kunalspathak](https://github.com/kunalspathak) - -**Kunal Pathak** <kunal.pathak@microsoft.com> -* [lucamaraschi](https://github.com/lucamaraschi) - -**Luca Maraschi** <luca.maraschi@gmail.com> (he/him) -* [lxe](https://github.com/lxe) - -**Aleksey Smolenchuk** <lxe@lxe.co> -* [maclover7](https://github.com/maclover7) - -**Jon Moss** <me@jonathanmoss.me> (he/him) -* [matthewloring](https://github.com/matthewloring) - -**Matthew Loring** <mattloring@google.com> -* [micnic](https://github.com/micnic) - -**Nicu Micleușanu** <micnic90@gmail.com> (he/him) -* [mikeal](https://github.com/mikeal) - -**Mikeal Rogers** <mikeal.rogers@gmail.com> -* [monsanto](https://github.com/monsanto) - -**Christopher Monsanto** <chris@monsan.to> -* [MoonBall](https://github.com/MoonBall) - -**Chen Gang** <gangc.cxy@foxmail.com> -* [not-an-aardvark](https://github.com/not-an-aardvark) - -**Teddy Katz** <teddy.katz@gmail.com> (he/him) -* [Olegas](https://github.com/Olegas) - -**Oleg Elifantiev** <oleg@elifantiev.ru> -* [orangemocha](https://github.com/orangemocha) - -**Alexis Campailla** <orangemocha@nodejs.org> -* [othiym23](https://github.com/othiym23) - -**Forrest L Norvell** <ogd@aoaioxxysz.net> (he/him) -* [petkaantonov](https://github.com/petkaantonov) - -**Petka Antonov** <petka_antonov@hotmail.com> -* [phillipj](https://github.com/phillipj) - -**Phillip Johnsen** <johphi@gmail.com> -* [piscisaureus](https://github.com/piscisaureus) - -**Bert Belder** <bertbelder@gmail.com> -* [pmq20](https://github.com/pmq20) - -**Minqi Pan** <pmq2001@gmail.com> -* [princejwesley](https://github.com/princejwesley) - -**Prince John Wesley** <princejohnwesley@gmail.com> -* [rlidwka](https://github.com/rlidwka) - -**Alex Kocharin** <alex@kocharin.ru> -* [rmg](https://github.com/rmg) - -**Ryan Graham** <r.m.graham@gmail.com> -* [robertkowalski](https://github.com/robertkowalski) - -**Robert Kowalski** <rok@kowalski.gd> -* [romankl](https://github.com/romankl) - -**Roman Klauke** <romaaan.git@gmail.com> -* [RReverser](https://github.com/RReverser) - -**Ingvar Stepanyan** <me@rreverser.com> -* [stefanmb](https://github.com/stefanmb) - -**Stefan Budeanu** <stefan@budeanu.com> -* [tellnes](https://github.com/tellnes) - -**Christian Tellnes** <christian@tellnes.no> -* [thlorenz](https://github.com/thlorenz) - -**Thorsten Lorenz** <thlorenz@gmx.de> -* [trevnorris](https://github.com/trevnorris) - -**Trevor Norris** <trev.norris@gmail.com> -* [tunniclm](https://github.com/tunniclm) - -**Mike Tunnicliffe** <m.j.tunnicliffe@gmail.com> -* [vkurchatkin](https://github.com/vkurchatkin) - -**Vladimir Kurchatkin** <vladimir.kurchatkin@gmail.com> -* [vsemozhetbyt](https://github.com/vsemozhetbyt) - -**Vse Mozhet Byt** <vsemozhetbyt@gmail.com> (he/him) -* [whitlockjc](https://github.com/whitlockjc) - -**Jeremy Whitlock** <jwhitlock@apache.org> - -Collaborators follow the [Collaborator Guide](./doc/guides/collaborator-guide.md) in -maintaining the Node.js project. - -### Release Keys - -Primary GPG keys for Node.js Releasers (some Releasers sign with subkeys): - -* **Beth Griggs** <bethany.griggs@uk.ibm.com> -`4ED778F539E3634C779C87C6D7062848A1AB005C` -* **Colin Ihrig** <cjihrig@gmail.com> -`94AE36675C464D64BAFA68DD7434390BDBE9B9C5` -* **James M Snell** <jasnell@keybase.io> -`71DCFD284A79C3B38668286BC97EC7A07EDE3FC1` -* **Michaël Zasso** <targos@protonmail.com> -`8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600` -* **Myles Borins** <myles.borins@gmail.com> -`C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8` -* **Rod Vagg** <rod@vagg.org> -`DD8F2338BAE7501E3DD5AC78C273792F7D83545D` -* **Ruben Bridgewater** <ruben@bridgewater.de> -`A48C2BEE680E841632CD4E44F07496B3EB3C1762` -* **Shelley Vohr** <shelley.vohr@gmail.com> -`B9E2F5981AA6E0CD28160D9FF13993A75599653C` - -To import the full set of trusted release keys: - -```bash -gpg --keyserver pool.sks-keyservers.net --recv-keys 4ED778F539E3634C779C87C6D7062848A1AB005C -gpg --keyserver pool.sks-keyservers.net --recv-keys 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 -gpg --keyserver pool.sks-keyservers.net --recv-keys 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 -gpg --keyserver pool.sks-keyservers.net --recv-keys 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 -gpg --keyserver pool.sks-keyservers.net --recv-keys C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 -gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D -gpg --keyserver pool.sks-keyservers.net --recv-keys A48C2BEE680E841632CD4E44F07496B3EB3C1762 -gpg --keyserver pool.sks-keyservers.net --recv-keys B9E2F5981AA6E0CD28160D9FF13993A75599653C -``` - -See the section above on [Verifying Binaries](#verifying-binaries) for how to -use these keys to verify a downloaded file. - -Other keys used to sign some previous releases: - -* **Chris Dickinson** <christopher.s.dickinson@gmail.com> -`9554F04D7259F04124DE6B476D5A82AC7E37093B` -* **Evan Lucas** <evanlucas@me.com> -`B9AE9905FFD7803F25714661B63B535A4C206CA9` -* **Gibson Fahnestock** <gibfahn@gmail.com> -`77984A986EBC2AA786BC0F66B01FBB92821C587A` -* **Isaac Z. Schlueter** <i@izs.me> -`93C7E9E91B49E432C2F75674B0A78B0A6C481CF6` -* **Italo A. Casas** <me@italoacasas.com> -`56730D5401028683275BD23C23EFEFE93C4CFFFE` -* **Jeremiah Senkpiel** <fishrock@keybase.io> -`FD3A5288F042B6850C66B31F09FE44734EB7990E` -* **Julien Gilli** <jgilli@fastmail.fm> -`114F43EE0176B71C7BC219DD50A3051F888C628D` -* **Timothy J Fontaine** <tjfontaine@gmail.com> -`7937DFD2AB06298B2293C3187D33FF9D0246406D` - -[Code of Conduct]: https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md -[Contributing to the project]: CONTRIBUTING.md -[Node.js Website]: https://nodejs.org/ -[OpenJS Foundation]: https://openjsf.org/ -[Working Groups]: https://github.com/nodejs/TSC/blob/master/WORKING_GROUPS.md -[Strategic Initiatives]: https://github.com/nodejs/TSC/blob/master/Strategic-Initiatives.md +This project is bound by a [Code of Conduct](https://github.com/nodejs/TSC/blob/master/CODE_OF_CONDUCT.md). diff --git a/common.gypi b/common.gypi index 3afe3c133f8..da641d3547b 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.14', + 'v8_embedder_string': '-node.7', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/.gitignore b/deps/v8/.gitignore index 1afbd765d3e..6d2cf1077a5 100644 --- a/deps/v8/.gitignore +++ b/deps/v8/.gitignore @@ -61,6 +61,8 @@ !/third_party/antlr4 !/third_party/binutils !/third_party/inspector_protocol +!/third_party/jsoncpp +/third_party/jsoncpp/source !/third_party/colorama /third_party/colorama/src !/third_party/googletest diff --git a/deps/v8/AUTHORS b/deps/v8/AUTHORS index 7036ecd42bc..d6d9ffb1ed4 100644 --- a/deps/v8/AUTHORS +++ b/deps/v8/AUTHORS @@ -43,6 +43,7 @@ Julia Computing, Inc. <*@juliacomputing.com> Aaron Bieber Abdulla Kamar +Adam Kallai Akinori MUSHA Alessandro Pignotti Alex Kodat @@ -112,10 +113,12 @@ James Pike James M Snell Jianghua Yang Jiawen Geng +Jiaxun Yang Joel Stanley Johan Bergström Jonathan Liu Julien Brianceau +Junha Park JunHo Seo Junming Huang Kang-Hao (Kenny) Lu @@ -194,6 +197,7 @@ Tobias Burnus Tobias Nießen Ujjwal Sharma Vadim Gorbachev +Varun Varada Victor Costan Vlad Burlik Vladimir Krivosheev @@ -211,3 +215,4 @@ Zhao Jiazhong Zhongping Wang 柳荣一 Yanbo Li +Gilang Mentari Hamidy diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn index b2dde3f9d70..cde17854138 100644 --- a/deps/v8/BUILD.gn +++ b/deps/v8/BUILD.gn @@ -79,7 +79,7 @@ declare_args() { v8_enable_vtunetracemark = false # Sets -dENABLE_HANDLE_ZAPPING. - v8_enable_handle_zapping = is_debug + v8_enable_handle_zapping = true # Enable slow dchecks. v8_enable_slow_dchecks = false @@ -130,6 +130,11 @@ declare_args() { # Sets -dV8_ARRAY_BUFFER_EXTENSION v8_enable_array_buffer_extension = true + # Runs mksnapshot with --turbo-profiling. After building in this + # configuration, any subsequent run of d8 with --turbo-profiling will output + # information about both runtime-generated code and builtins. + v8_enable_builtins_profiling = false + # Enables various testing features. v8_enable_test_features = "" @@ -218,6 +223,20 @@ declare_args() { # Enable control-flow integrity features, such as pointer authentication for # ARM64. v8_control_flow_integrity = false + + # Enable object names in cppgc for debug purposes. + cppgc_enable_object_names = false + + # Enable heap reservation of size 4GB. Only possible for 64bit archs. + cppgc_enable_caged_heap = v8_current_cpu == "x64" || v8_current_cpu == "arm64" + + # Enable V8 heap sandbox experimental feature. + # Sets -DV8_HEAP_SANDBOX. + v8_enable_heap_sandbox = "" + + # Experimental support for native context independent code. + # https://crbug.com/v8/8888 + v8_enable_nci_code = false } # Derived defaults. @@ -254,7 +273,9 @@ if (v8_enable_pointer_compression == "") { if (v8_enable_fast_torque == "") { v8_enable_fast_torque = v8_enable_fast_mksnapshot } - +if (v8_enable_heap_sandbox == "") { + v8_enable_heap_sandbox = false +} if (v8_enable_single_generation == "") { v8_enable_single_generation = v8_disable_write_barriers } @@ -284,6 +305,13 @@ assert( !v8_enable_pointer_compression || !v8_enable_shared_ro_heap, "Pointer compression is not supported with shared read-only heap enabled") +assert(!v8_enable_heap_sandbox || v8_enable_pointer_compression, + "V8 Heap Sandbox requires pointer compression") + +assert(!cppgc_enable_caged_heap || v8_current_cpu == "x64" || + v8_current_cpu == "arm64", + "CppGC caged heap requires 64bit platforms") + v8_random_seed = "314159265" v8_toolset_for_shell = "host" @@ -294,8 +322,11 @@ v8_toolset_for_shell = "host" config("internal_config_base") { visibility = [ ":*" ] # Only targets in this file can depend on this. + configs = [ ":v8_tracing_config" ] + include_dirs = [ ".", + "include", "$target_gen_dir", ] } @@ -308,7 +339,6 @@ config("internal_config") { "//build/config/compiler:wexit_time_destructors", ":internal_config_base", ":v8_header_features", - ":v8_tracing_config", ] if (is_component_build) { @@ -346,6 +376,17 @@ config("libbase_config") { } } +# This config should be applied to code using the cppgc_base. +config("cppgc_base_config") { + defines = [] + if (cppgc_enable_object_names) { + defines += [ "CPPGC_SUPPORTS_OBJECT_NAMES" ] + } + if (cppgc_enable_caged_heap) { + defines += [ "CPPGC_CAGED_HEAP" ] + } +} + # This config should be applied to code using the libsampler. config("libsampler_config") { include_dirs = [ "include" ] @@ -389,6 +430,9 @@ config("v8_header_features") { if (v8_enable_pointer_compression || v8_enable_31bit_smis_on_64bit_arch) { defines += [ "V8_31BIT_SMIS_ON_64BIT_ARCH" ] } + if (v8_enable_heap_sandbox) { + defines += [ "V8_HEAP_SANDBOX" ] + } if (v8_deprecation_warnings) { defines += [ "V8_DEPRECATION_WARNINGS" ] } @@ -428,10 +472,6 @@ config("features") { } if (v8_enable_lite_mode) { defines += [ "V8_LITE_MODE" ] - - # TODO(v8:7777): Remove the define once the --jitless runtime flag does - # everything we need. - defines += [ "V8_JITLESS_MODE" ] } if (v8_enable_gdbjit) { defines += [ "ENABLE_GDB_JIT_INTERFACE" ] @@ -501,10 +541,6 @@ config("features") { if (v8_check_microtasks_scopes_consistency) { defines += [ "V8_CHECK_MICROTASKS_SCOPES_CONSISTENCY" ] } - - # TODO(v8:8519): Remove the define once all use-sites in - # the code are removed/fixed - defines += [ "V8_EMBEDDED_BUILTINS" ] if (v8_use_multi_snapshots) { defines += [ "V8_MULTI_SNAPSHOTS" ] } @@ -532,6 +568,9 @@ config("features") { if (v8_enable_wasm_gdb_remote_debugging) { defines += [ "V8_ENABLE_WASM_GDB_REMOTE_DEBUGGING" ] } + if (v8_enable_nci_code) { + defines += [ "V8_ENABLE_NCI_CODE" ] + } } config("toolchain") { @@ -630,7 +669,9 @@ config("toolchain") { if (v8_can_use_fpu_instructions) { defines += [ "CAN_USE_FPU_INSTRUCTIONS" ] } - + if (mips_use_msa) { + defines += [ "_MIPS_MSA" ] + } if (host_byteorder == "little") { defines += [ "V8_TARGET_ARCH_MIPS64_LE" ] } else if (host_byteorder == "big") { @@ -646,9 +687,6 @@ config("toolchain") { } if (mips_arch_variant == "r6") { defines += [ "_MIPS_ARCH_MIPS64R6" ] - if (mips_use_msa) { - defines += [ "_MIPS_MSA" ] - } } else if (mips_arch_variant == "r2") { defines += [ "_MIPS_ARCH_MIPS64R2" ] } @@ -982,6 +1020,7 @@ action("postmortem-metadata") { } torque_files = [ + "src/builtins/aggregate-error.tq", "src/builtins/array-copywithin.tq", "src/builtins/array-every.tq", "src/builtins/array-filter.tq", @@ -1007,14 +1046,19 @@ torque_files = [ "src/builtins/bigint.tq", "src/builtins/boolean.tq", "src/builtins/builtins-string.tq", - "src/builtins/collections.tq", "src/builtins/cast.tq", + "src/builtins/collections.tq", + "src/builtins/conversion.tq", "src/builtins/convert.tq", "src/builtins/console.tq", "src/builtins/data-view.tq", + "src/builtins/finalization-registry.tq", "src/builtins/frames.tq", "src/builtins/frame-arguments.tq", + "src/builtins/function.tq", "src/builtins/growable-fixed-array.tq", + "src/builtins/ic-callable.tq", + "src/builtins/ic.tq", "src/builtins/internal-coverage.tq", "src/builtins/iterator.tq", "src/builtins/math.tq", @@ -1024,6 +1068,7 @@ torque_files = [ "src/builtins/promise-abstract-operations.tq", "src/builtins/promise-all.tq", "src/builtins/promise-all-element-closure.tq", + "src/builtins/promise-any.tq", "src/builtins/promise-constructor.tq", "src/builtins/promise-finally.tq", "src/builtins/promise-misc.tq", @@ -1068,11 +1113,13 @@ torque_files = [ "src/builtins/torque-internal.tq", "src/builtins/typed-array-createtypedarray.tq", "src/builtins/typed-array-every.tq", + "src/builtins/typed-array-entries.tq", "src/builtins/typed-array-filter.tq", "src/builtins/typed-array-find.tq", "src/builtins/typed-array-findindex.tq", "src/builtins/typed-array-foreach.tq", "src/builtins/typed-array-from.tq", + "src/builtins/typed-array-keys.tq", "src/builtins/typed-array-of.tq", "src/builtins/typed-array-reduce.tq", "src/builtins/typed-array-reduceright.tq", @@ -1081,7 +1128,9 @@ torque_files = [ "src/builtins/typed-array-some.tq", "src/builtins/typed-array-sort.tq", "src/builtins/typed-array-subarray.tq", + "src/builtins/typed-array-values.tq", "src/builtins/typed-array.tq", + "src/builtins/wasm.tq", "src/ic/handler-configuration.tq", "src/objects/allocation-site.tq", "src/objects/api-callbacks.tq", @@ -1184,7 +1233,7 @@ template("run_torque") { "class-verifiers-tq.h", "enum-verifiers-tq.cc", "objects-printer-tq.cc", - "objects-body-descriptors-tq-inl.h", + "objects-body-descriptors-tq-inl.inc", "class-definitions-tq.cc", "class-definitions-tq-inl.h", "class-definitions-tq.h", @@ -1196,6 +1245,8 @@ template("run_torque") { "instance-types-tq.h", "internal-class-definitions-tq.h", "internal-class-definitions-tq-inl.h", + "exported-class-definitions-tq.h", + "exported-class-definitions-tq-inl.h", ] outputs = [] @@ -1270,6 +1321,7 @@ v8_source_set("torque_generated_initializers") { deps = [ ":generate_bytecode_builtins_list", ":run_torque", + ":v8_tracing", ] public_deps = [ ":v8_maybe_icu" ] @@ -1298,6 +1350,7 @@ v8_source_set("torque_generated_definitions") { deps = [ ":generate_bytecode_builtins_list", ":run_torque", + ":v8_tracing", ] public_deps = [ ":v8_maybe_icu" ] @@ -1375,6 +1428,10 @@ template("run_mksnapshot") { rebase_path("$target_gen_dir/embedded${suffix}.S", root_build_dir), ] + if (v8_enable_builtins_profiling) { + args += [ "--turbo-profiling" ] + } + # This is needed to distinguish between generating code for the simulator # and cross-compiling. The latter may need to run code on the host with the # simulator but cannot use simulator-specific instructions. @@ -1573,7 +1630,10 @@ v8_source_set("v8_initializers") { "test/cctest:*", ] - deps = [ ":torque_generated_initializers" ] + deps = [ + ":torque_generated_initializers", + ":v8_tracing", + ] sources = [ ### gcmole(all) ### @@ -1596,7 +1656,6 @@ v8_source_set("v8_initializers") { "src/builtins/builtins-data-view-gen.h", "src/builtins/builtins-date-gen.cc", "src/builtins/builtins-debug-gen.cc", - "src/builtins/builtins-function-gen.cc", "src/builtins/builtins-generator-gen.cc", "src/builtins/builtins-global-gen.cc", "src/builtins/builtins-handler-gen.cc", @@ -1624,6 +1683,7 @@ v8_source_set("v8_initializers") { "src/builtins/builtins-typed-array-gen.h", "src/builtins/builtins-utils-gen.h", "src/builtins/builtins-wasm-gen.cc", + "src/builtins/builtins-wasm-gen.h", "src/builtins/growable-fixed-array-gen.cc", "src/builtins/growable-fixed-array-gen.h", "src/builtins/setup-builtins-internal.cc", @@ -1636,6 +1696,8 @@ v8_source_set("v8_initializers") { "src/ic/binary-op-assembler.h", "src/ic/keyed-store-generic.cc", "src/ic/keyed-store-generic.h", + "src/ic/unary-op-assembler.cc", + "src/ic/unary-op-assembler.h", "src/interpreter/interpreter-assembler.cc", "src/interpreter/interpreter-assembler.h", "src/interpreter/interpreter-generator.cc", @@ -1701,7 +1763,10 @@ v8_source_set("v8_initializers") { v8_source_set("v8_init") { visibility = [ ":*" ] # Only targets in this file can depend on this. - deps = [ ":v8_initializers" ] + deps = [ + ":v8_initializers", + ":v8_tracing", + ] sources = [ ### gcmole(all) ### @@ -2005,6 +2070,7 @@ v8_source_set("v8_compiler_opt") { ":generate_bytecode_builtins_list", ":run_torque", ":v8_maybe_icu", + ":v8_tracing", ] if (is_debug && !v8_optimized_debug && v8_enable_fast_mksnapshot) { @@ -2029,6 +2095,7 @@ v8_source_set("v8_compiler") { ":generate_bytecode_builtins_list", ":run_torque", ":v8_maybe_icu", + ":v8_tracing", ] configs = [ ":internal_config" ] @@ -2042,6 +2109,18 @@ group("v8_compiler_for_mksnapshot") { } } +# Any target using trace events must directly or indirectly depend on +# v8_tracing. +group("v8_tracing") { + if (v8_use_perfetto) { + if (build_with_chromium) { + public_deps = [ "//third_party/perfetto:libperfetto" ] + } else { + public_deps = [ ":v8_libperfetto" ] + } + } +} + v8_source_set("v8_base_without_compiler") { visibility = [ ":*" ] # Only targets in this file can depend on this. @@ -2053,6 +2132,7 @@ v8_source_set("v8_base_without_compiler") { ### gcmole(all) ### "$target_gen_dir/builtins-generated/bytecodes-builtins-list.h", + "include/cppgc/common.h", "include/v8-fast-api-calls.h", "include/v8-inspector-protocol.h", "include/v8-inspector.h", @@ -2121,7 +2201,6 @@ v8_source_set("v8_base_without_compiler") { "src/builtins/builtins-json.cc", "src/builtins/builtins-number.cc", "src/builtins/builtins-object.cc", - "src/builtins/builtins-promise.cc", "src/builtins/builtins-promise.h", "src/builtins/builtins-reflect.cc", "src/builtins/builtins-regexp.cc", @@ -2160,6 +2239,8 @@ v8_source_set("v8_base_without_compiler") { "src/codegen/constant-pool.h", "src/codegen/constants-arch.h", "src/codegen/cpu-features.h", + "src/codegen/external-reference-encoder.cc", + "src/codegen/external-reference-encoder.h", "src/codegen/external-reference-table.cc", "src/codegen/external-reference-table.h", "src/codegen/external-reference.cc", @@ -2207,6 +2288,8 @@ v8_source_set("v8_base_without_compiler") { "src/common/assert-scope.cc", "src/common/assert-scope.h", "src/common/checks.h", + "src/common/external-pointer-inl.h", + "src/common/external-pointer.h", "src/common/message-template.h", "src/common/ptr-compr-inl.h", "src/common/ptr-compr.h", @@ -2284,6 +2367,7 @@ v8_source_set("v8_base_without_compiler") { "src/execution/messages.h", "src/execution/microtask-queue.cc", "src/execution/microtask-queue.h", + "src/execution/off-thread-isolate-inl.h", "src/execution/off-thread-isolate.cc", "src/execution/off-thread-isolate.h", "src/execution/pointer-authentication.h", @@ -2330,6 +2414,8 @@ v8_source_set("v8_base_without_compiler") { "src/handles/local-handles.h", "src/handles/maybe-handles-inl.h", "src/handles/maybe-handles.h", + "src/handles/persistent-handles.cc", + "src/handles/persistent-handles.h", "src/heap/array-buffer-collector.cc", "src/heap/array-buffer-collector.h", "src/heap/array-buffer-sweeper.cc", @@ -2340,10 +2426,15 @@ v8_source_set("v8_base_without_compiler") { "src/heap/barrier.h", "src/heap/basic-memory-chunk.cc", "src/heap/basic-memory-chunk.h", + "src/heap/code-object-registry.cc", + "src/heap/code-object-registry.h", "src/heap/code-stats.cc", "src/heap/code-stats.h", "src/heap/combined-heap.cc", "src/heap/combined-heap.h", + "src/heap/concurrent-allocator-inl.h", + "src/heap/concurrent-allocator.cc", + "src/heap/concurrent-allocator.h", "src/heap/concurrent-marking.cc", "src/heap/concurrent-marking.h", "src/heap/embedder-tracing.cc", @@ -2376,6 +2467,9 @@ v8_source_set("v8_base_without_compiler") { "src/heap/invalidated-slots.h", "src/heap/item-parallel-job.cc", "src/heap/item-parallel-job.h", + "src/heap/large-spaces.cc", + "src/heap/large-spaces.h", + "src/heap/list.h", "src/heap/local-allocator-inl.h", "src/heap/local-allocator.h", "src/heap/local-heap.cc", @@ -2389,11 +2483,19 @@ v8_source_set("v8_base_without_compiler") { "src/heap/marking-worklist.h", "src/heap/marking.cc", "src/heap/marking.h", + "src/heap/memory-allocator.cc", + "src/heap/memory-allocator.h", + "src/heap/memory-chunk-inl.h", + "src/heap/memory-chunk.cc", + "src/heap/memory-chunk.h", "src/heap/memory-measurement-inl.h", "src/heap/memory-measurement.cc", "src/heap/memory-measurement.h", "src/heap/memory-reducer.cc", "src/heap/memory-reducer.h", + "src/heap/new-spaces-inl.h", + "src/heap/new-spaces.cc", + "src/heap/new-spaces.h", "src/heap/object-stats.cc", "src/heap/object-stats.h", "src/heap/objects-visiting-inl.h", @@ -2401,9 +2503,16 @@ v8_source_set("v8_base_without_compiler") { "src/heap/objects-visiting.h", "src/heap/off-thread-factory.cc", "src/heap/off-thread-factory.h", + "src/heap/off-thread-heap.cc", + "src/heap/off-thread-heap.h", + "src/heap/paged-spaces-inl.h", + "src/heap/paged-spaces.cc", + "src/heap/paged-spaces.h", "src/heap/read-only-heap-inl.h", "src/heap/read-only-heap.cc", "src/heap/read-only-heap.h", + "src/heap/read-only-spaces.cc", + "src/heap/read-only-spaces.h", "src/heap/remembered-set.h", "src/heap/safepoint.cc", "src/heap/safepoint.h", @@ -2888,6 +2997,7 @@ v8_source_set("v8_base_without_compiler") { "src/runtime/runtime-typedarray.cc", "src/runtime/runtime-utils.h", "src/runtime/runtime-wasm.cc", + "src/runtime/runtime-weak-refs.cc", "src/runtime/runtime.cc", "src/runtime/runtime.h", "src/sanitizer/asan.h", @@ -2897,6 +3007,10 @@ v8_source_set("v8_base_without_compiler") { "src/sanitizer/tsan.h", "src/snapshot/code-serializer.cc", "src/snapshot/code-serializer.h", + "src/snapshot/context-deserializer.cc", + "src/snapshot/context-deserializer.h", + "src/snapshot/context-serializer.cc", + "src/snapshot/context-serializer.h", "src/snapshot/deserializer-allocator.cc", "src/snapshot/deserializer-allocator.h", "src/snapshot/deserializer.cc", @@ -2905,10 +3019,6 @@ v8_source_set("v8_base_without_compiler") { "src/snapshot/embedded/embedded-data.h", "src/snapshot/object-deserializer.cc", "src/snapshot/object-deserializer.h", - "src/snapshot/partial-deserializer.cc", - "src/snapshot/partial-deserializer.h", - "src/snapshot/partial-serializer.cc", - "src/snapshot/partial-serializer.h", "src/snapshot/read-only-deserializer.cc", "src/snapshot/read-only-deserializer.h", "src/snapshot/read-only-serializer.cc", @@ -2918,15 +3028,19 @@ v8_source_set("v8_base_without_compiler") { "src/snapshot/roots-serializer.h", "src/snapshot/serializer-allocator.cc", "src/snapshot/serializer-allocator.h", - "src/snapshot/serializer-common.cc", - "src/snapshot/serializer-common.h", + "src/snapshot/serializer-deserializer.cc", + "src/snapshot/serializer-deserializer.h", "src/snapshot/serializer.cc", "src/snapshot/serializer.h", - "src/snapshot/snapshot-common.cc", "src/snapshot/snapshot-compression.cc", "src/snapshot/snapshot-compression.h", + "src/snapshot/snapshot-data.cc", + "src/snapshot/snapshot-data.h", "src/snapshot/snapshot-source-sink.cc", "src/snapshot/snapshot-source-sink.h", + "src/snapshot/snapshot-utils.cc", + "src/snapshot/snapshot-utils.h", + "src/snapshot/snapshot.cc", "src/snapshot/snapshot.h", "src/snapshot/startup-deserializer.cc", "src/snapshot/startup-deserializer.h", @@ -3026,6 +3140,8 @@ v8_source_set("v8_base_without_compiler") { "src/wasm/signature-map.h", "src/wasm/streaming-decoder.cc", "src/wasm/streaming-decoder.h", + "src/wasm/struct-types.h", + "src/wasm/sync-streaming-decoder.cc", "src/wasm/value-type.h", "src/wasm/wasm-arguments.h", "src/wasm/wasm-code-manager.cc", @@ -3085,21 +3201,28 @@ v8_source_set("v8_base_without_compiler") { if (v8_enable_third_party_heap) { sources += v8_third_party_heap_files + } else { + sources += [ "src/heap/third-party/heap-api-stub.cc" ] } if (v8_enable_wasm_gdb_remote_debugging) { sources += [ + "src/debug/wasm/gdb-server/gdb-remote-util.cc", + "src/debug/wasm/gdb-server/gdb-remote-util.h", "src/debug/wasm/gdb-server/gdb-server-thread.cc", "src/debug/wasm/gdb-server/gdb-server-thread.h", "src/debug/wasm/gdb-server/gdb-server.cc", "src/debug/wasm/gdb-server/gdb-server.h", + "src/debug/wasm/gdb-server/packet.cc", + "src/debug/wasm/gdb-server/packet.h", "src/debug/wasm/gdb-server/session.cc", "src/debug/wasm/gdb-server/session.h", "src/debug/wasm/gdb-server/target.cc", "src/debug/wasm/gdb-server/target.h", "src/debug/wasm/gdb-server/transport.cc", "src/debug/wasm/gdb-server/transport.h", - "src/debug/wasm/gdb-server/util.h", + "src/debug/wasm/gdb-server/wasm-module-debug.cc", + "src/debug/wasm/gdb-server/wasm-module-debug.h", ] } @@ -3420,6 +3543,7 @@ v8_source_set("v8_base_without_compiler") { ":v8_libbase", ":v8_libsampler", ":v8_shared_internal_headers", + ":v8_tracing", ":v8_version", "src/inspector:inspector", ] @@ -3511,6 +3635,14 @@ v8_source_set("v8_base_without_compiler") { ] deps += [ "src/third_party/vtune:v8_vtune_trace_mark" ] } + + if (v8_use_perfetto) { + sources -= [ "//base/trace_event/common/trace_event_common.h" ] + sources += [ + "src/tracing/trace-categories.cc", + "src/tracing/trace-categories.h", + ] + } } group("v8_base") { @@ -3672,7 +3804,6 @@ v8_component("v8_libbase") { "src/base/ieee754.h", "src/base/iterator.h", "src/base/lazy-instance.h", - "src/base/list.h", "src/base/logging.cc", "src/base/logging.h", "src/base/lsan.h", @@ -3843,6 +3974,8 @@ v8_component("v8_libplatform") { "include/libplatform/v8-tracing.h", "src/libplatform/default-foreground-task-runner.cc", "src/libplatform/default-foreground-task-runner.h", + "src/libplatform/default-job.cc", + "src/libplatform/default-job.h", "src/libplatform/default-platform.cc", "src/libplatform/default-platform.h", "src/libplatform/default-worker-threads-task-runner.cc", @@ -3873,20 +4006,25 @@ v8_component("v8_libplatform") { deps = [ ":v8_headers", ":v8_libbase", + ":v8_tracing", ] + if (v8_use_perfetto) { + sources -= [ + "//base/trace_event/common/trace_event_common.h", + "src/libplatform/tracing/trace-buffer.cc", + "src/libplatform/tracing/trace-buffer.h", + "src/libplatform/tracing/trace-object.cc", + "src/libplatform/tracing/trace-writer.cc", + "src/libplatform/tracing/trace-writer.h", + ] sources += [ - "src/libplatform/tracing/json-trace-event-listener.cc", - "src/libplatform/tracing/json-trace-event-listener.h", "src/libplatform/tracing/trace-event-listener.cc", "src/libplatform/tracing/trace-event-listener.h", ] deps += [ + # TODO(skyostil): Switch TraceEventListener to protozero. "//third_party/perfetto/protos/perfetto/trace:lite", - "//third_party/perfetto/protos/perfetto/trace/chrome:minimal_complete_lite", - "//third_party/perfetto/protos/perfetto/trace/chrome:zero", - "//third_party/perfetto/src/tracing:client_api", - "//third_party/perfetto/src/tracing:platform_posix", ] } } @@ -3914,9 +4052,8 @@ v8_source_set("fuzzer_support") { configs = [ ":internal_config_base" ] - deps = [ ":v8" ] - public_deps = [ + ":v8", ":v8_libbase", ":v8_libplatform", ":v8_maybe_icu", @@ -3928,14 +4065,33 @@ v8_source_set("cppgc_base") { sources = [ "include/cppgc/allocation.h", - "include/cppgc/api-constants.h", - "include/cppgc/finalizer-trait.h", + "include/cppgc/common.h", + "include/cppgc/custom-space.h", "include/cppgc/garbage-collected.h", - "include/cppgc/gc-info.h", "include/cppgc/heap.h", + "include/cppgc/internal/accessors.h", + "include/cppgc/internal/api-contants.h", + "include/cppgc/internal/compiler-specific.h", + "include/cppgc/internal/finalizer-traits.h", + "include/cppgc/internal/gc-info.h", + "include/cppgc/internal/persistent-node.h", + "include/cppgc/internal/pointer-policies.h", + "include/cppgc/internal/prefinalizer-handler.h", + "include/cppgc/liveness-broker.h", + "include/cppgc/liveness-broker.h", + "include/cppgc/macros.h", + "include/cppgc/member.h", + "include/cppgc/persistent.h", "include/cppgc/platform.h", + "include/cppgc/prefinalizer.h", + "include/cppgc/source-location.h", + "include/cppgc/trace-trait.h", + "include/cppgc/type-traits.h", + "include/cppgc/visitor.h", "include/v8config.h", "src/heap/cppgc/allocation.cc", + "src/heap/cppgc/free-list.cc", + "src/heap/cppgc/free-list.h", "src/heap/cppgc/gc-info-table.cc", "src/heap/cppgc/gc-info-table.h", "src/heap/cppgc/gc-info.cc", @@ -3943,23 +4099,78 @@ v8_source_set("cppgc_base") { "src/heap/cppgc/heap-object-header-inl.h", "src/heap/cppgc/heap-object-header.cc", "src/heap/cppgc/heap-object-header.h", + "src/heap/cppgc/heap-page.cc", + "src/heap/cppgc/heap-page.h", + "src/heap/cppgc/heap-space.cc", + "src/heap/cppgc/heap-space.h", + "src/heap/cppgc/heap-visitor.h", "src/heap/cppgc/heap.cc", "src/heap/cppgc/heap.h", + "src/heap/cppgc/liveness-broker.cc", + "src/heap/cppgc/logging.cc", + "src/heap/cppgc/marker.cc", + "src/heap/cppgc/marker.h", + "src/heap/cppgc/marking-visitor.cc", + "src/heap/cppgc/marking-visitor.h", + "src/heap/cppgc/object-allocator-inl.h", + "src/heap/cppgc/object-allocator.cc", + "src/heap/cppgc/object-allocator.h", + "src/heap/cppgc/object-start-bitmap-inl.h", + "src/heap/cppgc/object-start-bitmap.h", + "src/heap/cppgc/page-memory-inl.h", + "src/heap/cppgc/page-memory.cc", + "src/heap/cppgc/page-memory.h", + "src/heap/cppgc/persistent-node.cc", "src/heap/cppgc/platform.cc", + "src/heap/cppgc/pointer-policies.cc", + "src/heap/cppgc/prefinalizer-handler.cc", + "src/heap/cppgc/prefinalizer-handler.h", + "src/heap/cppgc/raw-heap.cc", + "src/heap/cppgc/raw-heap.h", "src/heap/cppgc/sanitizers.h", + "src/heap/cppgc/source-location.cc", "src/heap/cppgc/stack.cc", "src/heap/cppgc/stack.h", + "src/heap/cppgc/sweeper.cc", + "src/heap/cppgc/sweeper.h", + "src/heap/cppgc/virtual-memory.cc", + "src/heap/cppgc/virtual-memory.h", + "src/heap/cppgc/visitor.cc", + "src/heap/cppgc/worklist.h", ] - if (target_cpu == "x64") { - if (is_win) { - sources += [ "src/heap/cppgc/asm/x64/push_registers_win.S" ] - } else { - sources += [ "src/heap/cppgc/asm/x64/push_registers.S" ] + if (is_clang || !is_win) { + if (target_cpu == "x64") { + sources += [ "src/heap/cppgc/asm/x64/push_registers_asm.cc" ] + } else if (target_cpu == "x86") { + sources += [ "src/heap/cppgc/asm/ia32/push_registers_asm.cc" ] + } else if (target_cpu == "arm") { + sources += [ "src/heap/cppgc/asm/arm/push_registers_asm.cc" ] + } else if (target_cpu == "arm64") { + sources += [ "src/heap/cppgc/asm/arm64/push_registers_asm.cc" ] + } else if (target_cpu == "ppc64") { + sources += [ "src/heap/cppgc/asm/ppc/push_registers_asm.cc" ] + } else if (target_cpu == "s390x") { + sources += [ "src/heap/cppgc/asm/s390/push_registers_asm.cc" ] + } else if (target_cpu == "mipsel") { + sources += [ "src/heap/cppgc/asm/mips/push_registers_asm.cc" ] + } else if (target_cpu == "mips64el") { + sources += [ "src/heap/cppgc/asm/mips64/push_registers_asm.cc" ] + } + } else if (is_win) { + if (target_cpu == "x64") { + sources += [ "src/heap/cppgc/asm/x64/push_registers_masm.S" ] + } else if (target_cpu == "x86") { + sources += [ "src/heap/cppgc/asm/ia32/push_registers_masm.S" ] + } else if (target_cpu == "arm64") { + sources += [ "src/heap/cppgc/asm/arm64/push_registers_masm.S" ] } } - configs = [ ":internal_config" ] + configs = [ + ":internal_config", + ":cppgc_base_config", + ] public_deps = [ ":v8_libbase" ] } @@ -4010,12 +4221,6 @@ v8_static_library("wee8") { ] } -v8_static_library("cppgc") { - deps = [ ":cppgc_base" ] - - configs = [ ":internal_config" ] -} - ############################################################################### # Executables # @@ -4074,6 +4279,7 @@ if (current_toolchain == v8_snapshot_toolchain) { ":v8_libbase", ":v8_libplatform", ":v8_maybe_icu", + ":v8_tracing", "//build/win:default_exe_manifest", ] } @@ -4308,6 +4514,14 @@ if (is_component_build) { public_configs = [ ":external_config" ] } + v8_component("cppgc") { + public_deps = [ ":cppgc_base" ] + + configs = [ ":internal_config" ] + + public_configs = [ ":external_config" ] + } + v8_component("cppgc_for_testing") { testonly = true @@ -4340,6 +4554,12 @@ if (is_component_build) { public_configs = [ ":external_config" ] } + group("cppgc") { + public_deps = [ ":cppgc_base" ] + + public_configs = [ ":external_config" ] + } + group("cppgc_for_testing") { testonly = true @@ -4374,6 +4594,7 @@ v8_executable("d8") { ":v8", ":v8_libbase", ":v8_libplatform", + ":v8_tracing", "//build/win:default_exe_manifest", ] @@ -4392,10 +4613,6 @@ v8_executable("d8") { if (v8_enable_vtunejit) { deps += [ "src/third_party/vtune:v8_vtune" ] } - - if (v8_use_perfetto) { - deps += [ "//third_party/perfetto/src/tracing:in_process_backend" ] - } } v8_executable("v8_hello_world") { @@ -4551,6 +4768,7 @@ v8_source_set("wasm_module_runner") { deps = [ ":generate_bytecode_builtins_list", ":run_torque", + ":v8_tracing", ] public_deps = [ ":v8_maybe_icu" ] @@ -4627,6 +4845,7 @@ v8_source_set("lib_wasm_fuzzer_common") { deps = [ ":generate_bytecode_builtins_list", ":run_torque", + ":v8_tracing", ] public_deps = [ ":v8_maybe_icu" ] @@ -4709,7 +4928,7 @@ if (!build_with_chromium && v8_use_perfetto) { "-Wno-tautological-constant-compare", ] } - if (is_win) { + if (is_win && is_clang) { cflags += [ "-Wno-microsoft-unqualified-friend" ] } } @@ -4868,4 +5087,21 @@ if (!build_with_chromium && v8_use_perfetto) { configs += [ "//build/config/compiler:no_chromium_code" ] } } # host_toolchain + + v8_component("v8_libperfetto") { + configs = [ ":v8_tracing_config" ] + public_configs = [ "//third_party/perfetto/gn:public_config" ] + deps = [ + "//third_party/perfetto/src/trace_processor:export_json", + "//third_party/perfetto/src/trace_processor:storage_minimal", + "//third_party/perfetto/src/tracing:client_api", + "//third_party/perfetto/src/tracing/core", + + # TODO(skyostil): Support non-POSIX platforms. + "//third_party/perfetto/protos/perfetto/config:cpp", + "//third_party/perfetto/protos/perfetto/trace/track_event:zero", + "//third_party/perfetto/src/tracing:in_process_backend", + "//third_party/perfetto/src/tracing:platform_posix", + ] + } } # if (!build_with_chromium && v8_use_perfetto) diff --git a/deps/v8/COMMON_OWNERS b/deps/v8/COMMON_OWNERS index 1eee48173a1..bfd539fb420 100644 --- a/deps/v8/COMMON_OWNERS +++ b/deps/v8/COMMON_OWNERS @@ -2,12 +2,14 @@ adamk@chromium.org ahaas@chromium.org bbudge@chromium.org binji@chromium.org +bikineev@chromium.org bmeurer@chromium.org cbruni@chromium.org clemensb@chromium.org danno@chromium.org delphick@chromium.org dinfuehr@chromium.org +ecmziegler@chromium.org gdeepti@chromium.org gsathya@chromium.org hablich@chromium.org @@ -25,6 +27,7 @@ mslekova@chromium.org mvstanton@chromium.org mythria@chromium.org neis@chromium.org +omerkatz@chromium.org petermarshall@chromium.org rmcilroy@chromium.org sigurds@chromium.org @@ -32,6 +35,7 @@ solanes@chromium.org syg@chromium.org szuend@chromium.org tebbi@chromium.org +thibaudm@chromium.org ulan@chromium.org verwaest@chromium.org victorgomes@chromium.org diff --git a/deps/v8/DEPS b/deps/v8/DEPS index 1bc687beaf6..4d0f67a0656 100644 --- a/deps/v8/DEPS +++ b/deps/v8/DEPS @@ -31,10 +31,10 @@ vars = { 'check_v8_header_includes': False, # GN CIPD package version. - 'gn_version': 'git_revision:5ed3c9cc67b090d5e311e4bd2aba072173e82db9', + 'gn_version': 'git_revision:d0a6f072070988e7b038496c4e7d6c562b649732', # luci-go CIPD package version. - 'luci_go': 'git_revision:de73cf6c4bde86f0a9c8d54151b69b0154a398f1', + 'luci_go': 'git_revision:56ae79476e3caf14da59d75118408aa778637936', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_build-tools_version @@ -55,7 +55,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_platform-tools_version # and whatever else without interference from each other. - 'android_sdk_platform-tools_version': 'Jxtur3_L9RzY4q79K-AwIahwFW4oi5uYVD5URx9h62wC', + 'android_sdk_platform-tools_version': 'zMVtBEihXp2Z0NYFNjLLmNrwy6252b_YWG6sh2l0QAcC', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_platforms_version # and whatever else without interference from each other. @@ -67,20 +67,20 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_tools-lint_version # and whatever else without interference from each other. - 'android_sdk_tools-lint_version': '89hXqZYzCum3delB5RV7J_QyWkaRodqdtQS0s3LMh3wC', + 'android_sdk_cmdline-tools_version': 'CR25ixsRhwuRnhdgDpGFyl9S0C_0HO9SUgFrwX46zq8C', } deps = { 'v8/build': - Var('chromium_url') + '/chromium/src/build.git' + '@' + '26e9d485d01d6e0eb9dadd21df767a63494c8fea', + Var('chromium_url') + '/chromium/src/build.git' + '@' + 'c523c20ca356cf8149569a4aeece9922c7f05813', 'v8/third_party/depot_tools': - Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + '2b2aec6506a810f8d7bd018609de2c2450b3c121', + Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + '99044852de36333f88644adfd074189c05eaec12', 'v8/third_party/icu': - Var('chromium_url') + '/chromium/deps/icu.git' + '@' + 'd7aff76cf6bb0fbef3afa6c07718f78a80a70f8f', + Var('chromium_url') + '/chromium/deps/icu.git' + '@' + '84e9d0035875f383b98320d48f3e7008a23c3738', 'v8/third_party/instrumented_libraries': Var('chromium_url') + '/chromium/src/third_party/instrumented_libraries.git' + '@' + 'bb3f1802c237dd19105dd0f7919f99e536a39d10', 'v8/buildtools': - Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '7977eb176752aeec29d888cfe8e677ac12ed1c41', + Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '7a0ebcc8407db6983748dd2edccec7a526e181fc', 'v8/buildtools/clang_format/script': Var('chromium_url') + '/chromium/llvm-project/cfe/tools/clang-format.git' + '@' + '96636aa0e9f047f17447f2d45a094d0b59ed7917', 'v8/buildtools/linux64': { @@ -108,7 +108,7 @@ deps = { 'v8/buildtools/third_party/libc++abi/trunk': Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxxabi.git' + '@' + '196ba1aaa8ac285d94f4ea8d9836390a45360533', 'v8/buildtools/third_party/libunwind/trunk': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libunwind.git' + '@' + '43bb9f872232f531bac80093ceb4de61c64b9ab7', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libunwind.git' + '@' + 'd999d54f4bca789543a2eb6c995af2d9b5a1f3ed', 'v8/buildtools/win': { 'packages': [ { @@ -120,13 +120,13 @@ deps = { 'condition': 'host_os == "win"', }, 'v8/base/trace_event/common': - Var('chromium_url') + '/chromium/src/base/trace_event/common.git' + '@' + 'dab187b372fc17e51f5b9fad8201813d0aed5129', + Var('chromium_url') + '/chromium/src/base/trace_event/common.git' + '@' + 'ef3586804494b7e402b6c1791d5dccdf2971afff', 'v8/third_party/android_ndk': { 'url': Var('chromium_url') + '/android_ndk.git' + '@' + '27c0a8d090c666a50e40fceb4ee5b40b1a2d3f87', 'condition': 'checkout_android', }, 'v8/third_party/android_platform': { - 'url': Var('chromium_url') + '/chromium/src/third_party/android_platform.git' + '@' + '2244b5ea295f8fda3179bef160c84ef8fa0ec9fc', + 'url': Var('chromium_url') + '/chromium/src/third_party/android_platform.git' + '@' + 'c1f84dcf41795fba13a53c86de608fc0cf6f813e', 'condition': 'checkout_android', }, 'v8/third_party/android_sdk/public': { @@ -160,15 +160,15 @@ deps = { 'version': Var('android_sdk_sources_version'), }, { - 'package': 'chromium/third_party/android_sdk/public/tools-lint', - 'version': Var('android_sdk_tools-lint_version'), + 'package': 'chromium/third_party/android_sdk/public/cmdline-tools', + 'version': Var('android_sdk_cmdline-tools_version'), }, ], 'condition': 'checkout_android', 'dep_type': 'cipd', }, 'v8/third_party/catapult': { - 'url': Var('chromium_url') + '/catapult.git' + '@' + '032c78376792ef343ea361bca2181ba6dec6b95f', + 'url': Var('chromium_url') + '/catapult.git' + '@' + '1ec298698eeb08ce1af69370e3e013aaaf1ec18d', 'condition': 'checkout_android', }, 'v8/third_party/colorama/src': { @@ -176,23 +176,23 @@ deps = { 'condition': 'checkout_android', }, 'v8/third_party/fuchsia-sdk': { - 'url': Var('chromium_url') + '/chromium/src/third_party/fuchsia-sdk.git' + '@' + '2457e41d8dc379f74662d3157e76339ba92cee06', + 'url': Var('chromium_url') + '/chromium/src/third_party/fuchsia-sdk.git' + '@' + '8ce22865fbbc501198e0dc9d3ca2eeaa46471d11', 'condition': 'checkout_fuchsia', }, 'v8/third_party/googletest/src': - Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + '10b1902d893ea8cc43c69541d70868f91af3646b', + Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + '011959aafddcd30611003de96cfd8d7a7685c700', 'v8/third_party/jinja2': - Var('chromium_url') + '/chromium/src/third_party/jinja2.git' + '@' + 'b41863e42637544c2941b574c7877d3e1f663e25', + Var('chromium_url') + '/chromium/src/third_party/jinja2.git' + '@' + '3f90fa05c85718505e28c9c3426c1ba52843b9b7', 'v8/third_party/markupsafe': Var('chromium_url') + '/chromium/src/third_party/markupsafe.git' + '@' + '8f45f5cfa0009d2a70589bcda0349b8cb2b72783', 'v8/tools/swarming_client': - Var('chromium_url') + '/infra/luci/client-py.git' + '@' + 'cc958279ffd6853e0a1b227a7e957ca334fe56af', + Var('chromium_url') + '/infra/luci/client-py.git' + '@' + '90c5e17a82612bc898c90ab1530dd1bd5822eae8', 'v8/test/benchmarks/data': Var('chromium_url') + '/v8/deps/third_party/benchmarks.git' + '@' + '05d7188267b4560491ff9155c5ee13e207ecd65f', 'v8/test/mozilla/data': Var('chromium_url') + '/v8/deps/third_party/mozilla-tests.git' + '@' + 'f6c578a10ea707b1a8ab0b88943fe5115ce2b9be', 'v8/test/test262/data': - Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + 'f6b2ccdd091ff82da54150796297c3a96d7edb41', + Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + 'd2f7d4285c4a5267f5be37a9c823a397daadad1b', 'v8/test/test262/harness': Var('chromium_url') + '/external/github.com/test262-utils/test262-harness-py.git' + '@' + '4555345a943d0c99a9461182705543fb171dda4b', 'v8/third_party/qemu-linux-x64': { @@ -219,7 +219,7 @@ deps = { 'packages': [ { 'package': 'fuchsia/third_party/aemu/linux-amd64', - 'version': '7YlCgase5GlIanqHn-nZClSlZ5kQETJyVUYRF7Jjy6UC' + 'version': 'V4ZGjQxGJ00ndsSZd9X90QJnY3N7-ZbuPq57Yk7yv74C' }, ], 'condition': 'host_os == "linux" and checkout_fuchsia', @@ -236,7 +236,7 @@ deps = { 'dep_type': 'cipd', }, 'v8/tools/clang': - Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + '105a8460911176861a422738eee4daad8dfe88a2', + Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + '8b9091fe8fc8e919e99b014907b264b2d81f241b', 'v8/tools/luci-go': { 'packages': [ { @@ -266,11 +266,13 @@ deps = { 'dep_type': 'cipd', }, 'v8/third_party/perfetto': - Var('android_url') + '/platform/external/perfetto.git' + '@' + 'b9b24d1b0b80aafec393af085067e9eae829412f', + Var('android_url') + '/platform/external/perfetto.git' + '@' + 'ff70e0d273ed10995866c803f23e11250eb3dc52', 'v8/third_party/protobuf': Var('chromium_url') + '/external/github.com/google/protobuf'+ '@' + 'b68a347f56137b4b1a746e8c7438495a6ac1bd91', 'v8/third_party/zlib': - Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + '156be8c52f80cde343088b4a69a80579101b6e67', + Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + 'f5eca0dc9b4525e975a5e862633ab38a06dc11b4', + 'v8/third_party/jsoncpp/source': + Var('chromium_url') + '/external/github.com/open-source-parsers/jsoncpp.git'+ '@' + '645250b6690785be60ab6780ce4b58698d884d11', 'v8/third_party/ittapi': { # Force checkout ittapi libraries to pass v8 header includes check on # bots that has check_v8_header_includes enabled. diff --git a/deps/v8/INTL_OWNERS b/deps/v8/INTL_OWNERS index dbe6f3b7b54..6e9f2cedb98 100644 --- a/deps/v8/INTL_OWNERS +++ b/deps/v8/INTL_OWNERS @@ -1,3 +1,4 @@ cira@chromium.org mnita@google.com jshin@chromium.org +ftang@chromium.org diff --git a/deps/v8/WATCHLISTS b/deps/v8/WATCHLISTS index 47470f49e42..54d6bbec1c5 100644 --- a/deps/v8/WATCHLISTS +++ b/deps/v8/WATCHLISTS @@ -33,10 +33,6 @@ { 'WATCHLIST_DEFINITIONS': { - 'api': { - 'filepath': 'include/' \ - '|src/api\.(cc|h)$', - }, 'snapshot': { 'filepath': 'src/snapshot/', }, @@ -94,9 +90,6 @@ }, 'WATCHLISTS': { - 'api': [ - 'yangguo+watch@chromium.org', - ], 'csa': [ 'jgruber+watch@chromium.org', ], diff --git a/deps/v8/base/trace_event/common/trace_event_common.h b/deps/v8/base/trace_event/common/trace_event_common.h index a7bffbdbeb4..28b7275345c 100644 --- a/deps/v8/base/trace_event/common/trace_event_common.h +++ b/deps/v8/base/trace_event/common/trace_event_common.h @@ -837,6 +837,14 @@ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT, category_group, name, id, \ TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_NONE) +#define TRACE_EVENT_COPY_NESTABLE_ASYNC_BEGIN0(category_group, name, id) \ + INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, \ + category_group, name, id, \ + TRACE_EVENT_FLAG_COPY) +#define TRACE_EVENT_COPY_NESTABLE_ASYNC_END0(category_group, name, id) \ + INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, \ + category_group, name, id, \ + TRACE_EVENT_FLAG_COPY) #define TRACE_EVENT_COPY_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0( \ category_group, name, id, timestamp) \ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ diff --git a/deps/v8/build_overrides/build.gni b/deps/v8/build_overrides/build.gni index 5b99eb94022..dde92c46eaa 100644 --- a/deps/v8/build_overrides/build.gni +++ b/deps/v8/build_overrides/build.gni @@ -16,6 +16,14 @@ perfetto_build_with_embedder = true perfetto_protobuf_target_prefix = "//" perfetto_protobuf_gni = "//gni/proto_library.gni" +# We use Perfetto's Trace Processor to convert traces to the legacy JSON +# format. +enable_perfetto_trace_processor = true + +# When building with chromium, determines whether we want to also use the +# perfetto library from chromium instead declaring our own. +use_perfetto_client_library = false + # Uncomment these to specify a different NDK location and version in # non-Chromium builds. # default_android_ndk_root = "//third_party/android_ndk" diff --git a/deps/v8/gni/v8.gni b/deps/v8/gni/v8.gni index 0b2806ca949..9d286ebbfc0 100644 --- a/deps/v8/gni/v8.gni +++ b/deps/v8/gni/v8.gni @@ -54,8 +54,7 @@ declare_args() { # Expose symbols for dynamic linking. v8_expose_symbols = false - # Use Perfetto (https://perfetto.dev) as the default TracingController. Not - # currently implemented. + # Implement tracing using Perfetto (https://perfetto.dev). v8_use_perfetto = false # Override global symbol level setting for v8 @@ -82,6 +81,12 @@ if (v8_enable_backtrace == "") { v8_enable_backtrace = is_debug && !v8_optimized_debug } +# If chromium is configured to use the perfetto client library, v8 should also +# use perfetto for tracing. +if (build_with_chromium && use_perfetto_client_library) { + v8_use_perfetto = true +} + # Points to // in v8 stand-alone or to //v8/ in chromium. We need absolute # paths for all configs in templates as they are shared in different # subdirectories. diff --git a/deps/v8/include/DEPS b/deps/v8/include/DEPS index ca60f841f53..7305ff51125 100644 --- a/deps/v8/include/DEPS +++ b/deps/v8/include/DEPS @@ -1,4 +1,5 @@ include_rules = [ # v8-inspector-protocol.h depends on generated files under include/inspector. "+inspector", + "+cppgc/common.h", ] diff --git a/deps/v8/include/OWNERS b/deps/v8/include/OWNERS index 4f90a5c8c70..a61f6ed48ed 100644 --- a/deps/v8/include/OWNERS +++ b/deps/v8/include/OWNERS @@ -16,4 +16,9 @@ per-file v8-inspector-protocol.h=kozyatinskiy@chromium.org per-file js_protocol.pdl=dgozman@chromium.org per-file js_protocol.pdl=pfeldman@chromium.org +# For branch updates: +per-file v8-version.h=file:../INFRA_OWNERS +per-file v8-version.h=hablich@chromium.org +per-file v8-version.h=vahl@chromium.org + # COMPONENT: Blink>JavaScript>API diff --git a/deps/v8/include/cppgc/DEPS b/deps/v8/include/cppgc/DEPS new file mode 100644 index 00000000000..04c343de27c --- /dev/null +++ b/deps/v8/include/cppgc/DEPS @@ -0,0 +1,7 @@ +include_rules = [ + "-include", + "+v8config.h", + "+v8-platform.h", + "+cppgc", + "-src", +] diff --git a/deps/v8/include/cppgc/allocation.h b/deps/v8/include/cppgc/allocation.h index 3e717ad7d42..49ad49c34d6 100644 --- a/deps/v8/include/cppgc/allocation.h +++ b/deps/v8/include/cppgc/allocation.h @@ -6,12 +6,14 @@ #define INCLUDE_CPPGC_ALLOCATION_H_ #include + #include -#include "include/cppgc/garbage-collected.h" -#include "include/cppgc/gc-info.h" -#include "include/cppgc/heap.h" -#include "include/cppgc/internals.h" +#include "cppgc/custom-space.h" +#include "cppgc/garbage-collected.h" +#include "cppgc/heap.h" +#include "cppgc/internal/api-constants.h" +#include "cppgc/internal/gc-info.h" namespace cppgc { @@ -35,36 +37,80 @@ class V8_EXPORT MakeGarbageCollectedTraitInternal { } static void* Allocate(cppgc::Heap* heap, size_t size, GCInfoIndex index); + static void* Allocate(cppgc::Heap* heapx, size_t size, GCInfoIndex index, + CustomSpaceIndex space_inde); friend class HeapObjectHeader; }; } // namespace internal -// Users with custom allocation needs (e.g. overriding size) should override -// MakeGarbageCollectedTrait (see below) and inherit their trait from -// MakeGarbageCollectedTraitBase to get access to low-level primitives. +/** + * Base trait that provides utilities for advancers users that have custom + * allocation needs (e.g., overriding size). It's expected that users override + * MakeGarbageCollectedTrait (see below) and inherit from + * MakeGarbageCollectedTraitBase and make use of the low-level primitives + * offered to allocate and construct an object. + */ template class MakeGarbageCollectedTraitBase : private internal::MakeGarbageCollectedTraitInternal { + private: + template + struct SpacePolicy { + static void* Allocate(Heap* heap, size_t size) { + // Custom space. + static_assert(std::is_base_of::value, + "Custom space must inherit from CustomSpaceBase."); + return internal::MakeGarbageCollectedTraitInternal::Allocate( + heap, size, internal::GCInfoTrait::Index(), + CustomSpace::kSpaceIndex); + } + }; + + template + struct SpacePolicy { + static void* Allocate(Heap* heap, size_t size) { + // Default space. + return internal::MakeGarbageCollectedTraitInternal::Allocate( + heap, size, internal::GCInfoTrait::Index()); + } + }; + protected: - // Allocates an object of |size| bytes on |heap|. - // - // TODO(mlippautz): Allow specifying arena for specific embedder uses. + /** + * Allocates memory for an object of type T. + * + * \param heap The heap to allocate this object on. + * \param size The size that should be reserved for the object. + * \returns the memory to construct an object of type T on. + */ static void* Allocate(Heap* heap, size_t size) { - return internal::MakeGarbageCollectedTraitInternal::Allocate( - heap, size, internal::GCInfoTrait::Index()); + return SpacePolicy::Space>::Allocate(heap, size); } - // Marks an object as being fully constructed, resulting in precise handling - // by the garbage collector. + /** + * Marks an object as fully constructed, resulting in precise handling by the + * garbage collector. + * + * \param payload The base pointer the object is allocated at. + */ static void MarkObjectAsFullyConstructed(const void* payload) { - // internal::MarkObjectAsFullyConstructed(payload); internal::MakeGarbageCollectedTraitInternal::MarkObjectAsFullyConstructed( payload); } }; +/** + * Default trait class that specifies how to construct an object of type T. + * Advanced users may override how an object is constructed using the utilities + * that are provided through MakeGarbageCollectedTraitBase. + * + * Any trait overriding construction must + * - allocate through MakeGarbageCollectedTraitBase::Allocate; + * - mark the object as fully constructed using + * MakeGarbageCollectedTraitBase::MarkObjectAsFullyConstructed; + */ template class MakeGarbageCollectedTrait : public MakeGarbageCollectedTraitBase { public: @@ -72,6 +118,10 @@ class MakeGarbageCollectedTrait : public MakeGarbageCollectedTraitBase { static T* Call(Heap* heap, Args&&... args) { static_assert(internal::IsGarbageCollectedType::value, "T needs to be a garbage collected object"); + static_assert( + !internal::IsGarbageCollectedMixinType::value || + sizeof(T) <= internal::api_constants::kLargeObjectSizeThreshold, + "GarbageCollectedMixin may not be a large object"); void* memory = MakeGarbageCollectedTraitBase::Allocate(heap, sizeof(T)); T* object = ::new (memory) T(std::forward(args)...); MakeGarbageCollectedTraitBase::MarkObjectAsFullyConstructed(object); @@ -79,11 +129,31 @@ class MakeGarbageCollectedTrait : public MakeGarbageCollectedTraitBase { } }; -// Default MakeGarbageCollected: Constructs an instance of T, which is a garbage -// collected type. +/** + * Allows users to specify a post-construction callback for specific types. The + * callback is invoked on the instance of type T right after it has been + * constructed. This can be useful when the callback requires a + * fully-constructed object to be able to dispatch to virtual methods. + */ +template +struct PostConstructionCallbackTrait { + static void Call(T*) {} +}; + +/** + * Constructs a managed object of type T where T transitively inherits from + * GarbageCollected. + * + * \param args List of arguments with which an instance of T will be + * constructed. + * \returns an instance of type T. + */ template T* MakeGarbageCollected(Heap* heap, Args&&... args) { - return MakeGarbageCollectedTrait::Call(heap, std::forward(args)...); + T* object = + MakeGarbageCollectedTrait::Call(heap, std::forward(args)...); + PostConstructionCallbackTrait::Call(object); + return object; } } // namespace cppgc diff --git a/deps/v8/include/cppgc/common.h b/deps/v8/include/cppgc/common.h new file mode 100644 index 00000000000..228b9abb74e --- /dev/null +++ b/deps/v8/include/cppgc/common.h @@ -0,0 +1,26 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_COMMON_H_ +#define INCLUDE_CPPGC_COMMON_H_ + +// TODO(chromium:1056170): Remove dependency on v8. +#include "v8config.h" // NOLINT(build/include_directory) + +namespace cppgc { + +// Indicator for the stack state of the embedder. +enum class EmbedderStackState { + kMayContainHeapPointers, + kNoHeapPointers, + kUnknown V8_ENUM_DEPRECATE_SOON("Use kMayContainHeapPointers") = + kMayContainHeapPointers, + kNonEmpty V8_ENUM_DEPRECATE_SOON("Use kMayContainHeapPointers") = + kMayContainHeapPointers, + kEmpty V8_ENUM_DEPRECATE_SOON("Use kNoHeapPointers") = kNoHeapPointers, +}; + +} // namespace cppgc + +#endif // INCLUDE_CPPGC_COMMON_H_ diff --git a/deps/v8/include/cppgc/custom-space.h b/deps/v8/include/cppgc/custom-space.h new file mode 100644 index 00000000000..2597a5bdef7 --- /dev/null +++ b/deps/v8/include/cppgc/custom-space.h @@ -0,0 +1,62 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_CUSTOM_SPACE_H_ +#define INCLUDE_CPPGC_CUSTOM_SPACE_H_ + +#include + +namespace cppgc { + +struct CustomSpaceIndex { + CustomSpaceIndex(size_t value) : value(value) {} // NOLINT + size_t value; +}; + +/** + * Top-level base class for custom spaces. Users must inherit from CustomSpace + * below. + */ +class CustomSpaceBase { + public: + virtual ~CustomSpaceBase() = default; + virtual CustomSpaceIndex GetCustomSpaceIndex() const = 0; +}; + +/** + * Base class custom spaces should directly inherit from. The class inheriting + * from CustomSpace must define kSpaceIndex as unique space index. These + * indices need for form a sequence starting at 0. + * + * Example: + * \code + * class CustomSpace1 : public CustomSpace { + * public: + * static constexpr CustomSpaceIndex kSpaceIndex = 0; + * }; + * class CustomSpace2 : public CustomSpace { + * public: + * static constexpr CustomSpaceIndex kSpaceIndex = 1; + * }; + * \endcode + */ +template +class CustomSpace : public CustomSpaceBase { + public: + CustomSpaceIndex GetCustomSpaceIndex() const final { + return ConcreteCustomSpace::kSpaceIndex; + } +}; + +/** + * User-overridable trait that allows pinning types to custom spaces. + */ +template +struct SpaceTrait { + using Space = void; +}; + +} // namespace cppgc + +#endif // INCLUDE_CPPGC_CUSTOM_SPACE_H_ diff --git a/deps/v8/include/cppgc/garbage-collected.h b/deps/v8/include/cppgc/garbage-collected.h index 6c62daafdc5..299b861d845 100644 --- a/deps/v8/include/cppgc/garbage-collected.h +++ b/deps/v8/include/cppgc/garbage-collected.h @@ -7,31 +7,19 @@ #include -#include "include/cppgc/internals.h" -#include "include/cppgc/platform.h" +#include "cppgc/internal/api-constants.h" +#include "cppgc/platform.h" +#include "cppgc/trace-trait.h" +#include "cppgc/type-traits.h" namespace cppgc { -namespace internal { - -template -struct IsGarbageCollectedType : std::false_type { - static_assert(sizeof(T), "T must be fully defined"); -}; -template -struct IsGarbageCollectedType< - T, void_t::IsGarbageCollectedTypeMarker>> - : std::true_type { - static_assert(sizeof(T), "T must be fully defined"); -}; +class Visitor; -} // namespace internal +namespace internal { -template -class GarbageCollected { +class GarbageCollectedBase { public: - using IsGarbageCollectedTypeMarker = void; - // Must use MakeGarbageCollected. void* operator new(size_t) = delete; void* operator new[](size_t) = delete; @@ -44,10 +32,160 @@ class GarbageCollected { } void operator delete[](void*) = delete; + protected: + GarbageCollectedBase() = default; +}; + +} // namespace internal + +/** + * Base class for managed objects. Only descendent types of GarbageCollected + * can be constructed using MakeGarbageCollected. Must be inherited from as + * left-most base class. + * + * Types inheriting from GarbageCollected must provide a method of + * signature `void Trace(cppgc::Visitor*) const` that dispatchs all managed + * pointers to the visitor and delegates to garbage-collected base classes. + * The method must be virtual if the type is not directly a child of + * GarbageCollected and marked as final. + * + * \code + * // Example using final class. + * class FinalType final : public GarbageCollected { + * public: + * void Trace(cppgc::Visitor* visitor) const { + * // Dispatch using visitor->Trace(...); + * } + * }; + * + * // Example using non-final base class. + * class NonFinalBase : public GarbageCollected { + * public: + * virtual void Trace(cppgc::Visitor*) const {} + * }; + * + * class FinalChild final : public NonFinalBase { + * public: + * void Trace(cppgc::Visitor* visitor) const final { + * // Dispatch using visitor->Trace(...); + * NonFinalBase::Trace(visitor); + * } + * }; + * \endcode + */ +template +class GarbageCollected : public internal::GarbageCollectedBase { + public: + using IsGarbageCollectedTypeMarker = void; + protected: GarbageCollected() = default; }; +/** + * Base class for managed mixin objects. Such objects cannot be constructed + * directly but must be mixed into the inheritance hierarchy of a + * GarbageCollected object. + * + * Types inheriting from GarbageCollectedMixin must override a virtual method + * of signature `void Trace(cppgc::Visitor*) const` that dispatchs all managed + * pointers to the visitor and delegates to base classes. + * + * \code + * class Mixin : public GarbageCollectedMixin { + * public: + * void Trace(cppgc::Visitor* visitor) const override { + * // Dispatch using visitor->Trace(...); + * } + * }; + * \endcode + */ +class GarbageCollectedMixin : public internal::GarbageCollectedBase { + public: + using IsGarbageCollectedMixinTypeMarker = void; + + // Sentinel used to mark not-fully-constructed mixins. + static constexpr void* kNotFullyConstructedObject = nullptr; + + // Provide default implementation that indicate that the vtable is not yet + // set up properly. This is used to to get GCInfo objects for mixins so that + // these objects can be processed later on. + virtual TraceDescriptor GetTraceDescriptor() const { + return {kNotFullyConstructedObject, nullptr}; + } + + /** + * This Trace method must be overriden by objects inheriting from + * GarbageCollectedMixin. + */ + virtual void Trace(cppgc::Visitor*) const {} +}; + +/** + * Macro defines all methods and markers needed for handling mixins. Must be + * used on the type that is inheriting from GarbageCollected *and* + * GarbageCollectedMixin. + * + * \code + * class Mixin : public GarbageCollectedMixin { + * public: + * void Trace(cppgc::Visitor* visitor) const override { + * // Dispatch using visitor->Trace(...); + * } + * }; + * + * class Foo : public GarbageCollected, public Mixin { + * USING_GARBAGE_COLLECTED_MIXIN(); + * public: + * void Trace(cppgc::Visitor* visitor) const override { + * // Dispatch using visitor->Trace(...); + * Mixin::Trace(visitor); + * } + * }; + * \endcode + */ +#define USING_GARBAGE_COLLECTED_MIXIN() \ + public: \ + /* Marker is used by clang to check for proper usages of the macro. */ \ + typedef int HasUsingGarbageCollectedMixinMacro; \ + \ + TraceDescriptor GetTraceDescriptor() const override { \ + static_assert( \ + internal::IsSubclassOfTemplate< \ + std::remove_const_t>, \ + cppgc::GarbageCollected>::value, \ + "Only garbage collected objects can have garbage collected mixins"); \ + return {this, TraceTrait>>::Trace}; \ + } \ + \ + private: \ + static_assert(true, "Force semicolon.") + +/** + * Merge two or more Mixins into one. + * + * \code + * class A : public GarbageCollectedMixin {}; + * class B : public GarbageCollectedMixin {}; + * class C : public A, public B { + * MERGE_GARBAGE_COLLECTED_MIXINS(); + * public: + * }; + * \endcode + */ +#define MERGE_GARBAGE_COLLECTED_MIXINS() \ + public: \ + /* When using multiple mixins the methods become */ \ + /* ambigous. Providing additional implementations */ \ + /* disambiguate them again. */ \ + TraceDescriptor GetTraceDescriptor() const override { \ + return {kNotFullyConstructedObject, nullptr}; \ + } \ + \ + private: \ + static_assert(true, "Force semicolon.") + } // namespace cppgc #endif // INCLUDE_CPPGC_GARBAGE_COLLECTED_H_ diff --git a/deps/v8/include/cppgc/heap.h b/deps/v8/include/cppgc/heap.h index a0568d534fb..d24b63e517e 100644 --- a/deps/v8/include/cppgc/heap.h +++ b/deps/v8/include/cppgc/heap.h @@ -6,20 +6,75 @@ #define INCLUDE_CPPGC_HEAP_H_ #include +#include -#include "include/v8config.h" +#include "cppgc/common.h" +#include "cppgc/custom-space.h" +#include "cppgc/platform.h" +#include "v8config.h" // NOLINT(build/include_directory) +/** + * cppgc - A C++ garbage collection library. + */ namespace cppgc { + namespace internal { class Heap; } // namespace internal class V8_EXPORT Heap { public: - static std::unique_ptr Create(); + /** + * Specifies the stack state the embedder is in. + */ + using StackState = EmbedderStackState; + + /** + * Options specifying Heap properties (e.g. custom spaces) when initializing a + * heap through Heap::Create(). + */ + struct HeapOptions { + /** + * Creates reasonable defaults for instantiating a Heap. + * + * \returns the HeapOptions that can be passed to Heap::Create(). + */ + static HeapOptions Default() { return {}; } + + /** + * Custom spaces added to heap are required to have indices forming a + * numbered sequence starting at 0, i.e., their kSpaceIndex must correspond + * to the index they reside in the vector. + */ + std::vector> custom_spaces; + }; + + /** + * Creates a new heap that can be used for object allocation. + * + * \param platform implemented and provided by the embedder. + * \param options HeapOptions specifying various properties for the Heap. + * \returns a new Heap instance. + */ + static std::unique_ptr Create( + std::shared_ptr platform, + HeapOptions options = HeapOptions::Default()); virtual ~Heap() = default; + /** + * Forces garbage collection. + * + * \param source String specifying the source (or caller) triggering a + * forced garbage collection. + * \param reason String specifying the reason for the forced garbage + * collection. + * \param stack_state The embedder stack state, see StackState. + */ + void ForceGarbageCollectionSlow( + const char* source, const char* reason, + StackState stack_state = StackState::kMayContainHeapPointers); + private: Heap() = default; diff --git a/deps/v8/include/cppgc/internal/accessors.h b/deps/v8/include/cppgc/internal/accessors.h new file mode 100644 index 00000000000..ee0a0042fe0 --- /dev/null +++ b/deps/v8/include/cppgc/internal/accessors.h @@ -0,0 +1,26 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_INTERNAL_ACCESSORS_H_ +#define INCLUDE_CPPGC_INTERNAL_ACCESSORS_H_ + +#include "cppgc/internal/api-constants.h" + +namespace cppgc { + +class Heap; + +namespace internal { + +inline cppgc::Heap* GetHeapFromPayload(const void* payload) { + return *reinterpret_cast( + ((reinterpret_cast(payload) & api_constants::kPageBaseMask) + + api_constants::kGuardPageSize) + + api_constants::kHeapOffset); +} + +} // namespace internal +} // namespace cppgc + +#endif // INCLUDE_CPPGC_INTERNAL_ACCESSORS_H_ diff --git a/deps/v8/include/cppgc/internals.h b/deps/v8/include/cppgc/internal/api-constants.h similarity index 57% rename from deps/v8/include/cppgc/internals.h rename to deps/v8/include/cppgc/internal/api-constants.h index 1e57779758b..ef910a48571 100644 --- a/deps/v8/include/cppgc/internals.h +++ b/deps/v8/include/cppgc/internal/api-constants.h @@ -2,25 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef INCLUDE_CPPGC_INTERNALS_H_ -#define INCLUDE_CPPGC_INTERNALS_H_ +#ifndef INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_ +#define INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_ #include #include -#include "include/v8config.h" +#include "v8config.h" // NOLINT(build/include_directory) namespace cppgc { namespace internal { -// Pre-C++17 custom implementation of std::void_t. -template -struct make_void { - typedef void type; -}; -template -using void_t = typename make_void::type; - // Embedders should not rely on this code! // Internal constants to avoid exposing internal types on the API surface. @@ -33,9 +25,20 @@ static constexpr size_t kFullyConstructedBitFieldOffsetFromPayload = // Mask for in-construction bit. static constexpr size_t kFullyConstructedBitMask = size_t{1}; +// Page constants used to align pointers to page begin. +static constexpr size_t kPageSize = size_t{1} << 17; +static constexpr size_t kPageAlignment = kPageSize; +static constexpr size_t kPageBaseMask = ~(kPageAlignment - 1); +static constexpr size_t kGuardPageSize = 4096; + +// Offset of the Heap backref. +static constexpr size_t kHeapOffset = 0; + +static constexpr size_t kLargeObjectSizeThreshold = kPageSize / 2; + } // namespace api_constants } // namespace internal } // namespace cppgc -#endif // INCLUDE_CPPGC_INTERNALS_H_ +#endif // INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_ diff --git a/deps/v8/include/cppgc/internal/compiler-specific.h b/deps/v8/include/cppgc/internal/compiler-specific.h new file mode 100644 index 00000000000..e1f5c1d57fb --- /dev/null +++ b/deps/v8/include/cppgc/internal/compiler-specific.h @@ -0,0 +1,26 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_ +#define INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_ + +namespace cppgc { + +#if defined(__has_cpp_attribute) +#define CPPGC_HAS_CPP_ATTRIBUTE(FEATURE) __has_cpp_attribute(FEATURE) +#else +#define CPPGC_HAS_CPP_ATTRIBUTE(FEATURE) 0 +#endif + +// [[no_unique_address]] comes in C++20 but supported in clang with -std >= +// c++11. +#if CPPGC_HAS_CPP_ATTRIBUTE(no_unique_address) // NOLINTNEXTLINE +#define CPPGC_NO_UNIQUE_ADDRESS [[no_unique_address]] +#else +#define CPPGC_NO_UNIQUE_ADDRESS +#endif + +} // namespace cppgc + +#endif // INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_ diff --git a/deps/v8/include/cppgc/finalizer-trait.h b/deps/v8/include/cppgc/internal/finalizer-trait.h similarity index 92% rename from deps/v8/include/cppgc/finalizer-trait.h rename to deps/v8/include/cppgc/internal/finalizer-trait.h index 12216ed84ed..a95126591cb 100644 --- a/deps/v8/include/cppgc/finalizer-trait.h +++ b/deps/v8/include/cppgc/internal/finalizer-trait.h @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef INCLUDE_CPPGC_FINALIZER_TRAIT_H_ -#define INCLUDE_CPPGC_FINALIZER_TRAIT_H_ +#ifndef INCLUDE_CPPGC_INTERNAL_FINALIZER_TRAIT_H_ +#define INCLUDE_CPPGC_INTERNAL_FINALIZER_TRAIT_H_ #include -#include "include/cppgc/internals.h" +#include "cppgc/type-traits.h" namespace cppgc { namespace internal { @@ -87,4 +87,4 @@ constexpr FinalizationCallback FinalizerTrait::kCallback; } // namespace internal } // namespace cppgc -#endif // INCLUDE_CPPGC_FINALIZER_TRAIT_H_ +#endif // INCLUDE_CPPGC_INTERNAL_FINALIZER_TRAIT_H_ diff --git a/deps/v8/include/cppgc/gc-info.h b/deps/v8/include/cppgc/internal/gc-info.h similarity index 66% rename from deps/v8/include/cppgc/gc-info.h rename to deps/v8/include/cppgc/internal/gc-info.h index 987ba34fa42..3d361e6d71a 100644 --- a/deps/v8/include/cppgc/gc-info.h +++ b/deps/v8/include/cppgc/internal/gc-info.h @@ -2,13 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef INCLUDE_CPPGC_GC_INFO_H_ -#define INCLUDE_CPPGC_GC_INFO_H_ +#ifndef INCLUDE_CPPGC_INTERNAL_GC_INFO_H_ +#define INCLUDE_CPPGC_INTERNAL_GC_INFO_H_ #include -#include "include/cppgc/finalizer-trait.h" -#include "include/v8config.h" +#include "cppgc/internal/finalizer-trait.h" +#include "cppgc/trace-trait.h" +#include "v8config.h" // NOLINT(build/include_directory) namespace cppgc { namespace internal { @@ -18,7 +19,7 @@ using GCInfoIndex = uint16_t; class V8_EXPORT RegisteredGCInfoIndex final { public: RegisteredGCInfoIndex(FinalizationCallback finalization_callback, - bool has_v_table); + TraceCallback trace_callback, bool has_v_table); GCInfoIndex GetIndex() const { return index_; } private: @@ -32,7 +33,8 @@ struct GCInfoTrait { static GCInfoIndex Index() { static_assert(sizeof(T), "T must be fully defined"); static const RegisteredGCInfoIndex registered_index( - FinalizerTrait::kCallback, std::is_polymorphic::value); + FinalizerTrait::kCallback, TraceTrait::Trace, + std::is_polymorphic::value); return registered_index.GetIndex(); } }; @@ -40,4 +42,4 @@ struct GCInfoTrait { } // namespace internal } // namespace cppgc -#endif // INCLUDE_CPPGC_GC_INFO_H_ +#endif // INCLUDE_CPPGC_INTERNAL_GC_INFO_H_ diff --git a/deps/v8/include/cppgc/internal/logging.h b/deps/v8/include/cppgc/internal/logging.h new file mode 100644 index 00000000000..79beaef7d4f --- /dev/null +++ b/deps/v8/include/cppgc/internal/logging.h @@ -0,0 +1,50 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_INTERNAL_LOGGING_H_ +#define INCLUDE_CPPGC_INTERNAL_LOGGING_H_ + +#include "cppgc/source-location.h" +#include "v8config.h" // NOLINT(build/include_directory) + +namespace cppgc { +namespace internal { + +void V8_EXPORT DCheckImpl(const char*, + const SourceLocation& = SourceLocation::Current()); +[[noreturn]] void V8_EXPORT +FatalImpl(const char*, const SourceLocation& = SourceLocation::Current()); + +// Used to ignore -Wunused-variable. +template +struct EatParams {}; + +#if DEBUG +#define CPPGC_DCHECK_MSG(condition, message) \ + do { \ + if (V8_UNLIKELY(!(condition))) { \ + ::cppgc::internal::DCheckImpl(message); \ + } \ + } while (false) +#else +#define CPPGC_DCHECK_MSG(condition, message) \ + (static_cast(::cppgc::internal::EatParams(condition), message)>{})) +#endif + +#define CPPGC_DCHECK(condition) CPPGC_DCHECK_MSG(condition, #condition) + +#define CPPGC_CHECK_MSG(condition, message) \ + do { \ + if (V8_UNLIKELY(!(condition))) { \ + ::cppgc::internal::FatalImpl(message); \ + } \ + } while (false) + +#define CPPGC_CHECK(condition) CPPGC_CHECK_MSG(condition, #condition) + +} // namespace internal +} // namespace cppgc + +#endif // INCLUDE_CPPGC_INTERNAL_LOGGING_H_ diff --git a/deps/v8/include/cppgc/internal/persistent-node.h b/deps/v8/include/cppgc/internal/persistent-node.h new file mode 100644 index 00000000000..11cf69623e8 --- /dev/null +++ b/deps/v8/include/cppgc/internal/persistent-node.h @@ -0,0 +1,109 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_INTERNAL_PERSISTENT_NODE_H_ +#define INCLUDE_CPPGC_INTERNAL_PERSISTENT_NODE_H_ + +#include +#include +#include + +#include "cppgc/internal/logging.h" +#include "cppgc/trace-trait.h" +#include "v8config.h" // NOLINT(build/include_directory) + +namespace cppgc { + +class Visitor; + +namespace internal { + +// PersistentNode represesents a variant of two states: +// 1) traceable node with a back pointer to the Persistent object; +// 2) freelist entry. +class PersistentNode final { + public: + PersistentNode() = default; + + PersistentNode(const PersistentNode&) = delete; + PersistentNode& operator=(const PersistentNode&) = delete; + + void InitializeAsUsedNode(void* owner, TraceCallback trace) { + owner_ = owner; + trace_ = trace; + } + + void InitializeAsFreeNode(PersistentNode* next) { + next_ = next; + trace_ = nullptr; + } + + void UpdateOwner(void* owner) { + CPPGC_DCHECK(IsUsed()); + owner_ = owner; + } + + PersistentNode* FreeListNext() const { + CPPGC_DCHECK(!IsUsed()); + return next_; + } + + void Trace(Visitor* visitor) const { + CPPGC_DCHECK(IsUsed()); + trace_(visitor, owner_); + } + + bool IsUsed() const { return trace_; } + + private: + // PersistentNode acts as a designated union: + // If trace_ != nullptr, owner_ points to the corresponding Persistent handle. + // Otherwise, next_ points to the next freed PersistentNode. + union { + void* owner_ = nullptr; + PersistentNode* next_; + }; + TraceCallback trace_ = nullptr; +}; + +class V8_EXPORT PersistentRegion { + using PersistentNodeSlots = std::array; + + public: + PersistentRegion() = default; + + PersistentRegion(const PersistentRegion&) = delete; + PersistentRegion& operator=(const PersistentRegion&) = delete; + + PersistentNode* AllocateNode(void* owner, TraceCallback trace) { + if (!free_list_head_) { + EnsureNodeSlots(); + } + PersistentNode* node = free_list_head_; + free_list_head_ = free_list_head_->FreeListNext(); + node->InitializeAsUsedNode(owner, trace); + return node; + } + + void FreeNode(PersistentNode* node) { + node->InitializeAsFreeNode(free_list_head_); + free_list_head_ = node; + } + + void Trace(Visitor*); + + size_t NodesInUse() const; + + private: + void EnsureNodeSlots(); + + std::vector> nodes_; + PersistentNode* free_list_head_ = nullptr; +}; + +} // namespace internal + +} // namespace cppgc + +#endif // INCLUDE_CPPGC_INTERNAL_PERSISTENT_NODE_H_ diff --git a/deps/v8/include/cppgc/internal/pointer-policies.h b/deps/v8/include/cppgc/internal/pointer-policies.h new file mode 100644 index 00000000000..fe8d94b57a6 --- /dev/null +++ b/deps/v8/include/cppgc/internal/pointer-policies.h @@ -0,0 +1,133 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_INTERNAL_POINTER_POLICIES_H_ +#define INCLUDE_CPPGC_INTERNAL_POINTER_POLICIES_H_ + +#include +#include + +#include "cppgc/source-location.h" +#include "v8config.h" // NOLINT(build/include_directory) + +namespace cppgc { +namespace internal { + +class PersistentRegion; + +// Tags to distinguish between strong and weak member types. +class StrongMemberTag; +class WeakMemberTag; +class UntracedMemberTag; + +struct DijkstraWriteBarrierPolicy { + static void InitializingBarrier(const void*, const void*) { + // Since in initializing writes the source object is always white, having no + // barrier doesn't break the tri-color invariant. + } + static void AssigningBarrier(const void*, const void*) { + // TODO(chromium:1056170): Add actual implementation. + } +}; + +struct NoWriteBarrierPolicy { + static void InitializingBarrier(const void*, const void*) {} + static void AssigningBarrier(const void*, const void*) {} +}; + +class V8_EXPORT EnabledCheckingPolicy { + protected: + EnabledCheckingPolicy(); + void CheckPointer(const void* ptr); + + private: + void* impl_; +}; + +class DisabledCheckingPolicy { + protected: + void CheckPointer(const void* raw) {} +}; + +#if V8_ENABLE_CHECKS +using DefaultCheckingPolicy = EnabledCheckingPolicy; +#else +using DefaultCheckingPolicy = DisabledCheckingPolicy; +#endif + +class KeepLocationPolicy { + public: + constexpr const SourceLocation& Location() const { return location_; } + + protected: + constexpr explicit KeepLocationPolicy(const SourceLocation& location) + : location_(location) {} + + // KeepLocationPolicy must not copy underlying source locations. + KeepLocationPolicy(const KeepLocationPolicy&) = delete; + KeepLocationPolicy& operator=(const KeepLocationPolicy&) = delete; + + // Location of the original moved from object should be preserved. + KeepLocationPolicy(KeepLocationPolicy&&) = default; + KeepLocationPolicy& operator=(KeepLocationPolicy&&) = default; + + private: + SourceLocation location_; +}; + +class IgnoreLocationPolicy { + public: + constexpr SourceLocation Location() const { return {}; } + + protected: + constexpr explicit IgnoreLocationPolicy(const SourceLocation&) {} +}; + +#if CPPGC_SUPPORTS_OBJECT_NAMES +using DefaultLocationPolicy = KeepLocationPolicy; +#else +using DefaultLocationPolicy = IgnoreLocationPolicy; +#endif + +struct StrongPersistentPolicy { + using IsStrongPersistent = std::true_type; + + static V8_EXPORT PersistentRegion& GetPersistentRegion(void* object); +}; + +struct WeakPersistentPolicy { + using IsStrongPersistent = std::false_type; + + static V8_EXPORT PersistentRegion& GetPersistentRegion(void* object); +}; + +// Persistent/Member forward declarations. +template +class BasicPersistent; +template +class BasicMember; + +// Special tag type used to denote some sentinel member. The semantics of the +// sentinel is defined by the embedder. +struct SentinelPointer { + template + operator T*() const { // NOLINT + static constexpr intptr_t kSentinelValue = -1; + return reinterpret_cast(kSentinelValue); + } + // Hidden friends. + friend bool operator==(SentinelPointer, SentinelPointer) { return true; } + friend bool operator!=(SentinelPointer, SentinelPointer) { return false; } +}; + +} // namespace internal + +constexpr internal::SentinelPointer kSentinelPointer; + +} // namespace cppgc + +#endif // INCLUDE_CPPGC_INTERNAL_POINTER_POLICIES_H_ diff --git a/deps/v8/include/cppgc/internal/prefinalizer-handler.h b/deps/v8/include/cppgc/internal/prefinalizer-handler.h new file mode 100644 index 00000000000..939a9b8ff0a --- /dev/null +++ b/deps/v8/include/cppgc/internal/prefinalizer-handler.h @@ -0,0 +1,31 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_INTERNAL_PREFINALIZER_HANDLER_H_ +#define INCLUDE_CPPGC_INTERNAL_PREFINALIZER_HANDLER_H_ + +#include "cppgc/heap.h" +#include "cppgc/liveness-broker.h" + +namespace cppgc { +namespace internal { + +class V8_EXPORT PreFinalizerRegistrationDispatcher final { + public: + using PreFinalizerCallback = bool (*)(const LivenessBroker&, void*); + struct PreFinalizer { + void* object_; + PreFinalizerCallback callback_; + + bool operator==(const PreFinalizer& other); + }; + + static void RegisterPrefinalizer(cppgc::Heap* heap, + PreFinalizer prefinalzier); +}; + +} // namespace internal +} // namespace cppgc + +#endif // INCLUDE_CPPGC_INTERNAL_PREFINALIZER_HANDLER_H_ diff --git a/deps/v8/include/cppgc/liveness-broker.h b/deps/v8/include/cppgc/liveness-broker.h new file mode 100644 index 00000000000..640a5519ff9 --- /dev/null +++ b/deps/v8/include/cppgc/liveness-broker.h @@ -0,0 +1,74 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_LIVENESS_BROKER_H_ +#define INCLUDE_CPPGC_LIVENESS_BROKER_H_ + +#include "cppgc/heap.h" +#include "cppgc/member.h" +#include "cppgc/trace-trait.h" +#include "v8config.h" // NOLINT(build/include_directory) + +namespace cppgc { + +namespace internal { +class LivenessBrokerFactory; +} // namespace internal + +/** + * The broker is passed to weak callbacks to allow (temporarily) querying + * the liveness state of an object. References to non-live objects must be + * cleared when IsHeapObjectAlive() returns false. + * + * \code + * class GCedWithCustomWeakCallback final + * : public GarbageCollected { + * public: + * UntracedMember bar; + * + * void CustomWeakCallbackMethod(const LivenessBroker& broker) { + * if (!broker.IsHeapObjectAlive(bar)) + * bar = nullptr; + * } + * + * void Trace(cppgc::Visitor* visitor) const { + * visitor->RegisterWeakCallbackMethod< + * GCedWithCustomWeakCallback, + * &GCedWithCustomWeakCallback::CustomWeakCallbackMethod>(this); + * } + * }; + * \endcode + */ +class V8_EXPORT LivenessBroker final { + public: + template + bool IsHeapObjectAlive(const T* object) const { + return object && + IsHeapObjectAliveImpl( + TraceTrait::GetTraceDescriptor(object).base_object_payload); + } + + template + bool IsHeapObjectAlive(const WeakMember& weak_member) const { + return (weak_member != kSentinelPointer) && + IsHeapObjectAlive(weak_member.Get()); + } + + template + bool IsHeapObjectAlive(const UntracedMember& untraced_member) const { + return (untraced_member != kSentinelPointer) && + IsHeapObjectAlive(untraced_member.Get()); + } + + private: + LivenessBroker() = default; + + bool IsHeapObjectAliveImpl(const void*) const; + + friend class internal::LivenessBrokerFactory; +}; + +} // namespace cppgc + +#endif // INCLUDE_CPPGC_LIVENESS_BROKER_H_ diff --git a/deps/v8/include/cppgc/macros.h b/deps/v8/include/cppgc/macros.h new file mode 100644 index 00000000000..adff32e4246 --- /dev/null +++ b/deps/v8/include/cppgc/macros.h @@ -0,0 +1,22 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_MACROS_H_ +#define INCLUDE_CPPGC_MACROS_H_ + +namespace cppgc { + +// Use if the object is only stack allocated. +#define CPPGC_STACK_ALLOCATED() \ + public: \ + using IsStackAllocatedTypeMarker = int; \ + \ + private: \ + void* operator new(size_t) = delete; \ + void* operator new(size_t, void*) = delete; \ + static_assert(true, "Force semicolon.") + +} // namespace cppgc + +#endif // INCLUDE_CPPGC_MACROS_H_ diff --git a/deps/v8/include/cppgc/member.h b/deps/v8/include/cppgc/member.h new file mode 100644 index 00000000000..a183edb96fd --- /dev/null +++ b/deps/v8/include/cppgc/member.h @@ -0,0 +1,206 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_MEMBER_H_ +#define INCLUDE_CPPGC_MEMBER_H_ + +#include +#include +#include + +#include "cppgc/internal/pointer-policies.h" +#include "cppgc/type-traits.h" +#include "v8config.h" // NOLINT(build/include_directory) + +namespace cppgc { + +class Visitor; + +namespace internal { + +// The basic class from which all Member classes are 'generated'. +template +class BasicMember : private CheckingPolicy { + public: + using PointeeType = T; + + constexpr BasicMember() = default; + constexpr BasicMember(std::nullptr_t) {} // NOLINT + BasicMember(SentinelPointer s) : raw_(s) {} // NOLINT + BasicMember(T* raw) : raw_(raw) { // NOLINT + InitializingWriteBarrier(); + this->CheckPointer(raw_); + } + BasicMember(T& raw) : BasicMember(&raw) {} // NOLINT + BasicMember(const BasicMember& other) : BasicMember(other.Get()) {} + // Allow heterogeneous construction. + template ::value>> + BasicMember( // NOLINT + const BasicMember& other) + : BasicMember(other.Get()) {} + // Construction from Persistent. + template ::value>> + BasicMember( // NOLINT + const BasicPersistent& + p) + : BasicMember(p.Get()) {} + + BasicMember& operator=(const BasicMember& other) { + return operator=(other.Get()); + } + // Allow heterogeneous assignment. + template ::value>> + BasicMember& operator=( + const BasicMember& other) { + return operator=(other.Get()); + } + // Assignment from Persistent. + template ::value>> + BasicMember& operator=( + const BasicPersistent& + other) { + return operator=(other.Get()); + } + BasicMember& operator=(T* other) { + SetRawAtomic(other); + AssigningWriteBarrier(); + this->CheckPointer(Get()); + return *this; + } + BasicMember& operator=(std::nullptr_t) { + Clear(); + return *this; + } + BasicMember& operator=(SentinelPointer s) { + SetRawAtomic(s); + return *this; + } + + template + void Swap(BasicMember& other) { + T* tmp = Get(); + *this = other; + other = tmp; + } + + explicit operator bool() const { return Get(); } + operator T*() const { return Get(); } // NOLINT + T* operator->() const { return Get(); } + T& operator*() const { return *Get(); } + + T* Get() const { + // Executed by the mutator, hence non atomic load. + return raw_; + } + + void Clear() { SetRawAtomic(nullptr); } + + T* Release() { + T* result = Get(); + Clear(); + return result; + } + + private: + void SetRawAtomic(T* raw) { + reinterpret_cast*>(&raw_)->store(raw, + std::memory_order_relaxed); + } + T* GetRawAtomic() const { + return reinterpret_cast*>(&raw_)->load( + std::memory_order_relaxed); + } + + void InitializingWriteBarrier() const { + WriteBarrierPolicy::InitializingBarrier( + reinterpret_cast(&raw_), static_cast(raw_)); + } + void AssigningWriteBarrier() const { + WriteBarrierPolicy::AssigningBarrier(reinterpret_cast(&raw_), + static_cast(raw_)); + } + + T* raw_ = nullptr; + + friend class cppgc::Visitor; +}; + +template +bool operator==( + BasicMember member1, + BasicMember + member2) { + return member1.Get() == member2.Get(); +} + +template +bool operator!=( + BasicMember member1, + BasicMember + member2) { + return !(member1 == member2); +} + +template +struct IsWeak< + internal::BasicMember> + : std::true_type {}; + +} // namespace internal + +/** + * Members are used in classes to contain strong pointers to other garbage + * collected objects. All Member fields of a class must be traced in the class' + * trace method. + */ +template +using Member = internal::BasicMember; + +/** + * WeakMember is similar to Member in that it is used to point to other garbage + * collected objects. However instead of creating a strong pointer to the + * object, the WeakMember creates a weak pointer, which does not keep the + * pointee alive. Hence if all pointers to to a heap allocated object are weak + * the object will be garbage collected. At the time of GC the weak pointers + * will automatically be set to null. + */ +template +using WeakMember = internal::BasicMember; + +/** + * UntracedMember is a pointer to an on-heap object that is not traced for some + * reason. Do not use this unless you know what you are doing. Keeping raw + * pointers to on-heap objects is prohibited unless used from stack. Pointee + * must be kept alive through other means. + */ +template +using UntracedMember = internal::BasicMember; + +} // namespace cppgc + +#endif // INCLUDE_CPPGC_MEMBER_H_ diff --git a/deps/v8/include/cppgc/persistent.h b/deps/v8/include/cppgc/persistent.h new file mode 100644 index 00000000000..fc6b0b9d92e --- /dev/null +++ b/deps/v8/include/cppgc/persistent.h @@ -0,0 +1,304 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_PERSISTENT_H_ +#define INCLUDE_CPPGC_PERSISTENT_H_ + +#include + +#include "cppgc/internal/persistent-node.h" +#include "cppgc/internal/pointer-policies.h" +#include "cppgc/source-location.h" +#include "cppgc/type-traits.h" +#include "cppgc/visitor.h" +#include "v8config.h" // NOLINT(build/include_directory) + +namespace cppgc { +namespace internal { + +// The basic class from which all Persistent classes are generated. +template +class BasicPersistent : public LocationPolicy, + private WeaknessPolicy, + private CheckingPolicy { + public: + using typename WeaknessPolicy::IsStrongPersistent; + using PointeeType = T; + + // Null-state/sentinel constructors. + BasicPersistent( // NOLINT + const SourceLocation& loc = SourceLocation::Current()) + : LocationPolicy(loc) {} + + BasicPersistent(std::nullptr_t, // NOLINT + const SourceLocation& loc = SourceLocation::Current()) + : LocationPolicy(loc) {} + + BasicPersistent( // NOLINT + SentinelPointer s, const SourceLocation& loc = SourceLocation::Current()) + : LocationPolicy(loc), raw_(s) {} + + // Raw value contstructors. + BasicPersistent(T* raw, // NOLINT + const SourceLocation& loc = SourceLocation::Current()) + : LocationPolicy(loc), raw_(raw) { + if (!IsValid()) return; + node_ = WeaknessPolicy::GetPersistentRegion(raw_).AllocateNode( + this, &BasicPersistent::Trace); + this->CheckPointer(Get()); + } + + BasicPersistent(T& raw, // NOLINT + const SourceLocation& loc = SourceLocation::Current()) + : BasicPersistent(&raw, loc) {} + + // Copy ctor. + BasicPersistent(const BasicPersistent& other, + const SourceLocation& loc = SourceLocation::Current()) + : BasicPersistent(other.Get(), loc) {} + + // Heterogeneous ctor. + template ::value>> + BasicPersistent( // NOLINT + const BasicPersistent& other, + const SourceLocation& loc = SourceLocation::Current()) + : BasicPersistent(other.Get(), loc) {} + + // Move ctor. The heterogeneous move ctor is not supported since e.g. + // persistent can't reuse persistent node from weak persistent. + BasicPersistent( + BasicPersistent&& other, + const SourceLocation& loc = SourceLocation::Current()) noexcept + : LocationPolicy(std::move(other)), + raw_(std::move(other.raw_)), + node_(std::move(other.node_)) { + if (!IsValid()) return; + node_->UpdateOwner(this); + other.raw_ = nullptr; + other.node_ = nullptr; + this->CheckPointer(Get()); + } + + // Constructor from member. + template ::value>> + BasicPersistent(internal::BasicMember + member, + const SourceLocation& loc = SourceLocation::Current()) + : BasicPersistent(member.Get(), loc) {} + + ~BasicPersistent() { Clear(); } + + // Copy assignment. + BasicPersistent& operator=(const BasicPersistent& other) { + return operator=(other.Get()); + } + + template ::value>> + BasicPersistent& operator=( + const BasicPersistent& other) { + return operator=(other.Get()); + } + + // Move assignment. + BasicPersistent& operator=(BasicPersistent&& other) { + if (this == &other) return *this; + Clear(); + LocationPolicy::operator=(std::move(other)); + raw_ = std::move(other.raw_); + node_ = std::move(other.node_); + if (!IsValid()) return *this; + node_->UpdateOwner(this); + other.raw_ = nullptr; + other.node_ = nullptr; + this->CheckPointer(Get()); + return *this; + } + + // Assignment from member. + template ::value>> + BasicPersistent& operator=( + internal::BasicMember + member) { + return operator=(member.Get()); + } + + BasicPersistent& operator=(T* other) { + Assign(other); + return *this; + } + + BasicPersistent& operator=(std::nullptr_t) { + Clear(); + return *this; + } + + BasicPersistent& operator=(SentinelPointer s) { + Assign(s); + return *this; + } + + explicit operator bool() const { return Get(); } + operator T*() const { return Get(); } + T* operator->() const { return Get(); } + T& operator*() const { return *Get(); } + + T* Get() const { return raw_; } + + void Clear() { Assign(nullptr); } + + T* Release() { + T* result = Get(); + Clear(); + return result; + } + + private: + static void Trace(Visitor* v, const void* ptr) { + const auto* persistent = static_cast(ptr); + v->TraceRoot(*persistent, persistent->Location()); + } + + bool IsValid() const { + // Ideally, handling kSentinelPointer would be done by the embedder. On the + // other hand, having Persistent aware of it is beneficial since no node + // gets wasted. + return raw_ != nullptr && raw_ != kSentinelPointer; + } + + void Assign(T* ptr) { + if (IsValid()) { + if (ptr && ptr != kSentinelPointer) { + // Simply assign the pointer reusing the existing node. + raw_ = ptr; + this->CheckPointer(ptr); + return; + } + WeaknessPolicy::GetPersistentRegion(raw_).FreeNode(node_); + node_ = nullptr; + } + raw_ = ptr; + if (!IsValid()) return; + node_ = WeaknessPolicy::GetPersistentRegion(raw_).AllocateNode( + this, &BasicPersistent::Trace); + this->CheckPointer(Get()); + } + + T* raw_ = nullptr; + PersistentNode* node_ = nullptr; +}; + +template +bool operator==(const BasicPersistent& p1, + const BasicPersistent& p2) { + return p1.Get() == p2.Get(); +} + +template +bool operator!=(const BasicPersistent& p1, + const BasicPersistent& p2) { + return !(p1 == p2); +} + +template +bool operator==(const BasicPersistent& p, + BasicMember + m) { + return p.Get() == m.Get(); +} + +template +bool operator!=(const BasicPersistent& p, + BasicMember + m) { + return !(p == m); +} + +template +bool operator==(BasicMember + m, + const BasicPersistent& p) { + return m.Get() == p.Get(); +} + +template +bool operator!=(BasicMember + m, + const BasicPersistent& p) { + return !(m == p); +} + +template +struct IsWeak> : std::true_type {}; +} // namespace internal + +/** + * Persistent is a way to create a strong pointer from an off-heap object to + * another on-heap object. As long as the Persistent handle is alive the GC will + * keep the object pointed to alive. The Persistent handle is always a GC root + * from the point of view of the GC. Persistent must be constructed and + * destructed in the same thread. + */ +template +using Persistent = + internal::BasicPersistent; + +/** + * WeakPersistent is a way to create a weak pointer from an off-heap object to + * an on-heap object. The pointer is automatically cleared when the pointee gets + * collected. WeakPersistent must be constructed and destructed in the same + * thread. + */ +template +using WeakPersistent = + internal::BasicPersistent; + +} // namespace cppgc + +#endif // INCLUDE_CPPGC_PERSISTENT_H_ diff --git a/deps/v8/include/cppgc/platform.h b/deps/v8/include/cppgc/platform.h index f216c2730a4..c52b73c8e75 100644 --- a/deps/v8/include/cppgc/platform.h +++ b/deps/v8/include/cppgc/platform.h @@ -5,21 +5,117 @@ #ifndef INCLUDE_CPPGC_PLATFORM_H_ #define INCLUDE_CPPGC_PLATFORM_H_ -#include "include/v8-platform.h" -#include "include/v8config.h" +#include "v8-platform.h" // NOLINT(build/include_directory) +#include "v8config.h" // NOLINT(build/include_directory) namespace cppgc { -// TODO(v8:10346): Put PageAllocator in a non-V8 include header to avoid -// depending on namespace v8. +// TODO(v8:10346): Create separate includes for concepts that are not +// V8-specific. +using JobHandle = v8::JobHandle; +using JobTask = v8::JobTask; using PageAllocator = v8::PageAllocator; +using TaskPriority = v8::TaskPriority; +using TaskRunner = v8::TaskRunner; -// Initializes the garbage collector with the provided platform. Must be called -// before creating a Heap. -V8_EXPORT void InitializePlatform(PageAllocator* page_allocator); +/** + * Platform interface used by Heap. Contains allocators and executors. + */ +class V8_EXPORT Platform { + public: + virtual ~Platform() = default; -// Must be called after destroying the last used heap. -V8_EXPORT void ShutdownPlatform(); + /** + * Returns the allocator used by cppgc to allocate its heap and various + * support structures. + */ + virtual PageAllocator* GetPageAllocator() = 0; + + /** + * Monotonically increasing time in seconds from an arbitrary fixed point in + * the past. This function is expected to return at least + * millisecond-precision values. For this reason, + * it is recommended that the fixed point be no further in the past than + * the epoch. + **/ + virtual double MonotonicallyIncreasingTime() = 0; + + /** + * Foreground task runner that should be used by a Heap. + */ + virtual std::shared_ptr GetForegroundTaskRunner() { + return nullptr; + } + + /** + * Posts |job_task| to run in parallel. Returns a JobHandle associated with + * the Job, which can be joined or canceled. + * This avoids degenerate cases: + * - Calling CallOnWorkerThread() for each work item, causing significant + * overhead. + * - Fixed number of CallOnWorkerThread() calls that split the work and might + * run for a long time. This is problematic when many components post + * "num cores" tasks and all expect to use all the cores. In these cases, + * the scheduler lacks context to be fair to multiple same-priority requests + * and/or ability to request lower priority work to yield when high priority + * work comes in. + * A canonical implementation of |job_task| looks like: + * class MyJobTask : public JobTask { + * public: + * MyJobTask(...) : worker_queue_(...) {} + * // JobTask: + * void Run(JobDelegate* delegate) override { + * while (!delegate->ShouldYield()) { + * // Smallest unit of work. + * auto work_item = worker_queue_.TakeWorkItem(); // Thread safe. + * if (!work_item) return; + * ProcessWork(work_item); + * } + * } + * + * size_t GetMaxConcurrency() const override { + * return worker_queue_.GetSize(); // Thread safe. + * } + * }; + * auto handle = PostJob(TaskPriority::kUserVisible, + * std::make_unique(...)); + * handle->Join(); + * + * PostJob() and methods of the returned JobHandle/JobDelegate, must never be + * called while holding a lock that could be acquired by JobTask::Run or + * JobTask::GetMaxConcurrency -- that could result in a deadlock. This is + * because [1] JobTask::GetMaxConcurrency may be invoked while holding + * internal lock (A), hence JobTask::GetMaxConcurrency can only use a lock (B) + * if that lock is *never* held while calling back into JobHandle from any + * thread (A=>B/B=>A deadlock) and [2] JobTask::Run or + * JobTask::GetMaxConcurrency may be invoked synchronously from JobHandle + * (B=>JobHandle::foo=>B deadlock). + * + * A sufficient PostJob() implementation that uses the default Job provided in + * libplatform looks like: + * std::unique_ptr PostJob( + * TaskPriority priority, std::unique_ptr job_task) override { + * return std::make_unique( + * std::make_shared( + * this, std::move(job_task), kNumThreads)); + * } + */ + virtual std::unique_ptr PostJob( + TaskPriority priority, std::unique_ptr job_task) { + return nullptr; + } +}; + +/** + * Process-global initialization of the garbage collector. Must be called before + * creating a Heap. + */ +V8_EXPORT void InitializeProcess(PageAllocator*); + +/** + * Must be called after destroying the last used heap. + */ +V8_EXPORT void ShutdownProcess(); namespace internal { diff --git a/deps/v8/include/cppgc/prefinalizer.h b/deps/v8/include/cppgc/prefinalizer.h new file mode 100644 index 00000000000..6c741645990 --- /dev/null +++ b/deps/v8/include/cppgc/prefinalizer.h @@ -0,0 +1,53 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_PREFINALIZER_H_ +#define INCLUDE_CPPGC_PREFINALIZER_H_ + +#include "cppgc/internal/accessors.h" +#include "cppgc/internal/compiler-specific.h" +#include "cppgc/internal/prefinalizer-handler.h" +#include "cppgc/liveness-broker.h" + +namespace cppgc { + +namespace internal { + +template +class PrefinalizerRegistration final { + public: + explicit PrefinalizerRegistration(T* self) { + static_assert(sizeof(&T::InvokePreFinalizer) > 0, + "USING_PRE_FINALIZER(T) must be defined."); + + cppgc::internal::PreFinalizerRegistrationDispatcher::RegisterPrefinalizer( + internal::GetHeapFromPayload(self), {self, T::InvokePreFinalizer}); + } + + void* operator new(size_t, void* location) = delete; + void* operator new(size_t) = delete; +}; + +} // namespace internal + +#define CPPGC_USING_PRE_FINALIZER(Class, PreFinalizer) \ + public: \ + static bool InvokePreFinalizer(const LivenessBroker& liveness_broker, \ + void* object) { \ + static_assert(internal::IsGarbageCollectedTypeV, \ + "Only garbage collected objects can have prefinalizers"); \ + Class* self = static_cast(object); \ + if (liveness_broker.IsHeapObjectAlive(self)) return false; \ + self->Class::PreFinalizer(); \ + return true; \ + } \ + \ + private: \ + CPPGC_NO_UNIQUE_ADDRESS internal::PrefinalizerRegistration \ + prefinalizer_dummy_{this}; \ + static_assert(true, "Force semicolon.") + +} // namespace cppgc + +#endif // INCLUDE_CPPGC_PREFINALIZER_H_ diff --git a/deps/v8/include/cppgc/source-location.h b/deps/v8/include/cppgc/source-location.h new file mode 100644 index 00000000000..8cc52d6a539 --- /dev/null +++ b/deps/v8/include/cppgc/source-location.h @@ -0,0 +1,59 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_SOURCE_LOCATION_H_ +#define INCLUDE_CPPGC_SOURCE_LOCATION_H_ + +#include + +#include "v8config.h" // NOLINT(build/include_directory) + +#if defined(__has_builtin) +#define CPPGC_SUPPORTS_SOURCE_LOCATION \ + (__has_builtin(__builtin_FUNCTION) && __has_builtin(__builtin_FILE) && \ + __has_builtin(__builtin_LINE)) // NOLINT +#elif defined(V8_CC_GNU) && __GNUC__ >= 7 +#define CPPGC_SUPPORTS_SOURCE_LOCATION 1 +#elif defined(V8_CC_INTEL) && __ICC >= 1800 +#define CPPGC_SUPPORTS_SOURCE_LOCATION 1 +#else +#define CPPGC_SUPPORTS_SOURCE_LOCATION 0 +#endif + +namespace cppgc { + +// Encapsulates source location information. Mimics C++20's +// std::source_location. +class V8_EXPORT SourceLocation final { + public: +#if CPPGC_SUPPORTS_SOURCE_LOCATION + static constexpr SourceLocation Current( + const char* function = __builtin_FUNCTION(), + const char* file = __builtin_FILE(), size_t line = __builtin_LINE()) { + return SourceLocation(function, file, line); + } +#else + static constexpr SourceLocation Current() { return SourceLocation(); } +#endif // CPPGC_SUPPORTS_SOURCE_LOCATION + + constexpr SourceLocation() = default; + + constexpr const char* Function() const { return function_; } + constexpr const char* FileName() const { return file_; } + constexpr size_t Line() const { return line_; } + + std::string ToString() const; + + private: + constexpr SourceLocation(const char* function, const char* file, size_t line) + : function_(function), file_(file), line_(line) {} + + const char* function_ = nullptr; + const char* file_ = nullptr; + size_t line_ = 0u; +}; + +} // namespace cppgc + +#endif // INCLUDE_CPPGC_SOURCE_LOCATION_H_ diff --git a/deps/v8/include/cppgc/trace-trait.h b/deps/v8/include/cppgc/trace-trait.h new file mode 100644 index 00000000000..e246bc53b7d --- /dev/null +++ b/deps/v8/include/cppgc/trace-trait.h @@ -0,0 +1,67 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_TRACE_TRAIT_H_ +#define INCLUDE_CPPGC_TRACE_TRAIT_H_ + +#include +#include "cppgc/type-traits.h" + +namespace cppgc { + +class Visitor; + +namespace internal { + +template ::type>> +struct TraceTraitImpl; + +} // namespace internal + +using TraceCallback = void (*)(Visitor*, const void*); + +// TraceDescriptor is used to describe how to trace an object. +struct TraceDescriptor { + // The adjusted base pointer of the object that should be traced. + const void* base_object_payload; + // A callback for tracing the object. + TraceCallback callback; +}; + +template +struct TraceTrait { + static_assert(internal::IsTraceableV, "T must have a Trace() method"); + + static TraceDescriptor GetTraceDescriptor(const void* self) { + return internal::TraceTraitImpl::GetTraceDescriptor( + static_cast(self)); + } + + static void Trace(Visitor* visitor, const void* self) { + static_cast(self)->Trace(visitor); + } +}; + +namespace internal { + +template +struct TraceTraitImpl { + static TraceDescriptor GetTraceDescriptor(const void* self) { + return {self, TraceTrait::Trace}; + } +}; + +template +struct TraceTraitImpl { + static TraceDescriptor GetTraceDescriptor(const void* self) { + return static_cast(self)->GetTraceDescriptor(); + } +}; + +} // namespace internal +} // namespace cppgc + +#endif // INCLUDE_CPPGC_TRACE_TRAIT_H_ diff --git a/deps/v8/include/cppgc/type-traits.h b/deps/v8/include/cppgc/type-traits.h new file mode 100644 index 00000000000..4d8ab809c8d --- /dev/null +++ b/deps/v8/include/cppgc/type-traits.h @@ -0,0 +1,109 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_TYPE_TRAITS_H_ +#define INCLUDE_CPPGC_TYPE_TRAITS_H_ + +#include + +namespace cppgc { + +class Visitor; + +namespace internal { + +// Pre-C++17 custom implementation of std::void_t. +template +struct make_void { + typedef void type; +}; +template +using void_t = typename make_void::type; + +// Not supposed to be specialized by the user. +template +struct IsWeak : std::false_type {}; + +template class U> +struct IsSubclassOfTemplate { + private: + template + static std::true_type SubclassCheck(U*); + static std::false_type SubclassCheck(...); + + public: + static constexpr bool value = + decltype(SubclassCheck(std::declval()))::value; +}; + +// IsTraceMethodConst is used to verify that all Trace methods are marked as +// const. It is equivalent to IsTraceable but for a non-const object. +template +struct IsTraceMethodConst : std::false_type {}; + +template +struct IsTraceMethodConst().Trace( + std::declval()))>> : std::true_type { +}; + +template +struct IsTraceable : std::false_type { + static_assert(sizeof(T), "T must be fully defined"); +}; + +template +struct IsTraceable< + T, void_t().Trace(std::declval()))>> + : std::true_type { + // All Trace methods should be marked as const. If an object of type + // 'T' is traceable then any object of type 'const T' should also + // be traceable. + static_assert(IsTraceMethodConst(), + "Trace methods should be marked as const."); +}; + +template +constexpr bool IsTraceableV = IsTraceable::value; + +template +struct IsGarbageCollectedMixinType : std::false_type { + static_assert(sizeof(T), "T must be fully defined"); +}; + +template +struct IsGarbageCollectedMixinType< + T, + void_t::IsGarbageCollectedMixinTypeMarker>> + : std::true_type { + static_assert(sizeof(T), "T must be fully defined"); +}; + +template +struct IsGarbageCollectedType : IsGarbageCollectedMixinType { + static_assert(sizeof(T), "T must be fully defined"); +}; + +template +struct IsGarbageCollectedType< + T, void_t::IsGarbageCollectedTypeMarker>> + : std::true_type { + static_assert(sizeof(T), "T must be fully defined"); +}; + +template +constexpr bool IsGarbageCollectedTypeV = + internal::IsGarbageCollectedType::value; + +template +constexpr bool IsGarbageCollectedMixinTypeV = + internal::IsGarbageCollectedMixinType::value; + +} // namespace internal + +template +constexpr bool IsWeakV = internal::IsWeak::value; + +} // namespace cppgc + +#endif // INCLUDE_CPPGC_TYPE_TRAITS_H_ diff --git a/deps/v8/include/cppgc/visitor.h b/deps/v8/include/cppgc/visitor.h new file mode 100644 index 00000000000..55d44c1ccea --- /dev/null +++ b/deps/v8/include/cppgc/visitor.h @@ -0,0 +1,154 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef INCLUDE_CPPGC_VISITOR_H_ +#define INCLUDE_CPPGC_VISITOR_H_ + +#include "cppgc/garbage-collected.h" +#include "cppgc/internal/logging.h" +#include "cppgc/internal/pointer-policies.h" +#include "cppgc/liveness-broker.h" +#include "cppgc/member.h" +#include "cppgc/source-location.h" +#include "cppgc/trace-trait.h" + +namespace cppgc { +namespace internal { +class VisitorBase; +} // namespace internal + +using WeakCallback = void (*)(const LivenessBroker&, const void*); + +/** + * Visitor passed to trace methods. All managed pointers must have called the + * visitor's trace method on them. + */ +class Visitor { + public: + template + void Trace(const Member& member) { + const T* value = member.GetRawAtomic(); + CPPGC_DCHECK(value != kSentinelPointer); + Trace(value); + } + + template + void Trace(const WeakMember& weak_member) { + static_assert(sizeof(T), "Pointee type must be fully defined."); + static_assert(internal::IsGarbageCollectedType::value, + "T must be GarabgeCollected or GarbageCollectedMixin type"); + + const T* value = weak_member.GetRawAtomic(); + + // Bailout assumes that WeakMember emits write barrier. + if (!value) { + return; + } + + // TODO(chromium:1056170): DCHECK (or similar) for deleted values as they + // should come in at a different path. + VisitWeak(value, TraceTrait::GetTraceDescriptor(value), + &HandleWeak>, &weak_member); + } + + template * = nullptr> + void TraceRoot(const Persistent& p, const SourceLocation& loc) { + using PointeeType = typename Persistent::PointeeType; + static_assert(sizeof(PointeeType), + "Persistent's pointee type must be fully defined"); + static_assert(internal::IsGarbageCollectedType::value, + "Persisent's pointee type must be GarabgeCollected or " + "GarbageCollectedMixin"); + if (!p.Get()) { + return; + } + VisitRoot(p.Get(), TraceTrait::GetTraceDescriptor(p.Get())); + } + + template < + typename WeakPersistent, + std::enable_if_t* = nullptr> + void TraceRoot(const WeakPersistent& p, const SourceLocation& loc) { + using PointeeType = typename WeakPersistent::PointeeType; + static_assert(sizeof(PointeeType), + "Persistent's pointee type must be fully defined"); + static_assert(internal::IsGarbageCollectedType::value, + "Persisent's pointee type must be GarabgeCollected or " + "GarbageCollectedMixin"); + VisitWeakRoot(p.Get(), TraceTrait::GetTraceDescriptor(p.Get()), + &HandleWeak, &p); + } + + template + void Trace(const T& object) { +#if V8_ENABLE_CHECKS + // This object is embedded in potentially multiple nested objects. The + // outermost object must not be in construction as such objects are (a) not + // processed immediately, and (b) only processed conservatively if not + // otherwise possible. + CheckObjectNotInConstruction(&object); +#endif // V8_ENABLE_CHECKS + TraceTrait::Trace(this, &object); + } + + template + void RegisterWeakCallbackMethod(const T* obj) { + RegisterWeakCallback(&WeakCallbackMethodDelegate, obj); + } + + virtual void RegisterWeakCallback(WeakCallback, const void*) {} + + protected: + virtual void Visit(const void* self, TraceDescriptor) {} + virtual void VisitWeak(const void* self, TraceDescriptor, WeakCallback, + const void* weak_member) {} + virtual void VisitRoot(const void*, TraceDescriptor) {} + virtual void VisitWeakRoot(const void* self, TraceDescriptor, WeakCallback, + const void* weak_root) {} + + private: + template + static void WeakCallbackMethodDelegate(const LivenessBroker& info, + const void* self) { + // Callback is registered through a potential const Trace method but needs + // to be able to modify fields. See HandleWeak. + (const_cast(static_cast(self))->*method)(info); + } + + template + static void HandleWeak(const LivenessBroker& info, const void* object) { + const PointerType* weak = static_cast(object); + const auto* raw = weak->Get(); + if (raw && !info.IsHeapObjectAlive(raw)) { + // Object is passed down through the marker as const. Alternatives are + // - non-const Trace method; + // - mutable pointer in MemberBase; + const_cast(weak)->Clear(); + } + } + + Visitor() = default; + + template + void Trace(const T* t) { + static_assert(sizeof(T), "Pointee type must be fully defined."); + static_assert(internal::IsGarbageCollectedType::value, + "T must be GarabgeCollected or GarbageCollectedMixin type"); + if (!t) { + return; + } + Visit(t, TraceTrait::GetTraceDescriptor(t)); + } + +#if V8_ENABLE_CHECKS + V8_EXPORT void CheckObjectNotInConstruction(const void* address); +#endif // V8_ENABLE_CHECKS + + friend class internal::VisitorBase; +}; + +} // namespace cppgc + +#endif // INCLUDE_CPPGC_VISITOR_H_ diff --git a/deps/v8/include/js_protocol.pdl b/deps/v8/include/js_protocol.pdl index 3f5410d1e1f..706c37f958e 100644 --- a/deps/v8/include/js_protocol.pdl +++ b/deps/v8/include/js_protocol.pdl @@ -204,6 +204,21 @@ domain Debugger # Exception details. optional Runtime.ExceptionDetails exceptionDetails + # Execute a Wasm Evaluator module on a given call frame. + experimental command executeWasmEvaluator + parameters + # WebAssembly call frame identifier to evaluate on. + CallFrameId callFrameId + # Code of the evaluator module. + binary evaluator + # Terminate execution after timing out (number of milliseconds). + experimental optional Runtime.TimeDelta timeout + returns + # Object wrapper for the evaluation result. + Runtime.RemoteObject result + # Exception details. + optional Runtime.ExceptionDetails exceptionDetails + # Returns possible locations for breakpoint. scriptId in start and end range locations should be # the same. command getPossibleBreakpoints @@ -510,6 +525,18 @@ domain Debugger JavaScript WebAssembly + # Debug symbols available for a wasm script. + type DebugSymbols extends object + properties + # Type of the debug symbols. + enum type + None + SourceMap + EmbeddedDWARF + ExternalDWARF + # URL of the external symbol source. + optional string externalURL + # Fired when virtual machine fails to parse the script. event scriptFailedToParse parameters @@ -584,6 +611,8 @@ domain Debugger experimental optional integer codeOffset # The language of the script. experimental optional Debugger.ScriptLanguage scriptLanguage + # If the scriptLanguage is WebASsembly, the source of debug symbols for the module. + experimental optional Debugger.DebugSymbols debugSymbols experimental domain HeapProfiler depends on Runtime @@ -980,6 +1009,7 @@ domain Runtime f32 f64 v128 + anyref # Object class (constructor) name. Specified for `object` type values only. optional string className # Remote object value in case of primitive values or JSON values (if it was requested). diff --git a/deps/v8/include/libplatform/libplatform.h b/deps/v8/include/libplatform/libplatform.h index 6051b644fb9..c7ea4c2bd38 100644 --- a/deps/v8/include/libplatform/libplatform.h +++ b/deps/v8/include/libplatform/libplatform.h @@ -9,8 +9,8 @@ #include "libplatform/libplatform-export.h" #include "libplatform/v8-tracing.h" -#include "v8-platform.h" // NOLINT(build/include) -#include "v8config.h" // NOLINT(build/include) +#include "v8-platform.h" // NOLINT(build/include_directory) +#include "v8config.h" // NOLINT(build/include_directory) namespace v8 { namespace platform { diff --git a/deps/v8/include/libplatform/v8-tracing.h b/deps/v8/include/libplatform/v8-tracing.h index 79e6f62d23e..45822d00f37 100644 --- a/deps/v8/include/libplatform/v8-tracing.h +++ b/deps/v8/include/libplatform/v8-tracing.h @@ -12,9 +12,12 @@ #include #include "libplatform/libplatform-export.h" -#include "v8-platform.h" // NOLINT(build/include) +#include "v8-platform.h" // NOLINT(build/include_directory) namespace perfetto { +namespace trace_processor { +class TraceProcessorStorage; +} class TracingSession; } @@ -28,7 +31,6 @@ namespace platform { namespace tracing { class TraceEventListener; -class JSONTraceEventListener; const int kTraceMaxNumArgs = 2; @@ -197,6 +199,9 @@ class V8_PLATFORM_EXPORT TraceConfig { TraceConfig() : enable_systrace_(false), enable_argument_filter_(false) {} TraceRecordMode GetTraceRecordMode() const { return record_mode_; } + const StringList& GetEnabledCategories() const { + return included_categories_; + } bool IsSystraceEnabled() const { return enable_systrace_; } bool IsArgumentFilterEnabled() const { return enable_argument_filter_; } @@ -229,6 +234,17 @@ class V8_PLATFORM_EXPORT TraceConfig { class V8_PLATFORM_EXPORT TracingController : public V8_PLATFORM_NON_EXPORTED_BASE(v8::TracingController) { public: + TracingController(); + ~TracingController() override; + +#if defined(V8_USE_PERFETTO) + // Must be called before StartTracing() if V8_USE_PERFETTO is true. Provides + // the output stream for the JSON trace data. + void InitializeForPerfetto(std::ostream* output_stream); + // Provide an optional listener for testing that will receive trace events. + // Must be called before StartTracing(). + void SetTraceEventListenerForTesting(TraceEventListener* listener); +#else // defined(V8_USE_PERFETTO) // The pointer returned from GetCategoryGroupEnabled() points to a value with // zero or more of the following bits. Used in this class only. The // TRACE_EVENT macros should only use the value as a bool. These values must @@ -242,19 +258,8 @@ class V8_PLATFORM_EXPORT TracingController ENABLED_FOR_ETW_EXPORT = 1 << 3 }; - TracingController(); - ~TracingController() override; - // Takes ownership of |trace_buffer|. void Initialize(TraceBuffer* trace_buffer); -#ifdef V8_USE_PERFETTO - // Must be called before StartTracing() if V8_USE_PERFETTO is true. Provides - // the output stream for the JSON trace data. - void InitializeForPerfetto(std::ostream* output_stream); - // Provide an optional listener for testing that will receive trace events. - // Must be called before StartTracing(). - void SetTraceEventListenerForTesting(TraceEventListener* listener); -#endif // v8::TracingController implementation. const uint8_t* GetCategoryGroupEnabled(const char* category_group) override; @@ -274,6 +279,10 @@ class V8_PLATFORM_EXPORT TracingController unsigned int flags, int64_t timestamp) override; void UpdateTraceEventDuration(const uint8_t* category_enabled_flag, const char* name, uint64_t handle) override; + + static const char* GetCategoryGroupName(const uint8_t* category_enabled_flag); +#endif // !defined(V8_USE_PERFETTO) + void AddTraceStateObserver( v8::TracingController::TraceStateObserver* observer) override; void RemoveTraceStateObserver( @@ -282,27 +291,32 @@ class V8_PLATFORM_EXPORT TracingController void StartTracing(TraceConfig* trace_config); void StopTracing(); - static const char* GetCategoryGroupName(const uint8_t* category_enabled_flag); - protected: +#if !defined(V8_USE_PERFETTO) virtual int64_t CurrentTimestampMicroseconds(); virtual int64_t CurrentCpuTimestampMicroseconds(); +#endif // !defined(V8_USE_PERFETTO) private: +#if !defined(V8_USE_PERFETTO) void UpdateCategoryGroupEnabledFlag(size_t category_index); void UpdateCategoryGroupEnabledFlags(); +#endif // !defined(V8_USE_PERFETTO) - std::unique_ptr trace_buffer_; - std::unique_ptr trace_config_; std::unique_ptr mutex_; - std::unordered_set observers_; + std::unique_ptr trace_config_; std::atomic_bool recording_{false}; -#ifdef V8_USE_PERFETTO + std::unordered_set observers_; + +#if defined(V8_USE_PERFETTO) std::ostream* output_stream_ = nullptr; - std::unique_ptr json_listener_; + std::unique_ptr + trace_processor_; TraceEventListener* listener_for_testing_ = nullptr; std::unique_ptr tracing_session_; -#endif +#else // !defined(V8_USE_PERFETTO) + std::unique_ptr trace_buffer_; +#endif // !defined(V8_USE_PERFETTO) // Disallow copy and assign TracingController(const TracingController&) = delete; diff --git a/deps/v8/include/v8-fast-api-calls.h b/deps/v8/include/v8-fast-api-calls.h index bfce66b652d..f74406493bc 100644 --- a/deps/v8/include/v8-fast-api-calls.h +++ b/deps/v8/include/v8-fast-api-calls.h @@ -165,7 +165,7 @@ #include #include -#include "v8config.h" // NOLINT(build/include) +#include "v8config.h" // NOLINT(build/include_directory) namespace v8 { @@ -183,30 +183,32 @@ class CTypeInfo { kUnwrappedApiObject, }; - enum ArgFlags : char { - None = 0, - IsArrayBit = 1 << 0, // This argument is first in an array of values. + enum class ArgFlags : uint8_t { + kNone = 0, + kIsArrayBit = 1 << 0, // This argument is first in an array of values. }; static CTypeInfo FromWrapperType(const void* wrapper_type_info, - ArgFlags flags = ArgFlags::None) { + ArgFlags flags = ArgFlags::kNone) { uintptr_t wrapper_type_info_ptr = reinterpret_cast(wrapper_type_info); // Check that the lower kIsWrapperTypeBit bits are 0's. CHECK_EQ( wrapper_type_info_ptr & ~(static_cast(~0) << static_cast(kIsWrapperTypeBit)), - 0); + 0u); // TODO(mslekova): Refactor the manual bit manipulations to use // PointerWithPayload instead. - return CTypeInfo(wrapper_type_info_ptr | flags | kIsWrapperTypeBit); + return CTypeInfo(wrapper_type_info_ptr | static_cast(flags) | + kIsWrapperTypeBit); } static constexpr CTypeInfo FromCType(Type ctype, - ArgFlags flags = ArgFlags::None) { + ArgFlags flags = ArgFlags::kNone) { // ctype cannot be Type::kUnwrappedApiObject. return CTypeInfo( - ((static_cast(ctype) << kTypeOffset) & kTypeMask) | flags); + ((static_cast(ctype) << kTypeOffset) & kTypeMask) | + static_cast(flags)); } const void* GetWrapperInfo() const; @@ -218,7 +220,9 @@ class CTypeInfo { return static_cast((payload_ & kTypeMask) >> kTypeOffset); } - constexpr bool IsArray() const { return payload_ & ArgFlags::IsArrayBit; } + constexpr bool IsArray() const { + return payload_ & static_cast(ArgFlags::kIsArrayBit); + } private: explicit constexpr CTypeInfo(uintptr_t payload) : payload_(payload) {} @@ -283,9 +287,6 @@ SUPPORTED_C_TYPES(SPECIALIZE_GET_C_TYPE_FOR) template struct EnableIfHasWrapperTypeInfo {}; -template <> -struct EnableIfHasWrapperTypeInfo {}; - template struct EnableIfHasWrapperTypeInfo::GetTypeInfo(), void())> { @@ -297,7 +298,7 @@ template struct GetCTypePointerImpl { static constexpr CTypeInfo Get() { return CTypeInfo::FromCType(GetCType::Get().GetType(), - CTypeInfo::IsArrayBit); + CTypeInfo::ArgFlags::kIsArrayBit); } }; @@ -321,7 +322,7 @@ struct GetCTypePointerPointerImpl< T, typename EnableIfHasWrapperTypeInfo::type> { static constexpr CTypeInfo Get() { return CTypeInfo::FromWrapperType(WrapperTraits::GetTypeInfo(), - CTypeInfo::IsArrayBit); + CTypeInfo::ArgFlags::kIsArrayBit); } }; @@ -335,11 +336,12 @@ template class CFunctionInfoImpl : public CFunctionInfo { public: CFunctionInfoImpl() - : return_info_(i::GetCType::Get()), + : return_info_(internal::GetCType::Get()), arg_count_(sizeof...(Args)), - arg_info_{i::GetCType::Get()...} { - static_assert(i::GetCType::Get().GetType() == CTypeInfo::Type::kVoid, - "Only void return types are currently supported."); + arg_info_{internal::GetCType::Get()...} { + static_assert( + internal::GetCType::Get().GetType() == CTypeInfo::Type::kVoid, + "Only void return types are currently supported."); } const CTypeInfo& ReturnInfo() const override { return return_info_; } @@ -359,6 +361,8 @@ class CFunctionInfoImpl : public CFunctionInfo { class V8_EXPORT CFunction { public: + constexpr CFunction() : address_(nullptr), type_info_(nullptr) {} + const CTypeInfo& ReturnInfo() const { return type_info_->ReturnInfo(); } const CTypeInfo& ArgumentInfo(unsigned int index) const { diff --git a/deps/v8/include/v8-inspector-protocol.h b/deps/v8/include/v8-inspector-protocol.h index 612a2ebc391..a5ffb7d6954 100644 --- a/deps/v8/include/v8-inspector-protocol.h +++ b/deps/v8/include/v8-inspector-protocol.h @@ -5,9 +5,9 @@ #ifndef V8_V8_INSPECTOR_PROTOCOL_H_ #define V8_V8_INSPECTOR_PROTOCOL_H_ -#include "inspector/Debugger.h" // NOLINT(build/include) -#include "inspector/Runtime.h" // NOLINT(build/include) -#include "inspector/Schema.h" // NOLINT(build/include) -#include "v8-inspector.h" // NOLINT(build/include) +#include "inspector/Debugger.h" // NOLINT(build/include_directory) +#include "inspector/Runtime.h" // NOLINT(build/include_directory) +#include "inspector/Schema.h" // NOLINT(build/include_directory) +#include "v8-inspector.h" // NOLINT(build/include_directory) #endif // V8_V8_INSPECTOR_PROTOCOL_H_ diff --git a/deps/v8/include/v8-inspector.h b/deps/v8/include/v8-inspector.h index 01274625c1f..6573940e2fe 100644 --- a/deps/v8/include/v8-inspector.h +++ b/deps/v8/include/v8-inspector.h @@ -11,7 +11,7 @@ #include #include -#include "v8.h" // NOLINT(build/include) +#include "v8.h" // NOLINT(build/include_directory) namespace v8_inspector { diff --git a/deps/v8/include/v8-internal.h b/deps/v8/include/v8-internal.h index 876408ebba9..127a77dbfca 100644 --- a/deps/v8/include/v8-internal.h +++ b/deps/v8/include/v8-internal.h @@ -10,8 +10,8 @@ #include #include -#include "v8-version.h" // NOLINT(build/include) -#include "v8config.h" // NOLINT(build/include) +#include "v8-version.h" // NOLINT(build/include_directory) +#include "v8config.h" // NOLINT(build/include_directory) namespace v8 { @@ -106,6 +106,20 @@ const int kApiTaggedSize = kApiInt32Size; const int kApiTaggedSize = kApiSystemPointerSize; #endif +constexpr bool PointerCompressionIsEnabled() { + return kApiTaggedSize != kApiSystemPointerSize; +} + +constexpr bool HeapSandboxIsEnabled() { +#ifdef V8_HEAP_SANDBOX + return true; +#else + return false; +#endif +} + +using ExternalPointer_t = Address; + #ifdef V8_31BIT_SMIS_ON_64BIT_ARCH using PlatformSmiTagging = SmiTagging; #else @@ -126,6 +140,15 @@ V8_INLINE static constexpr internal::Address IntToSmi(int value) { kSmiTag; } +// {obj} must be the raw tagged pointer representation of a HeapObject +// that's guaranteed to never be in ReadOnlySpace. +V8_EXPORT internal::Isolate* IsolateFromNeverReadOnlySpaceObject(Address obj); + +// Returns if we need to throw when an error occurs. This infers the language +// mode based on the current context and the closure. This returns true if the +// language mode is strict. +V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate* isolate); + /** * This class exports constants and functionality from within v8 that * is necessary to implement inline functions in the v8 api. Don't @@ -141,7 +164,6 @@ class Internals { 1 * kApiTaggedSize + 2 * kApiInt32Size; static const int kOddballKindOffset = 4 * kApiTaggedSize + kApiDoubleSize; - static const int kForeignAddressOffset = kApiTaggedSize; static const int kJSObjectHeaderSize = 3 * kApiTaggedSize; static const int kFixedArrayHeaderSize = 2 * kApiTaggedSize; static const int kEmbedderDataArrayHeaderSize = 2 * kApiTaggedSize; @@ -326,11 +348,36 @@ class Internals { #endif } + V8_INLINE static internal::Isolate* GetIsolateForHeapSandbox( + internal::Address obj) { +#ifdef V8_HEAP_SANDBOX + return internal::IsolateFromNeverReadOnlySpaceObject(obj); +#else + // Not used in non-sandbox mode. + return nullptr; +#endif + } + + V8_INLINE static internal::Address ReadExternalPointerField( + internal::Isolate* isolate, internal::Address heap_object_ptr, + int offset) { + internal::Address value = ReadRawField
(heap_object_ptr, offset); +#ifdef V8_HEAP_SANDBOX + // We currently have to treat zero as nullptr in embedder slots. + if (value) value = DecodeExternalPointer(isolate, value); +#endif + return value; + } + #ifdef V8_COMPRESS_POINTERS // See v8:7703 or src/ptr-compr.* for details about pointer compression. static constexpr size_t kPtrComprHeapReservationSize = size_t{1} << 32; static constexpr size_t kPtrComprIsolateRootAlignment = size_t{1} << 32; + // See v8:10391 for details about V8 heap sandbox. + static constexpr uint32_t kExternalPointerSalt = + 0x7fffffff & ~static_cast(kHeapObjectTagMask); + V8_INLINE static internal::Address GetRootFromOnHeapAddress( internal::Address addr) { return addr & -static_cast(kPtrComprIsolateRootAlignment); @@ -341,6 +388,15 @@ class Internals { internal::Address root = GetRootFromOnHeapAddress(heap_object_ptr); return root + static_cast(static_cast(value)); } + + V8_INLINE static Address DecodeExternalPointer( + const Isolate* isolate, ExternalPointer_t encoded_pointer) { +#ifndef V8_HEAP_SANDBOX + return encoded_pointer; +#else + return encoded_pointer ^ kExternalPointerSalt; +#endif + } #endif // V8_COMPRESS_POINTERS }; @@ -367,15 +423,6 @@ V8_INLINE void PerformCastCheck(T* data) { CastCheck::value>::Perform(data); } -// {obj} must be the raw tagged pointer representation of a HeapObject -// that's guaranteed to never be in ReadOnlySpace. -V8_EXPORT internal::Isolate* IsolateFromNeverReadOnlySpaceObject(Address obj); - -// Returns if we need to throw when an error occurs. This infers the language -// mode based on the current context and the closure. This returns true if the -// language mode is strict. -V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate* isolate); - // A base class for backing stores, which is needed due to vagaries of // how static casts work with std::shared_ptr. class BackingStoreBase {}; diff --git a/deps/v8/include/v8-platform.h b/deps/v8/include/v8-platform.h index 5d23cd665ed..7cfd18b5708 100644 --- a/deps/v8/include/v8-platform.h +++ b/deps/v8/include/v8-platform.h @@ -11,12 +11,34 @@ #include #include -#include "v8config.h" // NOLINT(build/include) +#include "v8config.h" // NOLINT(build/include_directory) namespace v8 { class Isolate; +// Valid priorities supported by the task scheduling infrastructure. +enum class TaskPriority : uint8_t { + /** + * Best effort tasks are not critical for performance of the application. The + * platform implementation should preempt such tasks if higher priority tasks + * arrive. + */ + kBestEffort, + /** + * User visible tasks are long running background tasks that will + * improve performance and memory usage of the application upon completion. + * Example: background compilation and garbage collection. + */ + kUserVisible, + /** + * User blocking tasks are highest priority tasks that block the execution + * thread (e.g. major garbage collection). They must be finished as soon as + * possible. + */ + kUserBlocking, +}; + /** * A Task represents a unit of work. */ @@ -113,6 +135,82 @@ class TaskRunner { TaskRunner& operator=(const TaskRunner&) = delete; }; +/** + * Delegate that's passed to Job's worker task, providing an entry point to + * communicate with the scheduler. + */ +class JobDelegate { + public: + /** + * Returns true if this thread should return from the worker task on the + * current thread ASAP. Workers should periodically invoke ShouldYield (or + * YieldIfNeeded()) as often as is reasonable. + */ + virtual bool ShouldYield() = 0; + + /** + * Notifies the scheduler that max concurrency was increased, and the number + * of worker should be adjusted accordingly. See Platform::PostJob() for more + * details. + */ + virtual void NotifyConcurrencyIncrease() = 0; +}; + +/** + * Handle returned when posting a Job. Provides methods to control execution of + * the posted Job. + */ +class JobHandle { + public: + virtual ~JobHandle() = default; + + /** + * Notifies the scheduler that max concurrency was increased, and the number + * of worker should be adjusted accordingly. See Platform::PostJob() for more + * details. + */ + virtual void NotifyConcurrencyIncrease() = 0; + + /** + * Contributes to the job on this thread. Doesn't return until all tasks have + * completed and max concurrency becomes 0. When Join() is called and max + * concurrency reaches 0, it should not increase again. This also promotes + * this Job's priority to be at least as high as the calling thread's + * priority. + */ + virtual void Join() = 0; + + /** + * Forces all existing workers to yield ASAP. Waits until they have all + * returned from the Job's callback before returning. + */ + virtual void Cancel() = 0; + + /** + * Returns true if associated with a Job and other methods may be called. + * Returns false after Join() or Cancel() was called. + */ + virtual bool IsRunning() = 0; +}; + +/** + * A JobTask represents work to run in parallel from Platform::PostJob(). + */ +class JobTask { + public: + virtual ~JobTask() = default; + + virtual void Run(JobDelegate* delegate) = 0; + + /** + * Controls the maximum number of threads calling Run() concurrently. Run() is + * only invoked if the number of threads previously running Run() was less + * than the value returned. Since GetMaxConcurrency() is a leaf function, it + * must not call back any JobHandle methods. + */ + virtual size_t GetMaxConcurrency() const = 0; +}; + /** * The interface represents complex arguments to trace events. */ @@ -138,6 +236,10 @@ class TracingController { public: virtual ~TracingController() = default; + // In Perfetto mode, trace events are written using Perfetto's Track Event + // API directly without going through the embedder. However, it is still + // possible to observe tracing being enabled and disabled. +#if !defined(V8_USE_PERFETTO) /** * Called by TRACE_EVENT* macros, don't call this directly. * The name parameter is a category group for example: @@ -183,6 +285,7 @@ class TracingController { **/ virtual void UpdateTraceEventDuration(const uint8_t* category_enabled_flag, const char* name, uint64_t handle) {} +#endif // !defined(V8_USE_PERFETTO) class TraceStateObserver { public: @@ -368,6 +471,64 @@ class Platform { */ virtual bool IdleTasksEnabled(Isolate* isolate) { return false; } + /** + * Posts |job_task| to run in parallel. Returns a JobHandle associated with + * the Job, which can be joined or canceled. + * This avoids degenerate cases: + * - Calling CallOnWorkerThread() for each work item, causing significant + * overhead. + * - Fixed number of CallOnWorkerThread() calls that split the work and might + * run for a long time. This is problematic when many components post + * "num cores" tasks and all expect to use all the cores. In these cases, + * the scheduler lacks context to be fair to multiple same-priority requests + * and/or ability to request lower priority work to yield when high priority + * work comes in. + * A canonical implementation of |job_task| looks like: + * class MyJobTask : public JobTask { + * public: + * MyJobTask(...) : worker_queue_(...) {} + * // JobTask: + * void Run(JobDelegate* delegate) override { + * while (!delegate->ShouldYield()) { + * // Smallest unit of work. + * auto work_item = worker_queue_.TakeWorkItem(); // Thread safe. + * if (!work_item) return; + * ProcessWork(work_item); + * } + * } + * + * size_t GetMaxConcurrency() const override { + * return worker_queue_.GetSize(); // Thread safe. + * } + * }; + * auto handle = PostJob(TaskPriority::kUserVisible, + * std::make_unique(...)); + * handle->Join(); + * + * PostJob() and methods of the returned JobHandle/JobDelegate, must never be + * called while holding a lock that could be acquired by JobTask::Run or + * JobTask::GetMaxConcurrency -- that could result in a deadlock. This is + * because [1] JobTask::GetMaxConcurrency may be invoked while holding + * internal lock (A), hence JobTask::GetMaxConcurrency can only use a lock (B) + * if that lock is *never* held while calling back into JobHandle from any + * thread (A=>B/B=>A deadlock) and [2] JobTask::Run or + * JobTask::GetMaxConcurrency may be invoked synchronously from JobHandle + * (B=>JobHandle::foo=>B deadlock). + * + * A sufficient PostJob() implementation that uses the default Job provided in + * libplatform looks like: + * std::unique_ptr PostJob( + * TaskPriority priority, std::unique_ptr job_task) override { + * return std::make_unique( + * std::make_shared( + * this, std::move(job_task), kNumThreads)); + * } + */ + virtual std::unique_ptr PostJob( + TaskPriority priority, std::unique_ptr job_task) { + return nullptr; + } + /** * Monotonically increasing time in seconds from an arbitrary fixed point in * the past. This function is expected to return at least diff --git a/deps/v8/include/v8-profiler.h b/deps/v8/include/v8-profiler.h index 866d799076e..c3b25e8d6a6 100644 --- a/deps/v8/include/v8-profiler.h +++ b/deps/v8/include/v8-profiler.h @@ -10,7 +10,7 @@ #include #include -#include "v8.h" // NOLINT(build/include) +#include "v8.h" // NOLINT(build/include_directory) /** * Profiler support for the V8 JavaScript engine. diff --git a/deps/v8/include/v8-util.h b/deps/v8/include/v8-util.h index 29d813e4274..89ec4f6a789 100644 --- a/deps/v8/include/v8-util.h +++ b/deps/v8/include/v8-util.h @@ -5,7 +5,7 @@ #ifndef V8_UTIL_H_ #define V8_UTIL_H_ -#include "v8.h" // NOLINT(build/include) +#include "v8.h" // NOLINT(build/include_directory) #include #include #include diff --git a/deps/v8/include/v8-version-string.h b/deps/v8/include/v8-version-string.h index fb84144d544..8faed2a7405 100644 --- a/deps/v8/include/v8-version-string.h +++ b/deps/v8/include/v8-version-string.h @@ -5,7 +5,7 @@ #ifndef V8_VERSION_STRING_H_ #define V8_VERSION_STRING_H_ -#include "v8-version.h" // NOLINT(build/include) +#include "v8-version.h" // NOLINT(build/include_directory) // This is here rather than v8-version.h to keep that file simple and // machine-processable. diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 64f18486653..1061218a36a 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -9,9 +9,9 @@ // NOTE these macros are used by some of the tool scripts and the build // system so their names cannot be changed without changing the scripts. #define V8_MAJOR_VERSION 8 -#define V8_MINOR_VERSION 3 -#define V8_BUILD_NUMBER 110 -#define V8_PATCH_LEVEL 9 +#define V8_MINOR_VERSION 5 +#define V8_BUILD_NUMBER 74 +#define V8_PATCH_LEVEL 0 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/include/v8-wasm-trap-handler-posix.h b/deps/v8/include/v8-wasm-trap-handler-posix.h index 998d0a41bb7..9b8e8a5b496 100644 --- a/deps/v8/include/v8-wasm-trap-handler-posix.h +++ b/deps/v8/include/v8-wasm-trap-handler-posix.h @@ -7,7 +7,7 @@ #include -#include "v8config.h" // NOLINT(build/include) +#include "v8config.h" // NOLINT(build/include_directory) namespace v8 { /** diff --git a/deps/v8/include/v8-wasm-trap-handler-win.h b/deps/v8/include/v8-wasm-trap-handler-win.h index 0185df6401c..9d3cad58483 100644 --- a/deps/v8/include/v8-wasm-trap-handler-win.h +++ b/deps/v8/include/v8-wasm-trap-handler-win.h @@ -7,7 +7,7 @@ #include -#include "v8config.h" // NOLINT(build/include) +#include "v8config.h" // NOLINT(build/include_directory) namespace v8 { /** diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index 5dcb6765608..5773d083987 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -18,15 +18,17 @@ #include #include #include + #include #include #include #include #include -#include "v8-internal.h" // NOLINT(build/include) -#include "v8-version.h" // NOLINT(build/include) -#include "v8config.h" // NOLINT(build/include) +#include "cppgc/common.h" +#include "v8-internal.h" // NOLINT(build/include_directory) +#include "v8-version.h" // NOLINT(build/include_directory) +#include "v8config.h" // NOLINT(build/include_directory) // We reserve the V8_* prefix for macros defined in V8 public API and // assume there are no name conflicts with the embedder's code. @@ -123,19 +125,21 @@ namespace internal { enum class ArgumentsType; template class Arguments; +template +class CustomArguments; class DeferredHandles; +class FunctionCallbackArguments; +class GlobalHandles; class Heap; class HeapObject; class ExternalString; class Isolate; class LocalEmbedderHeapTracer; class MicrotaskQueue; -struct ScriptStreamingData; -template class CustomArguments; class PropertyCallbackArguments; -class FunctionCallbackArguments; -class GlobalHandles; +class ReadOnlyHeap; class ScopedExternalStringLock; +struct ScriptStreamingData; class ThreadLocalTop; namespace wasm { @@ -4764,11 +4768,17 @@ class V8_EXPORT CompiledWasmModule { */ MemorySpan GetWireBytesRef(); + const std::string& source_url() const { return source_url_; } + private: - explicit CompiledWasmModule(std::shared_ptr); - friend class Utils; + friend class WasmModuleObject; + friend class WasmStreaming; + + explicit CompiledWasmModule(std::shared_ptr, + const char* source_url, size_t url_length); const std::shared_ptr native_module_; + const std::string source_url_; }; // An instance of WebAssembly.Module. @@ -5935,37 +5945,6 @@ class V8_EXPORT RegExp : public Object { static void CheckCast(Value* obj); }; -/** - * An instance of the built-in FinalizationRegistry constructor. - * - * The C++ name is FinalizationGroup for backwards compatibility. This API is - * experimental and deprecated. - */ -class V8_EXPORT FinalizationGroup : public Object { - public: - /** - * Runs the cleanup callback of the given FinalizationRegistry. - * - * V8 will inform the embedder that there are finalizer callbacks be - * called through HostCleanupFinalizationGroupCallback. - * - * HostCleanupFinalizationGroupCallback should schedule a task to - * call FinalizationGroup::Cleanup() at some point in the - * future. It's the embedders responsiblity to make this call at a - * time which does not interrupt synchronous ECMAScript code - * execution. - * - * If the result is Nothing then an exception has - * occurred. Otherwise the result is |true| if the cleanup callback - * was called successfully. The result is never |false|. - */ - V8_DEPRECATED( - "FinalizationGroup cleanup is automatic if " - "HostCleanupFinalizationGroupCallback is not set") - static V8_WARN_UNUSED_RESULT Maybe Cleanup( - Local finalization_group); -}; - /** * A JavaScript value that wraps a C++ void*. This type of value is mainly used * to associate C++ data structures with JavaScript objects. @@ -6451,11 +6430,6 @@ class V8_EXPORT FunctionTemplate : public Template { SideEffectType side_effect_type = SideEffectType::kHasSideEffect, const CFunction* c_function = nullptr); - /** Get a template included in the snapshot by index. */ - V8_DEPRECATED("Use v8::Isolate::GetDataFromSnapshotOnce instead") - static MaybeLocal FromSnapshot(Isolate* isolate, - size_t index); - /** * Creates a function template backed/cached by a private property. */ @@ -6745,11 +6719,6 @@ class V8_EXPORT ObjectTemplate : public Template { Isolate* isolate, Local constructor = Local()); - /** Get a template included in the snapshot by index. */ - V8_DEPRECATED("Use v8::Isolate::GetDataFromSnapshotOnce instead") - static MaybeLocal FromSnapshot(Isolate* isolate, - size_t index); - /** Creates a new instance of this template.*/ V8_WARN_UNUSED_RESULT MaybeLocal NewInstance(Local context); @@ -7182,6 +7151,9 @@ class V8_EXPORT Exception { static Local ReferenceError(Local message); static Local SyntaxError(Local message); static Local TypeError(Local message); + static Local WasmCompileError(Local message); + static Local WasmLinkError(Local message); + static Local WasmRuntimeError(Local message); static Local Error(Local message); /** @@ -7225,20 +7197,6 @@ typedef void (*AddCrashKeyCallback)(CrashKeyId id, const std::string& value); typedef void (*BeforeCallEnteredCallback)(Isolate*); typedef void (*CallCompletedCallback)(Isolate*); -/** - * HostCleanupFinalizationGroupCallback is called when we require the - * embedder to enqueue a task that would call - * FinalizationGroup::Cleanup(). - * - * The FinalizationGroup is the one for which the embedder needs to - * call FinalizationGroup::Cleanup() on. - * - * The context provided is the one in which the FinalizationGroup was - * created in. - */ -typedef void (*HostCleanupFinalizationGroupCallback)( - Local context, Local fg); - /** * HostImportModuleDynamicallyCallback is called when we require the * embedder to load a module. This is used as part of the dynamic @@ -7265,7 +7223,8 @@ typedef MaybeLocal (*HostImportModuleDynamicallyCallback)( /** * HostInitializeImportMetaObjectCallback is called the first time import.meta - * is accessed for a module. Subsequent access will reuse the same value. + * is accessed for a module. Subsequent access will reuse the same value. The + * callback must not throw. * * The method combines two implementation-defined abstract operations into one: * HostGetImportMetaProperties and HostFinalizeImportMeta. @@ -7527,6 +7486,9 @@ typedef bool (*WasmThreadsEnabledCallback)(Local context); typedef Local (*WasmLoadSourceMapCallback)(Isolate* isolate, const char* name); +// --- Callback for checking if WebAssembly Simd is enabled --- +typedef bool (*WasmSimdEnabledCallback)(Local context); + // --- Garbage Collection Callbacks --- /** @@ -7604,6 +7566,7 @@ class V8_EXPORT SharedMemoryStatistics { size_t read_only_space_physical_size_; friend class V8; + friend class internal::ReadOnlyHeap; }; /** @@ -7883,16 +7846,12 @@ enum class MemoryPressureLevel { kNone, kModerate, kCritical }; */ class V8_EXPORT EmbedderHeapTracer { public: + using EmbedderStackState = cppgc::EmbedderStackState; + enum TraceFlags : uint64_t { kNoFlags = 0, kReduceMemory = 1 << 0, - }; - - // Indicator for the stack state of the embedder. - enum EmbedderStackState { - kUnknown, - kNonEmpty, - kEmpty, + kForced = 1 << 2, }; /** @@ -8184,7 +8143,9 @@ class V8_EXPORT Isolate { array_buffer_allocator_shared(), external_references(nullptr), allow_atomics_wait(true), - only_terminate_in_safe_scope(false) {} + only_terminate_in_safe_scope(false), + embedder_wrapper_type_index(-1), + embedder_wrapper_object_index(-1) {} /** * Allows the host application to provide the address of a function that is @@ -8248,6 +8209,14 @@ class V8_EXPORT Isolate { * Termination is postponed when there is no active SafeForTerminationScope. */ bool only_terminate_in_safe_scope; + + /** + * The following parameters describe the offsets for addressing type info + * for wrapped API objects and are used by the fast C API + * (for details see v8-fast-api-calls.h). + */ + int embedder_wrapper_type_index; + int embedder_wrapper_object_index; }; @@ -8340,7 +8309,7 @@ class V8_EXPORT Isolate { /** * This scope allows terminations inside direct V8 API calls and forbid them - * inside any recursice API calls without explicit SafeForTerminationScope. + * inside any recursive API calls without explicit SafeForTerminationScope. */ class V8_EXPORT SafeForTerminationScope { public: @@ -8445,7 +8414,7 @@ class V8_EXPORT Isolate { kOptimizedFunctionWithOneShotBytecode = 71, kRegExpMatchIsTrueishOnNonJSRegExp = 72, kRegExpMatchIsFalseishOnJSRegExp = 73, - kDateGetTimezoneOffset = 74, + kDateGetTimezoneOffset = 74, // Unused. kStringNormalize = 75, kCallSiteAPIGetFunctionSloppyCall = 76, kCallSiteAPIGetThisSloppyCall = 77, @@ -8461,6 +8430,24 @@ class V8_EXPORT Isolate { kDateTimeFormatDateTimeStyle = 87, kBreakIteratorTypeWord = 88, kBreakIteratorTypeLine = 89, + kInvalidatedArrayBufferDetachingProtector = 90, + kInvalidatedArrayConstructorProtector = 91, + kInvalidatedArrayIteratorLookupChainProtector = 92, + kInvalidatedArraySpeciesLookupChainProtector = 93, + kInvalidatedIsConcatSpreadableLookupChainProtector = 94, + kInvalidatedMapIteratorLookupChainProtector = 95, + kInvalidatedNoElementsProtector = 96, + kInvalidatedPromiseHookProtector = 97, + kInvalidatedPromiseResolveLookupChainProtector = 98, + kInvalidatedPromiseSpeciesLookupChainProtector = 99, + kInvalidatedPromiseThenLookupChainProtector = 100, + kInvalidatedRegExpSpeciesLookupChainProtector = 101, + kInvalidatedSetIteratorLookupChainProtector = 102, + kInvalidatedStringIteratorLookupChainProtector = 103, + kInvalidatedStringLengthOverflowLookupChainProtector = 104, + kInvalidatedTypedArraySpeciesLookupChainProtector = 105, + kWasmSimdOpcodes = 106, + kVarRedeclaredCatchBinding = 107, // If you add new values here, you'll also need to update Chromium's: // web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to @@ -8549,17 +8536,6 @@ class V8_EXPORT Isolate { void SetAbortOnUncaughtExceptionCallback( AbortOnUncaughtExceptionCallback callback); - /** - * This specifies the callback to be called when FinalizationRegistries - * are ready to be cleaned up and require FinalizationGroup::Cleanup() - * to be called in a future task. - */ - V8_DEPRECATED( - "FinalizationRegistry cleanup is automatic if " - "HostCleanupFinalizationGroupCallback is not set") - void SetHostCleanupFinalizationGroupCallback( - HostCleanupFinalizationGroupCallback callback); - /** * This specifies the callback called by the upcoming dynamic * import() language feature to load modules. @@ -8568,7 +8544,7 @@ class V8_EXPORT Isolate { HostImportModuleDynamicallyCallback callback); /** - * This specifies the callback called by the upcoming importa.meta + * This specifies the callback called by the upcoming import.meta * language feature to retrieve host-defined meta data for a module. */ void SetHostInitializeImportMetaObjectCallback( @@ -9374,6 +9350,8 @@ class V8_EXPORT Isolate { void SetWasmLoadSourceMapCallback(WasmLoadSourceMapCallback callback); + void SetWasmSimdEnabledCallback(WasmSimdEnabledCallback callback); + /** * Check if V8 is dead and therefore unusable. This is the case after * fatal errors such as out-of-memory situations. @@ -9512,7 +9490,6 @@ class V8_EXPORT Isolate { internal::Address* GetDataFromSnapshotOnce(size_t index); void ReportExternalAllocationLimitReached(); - void CheckMemoryPressure(); }; class V8_EXPORT StartupData { @@ -9523,12 +9500,16 @@ class V8_EXPORT StartupData { * Only valid for StartupData returned by SnapshotCreator::CreateBlob(). */ bool CanBeRehashed() const; + /** + * Allows embedders to verify whether the data is valid for the current + * V8 instance. + */ + bool IsValid() const; const char* data; int raw_size; }; - /** * EntropySource is used as a callback function when v8 needs a source * of entropy. @@ -9598,7 +9579,13 @@ class V8_EXPORT V8 { * Initializes V8. This function needs to be called before the first Isolate * is created. It always returns true. */ - static bool Initialize(); + V8_INLINE static bool Initialize() { + const int kBuildConfiguration = + (internal::PointerCompressionIsEnabled() ? kPointerCompression : 0) | + (internal::SmiValuesAre31Bits() ? k31BitSmis : 0) | + (internal::HeapSandboxIsEnabled() ? kHeapSandbox : 0); + return Initialize(kBuildConfiguration); + } /** * Allows the host application to provide a callback which can be used @@ -9732,6 +9719,18 @@ class V8_EXPORT V8 { private: V8(); + enum BuildConfigurationFeatures { + kPointerCompression = 1 << 0, + k31BitSmis = 1 << 1, + kHeapSandbox = 1 << 2, + }; + + /** + * Checks that the embedder build configuration is compatible with + * the V8 binary and if so initializes V8. + */ + static bool Initialize(int build_config); + static internal::Address* GlobalizeReference(internal::Isolate* isolate, internal::Address* handle); static internal::Address* GlobalizeTracedReference(internal::Isolate* isolate, @@ -9788,6 +9787,11 @@ class V8_EXPORT V8 { /** * Helper class to create a snapshot data blob. + * + * The Isolate used by a SnapshotCreator is owned by it, and will be entered + * and exited by the constructor and destructor, respectively; The destructor + * will also destroy the Isolate. Experimental language features, including + * those available by default, are not available while creating a snapshot. */ class V8_EXPORT SnapshotCreator { public: @@ -9816,6 +9820,10 @@ class V8_EXPORT SnapshotCreator { SnapshotCreator(const intptr_t* external_references = nullptr, StartupData* existing_blob = nullptr); + /** + * Destroy the snapshot creator, and exit and dispose of the Isolate + * associated with it. + */ ~SnapshotCreator(); /** @@ -9846,13 +9854,6 @@ class V8_EXPORT SnapshotCreator { SerializeInternalFieldsCallback callback = SerializeInternalFieldsCallback()); - /** - * Add a template to be included in the snapshot blob. - * \returns the index of the template in the snapshot blob. - */ - V8_DEPRECATED("use AddData instead") - size_t AddTemplate(Local