0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

93 Commits

Author SHA1 Message Date
Rod Vagg
d2c8ba5248 node: s/doNTCallbackX/nextTickCallbackWithXArgs/
Rename doNTCallback functions for clarity when profiling, these make
sense internally but the "NT" in particular is a bit obtuse to be
immediately understandable by non-core developers.

PR-URL: https://github.com/nodejs/node/pull/4167
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
2015-12-07 23:44:26 +09:00
Rich Trott
7cb89f515d test: remove flaky status from eval_messages test
This test has not failed on armv7-wheezy in over 6 weeks. Let's remove its
"flaky" status.

Fixes: https://github.com/nodejs/node/issues/2672
Reviewed-By: Rod Vagg <r@va.gg>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/3420
2015-10-20 12:16:00 -07:00
Michaël Zasso
bbdbef9274 test: fix tests after V8 upgrade
Some error messages have changed and the --debugger flag does
not exist in V8 anymore.

PR-URL: https://github.com/nodejs/node/pull/3351
Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
2015-10-14 11:20:35 -07:00
Alexis Campailla
165767dc7d test: mark eval_messages as flaky
This test has failed recently during a PR test in Jenkins, for
reasons seemingly not related to the change in the PR.

PR-URL: https://github.com/nodejs/node/pull/2648
Reviewed-By: evanlucas - Evan Lucas <evanlucas@me.com>
2015-09-06 21:37:59 +10:00
Alexis Campailla
ff05953b8d test: add test configuration templates
Template configuration files for marking tests as flaky.

PR-URL: https://github.com/nodejs/node/pull/2424
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2015-08-27 05:49:28 +02:00
Michaël Zasso
2235fad11b test: remove unreachable code
There is no way a line can be called after throwing an exception.

PR-URL: https://github.com/nodejs/node/pull/2289
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
2015-08-20 20:16:47 +02:00
Ben Noordhuis
70d1f32f56 deps: update v8 to 4.4.63.9
Upgrade the bundled V8 and update code in src/ and lib/ to the new API.

Notable backwards incompatible changes are the removal of the smalloc
module and dropped support for CESU-8 decoding.  CESU-8 support can be
brought back if necessary by doing UTF-8 decoding ourselves.

This commit includes https://codereview.chromium.org/1192973004 to fix
a build error on python 2.6 systems.  The original commit log follows:

    Use optparse in js2c.py for python compatibility

    Without this change, V8 won't build on RHEL/CentOS 6 because the
    distro python is too old to know about the argparse module.

PR-URL: https://github.com/nodejs/io.js/pull/2022
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-08-04 11:56:14 -07:00
Ben Noordhuis
c2b8b30836 test: remove stray copyright notices
Commit 3e1b1dd ("Remove excessive copyright/license boilerplate") left
in a few lines of boilerplate here and there.  This commit removes them.

PR-URL: https://github.com/nodejs/io.js/pull/1793
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-05-26 17:17:40 +02:00
Ben Noordhuis
93a44d5228 src: fix deferred events not working with -e
Defer evaluation of the script for a tick.  This is a workaround for
events not firing when evaluating scripts on the command line with -e.

Fixes: https://github.com/nodejs/io.js/issues/1600
PR-URL: https://github.com/nodejs/io.js/pull/1793
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-05-26 17:16:48 +02:00
Roman Reiss
f29762f4dd test: enable linting for tests
Enable linting for the test directory. A number of changes was made so
all tests conform the current rules used by lib and src directories. The
only exception for tests is that unreachable (dead) code is allowed.

test-fs-non-number-arguments-throw had to be excluded from the changes
because of a weird issue on Windows CI.

PR-URL: https://github.com/nodejs/io.js/pull/1721
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-19 21:21:27 +02:00
Brian White
c7782c0af8 node: improve nextTick performance
This commit uses separate functions to isolate deopts caused by
try-catches and avoids fn.apply() for callbacks with small numbers
of arguments.

These changes improve performance by ~1-40% in the various
nextTick benchmarks.

PR-URL: https://github.com/iojs/io.js/pull/1571
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2015-05-01 21:27:34 -04:00
Trevor Norris
10e31ba56c node: allow multiple arguments passed to nextTick
PR-URL: https://github.com/iojs/io.js/pull/1077
Reviewed-by: Colin Ihrig <cjihrig@gmail.com>
2015-04-15 17:02:21 -06:00
Brendan Ashworth
0df54303c1 test: common.js -> common
This commit changes many test styles to change all references
from require('./common.js'); to require('./common');.

The latter is much more common, with the former only being used in 50
tests. It is just a stylistic change, and it seems that `common.js` was
introduced by a rogue test and copied and pasted into the rest.

Semver: patch
PR-URL: https://github.com/iojs/io.js/pull/917
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-02-22 19:34:17 -08:00
Brian White
b677b844fc events: optimize various functions
Cache events and listeners objects where possible and loop over
Object.keys() instead of using for..in. These changes alone give
~60-65% improvement in the ee-add-remove benchmark.

The changes to EventEmitter.listenerCount() gives ~14%
improvement and changes to emitter.listeners() gives
significant improvements for <50 listeners
(~195% improvement for 10 listeners).

The changes to emitter.emit() gives 3x speedup for the fast
cases with multiple handlers and a minor speedup for the slow
case with multiple handlers.

The swapping out of the util.is* type checking functions with inline
checks gives another ~5-10% improvement.

PR-URL: https://github.com/iojs/io.js/pull/601
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2015-02-09 17:47:49 +01:00
Ben Noordhuis
635337f953 test: fix message tests regression
Commit 3e1b1dd ("Remove excessive copyright/license boilerplate") broke
some of the message tests because without the license boilerplate at
the top, the line numbers no longer match up.

PR-URL: https://github.com/iojs/io.js/pull/316
Reviewed-By: Bert Belder <bertbelder@gmail.com>
2015-01-13 01:50:32 +01:00
isaacs
3e1b1dd4a9 Remove excessive copyright/license boilerplate
The copyright and license notice is already in the LICENSE file.  There
is no justifiable reason to also require that it be included in every
file, since the individual files are not individually distributed except
as part of the entire package.
2015-01-12 15:30:28 -08:00
Ben Noordhuis
edaf7af30b test: make test runner multi-arch/mode compatible
Make `python tools/test.py --arch=ia32,x64 --mode=debug,release` work.
The test runner looks for the `node` binary in `out/${arch}.${mode}/`.

Running tools/test.py without --arch makes it use `out/Release/node` or
`out/Debug/node` like before.

This commit removes `test/simple/test-executable-path.js` because the
assumptions it makes about the locations of the debug and release
binaries are now outdated.

PR-URL: https://github.com/node-forward/node/pull/24
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-16 22:39:34 +02:00
Fedor Indutny
a48583e8d7 test: fix error messages after v8 upgrade 2014-10-12 02:05:02 +04:00
Fedor Indutny
9920ae67b5 Merge branch 'v0.10'
Conflicts:
	ChangeLog
	lib/events.js
	lib/tls.js
	src/node_constants.cc
	src/node_crypto.cc
	src/node_crypto.h
	src/node_version.h
2014-06-05 07:28:39 -07:00
Ben Noordhuis
17fbdc18b8 lib: name EventEmitter prototype methods
Before this commit the EventEmitter methods were anonymous functions.
V8 tries to infer names for anonymous functions based on the execution
context but it frequently gets it wrong and when that happens, the
stack trace is usually confusing and unhelpful.  This commit names all
methods so V8 can fall back to the method.name property.

The above gotcha applies to all anonymous functions but is exacerbated
for EventEmitter methods because those are invoked with a plenitude of
different receivers.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-05-07 12:11:57 -07:00
Timothy J Fontaine
06453a94a7 src: domain should not replace nextTick function
Previously if you cached process.nextTick and then require('domain')
subsequent nextTick() calls would not be caught because enqueued
functions were taking the wrong path. This keeps nextTick to a single
function reference and changes the implementation details after domain
has been required.
2014-03-03 16:27:58 -08:00
Fedor Indutny
f1de13b8ab node: do not print SyntaxError hints to stderr
Try embedding the ` ... ^` lines inside the `SyntaxError` (or any other
native error) object before giving up and printing them to the stderr.

fix #6920
fix #1310
2014-02-06 13:26:57 +04:00
Vladimir Kurchatkin
055f7e9da9 src: only access stack of non-null errors
Avoid segmentation fault when `null` is thrown
2013-12-23 15:08:11 +04:00
Vladimir Kurchatkin
259d449622 src: only access stack of defined errors
Avoid segmentation fault when `undefined` is thrown
2013-12-10 09:33:33 -08:00
Domenic Denicola
fd3657610e vm: update API to use options argument
Passing a filename is still supported in place of certain options
arguments, for backward-compatibility, but timeout and display-errors
are not translated since those were undocumented.

Also managed to eliminate an extra stack trace line by not calling
through the `createScript` export.

Added a few message tests to show how `displayErrors` works.
2013-08-28 22:27:24 -07:00
Domenic Denicola
7afdba6e0b vm, core, module: re-do vm to fix known issues
As documented in #3042 and in [1], the existing vm implementation has
many problems. All of these are solved by @brianmcd's [contextify][2]
package. This commit uses contextify as a conceptual base and its code
core to overhaul the vm module and fix its many edge cases and caveats.

Functionally, this fixes #3042. In particular:

- A context is now indistinguishable from the object it is based on
  (the "sandbox"). A context is simply a sandbox that has been marked
  by the vm module, via `vm.createContext`, with special internal
  information that allows scripts to be run inside of it.
- Consequently, items added to the context from anywhere are
  immediately visible to all code that can access that context, both
  inside and outside the virtual machine.

This commit also smooths over the API very slightly:

- Parameter defaults are now uniformly triggered via `undefined`, per
  ES6 semantics and previous discussion at [3].
- Several undocumented and problematic features have been removed, e.g.
  the conflation of `vm.Script` with `vm` itself, and the fact that
  `Script` instances also had all static `vm` methods. The API is now
  exactly as documented (although arguably the existence of the
  `vm.Script` export is not yet documented, just the `Script` class
  itself).

In terms of implementation, this replaces node_script.cc with
node_contextify.cc, which is derived originally from [4] (see [5]) but
has since undergone extensive modifications and iterations to expose
the most useful C++ API and use the coding conventions and utilities of
Node core.

The bindings exposed by `process.binding('contextify')`
(node_contextify.cc) replace those formerly exposed by
`process.binding('evals')` (node_script.cc). They are:

- ContextifyScript(code, [filename]), with methods:
  - runInThisContext()
  - runInContext(sandbox, [timeout])
- makeContext(sandbox)

From this, the vm.js file builds the entire documented vm module API.

node.js and module.js were modified to use this new native binding, or
the vm module itself where possible. This introduces an extra line or
two into the stack traces of module compilation (and thus into most
stack traces), explaining the changed tests.

The tests were also updated slightly, with all vm-related simple tests
consolidated as test/simple/test-vm-* (some of them were formerly
test/simple/test-script-*). At the same time they switched from
`common.debug` to `console.error` and were updated to use
`assert.throws` instead of rolling their own error-testing methods.

New tests were also added, of course, demonstrating the new
capabilities and fixes.

[1]: http://nodejs.org/docs/v0.10.16/api/vm.html#vm_caveats
[2]: https://github.com/brianmcd/contextify
[3]: https://github.com/joyent/node/issues/5323#issuecomment-20250726
[4]: bf123f3ef9/src/contextify.cc
[5]: https://gist.github.com/domenic/6068120
2013-08-21 15:52:23 -07:00
Ben Noordhuis
a1ea8a27e6 test: update tests after internal api change
Commit 0aa1335 changes the way timeout events are dispatched. Update
two tests that still used the old way.
2013-08-15 22:20:15 +02:00
Trevor Norris
0761c90204 process: remove maxTickDepth from _tickCallback
Removes the check for maxTickDepth for non-domain callbacks. So a user
can starve I/O by setting a recursive nextTick.

The domain case is more complex and will be addressed in another commit.
2013-05-30 09:30:19 -07:00
isaacs
896b2aa707 util: Add debuglog, deprecate console lookalikes 2013-05-21 16:39:50 -07:00
isaacs
1fd95b57bf test: Fix message/error_exit 2013-04-05 11:32:33 -07:00
Trevor Norris
0bba590283 bindings: update api
All compile time warnings about using deprecated APIs have been
suppressed by updating node's API. Though there are still many function
calls that can accept Isolate, and still need to be updated.

node_isolate had to be added as an extern variable in node.h and
node_object_wrap.h

Also a couple small fixes for Error handling.

Before v8 3.16.6 the error stack message was lazily written when it was
needed, which allowed you to change the message after instantiation.
Then the stack would be written with the new message the first time it
was accessed. Though that has changed. Now it creates the stack message
on instantiation. So setting a different message afterwards won't be
displayed.

This is not a complete fix for the problem. Getting error without any
message isn't very useful.
2013-03-20 01:11:01 +01:00
Trevor Norris
0c1e7b53d0 process: separate nextTick domain logic
It's cleaner to only load domain ticker logic when the domains are being
used. This makes execution slightly quicker in both cases, and simpler
from the spinner since there is no need to check if the latest callback
requires use of domains.
2013-02-27 16:37:10 -08:00
isaacs
875e4a0c59 core: Remove the nextTick for running the main file
Not necessary, since we can handle the error properly on the first tick
now, even if there are event listeners, etc.

Additionally, this removes the unnecessary "_needTickCallback" from
startup, since Module.loadMain() will kick off a nextTick callback right
after it runs the main module.

Fix #4856
2013-02-27 16:29:36 -08:00
Ben Noordhuis
51f6e6a9b3 src, test: downgrade to v8 3.14 api 2013-02-25 23:45:02 +01:00
Trevor Norris
86c0745a5e process: streamlining tick callback logic
* Callbacks from spinner now calls its own function, separate from the
  tickCallback logic
* MakeCallback will call a domain specific function if a domain is
  detected
* _tickCallback assumes no domains, until nextTick receives a callback
  with a domain. After that _tickCallback is overridden with the domain
  specific implementation.
* _needTickCallback runs in startup() instead of nextTick (isaacs)
* Fix bug in _fatalException where exit would be called twice (isaacs)
* Process.domain has a default value of null
* Manually track nextTickQueue.length (will be useful later)
* Update tests to reflect internal api changes
2013-02-15 18:13:01 -08:00
isaacs
95ac576bf9 Revert "Move MakeCallback to JS"
This reverts commit 0109a9f90a.

Also included:  Port all the changes to process._makeCallback into the
C++ version.  Immediate nextTick, etc.

This yields a slight boost in several benchmarks.  V8 is optimizing and
deoptimizing process._makeCallback repeatedly.
2013-02-15 18:13:01 -08:00
Fedor Indutny
8a96bb42c6 test: make tests work with newer v8 2013-01-02 12:13:47 +04:00
isaacs
6c80ef01c1 node: emit 'exit' when exiting with error
Fix #3555
2012-12-29 16:53:23 -08:00
isaacs
ba94f9d6f8 timers: Move list.ontimeout to separate function 2012-12-29 15:32:25 -08:00
isaacs
1c2910d94c test-message: Add setTimeout and nextTick message tests 2012-12-29 10:37:31 -08:00
isaacs
cd51fa8f5a test: Update message tests for streams2 2012-12-14 17:46:24 -08:00
isaacs
21c741f257 Print warning when maxTickDepth is reached 2012-10-29 10:53:39 -07:00
isaacs
3053f4d27d test: Fix stdin message tests 2012-09-28 10:42:52 -07:00
isaacs
99ad0561c0 test-message: fix message output
1. The net changes add a stack frame to stdin errors.
2. The error line numbers were overly strict in many places.
2012-08-05 13:53:31 -07:00
isaacs
37537d5720 test: stdin error messages 2012-08-02 08:11:18 -07:00
isaacs
b3cf3f35fc Report errors properly from --eval and stdin 2012-07-30 08:21:39 -07:00
isaacs
dd85a8c183 Update message test for new v8 behavior 2012-06-14 08:37:44 -07:00
Bert Belder
0dba4ad0f9 tests: make all message tests pass on Windows 2012-06-13 03:02:53 +02:00
isaacs
e0f5d8e86d test: v8 stack trace messages changed slightly 2012-06-01 22:31:05 -07:00
Oleg Efimov
968b49ba0a Check for tabs in source line in DisplayExceptionLine
Fix for joyent/node#3280
2012-05-21 18:30:16 +02:00