Skip to content

Commit

Permalink
src: make node_isolate global
Browse files Browse the repository at this point in the history
V8 3.15 has new API functions that let you specify the Isolate. V8 and
node.js generally spend 0.5-3.5% of the time in pthread_getspecific(),
looking up the current Isolate. Avoid that overhead by making "our"
isolate global so we can pass it around. The change to the new API is
introduced in follow-up commits.
  • Loading branch information
bnoordhuis committed Jan 7, 2013
1 parent df3563a commit 5d0816b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/node.cc
Expand Up @@ -148,6 +148,12 @@ static bool use_sni = false;
// process-relative uptime base, initialized at start-up
static double prog_start_time;

static volatile bool debugger_running = false;
static uv_async_t dispatch_debug_messages_async;

// Declared in node_internals.h
Isolate* node_isolate = NULL;


static void Tick(void) {
// Avoid entering a V8 scope.
Expand Down Expand Up @@ -2539,13 +2545,6 @@ static void ParseArgs(int argc, char **argv) {
}


static Isolate* node_isolate = NULL;
static volatile bool debugger_running = false;


static uv_async_t dispatch_debug_messages_async;


// Called from the main thread.
static void DispatchDebugMessagesAsyncCallback(uv_async_t* handle, int status) {
v8::Debug::ProcessDebugMessages();
Expand Down
3 changes: 3 additions & 0 deletions src/node_internals.h
Expand Up @@ -28,6 +28,9 @@

namespace node {

// Defined in node.cc
extern v8::Isolate* node_isolate;

#ifdef _WIN32
// emulate snprintf() on windows, _snprintf() doesn't zero-terminate the buffer
// on overflow...
Expand Down

0 comments on commit 5d0816b

Please sign in to comment.