From: isaacs Date: Fri, 11 Jan 2013 18:18:07 +0000 (-0800) Subject: Merge remote-tracking branch 'ry/v0.8' into master X-Git-Tag: v0.9.6~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97db62b4d9f7de385ccbcddb70ae048b050f5c24;p=platform%2Fupstream%2Fnodejs.git Merge remote-tracking branch 'ry/v0.8' into master Conflicts: AUTHORS ChangeLog Makefile src/node_version.h --- 97db62b4d9f7de385ccbcddb70ae048b050f5c24 diff --cc AUTHORS index 8c19b81,35b6305..c2d23b9 --- a/AUTHORS +++ b/AUTHORS @@@ -381,18 -370,8 +381,20 @@@ Igor Soarez Francois Marier Trevor Norris -Joshua Erickson Kai Sasaki Lewuathe + Nicolas Chambrier + Tim Bradshaw + Johannes Ewald +Brandon Philips +Frederico Silva +Jan Wynholds +Girish Ramakrishnan +Anthony Pesch +Stephen Gallagher +Sergey Kholodilov +Tim Kuijsten +Michael Axiak +Chad Rhyner - Nicolas Chambrier +Ben Taber +Luke Arduini +Luke Bayes diff --cc ChangeLog index da9978b,9865581..33076aa --- a/ChangeLog +++ b/ChangeLog @@@ -1,245 -1,19 +1,260 @@@ - 2012.12.30, Version 0.9.5 (Unstable) -2013.01.09, Version 0.8.17 (Stable) + +* assert: improve support for new execution contexts (lukebayes) + +* domain: use camelCase instead of snake_case (isaacs) + +* domain: Do not use uncaughtException handler (isaacs) + +* fs: make 'end' work with ReadStream without 'start' (Ben Noordhuis) + +* https: optimize createConnection() (Ryunosuke SATO) + +* buffer: speed up base64 encoding by 20% (Ben Noordhuis) + +* doc: Colorize API stabilitity index headers in docs (Luke Arduini) + +* net: socket.readyState corrections (bentaber) + +* http: Performance enhancements for http under streams2 (isaacs) + +* stream: fix to emit end event on http.ClientResponse (Shigeki Ohtsu) + +* stream: fix event handler leak in readstream pipe and unpipe (Andreas Madsen) + +* build: Support ./configure --tag switch (Maciej Małecki) + +* repl: don't touch `require.cache` (Nathan Rajlich) + +* node: Emit 'exit' event when exiting for an uncaught exception (isaacs) + + +2012.12.21, Version 0.9.4 (Unstable), d86d83c75f6343b5368bb7bd328b4466a035e1d4 + +* streams: Update all streaming interfaces to use new classes (isaacs) + +* node: remove idle gc (Ben Noordhuis) + +* http: protect against response splitting attacks (Bert Belder) + +* fs: Raise error when null bytes detected in paths (isaacs) + +* fs: fix 'object is not a function' callback errors (Ben Noordhuis) + +* fs: add autoClose=true option to fs.createReadStream (Farid Neshat) + +* process: add getgroups(), setgroups(), initgroups() (Ben Noordhuis) + +* openssl: optimized asm code on x86 and x64 (Bert Belder) + +* crypto: fix leak in GetPeerCertificate (Fedor Indutny) + +* add systemtap support (Jan Wynholds) + +* windows: add ETW and PerfCounters support (Scott Blomquist) + +* windows: fix normalization of UNC paths (Bert Belder) + +* crypto: fix ssl error handling (Sergey Kholodilov) + +* node: remove eio-emul.h (Ben Noordhuis) + +* os: add os.endianness() function (Nathan Rajlich) + +* readline: don't emit "line" events with a trailing '\n' char (Nathan Rajlich) + +* build: add configure option to generate xcode build files (Timothy J Fontaine) + +* build: allow linking against system libuv, cares, http_parser (Stephen Gallagher) + +* typed arrays: add slice() support to ArrayBuffer (Anthony Pesch) + +* debugger: exit and kill child on SIGTERM or SIGHUP (Fedor Indutny) + +* url: url.format escapes delimiters in path and query (J. Lee Coltrane) + + +2012.10.24, Version 0.9.3 (Unstable), 1ed4c6776e4f52956918b70565502e0f8869829d + +* V8: Upgrade to 3.13.7.4 + +* crypto: Default to buffers instead of binary strings (isaacs, Fedor Indutny) + +* crypto: add getHashes() and getCiphers() (Ben Noordhuis) + +* unix: add custom thread pool, remove libeio (Ben Noordhuis) + +* util: make `inspect()` accept an "options" argument (Nathan Rajlich) + +* https: fix renegotation attack protection (Ben Noordhuis) + +* cluster: make 'listening' handler see actual port (Aaditya Bhatia) + +* windows: use USERPROFILE to get the user's home dir (Bert Belder) + +* path: add platform specific path delimiter (Paul Serby) + +* http: add response.headersSent property (Pavel Lang) + +* child_process: make .fork()'d child auto-exit (Ben Noordhuis) + +* events: add 'removeListener' event (Ben Noordhuis) + +* string_decoder: Add 'end' method, do base64 properly (isaacs) + +* buffer: include encoding value in exception when invalid (Ricky Ng-Adam) + +* http: make http.ServerResponse no longer emit 'end' (isaacs) + +* streams: fix pipe is destructed by 'end' from destination (koichik) + + +2012.09.17, Version 0.9.2 (Unstable), 6e2055889091a424fbb5c500bc3ab9c05d1c28b4 + +* http_parser: upgrade to ad3b631 + +* openssl: upgrade 1.0.1c + +* darwin: use FSEvents to watch directory changes (Fedor Indutny) + +* unix: support missing API on NetBSD (Shigeki Ohtsu) + +* unix: fix EMFILE busy loop (Ben Noordhuis) + +* windows: un-break writable tty handles (Bert Belder) + +* windows: map WSAESHUTDOWN to UV_EPIPE (Bert Belder) + +* windows: make spawn with custom environment work again (Bert Belder) + +* windows: map ERROR_DIRECTORY to UV_ENOENT (Bert Belder) + +* tls, https: validate server certificate by default (Ben Noordhuis) + +* tls, https: throw exception on missing key/cert (Ben Noordhuis) + +* tls: async session storage (Fedor Indutny) + +* installer: don't install header files (Ben Noordhuis) + +* buffer: implement Buffer.prototype.toJSON() (Nathan Rajlich) + +* buffer: added support for writing NaN and Infinity (koichik) + +* http: make http.ServerResponse emit 'end' (Ben Noordhuis) + +* build: ./configure --ninja (Ben Noordhuis, Timothy J Fontaine) + +* installer: fix --without-npm (Ben Noordhuis) + +* cli: make -p equivalent to -pe (Ben Noordhuis) + +* url: Go much faster by using Url class (isaacs) + + +2012.08.28, Version 0.9.1 (Unstable), e6ce259d2caf338fec991c2dd447de763ce99ab7 + +* buffer: Add Buffer.isEncoding(enc) to test for valid encoding values (isaacs) + +* Raise UV_ECANCELED on premature close. (Ben Noordhuis) + +* Remove c-ares from libuv, move to a top-level node dependency (Bert Belder) + +* ref/unref for all HandleWraps, timers, servers, and sockets (Timothy J Fontaine) + +* addon: remove node-waf, superseded by node-gyp (Ben Noordhuis) + +* child_process: emit error on exec failure (Ben Noordhuis) + +* cluster: do not use internal server API (Andreas Madsen) + +* constants: add O_DIRECT (Ian Babrou) + +* crypto: add sync interface to crypto.pbkdf2() (Ben Noordhuis) + +* darwin: emulate fdatasync() (Fedor Indutny) + +* dgram: make .bind() always asynchronous (Ben Noordhuis) + +* events: Make emitter.listeners() side-effect free (isaacs, Joe Andaverde) + +* fs: Throw early on invalid encoding args (isaacs) + +* fs: fix naming of truncate/ftruncate functions (isaacs) + +* http: bubble up parser errors to ClientRequest (Brian White) + +* linux: improve cpuinfo parser on ARM and MIPS (Ben Noordhuis) + +* net: add support for IPv6 addresses ending in :: (Josh Erickson) + +* net: support Server.listen(Pipe) (Andreas Madsen) + +* node: don't scan add-on for "init" symbol (Ben Noordhuis) + +* remove process.uvCounters() (Ben Noordhuis) + +* repl: console writes to repl rather than process stdio (Nathan Rajlich) + +* timers: implement setImmediate (Timothy J Fontaine) + +* tls: fix segfault in pummel/test-tls-ci-reneg-attack (Ben Noordhuis) + +* tools: Move gyp addon tools to node-gyp (Nathan Rajlich) + +* unix: preliminary signal handler support (Ben Noordhuis) + +* unix: remove dependency on ev_child (Ben Noordhuis) + +* unix: work around darwin bug, don't poll() on pipe (Fedor Indutny) + +* util: Formally deprecate util.pump() (Ben Noordhuis) + +* windows: make active and closing handle state independent (Bert Belder) + +* windows: report spawn errors to the exit callback (Bert Belder) + +* windows: signal handling support with uv_signal_t (Bert Belder) + + +2012.07.20, Version 0.9.0 (Unstable), f9b237f478c372fd55e4590d7399dcd8f25f3603 + +* punycode: update to v1.1.1 (Mathias Bynens) + +* c-ares: upgrade to 1.9.0 (Saúl Ibarra Corretgé) + +* dns: ignore rogue DNS servers reported by windows (Saúl Ibarra Corretgé) + +* unix: speed up uv_async_send() (Ben Noordhuis) + +* darwin: get cpu model correctly on mac (Xidorn Quan) + +* nextTick: Handle tick callbacks before any other I/O (isaacs) + +* Enable color customization of `util.inspect` (Pavel Lang) + +* tls: Speed and memory improvements (Fedor Indutny) + +* readline: Use one history item for reentered line (Vladimir Beloborodov) + +* Fix #3521 Make process.env more like a regular Object (isaacs) + + ++2013.01.09, Version 0.8.17 (Stable), c50c33e9397d7a0a8717e8ce7530572907c054ad + + * npm: Upgrade to v1.2.0 + - peerDependencies (Domenic Denicola) + - node-gyp v0.8.2 (Nathan Rajlich) + - Faster installs from github user/project shorthands (Nathan Zadoks) + + * typed arrays: fix 32 bit size/index overflow (Ben Noordhuis) + + * http: Improve performance of single-packet responses (Ben Noordhuis) + + * install: fix openbsd man page location (Ben Noordhuis) + + * http: bubble up parser errors to ClientRequest (Brian White) + + 2012.12.13, Version 0.8.16 (Stable), 1c9c6277d5cfcaaac8569c0c8f7daa64292048a9 * npm: Upgrade to 1.1.69 diff --cc Makefile index 0dde96c,0ebc14f..779547b --- a/Makefile +++ b/Makefile @@@ -295,7 -278,7 +295,7 @@@ tar: $(TARBALL $(BINARYTAR): release-only rm -rf $(BINARYNAME) rm -rf out/deps out/Release - $(PYTHON) ./configure --prefix=/ --without-snapshot --dest-cpu=$(DESTCPU) - ./configure --prefix=/ --without-snapshot --dest-cpu=$(DESTCPU) $(CONFIG_FLAGS) ++ $(PYTHON) ./configure --prefix=/ --without-snapshot --dest-cpu=$(DESTCPU) $(CONFIG_FLAGS) $(MAKE) install DESTDIR=$(BINARYNAME) V=$(V) PORTABLE=1 cp README.md $(BINARYNAME) cp LICENSE $(BINARYNAME) diff --cc doc/api/process.markdown index 6a2f4a7,7938133..a6f160d --- a/doc/api/process.markdown +++ b/doc/api/process.markdown @@@ -530,15 -418,14 +530,14 @@@ You may pass in the result of a previou a diff reading, useful for benchmarks and measuring intervals: var time = process.hrtime(); - // [ 1800216, 927643717 ] + // [ 1800216, 25 ] - setTimeout(function () { + setTimeout(function() { var diff = process.hrtime(time); - // [ 1, 6962306 ] + // [ 1, 552 ] - console.log('benchmark took %d seconds and %d nanoseconds', - diff[0], diff[1]); - // benchmark took 1 seconds and 6962306 nanoseconds + console.log('benchmark took %d nanoseconds', diff[0] * 1e9 + diff[1]); + // benchmark took 1000000527 nanoseconds }, 1000); [EventEmitter]: events.html#events_class_events_eventemitter diff --cc src/v8_typed_array.cc index 1d2ffc4,783ce34..be9f480 --- a/src/v8_typed_array.cc +++ b/src/v8_typed_array.cc @@@ -21,9 -21,9 +21,10 @@@ #include // calloc, etc #include // memmove + #include #include "v8_typed_array.h" +#include "v8_typed_array_bswap.h" #include "node_buffer.h" #include "node.h" #include "v8.h" @@@ -674,28 -721,19 +675,31 @@@ class DataView unsigned int index = args[0]->Uint32Value(); bool little_endian = args[1]->BooleanValue(); // TODO(deanm): All of these things should be cacheable. - int element_size = SizeOfArrayElementForType( + int element_size = v8_typed_array::SizeOfArrayElementForType( args.This()->GetIndexedPropertiesExternalArrayDataType()); - int size = args.This()->GetIndexedPropertiesExternalArrayDataLength() * - element_size; + assert(element_size > 0); + int size = args.This()->GetIndexedPropertiesExternalArrayDataLength(); + assert(size >= 0); - if (index + sizeof(T) > (unsigned)size) // TODO(deanm): integer overflow. + if (static_cast(index) + sizeof(T) > + static_cast(size) * element_size) { return ThrowError("Index out of range."); + } - void* ptr = args.This()->GetIndexedPropertiesExternalArrayData(); - return cTypeToValue(getValue(ptr, index, !little_endian)); + void* ptr = reinterpret_cast( + args.This()->GetIndexedPropertiesExternalArrayData()) + index; + + T val; +#if V8_TYPED_ARRAY_LITTLE_ENDIAN + if (!little_endian) { +#else + if (little_endian) { +#endif + val = v8_typed_array::LoadAndSwapBytes(ptr); + } else { + memcpy(&val, ptr, sizeof(T)); + } + return cTypeToValue(val); } template @@@ -706,27 -744,19 +710,30 @@@ unsigned int index = args[0]->Int32Value(); bool little_endian = args[2]->BooleanValue(); // TODO(deanm): All of these things should be cacheable. - int element_size = SizeOfArrayElementForType( + int element_size = v8_typed_array::SizeOfArrayElementForType( args.This()->GetIndexedPropertiesExternalArrayDataType()); - int size = args.This()->GetIndexedPropertiesExternalArrayDataLength() * - element_size; + assert(element_size > 0); + int size = args.This()->GetIndexedPropertiesExternalArrayDataLength(); + assert(size >= 0); - if (index + sizeof(T) > (unsigned)size) // TODO(deanm): integer overflow. + if (static_cast(index) + sizeof(T) > + static_cast(size) * element_size) { return ThrowError("Index out of range."); + } - void* ptr = args.This()->GetIndexedPropertiesExternalArrayData(); - setValue(ptr, index, valueToCType(args[1]), !little_endian); + void* ptr = reinterpret_cast( + args.This()->GetIndexedPropertiesExternalArrayData()) + index; + + T val = valueToCType(args[1]); +#if V8_TYPED_ARRAY_LITTLE_ENDIAN + if (!little_endian) { +#else + if (little_endian) { +#endif + v8_typed_array::SwapBytesAndStore(ptr, val); + } else { + memcpy(ptr, &val, sizeof(T)); + } return v8::Undefined(); }