buffer: implement Uint8Array backed Buffer
authorTrevor Norris <trev.norris@gmail.com>
Tue, 26 May 2015 18:42:14 +0000 (12:42 -0600)
committerRod Vagg <rod@vagg.org>
Tue, 4 Aug 2015 18:56:10 +0000 (11:56 -0700)
commit63da0dfd3a4460e117240e84b57af2137469497e
tree4806693f7d89ba36ebbe4ff1ab5f34e1b3cf90ea
parent23be6ca189e1ebad24a814ed1c8c1c241fee354e
buffer: implement Uint8Array backed Buffer

With V8 4.4 removing the external array data API currently used by
Buffer, the new implementation uses the Uint8Array to back Buffer.

Buffers now have a maximum size of Smi::kMaxLength, as defined by V8.
Which is ~2 GB on 64 bit and ~1 GB on 32 bit.

The flag --use-old-buffer allows using the old Buffer implementation.
This flag will be removed once V8 4.4 has landed.

The two JS Buffer implementations have been split into two files for
simplicity.

Use getter to return expected .parent/.offset values for backwards
compatibility.

PR-URL: https://github.com/nodejs/io.js/pull/1825
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
13 files changed:
lib/buffer.js
lib/internal/buffer_new.js [new file with mode: 0644]
lib/internal/buffer_old.js [new file with mode: 0644]
node.gyp
src/env.h
src/node.cc
src/node_buffer.cc
src/node_buffer.h
src/node_internals.h
src/util-inl.h
src/util.h
test/parallel/test-buffer-slice.js [deleted file]
test/parallel/test-buffer.js