Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit d50069c

Browse files
committed
chakrashim: add warning for ignored engine flags
* Added a warning for any ignored engine-specific flags. * Added `--max-old-space-size=` to the list of ignored flags. PR-URL: #502 Reviewed-By: Seth Brenith <sethb@microsoft.com>
1 parent bdb2130 commit d50069c

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

deps/chakrashim/src/v8v8.cc

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,6 @@ static bool startsWith(const char* str, const char (&prefix)[N]) {
118118
return strncmp(str, prefix, N - 1) == 0;
119119
}
120120

121-
122-
123-
124121
void V8::SetFlagsFromCommandLine(int *argc, char **argv, bool remove_flags) {
125122
for (int i = 1; i < *argc; i++) {
126123
// Note: Node now exits on invalid options. We may not recognize V8 flags
@@ -142,18 +139,24 @@ void V8::SetFlagsFromCommandLine(int *argc, char **argv, bool remove_flags) {
142139
argv[i] = nullptr;
143140
}
144141
} else if (equals("--trace-debug-json", arg) ||
145-
equals("--trace_debug_json", arg)) {
142+
equals("--trace_debug_json", arg)) {
146143
g_trace_debug_json = true;
147144
if (remove_flags) {
148145
argv[i] = nullptr;
149146
}
150-
} else if (remove_flags &&
151-
(startsWith(
152-
arg, "--debug") // Ignore some flags to reduce unit test noise
153-
|| startsWith(arg, "--harmony")
154-
|| startsWith(arg, "--stack-size=")
155-
|| startsWith(arg, "--nolazy"))) {
156-
argv[i] = nullptr;
147+
} else if (startsWith(arg, "--debug") ||
148+
startsWith(arg, "--harmony") ||
149+
startsWith(arg, "--max-old-space-size=") ||
150+
startsWith(arg, "--nolazy") ||
151+
startsWith(arg, "--stack-size=")) {
152+
// Ignore some flags to reduce compatibility issues. These flags don't
153+
// have any functionality differences in ChakraCore and are generally
154+
// invisible to the running code.
155+
fprintf(stderr, "Warning: Ignored engine flag: %s\n", arg);
156+
157+
if (remove_flags) {
158+
argv[i] = nullptr;
159+
}
157160
} else if (equals("--help", arg)) {
158161
printf(
159162
"Options:\n"

0 commit comments

Comments
 (0)