summaryrefslogtreecommitdiff
path: root/src/node.cc
Commit message (Collapse)AuthorAgeFilesLines
* v8_platform: provide default v8::Platform implFedor Indutny2014-10-161-5/+7
| | | | Provide default Platform implementation for v8's purposes.
* src, test: fixup after v8 updateFedor Indutny2014-10-081-2/+3
| | | | | | | | | | | | | Because of behavior change of some V8 APIs (they mostly became more strict), following modules needed to be fixed: * crypto: duplicate prototype methods are not allowed anymore * contextify: some TryCatch trickery, the binding was using it incorrectly * util: maximum call stack error is now crashing in a different place Reviewed-By: Trevor Norris <trevnorris@gmail.com> PR-URL: https://github.com/joyent/node/pull/8476
* deps: re-implement debugger-agentFedor Indutny2014-10-081-71/+131
| | | | | Reviewed-By: Trevor Norris <trevnorris@gmail.com> PR-URL: https://github.com/joyent/node/pull/8476
* src: update use of ExternalArrayType constantsTrevor Norris2014-10-081-4/+4
| | | | | | Continuation of 4809c7a to update the use of v8::ExternalArrayType. Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* node: avoid automatic microtask runsVladimir Kurchatkin2014-10-011-0/+10
| | | | | | | | | | | | | | | | | | | Since we are taking control of the microtask queue it makes sense to disable autorun and only run microtasks when necessary. Just setting isolate->SetAutorunMicrotasks(false) would cause _tickCallback() not to be called. Automatically running the microtask queue will cause it to run: * After callback invocation * Inside _tickCallback() * After _tickCallback() invocation The third one is unnecessary as the microtask queue is guaranteed to be empty at this point. The first only needs to be run manually when _tickCallback() isn't going to be called by MakeCallback(). Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* build, i18n: improve Intl build, add "--with-intl"Steven R. Loomis2014-10-011-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The two main goals of this change are: - To make it easier to build the Intl option using ICU (particularly, using a newer ICU than v8/Chromium's version) - To enable a much smaller ICU build with only English support The goal here is to get node.js binaries built this way by default so that the Intl API can be used. Additional data can be added at execution time (see Readme and wiki) More details are at https://github.com/joyent/node/pull/7719 In particular, this change adds the "--with-intl=" configure option to provide more ways of building "Intl": - "full-icu" picks up an ICU from deps/icu - "small-icu" is similar, but builds only English - "system-icu" uses pkg-config to find an installed ICU - "none" does nothing (no Intl) For Windows builds, the "full-icu" or "small-icu" options are added to vcbuild.bat. Note that the existing "--with-icu-path" option is not removed from configure, but may not be used alongside the new option. Wiki changes have already been made on https://github.com/joyent/node/wiki/Installation and a new page created at https://github.com/joyent/node/wiki/Intl (marked as provisional until this change lands.) Summary of changes: * README.md : doc updates * .gitignore : added "deps/icu" as this is the location where ICU is unpacked to. * Makefile : added the tools/icu/* files to cpplint, but excluded a problematic file. * configure : added the "--with-intl" option mentioned above. Calculate at config time the list of ICU source files to use and data packaging options. * node.gyp : add the new files src/node_i18n.cc/.h as well as ICU linkage. * src/node.cc : add call into node::i18n::InitializeICUDirectory(icu_data_dir) as well as new --icu-data-dir option and NODE_ICU_DATA env variable to configure ICU data loading. This loading is only relevant in the "small" configuration. * src/node_i18n.cc : new source file for the above Initialize.. function, to setup ICU as needed. * tools/icu : new directory with some tools needed for this build. * tools/icu/icu-generic.gyp : new .gyp file that builds ICU in some new ways, both on unix/mac and windows. * tools/icu/icu-system.gyp : new .gyp file to build node against a pkg-config detected ICU. * tools/icu/icu_small.json : new config file for the "English-only" small build. * tools/icu/icutrim.py : new tool for trimming down ICU data. Reads the above .json file. * tools/icu/iculslocs.cc : new tool for repairing ICU data manifests after trim operation. * tools/icu/no-op.cc : dummy file to force .gyp into using a C++ linker. * vcbuild.bat : added small-icu and full-icu options, to call into configure. * Fixed toolset dependencies, see https://github.com/joyent/node/pull/7719#issuecomment-54641687 Note that because of a bug in gyp {CC,CXX}_host must also be set. Otherwise gcc/g++ will be used by default for part of the build. Reviewed-by: Trevor Norris <trev.norris@gmail.com> Reviewed-by: Fedor Indutny <fedor@indutny.com>
* src: fix VC++ warning C4244Rasmus Christian Pedersen2014-09-291-6/+6
| | | | Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* node: support v8 microtask queueVladimir Kurchatkin2014-09-181-0/+7
| | | | | | | | | | | When V8 started supporting Promises natively it also introduced a microtack queue. This feature operates similar to process.nextTick(), and created an issue where neither knew when the other had run. This patch has nextTick() call the microtask queue runner at the end of processing callbacks in the nextTickQueue. Fixes: https://github.com/joyent/node/issues/7714 Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* src: remove Environment::GetCurrentChecked()Ben Noordhuis2014-09-051-3/+6
| | | | | | | There is only one call site that uses it and that can do the checks itself. Removes ~15 lines of code. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* node,async-wrap: verify domain enter/exit are setTrevor Norris2014-09-021-14/+10
| | | | | | | | | | | | | The REPL global object lazy loads modules by placing getters for each. This causes MakeDomainCallback() to be run if a native module is loaded from the REPL, but if the domain module hasn't been loaded then there are no enter/exit callbacks to be called. Causing an assert() to fail. Fix the issue by conditionally running the callback instead of asserting it is available. Also add "addon" test to verify the fix. Fixes: #8231 Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* node: add missing Isolate::Scope at startupBen Noordhuis2014-08-191-0/+1
| | | | Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* windows: fix memory leak in WinapiErrnoExceptionAlexis Campailla2014-08-111-2/+9
| | | | | | Fix https://github.com/joyent/node/issues/2341 Reviewed-By: Fedor Indutny <fedor@indutny.com>
* process: improve process bindingJackson Tian2014-08-021-1/+6
| | | | Reviewed-By: Fedor Indutny <fedor@indutny.com>
* src: pass the v8::Context to CreateEnvironmentDean McNamee2014-07-131-3/+5
| | | | | | | | Pass in the v8::Context, instead of creating it within CreateEnvironment. This allows callers to use a pre-existing context. Signed-off-by: Fedor Indutny <fedor@indutny.com>
* node: fix #7841 by overlooking the spare sourcelineYazhong Liu2014-06-271-1/+9
| | | | Signed-off-by: Fedor Indutny <fedor@indutny.com>
* Merge remote-tracking branch 'upstream/v0.10'Timothy J Fontaine2014-06-101-22/+30
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: AUTHORS ChangeLog deps/v8/src/api.cc deps/v8/src/unicode-inl.h deps/v8/src/unicode.h lib/_stream_readable.js lib/http.js src/cares_wrap.cc src/node.cc src/node_crypto.cc src/node_dtrace.cc src/node_file.cc src/node_stat_watcher.cc src/node_version.h src/process_wrap.cc src/string_bytes.cc src/string_bytes.h src/udp_wrap.cc src/util.h test/simple/test-buffer.js test/simple/test-stream2-compatibility.js
| * src: replace usage of String::Utf8ValueTimothy J Fontaine2014-06-061-20/+22
| | | | | | | | | | v8::String::Utf8Value previously could allow invalid surrogates when interpreting values.
| * string_bytes: Guarantee valid utf-8 outputFelix Geisendörfer2014-06-061-0/+7
| | | | | | | | | | | | | | | | | | | | | | Previously v8's WriteUtf8 function would produce invalid utf-8 output when encountering unmatched surrogate code units [1]. The new REPLACE_INVALID_UTF8 option fixes that by replacing invalid code points with the unicode replacement character. [1]: JS Strings are defined as arrays of 16 bit unsigned integers. There is no unicode enforcement, so one can easily end up with invalid unicode code unit sequences inside a string.
* | src: replace CONTAINER_OF with type-safe functionBen Noordhuis2014-05-301-2/+2
| | | | | | | | | | | | | | Replace the CONTAINER_OF macro with a template function that is as type-safe as a reinterpret_cast<> of an arbitrary pointer can be made. Signed-off-by: Fedor Indutny <fedor@indutny.com>
* | src: kill isolate on exitBen Noordhuis2014-05-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | Otherwise it's not possible to check from inside a destructor if V8 is still alive with v8::V8::IsDead(). In V8 3.25, that function returns true until the last isolate is destroyed. This used to work in v0.10 and is a standard trick to dispose persistent handles conditionally. Signed-off-by: Fedor Indutny <fedor@indutny.com>
* | node: remove duplicate tickInfo assignmentTrevor Norris2014-05-121-8/+0
| | | | | | | | | | | | | | When process._setupNextTick() was introduced as the means to properly initialize the mechanism behind process.nextTick() a chunk of code was left behind that assigned memory to process._tickInfo. This code is no longer needed.
* | src: add --throw-deprecation entry to --helpTrevor Norris2014-05-071-0/+2
| |
* | debugger: assign Environment to DebugContext tooFedor Indutny2014-05-021-0/+8
| | | | | | | | fix #7517
* | Merge remote-tracking branch 'upstream/v0.10'Timothy J Fontaine2014-05-011-4/+6
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reverted 9520adeb37f5ebe02a68669ec97770f4869705bb Conflicts: deps/cares/src/ares_parse_txt_reply.c deps/uv/.mailmap deps/uv/AUTHORS deps/uv/ChangeLog deps/uv/include/uv.h deps/uv/src/unix/error.c deps/uv/src/unix/process.c deps/uv/src/version.c deps/uv/src/win/pipe.c deps/uv/src/win/signal.c deps/uv/src/win/util.c deps/uv/test/test-spawn.c deps/uv/vcbuild.bat deps/v8/src/platform-posix.cc deps/v8/tools/gyp/v8.gyp lib/util.js src/node.cc test/simple/test-util-format.js test/simple/test-util.js
| * src: use monotonic time for process.uptime()Timothy J Fontaine2014-04-101-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `process.uptime()` interface will return the amount of time the current process has been running. To achieve this it was caching the `uv_uptime` value at program start, and then on the call to `process.uptime()` returning the delta between the two values. `uv_uptime` is defined as the number of seconds the operating system has been up since last boot. On sunos this interface uses `kstat`s which can be a significantly expensive operation as it requires exclusive access, but because of the design of `process.uptime()` node *had* to always call this on start. As a result if you had many node processes all starting at the same time you would suffer lock contention as they all tried to read kstats. Instead of using `uv_uptime` to achieve this, the libuv loop already has a concept of current loop time in the form of `uv_now()` which is in fact monotonically increasing, and already stored directly on the loop. By using this value at start every platform performs at least one fewer syscall during initialization. Since the interface to `uv_uptime` is defined as seconds, in the call to `process.uptime()` we now `uv_update_time` get our delta, divide by 1000 to get seconds, and then convert to an `Integer`. In 0.12 we can move back to `Number::New` instead and not lose precision. Caveat: For some platforms `uv_uptime` reports time monotonically increasing regardless of system hibernation, `uv_now` interface is also monotonically increasing but may not reflect time spent in hibernation.
| * src: seed V8's random number generator at startupBen Noordhuis2014-03-261-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default entropy source is /dev/urandom on UNIX platforms, which is okay but we can do better by seeding it from OpenSSL's entropy pool. On Windows we can certainly do better; on that platform, V8 seeds the random number generator using only the current system time. Fixes #6250. NB: This is a back-port of commit 7ac2391 from the master branch that for some reason never got back-ported to the v0.10 branch. The default on UNIX platforms in v0.10 is different and arguably worse than it is with master: if no entropy source is provided, V8 3.14 calls srandom() with a xor of the PID and the current time in microseconds. That means that on systems with a coarse system clock, the initial state of the PRNG may be easily guessable. The situation on Windows is even more dire because there the PRNG is seeded with only the current time... in milliseconds.
| * src: domain should not replace nextTick functionTimothy J Fontaine2014-03-031-1/+1
| | | | | | | | | | | | | | | | 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.
* | tls: support OCSP on client and serverFedor Indutny2014-04-181-0/+7
| |
* | main: Handle SIGINT properly.Geir Hauge2014-04-121-6/+9
| | | | | | | | | | | | As explained by http://www.cons.org/cracauer/sigint.html Signed-off-by: Fedor Indutny <fedor@indutny.com>
* | src: fix use of uv_cwd, len includes the NULL byteSaúl Ibarra Corretgé2014-04-071-7/+1
| |
* | src: update uv callbacks after API changesSaúl Ibarra Corretgé2014-04-071-5/+5
| | | | | | | | | | async, timer, prepare, idle and check handles no longer get a status parameter since they can never fail.
* | src: fix up after v8 upgradeBen Noordhuis2014-04-021-1/+1
| | | | | | | | | | | | | | | | | | The two biggest changes are that v8::Script::New() has been removed and that a v8::Script object now has to be explicitly bound to a context if you want to run it from another context. We can accommodate both changes without breaking the vm module's public API or even the internal JS API.
* | configure: make --v8-options switch more robustBen Noordhuis2014-04-011-21/+6
| | | | | | | | | | | | | | Improve on commit b55c9d6 by not requiring that switches are comma separated. This commit makes `./configure --v8-options="--foo --bar"` work and takes special care to properly escape quotes in the options string.
* | configure: --v8-options optionFedor Indutny2014-03-291-0/+22
| | | | | | | | | | Introduce a way to set some v8 flags at compile time, the values should be separated by comma.
* | headers: remove env.h from node_internals.hFedor Indutny2014-03-181-0/+42
| | | | | | | | | | | | | | | | `env.h` is an internal header file and should not be copied or exposed to the users. Additionally, export convenience `Throw*` methods with `v8::Isolate*` as a first argument.
* | src: update to v8 3.24 APIsFedor Indutny2014-03-131-63/+70
| |
* | src: accommodate uv_cwd including null on win32v0.11.12v0.11.12-releaseTimothy J Fontaine2014-03-111-0/+6
| |
* | src: adapt to API change in uv_cwdSaúl Ibarra Corretgé2014-03-101-6/+8
| |
* | node: invoke `beforeExit` again if loop was activeFedor Indutny2014-03-011-1/+6
| | | | | | | | | | | | | | | | When `setImmediate(cb)` is called in `beforeExit` event handler the consequent `uv_run(..., UV_RUN_NOWAIT)` may return `0`, even if there was some active handles at start. Fixes simple/test-beforeexit-event.js.
* | src: emit 'beforeExit' event on process objectBen Noordhuis2014-02-281-1/+21
| | | | | | | | | | | | | | | | | | Unlike the 'exit' event, this event allows the user to schedule more work and thereby postpone the exit. That also means that the 'beforeExit' event may be emitted many times, see the attached test case for an example. Refs #6305.
* | src: node.cc use isolate->ThrowExceptionAlexis Campailla2014-02-241-29/+22
| | | | | | | | | | | | | | Environment doesn't have ThrowException, we meant isolate here. Introduced in commit 75adde07f9a2de7f38a67bec72bd377d450bdb52.
* | src: remove `node_isolate` from sourceFedor Indutny2014-02-221-232/+285
| | | | | | | | fix #6899
* | process: allow changing `exitCode` in `on('exit')`Fedor Indutny2014-02-091-1/+3
| | | | | | | | fix #7081
* | node: do not print SyntaxError hints to stderrFedor Indutny2014-02-061-77/+119
| | | | | | | | | | | | | | | | 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
* | src: fix MakeCallback() handle leakBen Noordhuis2014-02-051-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create a new HandleScope before looking up the object context with v8::Object::CreationContext(), else we leak the Local<Context> into the current HandleScope. That's relatively harmless unless the HandleScope is long-lived and MakeCallback() is called a lot. In a scenario like that, we may end up leaking a lot of memory. What is unfortunate about this change is that we're trying hard to eradicate the node_isolate global. Longer term, we will probably have to change the MakeCallback() prototype to one that requires an explicit v8::Isolate* argument.
* | src: update MakeCallback() function prototypeBen Noordhuis2014-02-051-59/+66
| | | | | | | | | | | | | | | | | | Make it possible to invoke MakeCallback() on a v8::Value but only for the variant that takes a v8::Function as the thing to call. The const char* and v8::String variants still require a v8::Object because the function to call is looked up as a property on the receiver, but that only works when the receiver is an object, not a primitive.
* | node: register modules from DSO constructorsKeith M Wesolowski2014-01-271-59/+61
| | | | | | | | | | | | | | Built-in modules should be automatically registered, replacing the static module list. Add-on modules should also be automatically registered via DSO constructors. This improves flexibility in adding built-in modules and is also a prerequisite to pure-C addon modules.
* | node: fix argument parsing with -p argAlexis Campailla2014-01-271-1/+3
| | | | | | | | | | | | node -p would cause an access violation. Fixes test\message\stdin_messages.js on Windows.
* | node: `EmitExit` should not call `exit()`Fedor Indutny2014-01-221-4/+5
| | | | | | | | | | Before this commit `RunAtExit` and `env->Dispose()` were never reached, because `EmitExit` was always colling `exit`.
* | async_wrap/timers: remove Add/RemoveAsyncListenerTrevor Norris2014-01-211-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ability to add/remove an AsyncListener to an object after its creation was an artifact of trying to get AL working with the domain module. Now that is no longer necessary and other features are going to be implemented that would be affected by this functionality. So the code will be removed for now to simplify the implementation process. In the future this code will likely be reintroduced, but after some other more important matters have been addressed. None of this functionality was documented, as is was meant specifically for domain specific implementation work arounds. Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>