Commit Graph

22 Commits

Author SHA1 Message Date
Ben Noordhuis
1643b9ed19
v8: serialize BigInt64Array and BigUint64Array
Teach the serializer about BigInt64Array and BigUint64Array.

I open-coded the type-to-index mapper to stay compatible with the
current wire format without undue code gymnastics.

PR-URL: https://github.com/nodejs/node/pull/43571
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-07-15 08:56:04 +01:00
Michaël Zasso
0854fce8bc
test: adapt test-v8-serdes for V8 9.9
V8 changed the serialization format so we cannot expect that a value
serialized by an old version can be reserialized to the same bytes.
Change the test to expect that deserialization of the old value still
works.

Add another test which is expected to fail when the format changes so
that we are aware when it happens and can call it out in the release
notes.

Closes: https://github.com/nodejs/node/issues/41519

PR-URL: https://github.com/nodejs/node/pull/42657
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2022-04-12 22:11:03 +02:00
Michaël Zasso
f691deef26
test: fix V8 serdes test for V8 9.1
Refs: 40e499cd28

PR-URL: https://github.com/nodejs/node/pull/38273
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
2021-06-10 11:11:47 +02:00
cjihrig
e96773b94b
test: add regression test for serdes readDouble()
Refs: https://github.com/nodejs/node/issues/37978
PR-URL: https://github.com/nodejs/node/pull/38121
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2021-04-08 22:27:04 -04:00
Rich Trott
330f25ef82 test: prepare for consistent comma-dangle lint rule
Make changes so that tests will pass when the comma-dangle settings
applied to the rest of the code base are also applied to tests.

PR-URL: https://github.com/nodejs/node/pull/37930
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
2021-04-01 23:14:29 -07:00
Rich Trott
c14284fb0b test: add DataView test case for v8 serdes
This completes code coverage for v8.js.

Refs: https://coverage.nodejs.org/coverage-290c158018ac0277/lib/v8.js.html#L240

PR-URL: https://github.com/nodejs/node/pull/37955
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2021-03-30 03:54:01 -07:00
ExE Boss
d90fa196c5
v8: fix native serdes constructors
Fixes: https://github.com/nodejs/node/issues/13326
Refs: https://github.com/nodejs/node/pull/13541
PR-URL: https://github.com/nodejs/node/pull/36549
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2020-12-22 14:13:56 +01:00
Matheus Marchini
119fdf6813
test: remove checks for deserializing wasm
V8 is removing support for serializing wasm modules via the value
serializer. Once this is complete (https://crrev.com/c/2013110), we can
re-add this test.

PR-URL: https://github.com/nodejs/node/pull/32116
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2020-03-18 16:37:20 -07:00
Anna Henningsen
afd29c9502
v8: inspect unserializable objects
This would otherwise sometimes just print relatively useless
information about the value in question, such as `[object Object]`.

PR-URL: https://github.com/nodejs/node/pull/30167
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: David Carlier <devnexen@gmail.com>
2019-11-05 20:01:39 +01:00
ZYSzys
dcc5e51e1c tools: force common be required before any other modules
PR-URL: https://github.com/nodejs/node/pull/27650
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-05-13 19:39:34 +08:00
Gus Caplan
0c8dedd103
test: clean up wasm fixtures
PR-URL: https://github.com/nodejs/node/pull/25360
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-01-08 12:57:24 -06:00
Anna Henningsen
47a9eea8c8
v8: enable inline WASM in serialization API
Since the API we expose through the `v8` module is Buffer-based,
we cannot transfer WASM modules directly. Instead, we enable
the V8-provided inline WASM (de)serialization for WASM modules.

PR-URL: https://github.com/nodejs/node/pull/25313
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gus Caplan <me@gus.host>
2019-01-06 00:52:57 +01:00
cjihrig
e7658471d3
test: remove unnecessary test flags
This commit removes unnecessary flags used when starting
tests via the "// Flags:" directive.

PR-URL: https://github.com/nodejs/node/pull/25277
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-01-01 09:57:32 -05:00
Ouyang Yadong
56881b0d95 lib: enable TypedArray and DataView for the v8 module
This commit allow passing `TypedArray` and `DataView` to:
- v8.deserialize()
- new v8.Deserializer()
- v8.serializer.writeRawBytes()

PR-URL: https://github.com/nodejs/node/pull/23953
Refs: https://github.com/nodejs/node/issues/1826
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2018-10-31 10:41:41 -04:00
Anto Aravinth
dcc0c2c5c9
lib: move process.binding('js_stream') to internalBinding
PR-URL: https://github.com/nodejs/node/pull/22239
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-09-18 13:29:55 +02:00
Anna Henningsen
70670b056a test: make test-v8-serdes work without stdin
If `stdin` was closed or referred to a file, this didn't work,
because it was accessed via file descriptor.

Instead, use another generic native object.

cherry-picked from https://github.com/ayojs/ayo/pull/63

Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-25 07:15:44 +02:00
Aditya Anand
ad664eae7d
test: mitigate RegEx exceeding 80 chars
Format commit wrapping lines containing RegEx and exceeding 80
chars.

PR-URL: https://github.com/nodejs/node/pull/14607
Fixes: https://github.com/nodejs/node/issues/14586
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2017-08-07 19:13:41 -04:00
Rich Trott
aa6fac68da test: adjust indentation for stricter linting
ESLint 4.x has stricter linting than previous versions. We are currently
using the legacy indentation rules in the test directory. This commit
changes the indentation of files to comply with the stricter 4.x linting
and enable stricter linting in the test directory.

PR-URL: https://github.com/nodejs/node/pull/14431
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2017-07-27 09:24:20 -07:00
Rajaram Gaunker
12fd63d6bb
v8: add a js class for Serializer/Dserializer
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-06-12 14:08:49 +02:00
Anna Henningsen
9b05393362
test: fix V8 test on big-endian machines
Ref: https://github.com/nodejs/node/pull/12143#issuecomment-291131159
PR-URL: https://github.com/nodejs/node/pull/12186
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-04-03 15:15:08 +02:00
Anna Henningsen
33a19b46ca v8: fix offsets for TypedArray deserialization
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-04-03 10:38:10 +02:00
Anna Henningsen
1fde98bb4f
v8: expose new V8 serialization API
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-29 05:14:55 +02:00