0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00
Commit Graph

36 Commits

Author SHA1 Message Date
Ben Noordhuis
2d82cdf670 src: replace NULL with nullptr
Now that we are building with C++11 features enabled, replace use
of NULL with nullptr.

The benefit of using nullptr is that it can never be confused for
an integral type because it does not support implicit conversions
to integral types except boolean - unlike NULL, which is defined
as a literal `0`.
2014-10-23 22:49:58 +02:00
Ben Noordhuis
d3c317e08a src: attach env directly to api functions
Attach the per-context execution environment directly to API functions.
Rationale:

 * Gets node one step closer to multi-isolate readiness.

 * Avoids multi-context confusion, e.g. when the caller and callee live
   in different contexts.

 * Avoids expensive calls to pthread_getspecific() on platforms where
   V8 does not know how to use the thread-local storage directly.
   (Linux, the BSDs.)

PR-URL: https://github.com/node-forward/node/pull/18
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-13 23:46:46 +04:00
Ben Noordhuis
97585b0d7a src: remove unnecessary HandleScopes
API callback functions don't need to create a v8::HandleScope instance
because V8 already creates one in the JS->C++ adapter frame.

PR-URL: https://github.com/node-forward/node/pull/16
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-12 02:09:16 +04:00
Timothy J Fontaine
1a09da6ec2 Merge remote-tracking branch 'upstream/v0.10'
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
2014-06-10 19:36:04 -04:00
Timothy J Fontaine
535c7777ac src: replace usage of String::Utf8Value
v8::String::Utf8Value previously could allow invalid surrogates when
interpreting values.
2014-06-06 15:07:29 -07:00
Ben Noordhuis
23dfa71dd5 src: fix tracing infrastructure after v8 upgrade
Fix up the dtrace/etw/systemtap infrastructure after the V8 upgrade in
commit 1c7bf24.  The win32 changes are untested but can hardly make
things worse because node doesn't build on windows right now.

Fixes #7313 with some luck.
2014-03-16 16:15:34 +04:00
Fedor Indutny
ce04c726a3 src: update to v8 3.24 APIs 2014-03-13 20:56:55 +04:00
Fedor Indutny
78d245f5b2 Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	configure
	lib/_stream_readable.js
	lib/http.js
	src/node_dtrace.cc
2014-03-02 23:54:19 +04:00
Fedor Indutny
75adde07f9 src: remove node_isolate from source
fix #6899
2014-02-22 03:20:56 +04:00
Fedor Indutny
a6f89ccd76 dtrace: workaround linker bug on FreeBSD 2014-02-21 00:56:17 +04:00
Timothy J Fontaine
eadb4f5606 Merge remote-tracking branch 'upstream/v0.10'
Conflicts:
	deps/v8/src/preparser.cc
	deps/v8/src/win32-math.h
	doc/api/http.markdown
	src/node_buffer.h
	src/node_crypto.cc
	src/node_file.cc
	src/node_http_parser.cc
2014-02-08 16:45:27 -08:00
Fedor Indutny
643a7d8c16 dtrace: fix arguments warning
Add enough arguments to `NODE_NET_SOCKET_READ()` and
`NODE_NET_SOCKET_WRITE()` stubs.
2014-02-01 00:45:55 +04:00
Ben Noordhuis
c4def505cb build: use zero overhead systemtap probes
Profiling suggested that on Linux sometimes over 10% of CPU time was
being spent inside the systemtap probe entry points in the binding
layer, even when the process was not actively being traced with the
`stap` tool.

That's why this commit makes it possible to use the *_ENABLED() macros
and bail out early when we're not being traced, reducing the overhead
of unused probes to (almost) zero.

Said macros were already being generated by `dtrace -h` but were not
usable because they rely on external definitions.  To remedy that, we
now generate the accompanying object files with `dtrace -G`.

This commit includes a change to libuv that has been landed upstream in
commit joyent/libuv@3c172ea.
2013-10-29 21:55:48 +01:00
Ben Noordhuis
f674b09f40 src: use v8::String::NewFrom*() functions
* Change calls to String::New() and String::NewSymbol() to their
  respective one-byte, two-byte and UTF-8 counterparts.

* Add a FIXED_ONE_BYTE_STRING macro that takes a string literal and
  turns it into a v8::Local<v8::String>.

* Add helper functions that make v8::String::NewFromOneByte() easier to
  work with. Said function expects a `const uint8_t*` but almost every
  call site deals with `const char*` or `const unsigned char*`. Helps
  us avoid doing reinterpret_casts all over the place.

* Code that handles file system paths keeps using UTF-8 for backwards
  compatibility reasons. At least now the use of UTF-8 is explicit.

* Remove v8::String::NewSymbol() entirely. Almost all call sites were
  effectively minor de-optimizations. If you create a string only once,
  there is no point in making it a symbol. If you are create the same
  string repeatedly, it should probably be cached in a persistent
  handle.
2013-08-09 11:44:50 +02:00
Fedor Indutny
8e29ce9f13 src: lint c++ code 2013-07-31 22:12:06 +04:00
Ben Noordhuis
110a9cd8db lib, src: upgrade after v8 api change
This is a big commit that touches just about every file in the src/
directory. The V8 API has changed in significant ways. The most
important changes are:

* Binding functions take a const v8::FunctionCallbackInfo<T>& argument
  rather than a const v8::Arguments& argument.

* Binding functions return void rather than v8::Handle<v8::Value>. The
  return value is returned with the args.GetReturnValue().Set() family
  of functions.

* v8::Persistent<T> no longer derives from v8::Handle<T> and no longer
  allows you to directly dereference the object that the persistent
  handle points to. This means that the common pattern of caching
  oft-used JS values in a persistent handle no longer quite works,
  you first need to reconstruct a v8::Local<T> from the persistent
  handle with the Local<T>::New(isolate, persistent) factory method.

A handful of (internal) convenience classes and functions have been
added to make dealing with the new API a little easier.

The most visible one is node::Cached<T>, which wraps a v8::Persistent<T>
with some template sugar. It can hold arbitrary types but so far it's
exclusively used for v8::Strings (which was by far the most commonly
cached handle type.)
2013-07-06 17:44:44 +02:00
Timothy J Fontaine
23509eb9e8 dtrace: unify dtrace and systemtap interfaces 2013-05-22 20:19:31 -07:00
Ben Noordhuis
75463899c8 dtrace: check if _handle property is set
Check that _handle is an object before trying to read its `fd`
property, avoids bogus values.
2013-04-03 09:52:56 -07:00
Timothy J Fontaine
aca31e37f7 dtrace: actually use the _handle.fd value
When using the DTrace/systemtap subsystems it would be helpful to
actually have an fd associated with the requests and responses.
2013-04-03 09:52:56 -07:00
Dave Pacheco
bf22f99f3a dtrace: pass more arguments to probes
OSX and other DTrace implementations don't support dereferencing
structs in probes. To accomodate that pass members from the struct as
arguments so that DTrace is useful on those systems.
2013-04-03 09:52:56 -07:00
Ben Noordhuis
9b8dd39553 dtrace: check if _handle property is set
Check that _handle is an object before trying to read its `fd`
property, avoids bogus values.
2013-03-30 01:49:21 +01:00
Timothy J Fontaine
aa5da48594 dtrace: actually use the _handle.fd value
When using the DTrace/systemtap subsystems it would be helpful to
actually have an fd associated with the requests and responses.
2013-03-30 01:30:16 +01:00
Dave Pacheco
7634069614 dtrace: pass more arguments to probes
OSX and other DTrace implementations don't support dereferencing
structs in probes. To accomodate that pass members from the struct as
arguments so that DTrace is useful on those systems.
2013-03-30 01:04:00 +01:00
Trevor Norris
f65e14ed1d src: pass Isolate to all applicable api
Update the api to pass node_isolate to all supported methods.

Much thanks to Ben Noordhuis and his work in 51f6e6a.
2013-03-20 01:11:02 +01: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
Ben Noordhuis
51f6e6a9b3 src, test: downgrade to v8 3.14 api 2013-02-25 23:45:02 +01:00
Ben Noordhuis
7788a6bf85 src: pass node_isolate to Undefined() 2013-01-07 17:39:58 +01:00
Jan Wynholds
06810b29fa tracing: add systemtap support 2012-11-01 01:25:22 +01:00
Igor Zinkovsky
35a1421e96 Windows: Enable ETW events.
This commit enables ETW events to be fired on Windows for existing
DTrace probes.  ETW instrumentation is enabled by default.  It
is possible to build node.exe without ETW instrumentation by
using --without-etw option with configure script.
2012-06-13 15:36:08 -07:00
ssuda
249c3c165a Avoiding unnecessary ToString() calls
String::Utf8Value and String::AsciiValue constructors take Handle<Value>
So no need to convert to Handle<String>
2012-03-23 01:02:59 +01:00
Ben Noordhuis
ff4a9d381d core: use proper #include directives 2012-03-10 00:14:14 +01:00
Bert Belder
5c9a262eb0 Compatibility issue and warning in x-forwarded-for dtrace probe 2011-06-08 05:06:09 +02:00
Dave Pacheco
e142fe2be6 DTrace probes: support X-Forwarded-For
INTRO-385
2011-06-04 16:05:01 +02:00
Ryan Dahl
55048cdf79 Update copyright headers 2011-03-14 17:37:05 -07:00
Ryan Dahl
e9257b859d New DTrace probes from CA team 2011-02-09 18:50:26 -08:00
Ryan Dahl
068b733583 Land Cantrill's DTrace patch
only works on solaris
2011-01-24 18:59:06 -08:00