summaryrefslogtreecommitdiff
path: root/src/node_util.cc
AgeCommit message (Collapse)Author
2017-04-03util: show External values explicitly in inspectAnna Henningsen
Display `v8::External` values as `[External]` rather than `{}` which makes them look like objects. PR-URL: https://github.com/nodejs/node/pull/12151 Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-03-02os: improve cpus() performanceBrian White
PR-URL: https://github.com/nodejs/node/pull/11564 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jackson Tian <shyvo1987@gmail.com>
2016-12-21buffer: allow Uint8Array input to methodsAnna Henningsen
Allow all methods on `buffer` and `Buffer` to take `Uint8Array` arguments where it makes sense. On the native side, there is effectively no difference, and as a bonus the `isUint8Array` check is faster than `instanceof Buffer`. PR-URL: https://github.com/nodejs/node/pull/10236 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
2016-09-26util: Add format for SharedArrayBufferYosuke Furukawa
PR-URL: https://github.com/nodejs/node/pull/8587 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-09-17buffer: add isSharedArrayBuffer checksOjas Shirekar
Fixes: https://github.com/nodejs/node/issues/8440 PR-URL: https://github.com/nodejs/node/pull/8510 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-09-09src: fix -Wunused-result warningSantiago Gimeno
PR-URL: https://github.com/nodejs/node/pull/8450 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-11test,util: fix flaky test-util-sigint-watchdogAnna Henningsen
Fix parallel/test-util-sigint-watchdog by polling until the signal has definitely been received instead of just using a timeout. Fixes: https://github.com/nodejs/node/issues/7919 PR-URL: https://github.com/nodejs/node/pull/7933 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-06-18vm: add ability to break on sigint/ctrl+cAnna Henningsen
- Adds the `breakEvalOnSigint` option to `vm.runIn(This)Context`. This uses a watchdog thread to wait for SIGINT and generally works just like the existing `timeout` option. - Adds a method to the existing timer-based watchdog to check if it stopped regularly or by running into the timeout. This is used to tell a SIGINT abort from a timer-based one. - Adds (internal) `process._{start,stop}SigintWatchdog` methods to start/stop the watchdog thread used by the above option manually. This will be used in the REPL to set up SIGINT handling before entering terminal raw mode, so that there is no time window in which Ctrl+C fully aborts the process. PR-URL: https://github.com/nodejs/node/pull/6635 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-06-01lib,src: drop dependency on v8::Private::ForApi()Ben Noordhuis
Said function requires that a v8::Context has been entered first, introducing a chicken-and-egg problem when creating the first context. PR-URL: https://github.com/nodejs/node/pull/7082 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-05-03util: fix inspecting of proxy objectsJames M Snell
In certain conditions, inspecting a Proxy object can lead to a max call stack error. Avoid that by detecting the Proxy object and outputting information about the Proxy object itself. Fixes: https://github.com/nodejs/node/issues/6464 PR-URL: https://github.com/nodejs/node/pull/6465 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-02-03src: upgrade to new v8::Private apiBen Noordhuis
Stop using the deprecated `GetHiddenValue()` and `SetHiddenValue()` methods, start using `GetPrivate()` and `SetPrivate()` instead. This commit turns some of the entries in the per-isolate string table into private symbols. PR-URL: https://github.com/nodejs/node/pull/5045 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-12-19module: always decorate thrown errorsBrian White
This provides more information when encountering a syntax or similar error when executing a file with require(). Fixes: https://github.com/nodejs/node/issues/4286 PR-URL: https://github.com/nodejs/node/pull/4287 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-12-03src: define Is* util functions with macroscjihrig
The Is* type checking functions in node_util.cc are mostly the same boilerplate. This commit defines them using a macro. Refs: https://github.com/nodejs/node/pull/4100 PR-URL: https://github.com/nodejs/node/pull/4118 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
2015-12-02util: determine object types in C++cjihrig
Determine object types of regular expressions, Dates, Maps, and Sets in the C++ layer instead of depending on toString() behavior in JavaScript. PR-URL: https://github.com/nodejs/node/pull/4100 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-12-02util: make inspect more reliableEvan Lucas
34a35919e165cba6d5972e004e6b2cbdf2f4c65a added pretty printing for TypedArray, ArrayBuffer, and DataView. This change allows inspecting those across different contexts. Since instanceof does not work across contexts, we can use v8::Value::IsTypedArray, v8::Value::IsArrayBuffer, and v8::Value::IsDataView PR-URL: https://github.com/nodejs/node/pull/4098 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-11-24util,src: allow lookup of hidden valuescjihrig
This commit adds an internal util method that makes hidden values in the C++ layer visible in JS. PR-URL: https://github.com/nodejs/node/pull/3988 Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-10-06util: fix for inspecting promisesEvan Lucas
The upgrade to v8 4.6 removes ObjectIsPromise. This change utilizes v8::Value::IsPromise to verify that the argument is indeed a promise. PR-URL: https://github.com/nodejs/node/pull/3221 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-10-05util: correctly inspect Map/Set IteratorsEvan Lucas
Previously, a MapIterator or SetIterator would not be inspected properly. This change makes it possible to inspect them by creating a Debug Mirror and previewing the iterators to not consume the actual iterator that we are trying to inspect. This change also adds a node_util binding that uses v8's Value::IsSetIterator and Value::IsMapIterator to verify that the values passed in are actual iterators. Fixes: https://github.com/nodejs/node/issues/3107 PR-URL: https://github.com/nodejs/node/pull/3119 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>