Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,11 @@ parser.add_option('--without-bundled-v8',
help='do not use V8 includes from the bundled deps folder. ' +
'(This mode is not officially supported for regular applications)')

parser.add_option('--without-profiler',
action='store_true',
dest='without_profiler',
help='disable V8 profiler usage')

(options, args) = parser.parse_args()

# Expand ~ in the install prefix now, it gets written to multiple files.
Expand Down Expand Up @@ -878,6 +883,8 @@ def configure_node(o):
else:
o['variables']['coverage'] = 'false'

o['variables']['node_use_profiler'] = b(not options.without_profiler)

def configure_library(lib, output):
shared_lib = 'shared_' + lib
output['variables']['node_' + shared_lib] = b(getattr(options, shared_lib))
Expand Down
11 changes: 9 additions & 2 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@
'defines': [
'NODE_ARCH="<(target_arch)"',
'NODE_PLATFORM="<(OS)"',
'NODE_WANT_INTERNALS=1',
# Warn when using deprecated V8 APIs.
'V8_DEPRECATION_WARNINGS=1',
],
Expand Down Expand Up @@ -275,6 +274,15 @@
'NODE_USE_V8_PLATFORM=0',
],
}],
[ 'node_use_v8_platform=="true"' and 'node_use_profiler=="true"', {
'defines': [
'NODE_USE_PROFILER=1',
],
}, {
'defines': [
'NODE_USE_PROFILER=0',
],
}],
[ 'node_tag!=""', {
'defines': [ 'NODE_TAG="<(node_tag)"' ],
}],
Expand Down Expand Up @@ -878,7 +886,6 @@
'GTEST_DONT_DEFINE_ASSERT_LE=1',
'GTEST_DONT_DEFINE_ASSERT_LT=1',
'GTEST_DONT_DEFINE_ASSERT_NE=1',
'NODE_WANT_INTERNALS=1',
],
'sources': [
'test/cctest/util.cc',
Expand Down
9 changes: 0 additions & 9 deletions src/async-wrap-inl.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
#ifndef SRC_ASYNC_WRAP_INL_H_
#define SRC_ASYNC_WRAP_INL_H_

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "async-wrap.h"
#include "base-object.h"
#include "base-object-inl.h"
#include "env.h"
#include "env-inl.h"
#include "node_internals.h"
#include "util.h"
#include "util-inl.h"
#include "v8.h"

namespace node {

Expand Down Expand Up @@ -51,6 +44,4 @@ inline v8::Local<v8::Value> AsyncWrap::MakeCallback(

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_ASYNC_WRAP_INL_H_
26 changes: 20 additions & 6 deletions src/async-wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
#include "util-inl.h"

#include "uv.h"

#include "v8.h"
#if defined(NODE_USE_PROFILER) && NODE_USE_PROFILER
#include "v8-profiler.h"
#endif

using v8::Boolean;
using v8::Context;
Expand All @@ -28,7 +31,8 @@ using v8::Value;

namespace node {

static const char* const provider_names[] = {
#if defined(NODE_USE_PROFILER) && NODE_USE_PROFILER
static const char* const retained_async_provider_names[] = {
#define V(PROVIDER) \
#PROVIDER,
NODE_ASYNC_PROVIDER_TYPES(V)
Expand All @@ -54,7 +58,7 @@ class RetainedAsyncInfo: public RetainedObjectInfo {


RetainedAsyncInfo::RetainedAsyncInfo(uint16_t class_id, AsyncWrap* wrap)
: label_(provider_names[class_id - NODE_ASYNC_ID_OFFSET]),
: label_(retained_async_provider_names[class_id - NODE_ASYNC_ID_OFFSET]),
wrap_(wrap),
length_(wrap->self_size()) {
}
Expand Down Expand Up @@ -100,6 +104,7 @@ RetainedObjectInfo* WrapperInfo(uint16_t class_id, Local<Value> wrapper) {

return new RetainedAsyncInfo(class_id, wrap);
}
#endif


// end RetainedAsyncInfo
Expand Down Expand Up @@ -203,7 +208,9 @@ void AsyncWrap::DestroyIdsCb(uv_idle_t* handle) {
// Want each callback to be cleaned up after itself, instead of cleaning
// them all up after the while() loop completes.
HandleScope scope(env->isolate());
Local<Value> argv = Number::New(env->isolate(), current_id);
// TBD POSSIBLE DATA LOSS:
Local<Value> argv = Number::New(env->isolate(),
static_cast<double>(current_id));
MaybeLocal<Value> ret = fn->Call(
env->context(), Undefined(env->isolate()), 1, &argv);

Expand All @@ -215,6 +222,7 @@ void AsyncWrap::DestroyIdsCb(uv_idle_t* handle) {
}


#if defined(NODE_USE_PROFILER) && NODE_USE_PROFILER
void LoadAsyncWrapperInfo(Environment* env) {
HeapProfiler* heap_profiler = env->isolate()->GetHeapProfiler();
#define V(PROVIDER) \
Expand All @@ -223,6 +231,7 @@ void LoadAsyncWrapperInfo(Environment* env) {
NODE_ASYNC_PROVIDER_TYPES(V)
#undef V
}
#endif


AsyncWrap::AsyncWrap(Environment* env,
Expand Down Expand Up @@ -252,14 +261,17 @@ AsyncWrap::AsyncWrap(Environment* env,
HandleScope scope(env->isolate());

Local<Value> argv[] = {
Number::New(env->isolate(), get_uid()),
// TBD POSSIBLE DATA LOSS:
Number::New(env->isolate(), static_cast<double>(get_uid())),
Int32::New(env->isolate(), provider),
Null(env->isolate()),
Null(env->isolate())
};

if (parent != nullptr) {
argv[2] = Number::New(env->isolate(), parent->get_uid());
// TBD POSSIBLE DATA LOSS:
argv[2] = Number::New(env->isolate(),
static_cast<double>(parent->get_uid()));
argv[3] = parent->object();
}

Expand Down Expand Up @@ -295,7 +307,9 @@ Local<Value> AsyncWrap::MakeCallback(const Local<Function> cb,

Local<Function> pre_fn = env()->async_hooks_pre_function();
Local<Function> post_fn = env()->async_hooks_post_function();
Local<Value> uid = Number::New(env()->isolate(), get_uid());
// TBD POSSIBLE DATA LOSS:
Local<Value> uid = Number::New(env()->isolate(),
static_cast<double>(get_uid()));
Local<Object> context = object();
Local<Object> domain;
bool has_domain = false;
Expand Down
8 changes: 4 additions & 4 deletions src/async-wrap.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef SRC_ASYNC_WRAP_H_
#define SRC_ASYNC_WRAP_H_

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "base-object.h"

#include "uv.h"

#include "v8.h"

#include <stdint.h>
Expand Down Expand Up @@ -91,10 +91,10 @@ class AsyncWrap : public BaseObject {
const int64_t uid_;
};

#if defined(NODE_USE_PROFILER) && NODE_USE_PROFILER
void LoadAsyncWrapperInfo(Environment* env);
#endif

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_ASYNC_WRAP_H_
2 changes: 1 addition & 1 deletion src/backtrace_posix.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "node.h"
#include "node_internals.h"

#if defined(__linux__)
#include <features.h>
Expand Down
5 changes: 0 additions & 5 deletions src/base-object-inl.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#ifndef SRC_BASE_OBJECT_INL_H_
#define SRC_BASE_OBJECT_INL_H_

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "base-object.h"
#include "env.h"
#include "env-inl.h"
#include "util.h"
#include "util-inl.h"
#include "v8.h"

namespace node {

Expand Down Expand Up @@ -70,6 +67,4 @@ inline void BaseObject::ClearWeak() {

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_BASE_OBJECT_INL_H_
4 changes: 0 additions & 4 deletions src/base-object.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef SRC_BASE_OBJECT_H_
#define SRC_BASE_OBJECT_H_

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "v8.h"

namespace node {
Expand Down Expand Up @@ -50,6 +48,4 @@ class BaseObject {

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_BASE_OBJECT_H_
13 changes: 5 additions & 8 deletions src/base64.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#ifndef SRC_BASE64_H_
#define SRC_BASE64_H_

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "util.h"

#include <stddef.h>

namespace node {

//// Base 64 ////
#define base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4)

Expand Down Expand Up @@ -61,8 +60,8 @@ size_t base64_decode_slow(char* dst, size_t dstlen,
for (;;) {
#define V(expr) \
while (i < srclen) { \
const uint8_t c = src[i]; \
lo = unbase64(c); \
const uint8_t c = static_cast<uint8_t>(src[i]); \
lo = static_cast<uint8_t>(unbase64(c)); \
i += 1; \
if (lo < 64) \
break; /* Legal character. */ \
Expand All @@ -75,7 +74,7 @@ size_t base64_decode_slow(char* dst, size_t dstlen,
if (k >= dstlen) \
return k; \
hi = lo;
V(/* Nothing. */);
V(; /* Nothing. */);
V(dst[k++] = ((hi & 0x3F) << 2) | ((lo & 0x30) >> 4));
V(dst[k++] = ((hi & 0x0F) << 4) | ((lo & 0x3C) >> 2));
V(dst[k++] = ((hi & 0x03) << 6) | ((lo & 0x3F) >> 0));
Expand Down Expand Up @@ -186,9 +185,7 @@ static size_t base64_encode(const char* src,

return dlen;
}
} // namespace node


#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
} // namespace node

#endif // SRC_BASE64_H_
6 changes: 3 additions & 3 deletions src/cares_wrap.cc
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#define CARES_STATICLIB
#include "ares.h"

#include "async-wrap.h"
#include "async-wrap-inl.h"
#include "env.h"
#include "env-inl.h"
#include "node.h"
#include "req-wrap.h"
#include "req-wrap-inl.h"

#include "tree.h"
#include "util.h"
#include "util-inl.h"

#include "uv.h"

#include <errno.h>
Expand Down
6 changes: 0 additions & 6 deletions src/connect_wrap.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#ifndef SRC_CONNECT_WRAP_H_
#define SRC_CONNECT_WRAP_H_

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "env.h"
#include "req-wrap.h"
#include "async-wrap.h"
#include "v8.h"

namespace node {

Expand All @@ -21,6 +17,4 @@ class ConnectWrap : public ReqWrap<uv_connect_t> {

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_CONNECT_WRAP_H_
7 changes: 0 additions & 7 deletions src/connection_wrap.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#ifndef SRC_CONNECTION_WRAP_H_
#define SRC_CONNECTION_WRAP_H_

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "env.h"
#include "stream_wrap.h"
#include "v8.h"

namespace node {

Expand All @@ -30,9 +26,6 @@ class ConnectionWrap : public StreamWrap {
UVType handle_;
};


} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_CONNECTION_WRAP_H_
9 changes: 2 additions & 7 deletions src/debug-agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@
#ifndef SRC_DEBUG_AGENT_H_
#define SRC_DEBUG_AGENT_H_

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "node_mutex.h"
#include "util.h"
#include "util-inl.h"
#include "uv.h"

#include "v8.h"
#include "v8-debug.h"

Expand Down Expand Up @@ -135,8 +131,7 @@ class Agent {
};

} // namespace debugger
} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
} // namespace node

#endif // SRC_DEBUG_AGENT_H_
6 changes: 2 additions & 4 deletions src/env-inl.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#ifndef SRC_ENV_INL_H_
#define SRC_ENV_INL_H_

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "env.h"
#include "node.h"
#include "util.h"
#include "util-inl.h"

#include "uv.h"

#include "v8.h"

#include <stddef.h>
Expand Down Expand Up @@ -496,6 +496,4 @@ inline v8::Local<v8::Object> Environment::NewInternalFieldObject() {

} // namespace node

#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#endif // SRC_ENV_INL_H_
Loading