James M Snell
e03af77418
src: improve error handling in buffer and dotenv
...
Replacing ToLocalChecked()
PR-URL: https://github.com/nodejs/node/pull/57189
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
2025-02-25 16:41:10 -08:00
James M Snell
a724a9e8dd
src: replace NewFromUtf8 with OneByteString where appropriate
...
PR-URL: https://github.com/nodejs/node/pull/57096
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2025-02-18 21:40:13 +00:00
James M Snell
869ea331f3
src: replace NoArrayBufferZeroFillScope with v8 option
...
NoArrayBufferZeroFillScope was added before the v8 option to
create uninitialized backing stores was added. We can start
moving away from it.
PR-URL: https://github.com/nodejs/node/pull/56658
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2025-01-23 15:02:04 -08:00
Michaël Zasso
9f2885ad21
Revert "src: migrate String::Value to String::ValueView"
...
This reverts commit 45c6a9e1f6 .
PR-URL: https://github.com/nodejs/node/pull/55828
Fixes: https://github.com/nodejs/node/issues/55826
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Jason Zhang <xzha4350@gmail.com >
2024-11-16 23:42:26 +00:00
Aviv Keller
45c6a9e1f6
src: migrate String::Value to String::ValueView
...
Fixes #54417
Ref: #55452
PR-URL: https://github.com/nodejs/node/pull/55458
Refs: https://github.com/nodejs/node/issues/55452
Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-10-29 00:32:26 +00:00
Aviv Keller
e4ca097f56
src: switch from Get/SetPrototype to Get/SetPrototypeV2
...
PR-URL: https://github.com/nodejs/node/pull/55453
Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-10-22 05:05:19 +00:00
Yagiz Nizipli
317d2450f9
src: modernize likely/unlikely hints
...
PR-URL: https://github.com/nodejs/node/pull/55155
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
2024-09-30 18:04:16 +00:00
Robert Nagy
0d4387ebe2
buffer: use simdutf convert_latin1_to_utf8_safe
...
simdutf 5.5 includes convert_latin1_to_utf8_safe
PR-URL: https://github.com/nodejs/node/pull/54798
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Daniel Lemire <daniel@lemire.me >
2024-09-18 18:39:01 +00:00
Gabriel Schulhof
d38dc99a95
src: add Cleanable class to Environment
...
We store a linked list of `Cleanable` objects on the
`node::Environment` and invoke their `Clean()` method during env
teardown.
This eliminates the need for adding many cleanup hooks.
PR-URL: https://github.com/nodejs/node/pull/54880
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2024-09-13 14:30:32 +00:00
Robert Nagy
dc74f17f6c
buffer: re-enable Fast API for Buffer.write
...
Re-enables fast Fast API for Buffer.write after fixing
UTF8 handling.
Fixes: https://github.com/nodejs/node/issues/54521
PR-URL: https://github.com/nodejs/node/pull/54526
Reviewed-By: Daniel Lemire <daniel@lemire.me >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
2024-09-04 22:34:29 +00:00
Michaël Zasso
7616855b2a
src: disable fast methods for buffer.write
...
It should resolve the regressions while we work on fixing them.
Refs: https://github.com/nodejs/node/issues/54521
PR-URL: https://github.com/nodejs/node/pull/54565
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-08-29 07:06:40 +00:00
Robert Nagy
2c1461541f
buffer: properly apply dst offset and src length on fast path
...
Refs: https://github.com/nodejs/node/pull/54311#issuecomment-2290453437
PR-URL: https://github.com/nodejs/node/pull/54391
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
2024-08-15 18:31:10 +00:00
Robert Nagy
ccf05ef751
buffer: use fast API for writing one-byte strings
...
PR-URL: https://github.com/nodejs/node/pull/54310
PR-URL: https://github.com/nodejs/node/pull/54311
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2024-08-15 01:01:05 +00:00
Robert Nagy
75d25bc6db
buffer: optimize byteLength for short strings
...
PR-URL: https://github.com/nodejs/node/pull/54345
Reviewed-By: Daniel Lemire <daniel@lemire.me >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-08-14 21:22:13 +00:00
Robert Nagy
9f083203b0
buffer: optimize createFromString
...
PR-URL: https://github.com/nodejs/node/pull/54324
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-08-14 13:34:07 +00:00
Robert Nagy
76c8ba9d9b
buffer: use native copy impl
...
PR-URL: https://github.com/nodejs/node/pull/54087
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Daniel Lemire <daniel@lemire.me >
2024-08-02 09:19:41 +00:00
James M Snell
d335487e3f
src, deps: add nbytes library
...
Projects that seek to implement Node.js compatible APIs end up
needed to reproduce various bits of functionality internally in
order to faithfully replicate the Node.js behaviors. This is
particularly true for things like byte manipulation, base64 and
hex encoding, and other low-level operations. This change
proposes moving much of this low-level byte manipulation code
out of nodejs/src and into a new `nbytes` library. Initially this
new library will exist in the `deps` directory but the intent is
to spin out a new separate repository to be its home in the future.
Doing so will allow other projects to use the nbytes library with
exactly the same implementation as Node.js.
This commit moves only the byte swapping and legacy base64 handling
code. Additional commits will move additional byte manipulation
logic into the library.
PR-URL: https://github.com/nodejs/node/pull/53507
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2024-06-21 07:38:37 -07:00
Tobias Nießen
103623b5ae
buffer: make indexOf(byte) faster
...
Add a V8 fast API implementation for indexOfNumber, which significantly
improves the performance of finding a single byte within a buffer.
Refs: https://github.com/nodejs/node/pull/52993
PR-URL: https://github.com/nodejs/node/pull/53455
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
2024-06-16 17:44:58 +00:00
Tobias Nießen
177b8b957b
src: convert all endian checks to constexpr
...
This is finally possible in C++20 without having to rely on
compiler-defined macros, assuming none of our supported platforms are
mixed-endian.
Refs: https://github.com/nodejs/node/pull/44411
PR-URL: https://github.com/nodejs/node/pull/52974
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-05-25 09:04:20 +00:00
Tobias Nießen
075853ed19
buffer: make compare/equals faster
...
This patch adds a V8 fast API implementation for the buffer.compare
binding, which is used both by Buffer.prototype.equals and
Buffer.prototype.compare. In particular, it significantly improves the
performance of comparing buffers for equality.
PR-URL: https://github.com/nodejs/node/pull/52993
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
2024-05-16 22:47:12 +00:00
Daniel Lemire
11c90c15fb
buffer: even faster atob
...
PR-URL: https://github.com/nodejs/node/pull/52443
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2024-05-12 19:29:25 +00:00
Yagiz Nizipli
21211a3fa9
buffer: improve btoa performance
...
PR-URL: https://github.com/nodejs/node/pull/52427
Reviewed-By: Daniel Lemire <daniel@lemire.me >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-04-11 11:41:44 +00:00
Yagiz Nizipli and Daniel Lemire
6f504b71ac
buffer: use simdutf for atob implementation
...
Co-authored-by: Daniel Lemire <daniel@lemire.me >
PR-URL: https://github.com/nodejs/node/pull/52381
Refs: https://github.com/nodejs/node/pull/51670
Reviewed-By: Daniel Lemire <daniel@lemire.me >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
2024-04-08 12:43:28 +00:00
Michaël Zasso and Joyee Cheung
ec1550407b
src: stop using v8::BackingStore::Reallocate
...
It's being deprecated by V8.
Explicitly allocate a new ArrayBuffer and copy the data when needed
instead.
Fixes: https://github.com/nodejs/node/issues/52234
Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/52292
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2024-04-05 09:20:10 +00:00
Daniel Lemire
891bd5b7d5
src: implement FastByteLengthUtf8 with simdutf::utf8_length_from_latin1
...
PR-URL: https://github.com/nodejs/node/pull/50840
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
2023-12-19 17:11:19 +00:00
Chengzhong Wu
e6b4d30a2f
src: bootstrap Web [Exposed=*] APIs in the shadow realm
...
This is the initial work to bootstrap Web interfaces that are defined
with extended attributes `[Exposed=*]`.
The ShadowRealm instances are garbage-collected once it is
unreachable. However, V8 can not infer the reference cycles between
the per-realm strong persistent function handles and the realm's
context handle. To allow the context to be gc-ed once it is not
reachable, the per-realm persistent handles are attached to the
context's global object and the persistent handles are set as weak.
PR-URL: https://github.com/nodejs/node/pull/46809
Refs: https://github.com/nodejs/node/issues/42528
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2023-03-16 00:22:06 +08:00
Joyee Cheung
25c21868b8
src: move encoding bindings to a new binding
...
Move the bindings used by TextEncoder to a new binding for
more self-contained code.
PR-URL: https://github.com/nodejs/node/pull/46658
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2023-03-07 22:45:42 +01:00
Joyee Cheung
ee1ce1872f
buffer: use v8 fast API calls for Buffer.byteLength implementation
...
Use v8 fast API calls for Buffer.byteLength with sequential one-byte
strings.
PR-URL: https://github.com/nodejs/node/pull/46616
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-02-26 19:02:45 +01:00
Yagiz Nizipli
babe6d7c84
buffer: add isAscii method
...
PR-URL: https://github.com/nodejs/node/pull/46046
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2023-01-20 03:24:40 +00:00
Yagiz Nizipli
d5a08c7e11
buffer: add buffer.isUtf8 for utf8 validation
...
PR-URL: https://github.com/nodejs/node/pull/45947
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2022-12-25 02:32:05 +00:00
Yagiz Nizipli
2ef13b8fb6
util: add fast path for text-decoder fatal flag
...
PR-URL: https://github.com/nodejs/node/pull/45803
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michael Dawson <midawson@redhat.com >
2022-12-22 20:22:28 +00:00
legendecas
71ff89f929
src: rename internal module declaration as internal bindings
...
This is a continuation of the name reification on the internal bindings.
Renames NODE_MODULE_CONTEXT_AWARE_INTERNAL and
NODE_MODULE_EXTERNAL_REFERENCE to NODE_BINDING_CONTEXT_AWARE_INTERNAL
and NODE_BINDING_EXTERNAL_REFERENCE respectively.
PR-URL: https://github.com/nodejs/node/pull/45551
Refs: https://github.com/nodejs/node/issues/44036
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2022-11-29 00:23:08 +08:00
Michaël Zasso
a6242772ec
src: fix ArrayBuffer::Detach deprecation
...
PR-URL: https://github.com/nodejs/node/pull/45579
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-11-27 17:27:21 +00:00
Yagiz Nizipli
60810f0da6
buffer: make decodeUTF8 params loose
...
PR-URL: https://github.com/nodejs/node/pull/45610
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2022-11-27 06:48:51 +00:00
Yagiz Nizipli and Anna Henningsen
4ac830effd
util: add fast path for utf8 encoding
...
Co-authored-by: Anna Henningsen <anna@addaleax.net >
PR-URL: https://github.com/nodejs/node/pull/45412
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com >
2022-11-12 21:31:44 +00:00
Keyhan Vakil
6e418ff94f
src,buffer: remove unused chars_written parameter
...
This parameter was always being set to `nullptr` by its callers, either
explicitly or implicitly via the default argument. It was also buggy, as
in some cases it wouldn't be written to, potentially leaking stack
memory (see the early returns in `StringBytes::WriteUCS2`). Remove it
entirely.
PR-URL: https://github.com/nodejs/node/pull/44092
Reviewed-By: Feng Yu <F3n67u@outlook.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2022-08-04 02:18:38 +00:00
Keyhan Vakil
8c35a4e4e6
src: remove unowned usages of GetBackingStore
...
This removes all usages of GetBackingStore without any entries in the
`CODEOWNERS` file. For the most part this is a pretty straightforward
review; except `SPREAD_BUFFER_ARG` and the changes to `CopyArrayBuffer`.
See the linked issue for an explanation.
Refs: https://github.com/nodejs/node/issues/32226
Refs: https://github.com/nodejs/node/pull/43921
PR-URL: https://github.com/nodejs/node/pull/44080
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2022-08-03 06:45:45 +00:00
legendecas
a7e5b413ef
src: split property helpers from node::Environment
...
PR-URL: https://github.com/nodejs/node/pull/44056
Refs: https://github.com/nodejs/node/issues/42528
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Feng Yu <F3n67u@outlook.com >
2022-08-02 00:01:02 +08:00
Keyhan Vakil
e8e92ec2d1
buffer: do not leak memory if buffer is too big
...
A recent pull request changed this method to throw when the buffer was
too big, but this meant that the `free` finalizer would never get
called, leading to a memory leak.
A previous version of this diff included a test provoking this behavior
with `v8.serialize`, but it unfortunately kept triggering the OOM
killer, so it was removed.
Refs: https://github.com/nodejs/node/pull/40243
PR-URL: https://github.com/nodejs/node/pull/43938
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2022-07-25 00:06:08 +01:00
Darshan Sen
f91dcc205d
src: delete AllocatedBuffer
...
Since all its uses are now gone, it's time to say goodbye to
AllocatedBuffer.
Refs: https://github.com/nodejs/node/pull/39941
Signed-off-by: Darshan Sen <raisinten@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/43008
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2022-05-13 15:24:13 +01:00
liuxingbaoyu
ce29d2847b
src: fix memory leak for v8.serialize
...
When Buffer::New passes in existing data,
it cannot be garbage collected in js synchronous execution.
Fixes: https://github.com/nodejs/node/issues/40828
Refs: https://github.com/nodejs/node/issues/38300
PR-URL: https://github.com/nodejs/node/pull/42695
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2022-05-02 20:45:47 +01:00
Tobias Nießen
afcfaa07ac
src: simplify bound check in ParseArrayIndex
...
PR-URL: https://github.com/nodejs/node/pull/42306
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-03-14 16:36:39 +00:00
Darshan Sen
5edad38328
src,buffer: evaluate THROW_AND_RETURN_IF_OOB() expression only once
...
There's no need to evaluate the expression passed into the macro more
than once.
Fixes: https://github.com/nodejs/node/issues/41935
Signed-off-by: Darshan Sen <raisinten@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/41945
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2022-02-18 00:05:42 +01:00
Ray Wang
7b49e29939
src: throw error instead of assertion
...
PR-URL: https://github.com/nodejs/node/pull/40243
Fixes: https://github.com/nodejs/node/issues/40059
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2021-10-23 08:47:13 +02:00
Darshan Sen
7cc96b2eaf
src: remove usage of AllocatedBuffer from src/node_buffer.cc
...
Since AllocatedBuffer is just a thin wrapper around v8::BackingStore, we
should prefer using v8::BackingStore directly.
Refs: https://github.com/nodejs/node/blob/52abf271c563ddffdc93b444ea05e5347a7f2784/src/allocated_buffer.h#L30-L31
Signed-off-by: Darshan Sen <darshan.sen@postman.com >
PR-URL: https://github.com/nodejs/node/pull/39941
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-09-03 07:42:27 -07:00
James M Snell
31d1d0c4c1
url,buffer: implement URL.createObjectURL
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/39693
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2021-08-12 07:23:15 -07:00
James M Snell
fa0c6883a6
stream: implement WHATWG streams
...
Experimental implementation of the WHATWG streams standard.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/39062
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2021-06-30 12:54:41 -07:00
Darshan Sen
7766b3853a
src: fix compiler warnings in node_buffer.cc
...
The variables could be initialized to `0` to avoid the warnings from
`-Wmaybe-uninitialized`.
Fixes: https://github.com/nodejs/node/issues/38718
PR-URL: https://github.com/nodejs/node/pull/38722
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2021-05-24 07:37:18 -07:00
James M Snell
720fdf2f80
src: avoid deferred gc/cleanup for Buffer.from
...
Previously, the code path would allocated a tracked ArrayBuffer
that defers cleanup and deallocation of the underlying data with
a SetImmediate. Avoid the unnecessary deferral by just allocating
a `BackingStore` directly and writing into it.
Fixes: https://github.com/nodejs/node/issues/38300
Refs: https://github.com/nodejs/node/pull/38336
PR-URL: https://github.com/nodejs/node/pull/38337
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Khaidi Chu <i@2333.moe >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2021-04-24 10:22:38 +02:00
James M Snell
d4bea09a0a
buffer: introduce Blob
...
The `Blob` object is an immutable data buffer. This is a first step
towards alignment with the `Blob` Web API.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36811
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-01-18 13:55:25 -08:00