summaryrefslogtreecommitdiff
path: root/lib/v8.js
AgeCommit message (Collapse)Author
2018-12-16tools: enable no-useless-constructor lint rulecjihrig
This commit enables ESLint's no-useless-constructor rule. Note that the documentation examples that only include constructor calls were left in tact. PR-URL: https://github.com/nodejs/node/pull/25055 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-12-13lib: refactor argument validation using validateStringZYSzys
PR-URL: https://github.com/nodejs/node/pull/24960 Refs: https://github.com/nodejs/node/pull/22101 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-10-15buffer: move process.binding('buffer') to internalBindingWeijia Wang
PR-URL: https://github.com/nodejs/node/pull/22370 Refs: https://github.com/nodejs/node/issues/22160 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-10-04bootstrapper: move internalBinding to NativeModuleGus Caplan
internalBinding is used so often that it should just automatically be available for usage in internals. PR-URL: https://github.com/nodejs/node/pull/23025 Refs: https://github.com/nodejs/node/commit/2a9eb31 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-08-18v8: move process.binding('v8') to internalBindingJames M Snell
PR-URL: https://github.com/nodejs/node/pull/22288 Refs: https://github.com/nodejs/node/issues/22160 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Yuta Hiroto <hello@hiroppy.me> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-08-08v8: move serdes to internalBindingGus Caplan
PR-URL: https://github.com/nodejs/node/pull/22161 Refs: https://github.com/nodejs/node/issues/22160 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2018-06-14v8: replace Buffer with FastBuffer in deserializeUjjwal Sharma
Replace the Buffer constructor with a FastBuffer in v8.deserialize in order to avoid calling the Buffer constructor and thus triggering a deprecation warning from code inside the core. Fixes: https://github.com/nodejs/node/issues/21181 PR-URL: https://github.com/nodejs/node/pull/21196 Fixes: https://github.com/nodejs/node/issues/21181 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-04-22lib: remove unnecessary assignment of exportsDaniel Bevenius
This commit removes the assignment of exports since it is not used in these files and there is no harm re-assigning module.exports. PR-URL: https://github.com/nodejs/node/pull/20143 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jackson Tian <shyvo1987@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-03-25lib: always show ERR_INVALID_ARG_TYPE received partRuben Bridgewater
This makes a effort to make sure all of these errors will actually also show the received input. On top of that it refactors a few tests for better maintainability. It will also change the returned type to always be a simple typeof instead of special handling null. PR-URL: https://github.com/nodejs/node/pull/19445 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-03-05lib: port errors to new systemMichaël Zasso
This is a first batch of updates that touches non-underscored modules in lib. PR-URL: https://github.com/nodejs/node/pull/19034 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2017-10-29v8: migrate setFlagsFromString to internal/errorsJames M Snell
PR-URL: https://github.com/nodejs/node/pull/16535 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-06-28v8: add new to the throw statementRuben Bridgewater
PR-URL: https://github.com/nodejs/node/pull/13857 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-06-12v8: add a js class for Serializer/DserializerRajaram Gaunker
Calling Serializer/Deserializer without new crashes node. Adding a js class which just inherits cpp bindings. Added regression tests. Fixes: https://github.com/nodejs/node/issues/13326 PR-URL: https://github.com/nodejs/node/pull/13541 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-04-28v8: refactor struture of v8 moduleJames M Snell
Use the more efficient module.exports = {} pattern, restructure imports from bindings, requires. PR-URL: https://github.com/nodejs/node/pull/12681 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2017-04-03v8: fix offsets for TypedArray deserializationAnna Henningsen
Fix the offset calculation for deserializing TypedArrays that are not aligned in their original buffer. Since `byteOffset` refers to the offset into the source `Buffer` instance, not its underlying `ArrayBuffer`, that is what should be passed to `buffer.copy`. PR-URL: https://github.com/nodejs/node/pull/12143 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-03-29v8: expose new V8 serialization APIAnna Henningsen
Expose the new serialization API that was added in V8 5.5 to userland. The JS API is virtually a direct copy of what V8 provides on the C++ level. This is useful Node as a possible replacement for some internals that currently use JSON, like IPC, but is likely to be useful to general userland code as well. PR-URL: https://github.com/nodejs/node/pull/11048 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-03-05v8: add cachedDataVersionTagAndres Suarez
Adds `v8.cachedDataVersionTag()`, which returns an integer representing the version tag for `cachedData` for the current V8 version & flags. PR-URL: https://github.com/nodejs/node/pull/11515 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-12-11lib,src: support values > 4GB in heap statisticsBen Noordhuis
We were transporting the heap statistics as uint32 values to JS land but those wrap around for values > 4 GB. Use 64 bits floats instead, those should last us a while. Fixes: https://github.com/nodejs/node/issues/10185 PR-URL: https://github.com/nodejs/node/pull/10186 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
2016-11-20src: extend `HeapStatistics` with new fieldsGareth Ellis
src: Add does_zap_garbage, malloced_memory and peak_malloced_memory to v8 HeapStatistics Following https://github.com/nodejs/code-and-learn/issues/56 I have exposed does_zap_garbage to HeapStatistics. The other fields, malloced_memory and peak_malloced_memory don't seem to be in the current version of v8 in master. PR-URL: https://github.com/nodejs/node/pull/8610 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-10-04lib: remove let from for loopsMyles Borins
This is a known de-opt. It may not be 100% necessary in all cases but it seems like a decent enough idea to avoid it. PR-URL: https://github.com/nodejs/node/pull/8873 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
2016-01-18v8,src: expose statistics about heap spacesBen Ripkens
Provide means to inspect information about the separate heap spaces via a callable API. This is helpful to analyze memory issues. Fixes: https://github.com/nodejs/node/issues/2079 PR-URL: https://github.com/nodejs/node/pull/4463 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
2015-08-11src: add total_available_size to v8 statisticsRoman Klauke
v8 introduced the new flag `total_available_size` in version 4.4 and upwards. This flag is now available on `v8.getHeapStatistics` with the name `total_available_size`. It contains the total available heap size of v8. Introduced with commit: v8/v8-git-mirror@0a1352a7 PR-URL: https://github.com/nodejs/io.js/pull/2348 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-08-04deps: update v8 to 4.4.63.9Ben Noordhuis
Upgrade the bundled V8 and update code in src/ and lib/ to the new API. Notable backwards incompatible changes are the removal of the smalloc module and dropped support for CESU-8 decoding. CESU-8 support can be brought back if necessary by doing UTF-8 decoding ourselves. This commit includes https://codereview.chromium.org/1192973004 to fix a build error on python 2.6 systems. The original commit log follows: Use optparse in js2c.py for python compatibility Without this change, V8 won't build on RHEL/CentOS 6 because the distro python is too old to know about the argparse module. PR-URL: https://github.com/nodejs/io.js/pull/2022 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-04-29lib: deprecate the smalloc moduleBen Noordhuis
Upcoming V8 changes will make it impossible to keep supporting the smalloc module so deprecate it now and tell people to switch to typed arrays. The module is used in core in a few places so this commit makes the public module private and replaces the public part with wrappers that print deprecation notices. PR-URL: https://github.com/iojs/io.js/pull/1564 Reviewed-By: Domenic Denicola <domenic@domenicdenicola.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-01-21lib: use const to define constantscjihrig
This commit replaces a number of var statements throughout the lib code with const statements. PR-URL: https://github.com/iojs/io.js/pull/541 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-21v8: optimize `getHeapStatistics`Vladimir Kurchatkin
Since setting object properties in C++ can be slow, pass data to JS using preallocated smalloc buffer and create object in JS instead. PR-URL: https://github.com/iojs/io.js/pull/469 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2014-12-18lib,src: remove post-gc event infrastructureBen Noordhuis
Remove the 'gc' event from the v8 module and remove the supporting infrastructure from src/. It gets the axe because: 1. There are currently no users. It was originally conceived as an upstreamed subset of StrongLoop's strong-agent GC metrics, but the strong-agent code base has evolved considerably since that time and has no use anymore for what is in core. 2. The implementation is not quite sound. It calls into JS land from inside the GC epilog and that is unsafe. We could fix that by delaying the callback until a safe time but because there are no users anyway, removing it is all around easier. PR-URL: https://github.com/iojs/io.js/pull/174 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2014-12-14lib: reintroduce v8 moduleBen Noordhuis
I introduced this module over a year ago in a pull request as the v8 module but it was quickly subsumed by the tracing module. The tracing module was recently removed again and that is why this commit introduces the v8 module again, including the new features it picked up commits d23ac0e and f8076c4. PR-URL: https://github.com/iojs/io.js/pull/131 Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: Christian Tellnes <christian@tellnes.no> Reviewed-By: Thorsten Lorenz <thlorenz@gmx.de> Reviewed-By: Trevor Norris <trev.norris@gmail.com>