Browse Source

src: make node_isolate global

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.
v0.9.6-release
Ben Noordhuis 12 years ago
parent
commit
5d0816bf3e
  1. 13
      src/node.cc
  2. 3
      src/node_internals.h

13
src/node.cc

@ -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.
@ -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();

3
src/node_internals.h

@ -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...

Loading…
Cancel
Save