33 using namespace v8::internal;
37 CHECK(FLAG_testing_bool_flag);
39 CHECK_EQ(2.5, FLAG_testing_float_flag);
40 CHECK_EQ(0, strcmp(FLAG_testing_string_flag,
"Hello, world!"));
44 static void SetFlagsToDefault() {
45 FlagList::ResetAllFlags();
51 FlagList::PrintHelp();
58 const char* argv[] = {
"Test2",
"-notesting-bool-flag",
59 "--notesting-maybe-bool-flag",
"notaflag",
60 "--testing_int_flag=77",
"-testing_float_flag=.25",
61 "--testing_string_flag",
"no way!" };
62 CHECK_EQ(0, FlagList::SetFlagsFromCommandLine(&argc,
63 const_cast<char **>(argv),
66 CHECK(!FLAG_testing_bool_flag);
67 CHECK(FLAG_testing_maybe_bool_flag.has_value);
68 CHECK(!FLAG_testing_maybe_bool_flag.value);
70 CHECK_EQ(.25, FLAG_testing_float_flag);
71 CHECK_EQ(0, strcmp(FLAG_testing_string_flag,
"no way!"));
78 " -notesting-bool-flag notaflag --testing_int_flag=77 "
79 "-notesting-maybe-bool-flag "
80 "-testing_float_flag=.25 "
81 "--testing_string_flag no_way! ";
83 CHECK(!FLAG_testing_bool_flag);
84 CHECK(FLAG_testing_maybe_bool_flag.has_value);
85 CHECK(!FLAG_testing_maybe_bool_flag.value);
87 CHECK_EQ(.25, FLAG_testing_float_flag);
88 CHECK_EQ(0, strcmp(FLAG_testing_string_flag,
"no_way!"));
96 {
"Test3",
"--testing_bool_flag",
"--testing-maybe-bool-flag",
"notaflag",
97 "--testing_int_flag",
"-666",
98 "--testing_float_flag",
"-12E10",
"-testing-string-flag=foo-bar" };
99 CHECK_EQ(0, FlagList::SetFlagsFromCommandLine(&argc,
100 const_cast<char **>(argv),
103 CHECK(FLAG_testing_bool_flag);
104 CHECK(FLAG_testing_maybe_bool_flag.has_value);
105 CHECK(FLAG_testing_maybe_bool_flag.value);
106 CHECK_EQ(-666, FLAG_testing_int_flag);
107 CHECK_EQ(-12E10, FLAG_testing_float_flag);
108 CHECK_EQ(0, strcmp(FLAG_testing_string_flag,
"foo-bar"));
115 "--testing_bool_flag --testing-maybe-bool-flag notaflag "
116 "--testing_int_flag -666 "
117 "--testing_float_flag -12E10 "
118 "-testing-string-flag=foo-bar";
120 CHECK(FLAG_testing_bool_flag);
121 CHECK(FLAG_testing_maybe_bool_flag.has_value);
122 CHECK(FLAG_testing_maybe_bool_flag.value);
123 CHECK_EQ(-666, FLAG_testing_int_flag);
124 CHECK_EQ(-12E10, FLAG_testing_float_flag);
125 CHECK_EQ(0, strcmp(FLAG_testing_string_flag,
"foo-bar"));
132 const char* argv[] = {
"Test4",
"--testing_bool_flag",
"--foo" };
133 CHECK_EQ(0, FlagList::SetFlagsFromCommandLine(&argc,
134 const_cast<char **>(argv),
137 CHECK(!FLAG_testing_maybe_bool_flag.has_value);
143 const char* str =
"--testing_bool_flag --foo";
145 CHECK(!FLAG_testing_maybe_bool_flag.has_value);
152 const char* argv[] = {
"Test5",
"--testing_int_flag=\"foobar\"" };
153 CHECK_EQ(1, FlagList::SetFlagsFromCommandLine(&argc,
154 const_cast<char **>(argv),
162 const char* str =
" --testing_int_flag=\"foobar\"";
170 const char* argv[] = {
"Test5",
"--testing-int-flag",
"0",
171 "--testing_float_flag" };
172 CHECK_EQ(3, FlagList::SetFlagsFromCommandLine(&argc,
173 const_cast<char **>(argv),
181 const char* str =
" --testing-int-flag 0 --testing_float_flag ";
189 const char* argv[] = {
"TestJSArgs1",
190 "--testing-int-flag",
"42",
191 "--",
"testing-float-flag",
"7"};
192 CHECK_EQ(0, FlagList::SetFlagsFromCommandLine(&argc,
193 const_cast<char **>(argv),
195 CHECK_EQ(42, FLAG_testing_int_flag);
196 CHECK_EQ(2.5, FLAG_testing_float_flag);
197 CHECK_EQ(2, FLAG_js_arguments.argc);
198 CHECK_EQ(0, strcmp(FLAG_js_arguments[0],
"testing-float-flag"));
199 CHECK_EQ(0, strcmp(FLAG_js_arguments[1],
"7"));
206 const char* str =
"--testing-int-flag 42 -- testing-float-flag 7";
208 CHECK_EQ(42, FLAG_testing_int_flag);
209 CHECK_EQ(2.5, FLAG_testing_float_flag);
210 CHECK_EQ(2, FLAG_js_arguments.argc);
211 CHECK_EQ(0, strcmp(FLAG_js_arguments[0],
"testing-float-flag"));
212 CHECK_EQ(0, strcmp(FLAG_js_arguments[1],
"7"));
218 const char* str =
"--testing-int-flag 42 --js-arguments testing-float-flag 7";
220 CHECK_EQ(42, FLAG_testing_int_flag);
221 CHECK_EQ(2.5, FLAG_testing_float_flag);
222 CHECK_EQ(2, FLAG_js_arguments.argc);
223 CHECK_EQ(0, strcmp(FLAG_js_arguments[0],
"testing-float-flag"));
224 CHECK_EQ(0, strcmp(FLAG_js_arguments[1],
"7"));
230 const char* str =
"--testing-int-flag 42 --js-arguments=testing-float-flag 7";
232 CHECK_EQ(42, FLAG_testing_int_flag);
233 CHECK_EQ(2.5, FLAG_testing_float_flag);
234 CHECK_EQ(2, FLAG_js_arguments.argc);
235 CHECK_EQ(0, strcmp(FLAG_js_arguments[0],
"testing-float-flag"));
236 CHECK_EQ(0, strcmp(FLAG_js_arguments[1],
"7"));
242 const char* str =
"--testing-int-flag 42 --";
244 CHECK_EQ(42, FLAG_testing_int_flag);
245 CHECK_EQ(0, FLAG_js_arguments.argc);
254 const char* argv[] = {
"",
"--crankshaft",
"--expose-debug-as" };
255 CHECK_EQ(2, FlagList::SetFlagsFromCommandLine(&argc,
256 const_cast<char **>(argv),
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
#define CHECK_EQ(expected, value)
#define CHECK_NE(unexpected, value)
int StrLength(const char *string)