From b55c9d68aa713e75ff5077cd425cbaafde010b92 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Thu, 27 Mar 2014 00:30:49 +0400 Subject: configure: --v8-options option Introduce a way to set some v8 flags at compile time, the values should be separated by comma. --- src/node.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/node.cc') 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(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(&dispatch_debug_messages_async)); + SetCompileTimeV8Options(argv); + // Parse a few arguments which are specific to Node. int v8_argc; const char** v8_argv; -- cgit v1.2.1