Commit Graph

2412 Commits (dc0c524ce681f53e2bd8f0974ed6aa3fd910054d)

Author SHA1 Message Date
Dean McNamee c207d400f1 typed arrays: implement load and store swizzling
Implement load and store swizzling operations. This reduces an unneeded
back and forth between types and additionally keeps the value in the
swappable type until it is swapped. This is important for correctness
when dealing with floating point, to avoid the possibility of loading
the bits of a signaling NaN (because it isn't yet swapped) into the FPU.

This additionally produces better code (comments are mine):

gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

setValue<double>:
  movd  %xmm0, %rax         ; fp reg -> gen reg
  bswapq  %rax              ; 64-bit byte swap
  movq  %rax, (%r15,%r12)   ; store
2013-01-09 17:44:25 +01:00
Dean McNamee 46a489be73 typed arrays: swizzle with compiler intrinsics
Implement swizzling with compiler intrinsics and be aware of the native
endianness to correctly swap on big endian machines.

This introduces a template function to swap the bytes of a value,
and macros for the low level swap (taking advantage of gcc and msvc
intrinsics). This produces code like the following (comments are mine):

gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

setValue<double>:
  movd  %xmm0, %rax         ; fp reg -> gen reg
  bswapq  %rax              ; 64-bit byte swap
  movd  %rax, %xmm0         ; gen reg -> fp reg
  movq  %xmm0, (%r15,%r12)  ; store
2013-01-09 17:44:25 +01:00
Ben Noordhuis 7d66a9d060 typed arrays: undo local changes
Partially revert 5664dd2, 6573fc3 and 7788a6b to ease landing changes
from upstream.
2013-01-09 17:43:19 +01:00
Dean McNamee 3f75454426 typed arrays: don't declare as module
TypedArrays is not a module, it is attached to the global object.
Don't register it with Node's module system.
2013-01-08 05:08:00 +01:00
Dean McNamee b50d51ef5b typed arrays: replace switch with templates
Convert TypedArray's TypeName implementation to template specialization
instead of a switch() statement.
2013-01-08 05:08:00 +01:00
isaacs 321b8eec08 dtrace: More style
Continuation lines should be indented with 4 spaces, not a tab.
2013-01-07 12:31:44 -08:00
isaacs 38df9d51a2 dtrace: Make D style more D-ish 2013-01-07 12:23:41 -08:00
Fedor Indutny f9afb3f010 dtrace: x64 ustack helper 2013-01-07 23:04:11 +04:00
Fedor Indutny 13296e4b13 dtrace: fix style in ustack helper 2013-01-07 23:01:54 +04:00
isaacs 3b715edda9 dtrace: SeqAsciiString was renamed to SeqOneByteString in v8 2013-01-07 10:30:15 -08:00
Ben Noordhuis 7788a6bf85 src: pass node_isolate to Undefined() 2013-01-07 17:39:58 +01:00
Ben Noordhuis c7d7ae1fe2 src: pass node_isolate to Null() 2013-01-07 17:39:57 +01:00
Ben Noordhuis 109f73b2c0 src: pass node_isolate to True() and False() 2013-01-07 17:39:57 +01:00
Ben Noordhuis 01c3d0aa88 src: pass node_isolate to Local<>::New 2013-01-07 17:39:57 +01:00
Ben Noordhuis 6573fc3502 src: pass node_isolate to Integer::New 2013-01-07 17:39:57 +01:00
Ben Noordhuis 412b3cee05 src: pass node_isolate to String::Empty 2013-01-07 17:39:57 +01:00
Ben Noordhuis 5d0816bf3e src: make node_isolate global
V8 3.15 has new API functions that let you specify the Isolate. V8 and
node.js generally spend 0.5-3.5% of the time in pthread_getspecific(),
looking up the current Isolate. Avoid that overhead by making "our"
isolate global so we can pass it around. The change to the new API is
introduced in follow-up commits.
2013-01-07 17:39:57 +01:00
Dean McNamee 8adebb92bc node: move symbol caching to Load() 2013-01-07 17:19:09 +01:00
Ben Noordhuis 5664dd2fc1 src: use static_cast where appropriate
Use static_cast instead of reinterpret_cast when casting from void*
to another type.

This is mostly an aesthetic change but may help catch bugs when the
affected code is modified.
2013-01-05 00:16:23 +01:00
Fedor Indutny 97056c064f object_wrap: add missing HandleScope
by Sven Panne's suggestion, see [0] for details.

[0]: https://code.google.com/p/v8/issues/detail?id=2468
2013-01-04 16:39:24 +04:00
Scott Blomquist a616774281 windows: improve Visual Studio Express build support
* Moved generated files to a clearer directory.
* Improved detection logic for ctrpp.exe tool.

Closes #4482
2013-01-03 23:38:25 +01:00
Scott Blomquist 5a39df4959 windows: fix perfctr crash on XP and 2003
Some performance counter related functions are not available on Windows
XP and Windows Server 2003, which caused node to call a NULL pointer.

Closes #4462
Closes #4511
2013-01-03 23:31:26 +01:00
Ben Noordhuis 875c1106c6 node: remove ev-emul.h
libev has been deprecated since v0.6. Add-on authors have had two major
release cycles to upgrade. Out it goes.
2013-01-03 19:58:38 +01:00
Fedor Indutny 5e57bcc3ce bindings: update to new v8 apis
GetPointerFromInternalField() is deprecated now, we should use
GetAlignedPointerFromInternalField().
2013-01-02 12:13:46 +04:00
isaacs 30bd774fbd Now working on 0.9.6 2012-12-29 17:25:40 -08:00
isaacs 01994e8119 2012.12.30, Version 0.9.5 (Unstable)
* 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-29 16:54:24 -08:00
isaacs 6c80ef01c1 node: emit 'exit' when exiting with error
Fix #3555
2012-12-29 16:53:23 -08:00
isaacs ec8ebaf300 domain: use camelCase instead of snake_case
While it's true that error objects have a history of getting snake_case
properties attached by the host system, it's a point of confusion to
Node users that comes up a lot.  It's still 'experimental', so best to
change this sooner rather than later.
2012-12-29 10:37:31 -08:00
isaacs 4401bb47bf domain: Do not use uncaughtException handler
This adds a process._fatalException method which is called into from
C++ in order to either emit the 'uncaughtException' method, or emit
'error' on the active domain.

The 'uncaughtException' event is an implementation detail that it would
be nice to deprecate one day, so exposing it as part of the domain
machinery is not ideal.

Fix #4375
2012-12-29 10:37:30 -08:00
Ben Noordhuis 910e24b53d fs: remove fs.sendfile()
Said function has been broken (and useless) since v0.6.0. Remove it altogether.

Fixes #3854.
2012-12-28 18:24:35 +01:00
Ben Noordhuis a329729537 buffer: speed up base64 encoding by 20%
Remove a lot of branches from the inner loop. Speeds up buf.toString('base64')
by about 20%.

Before:

  $ time out/Release/node benchmark/buffer-base64-encode.js
  real    0m6.607s
  user    0m5.508s
  sys     0m1.088s

After:

  $ time out/Release/node benchmark/buffer-base64-encode.js
  real    0m5.520s
  user    0m4.520s
  sys     0m0.992s
2012-12-28 13:20:07 +01:00
isaacs 4be9c695f0 build: Add hyphen to custom build tags
so that ./configure --tag=foo makes a version number like v0.9.5-foo
instead of v0.9.5foo
2012-12-26 20:35:00 -08:00
Maciej Małecki f84bf5b6b1 build: allow to specify custom tags
When building custom `node` versions (e.g., floating features/fixes from
different versions) it's often useful to specify a custom tag which
easily identifies build when invoking `node -v`.

Introduce a way to specify this tag in `node_version.h` file or by
running `./configure --tag="<tag>"`. Insert it right after the patch
version (and before `-pre`, if build is not a release).

Closes #4452.
2012-12-21 12:44:33 -08:00
isaacs 70eb227e80 Now working on 0.9.5 2012-12-21 12:36:34 -08:00
isaacs d86d83c75f 2012.12.21, Version 0.9.4 (Unstable)
* 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-12-21 12:15:05 -08:00
Scott Blomquist 841b7f534b Ease building with VS Express by checking in generated files. 2012-12-21 11:05:55 -08:00
isaacs 244924823e stdio: Do not read from stdout/err
This fixes windows stdio pipes in streams2 land.
2012-12-21 11:05:46 -08:00
Ben Noordhuis d607d856af node: remove idle gc
Remove the idle garbage collector. Its purpose was to run the garbage collector
when the application is idle but it never worked quite right. Many people have
complained over the years that with heaps > 128 MB, a node.js process never
sleeps anymore; instead, it spends nearly 100% of its CPU time trying to
collect garbage.

Back in the old days, idle GC probably was a good idea. But with V8's current
incremental collector, idle gc appears to offer no time or space benefits
whatsoever and indeed seems actively harmful. Remove it.

Fixes #3870.
2012-12-18 16:16:33 +01:00
Ben Noordhuis 8ccfed2edc node: s/-/_/ in add-on symbol name
Replace dashes with underscores. When loading foo-bar.node, look for
foo_bar_module, not foo-bar_module. The latter is not a legal symbol name.
2012-12-18 16:07:31 +01:00
isaacs 6c5356bfe2 Revert "buffer: allocate memory with mmap()"
Also Revert "buffer: use MAP_ANON, fix OS X build"

This reverts commit ddb15603e7.
This reverts commit 2433ec8276.
2012-12-17 10:47:17 -08:00
Dean McNamee 1c265c54a2 typed arrays: fix missing type in SizeOfArrayElementForType()
When Mikael Bourges-Sevenier added support for Uint8ClampedArray in 67fc1da,
the new type was not added to SizeOfArrayElementForType().
2012-12-17 17:37:51 +01:00
Dean McNamee ba00fb0199 typed arrays: re-export SizeOfArrayElementForType()
Although it is not used externally by node, it is needed by upstream and Plask.

This effectively reverts:

    commit 1444801374
    Author: Aaron Jacobs <jacobsa@google.com>
    Date:   Thu Mar 15 13:26:35 2012 +1100

        typed arrays: unexport SizeOfArrayElementForType()

        It isn't used anywhere else, so made it an implementation detail in
        v8_typed_array.cc.
2012-12-17 17:37:51 +01:00
Ben Noordhuis ddb15603e7 buffer: use MAP_ANON, fix OS X build 2012-12-17 11:29:03 +01:00
Ben Noordhuis 2433ec8276 buffer: allocate memory with mmap()
Work around an issue with the glibc malloc() implementation where memory blocks
are never returned to the operating system when they are allocated with brk()
and have overlapping lifecycles.

Fixes #4283.
2012-12-16 10:19:09 +01:00
isaacs bb56dcc450 tty/stdin: Refactor for streams2 2012-12-14 10:52:30 -08:00
isaacs 0e01d6398f zlib: streams2 2012-12-14 10:52:26 -08:00
isaacs 372cb32dc4 module: Support cycles in native module requires 2012-12-13 17:00:23 -08:00
Ben Noordhuis 6cf68aead6 deps: upgrade libuv to e079a99 2012-12-13 20:23:01 +01:00
Ben Noordhuis 3ece130ea2 process: add getgroups(), setgroups(), initgroups()
DRY the getuid(), getgid(), etc. functions while we're at it.
2012-12-06 17:14:58 +01:00
Ben Noordhuis c08e947fbd buffer: remove unused #includes 2012-12-06 04:45:11 +01:00