summaryrefslogtreecommitdiff
path: root/src/node.cc
diff options
context:
space:
mode:
authorFedor Indutny <fedor.indutny@gmail.com>2014-03-27 00:30:49 +0400
committerFedor Indutny <fedor@indutny.com>2014-03-29 11:51:41 +0400
commitb55c9d68aa713e75ff5077cd425cbaafde010b92 (patch)
tree0dba3e7197ef32ded58e984dc41043e042677343 /src/node.cc
parent6d15b163b090f7dd218843fdca55f874da5daead (diff)
downloadnode-new-b55c9d68aa713e75ff5077cd425cbaafde010b92.tar.gz
configure: --v8-options option
Introduce a way to set some v8 flags at compile time, the values should be separated by comma.
Diffstat (limited to 'src/node.cc')
-rw-r--r--src/node.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/node.cc b/src/node.cc
index 830d3c3c00..5c2a885cd2 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -3062,6 +3062,26 @@ static void ParseArgs(int* argc,
}
+static void SetCompileTimeV8Options(const char** argv) {
+#ifdef NODE_V8_OPTIONS
+ int v8_argc;
+ static const char* v8_argv[] = { NULL, NODE_V8_OPTIONS };
+ if (ARRAY_SIZE(v8_argv) == 1)
+ return;
+
+ v8_argv[0] = argv[0];
+ v8_argc = ARRAY_SIZE(v8_argv);
+ V8::SetFlagsFromCommandLine(&v8_argc, const_cast<char**>(v8_argv), true);
+
+ // Anything that's still in v8_argv is not a V8 or a node option.
+ for (int i = 1; i < v8_argc; i++)
+ fprintf(stderr, "%s: bad option: %s\n", argv[0], v8_argv[i]);
+ if (v8_argc > 1)
+ exit(9);
+#endif // NODE_V8_OPTIONS
+}
+
+
// Called from V8 Debug Agent TCP thread.
static void DispatchMessagesDebugAgentCallback() {
uv_async_send(&dispatch_debug_messages_async);
@@ -3355,6 +3375,8 @@ void Init(int* argc,
DispatchDebugMessagesAsyncCallback);
uv_unref(reinterpret_cast<uv_handle_t*>(&dispatch_debug_messages_async));
+ SetCompileTimeV8Options(argv);
+
// Parse a few arguments which are specific to Node.
int v8_argc;
const char** v8_argv;