51 static const KeywordToken keywords[] = {
52 #define KEYWORD(t, s, d) { s, i::Token::t },
55 {
NULL, i::Token::IDENTIFIER }
58 KeywordToken key_token;
61 for (
int i = 0; (key_token = keywords[i]).keyword !=
NULL; i++) {
63 reinterpret_cast<const i::byte*
>(key_token.keyword);
65 CHECK(static_cast<int>(
sizeof(buffer)) >= length);
85 static const char chars_to_append[] = {
'z',
'0',
'_' };
86 for (
int j = 0; j < static_cast<int>(
ARRAY_SIZE(chars_to_append)); ++j) {
88 buffer[length] = chars_to_append[j];
98 buffer[length - 1] =
'_';
121 const char* tests[] = {
123 "--> is eol-comment\nvar y = 37;\n",
124 "\n --> is eol-comment\nvar y = 37;\n",
125 "/* precomment */ --> is eol-comment\nvar y = 37;\n",
126 "\n/* precomment */ --> is eol-comment\nvar y = 37;\n",
128 "var x = 42;\n--> is eol-comment\nvar y = 37;\n",
129 "var x = 42;\n/* precomment */ --> is eol-comment\nvar y = 37;\n",
133 const char* fail_tests[] = {
134 "x --> is eol-comment\nvar y = 37;\n",
135 "\"\\n\" --> is eol-comment\nvar y = 37;\n",
136 "x/* precomment */ --> is eol-comment\nvar y = 37;\n",
137 "x/* precomment\n */ --> is eol-comment\nvar y = 37;\n",
138 "var x = 42; --> is eol-comment\nvar y = 37;\n",
139 "var x = 42; /* precomment\n */ --> is eol-comment\nvar y = 37;\n",
146 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
148 for (
int i = 0; tests[i]; i++) {
156 for (
int i = 0; fail_tests[i]; i++) {
172 : data_(data), length_(length) { }
174 const char*
data()
const {
return data_; }
175 size_t length()
const {
return length_; }
190 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
196 "function foo(a) { return function nolazy(b) { return a + b; } }"
197 "function bar(a) { if (a) return function lazy(b) { return b; } }"
198 "var z = {'string': 'string literal', bareword: 'propertyName', "
199 " 42: 'number literal', for: 'keyword as propertyName', "
200 " f\\u006fr: 'keyword propertyname with escape'};"
201 "var v = /RegExp Literal/;"
202 "var w = /RegExp Literal\\u0020With Escape/gin;"
203 "var y = { get getter() { return 42; }, "
204 " set setter(v) { this.value = v; }};";
206 const char* error_source =
"var x = y z;";
212 bool lazy_flag = i::FLAG_lazy;
219 reinterpret_cast<const uint8_t*>(preparse->
Data()),
226 i::FLAG_lazy =
false;
232 reinterpret_cast<const uint8_t*>(preparse->
Data()),
237 i::FLAG_lazy = lazy_flag;
244 error_source_length));
248 i::Scanner::Location error_location =
251 CHECK_EQ(10, error_location.beg_pos);
252 CHECK_EQ(11, error_location.end_pos);
254 const char*
message = pre_impl->BuildMessage();
259 delete error_preparse;
263 TEST(PreparseFunctionDataIsUsed) {
268 i::FLAG_min_preparse_length = 0;
276 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
278 const char* good_code =
279 "function this_is_lazy() { var a; } function foo() { return 25; } foo();";
282 const char* bad_code =
283 "function this_is_lazy() { if ( } function foo() { return 25; } foo();";
301 CHECK(result->IsInt32());
306 TEST(PreparseSymbolDataIsUsed) {
312 i::FLAG_crankshaft =
false;
315 i::FLAG_min_preparse_length = 0;
323 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
326 const char* good_code =
327 "(function weird() { var foo = 26; return foo; })()";
331 const char* bad_code =
332 "(function weird() { var foo = 26; return wut; })()";
351 CHECK(result->IsInt32());
361 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
363 const char* programs[] = {
366 "function foo(x, y) { return x + y; }",
367 "%ArgleBargle(glop);",
368 "var x = new new Function('this.x = 42');",
373 for (
int i = 0; programs[i]; i++) {
374 const char* program = programs[i];
376 reinterpret_cast<const i::byte*>(program),
377 static_cast<unsigned>(strlen(program)));
388 CHECK(!data.has_error());
393 TEST(StandAlonePreParserNoNatives) {
398 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
400 const char* programs[] = {
401 "%ArgleBargle(glop);",
402 "var x = %_IsSmi(42);",
407 for (
int i = 0; programs[i]; i++) {
408 const char* program = programs[i];
410 reinterpret_cast<const i::byte*>(program),
411 static_cast<unsigned>(strlen(program)));
423 CHECK(data.has_error());
428 TEST(PreparsingObjectLiterals) {
437 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
440 const char* source =
"var myo = {if: \"foo\"}; myo.if;";
442 CHECK(result->IsString());
448 const char* source =
"var myo = {\"bar\": \"foo\"}; myo[\"bar\"];";
450 CHECK(result->IsString());
456 const char* source =
"var myo = {1: \"foo\"}; myo[1];";
458 CHECK(result->IsString());
470 log->WriteNumber(number);
471 if (log->symbol_id_ < number + 1) {
472 log->symbol_id_ = number + 1;
476 return log->symbol_store_.
size();
479 return log->symbol_id_;
482 return log->function_store_.
size();
490 TEST(StoringNumbersInPreParseData) {
496 for (
int i = 0; i < 18; ++i) {
497 F::FakeWritingSymbolIdInPreParseData(&log, 1 << i);
499 for (
int i = 1; i < 18; ++i) {
500 F::FakeWritingSymbolIdInPreParseData(&log, (1 << i) + 1);
502 for (
int i = 6; i < 18; ++i) {
503 F::FakeWritingSymbolIdInPreParseData(&log, (3 << i) + (5 << (i - 6)));
509 for (
int i = 0; i < 18; ++i) {
512 for (
int i = 1; i < 18; ++i) {
515 for (
int i = 6; i < 18; ++i) {
527 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
529 const char* program =
"var x = 'something';\n"
530 "escape: function() {}";
537 reinterpret_cast<const i::byte*>(program),
538 static_cast<unsigned>(strlen(program)));
556 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
558 const char* program =
559 "try { } catch (e) { var foo = function () { /* first */ } }"
560 "var bar = function () { /* second */ }";
567 CHECK(!data->HasError());
572 static_cast<int>(strstr(program,
"function") - program);
573 int first_lbrace = first_function +
i::StrLength(
"function () ");
574 CHECK_EQ(
'{', program[first_lbrace]);
575 i::FunctionEntry entry1 = data->GetFunctionEntry(first_lbrace);
576 CHECK(!entry1.is_valid());
578 int second_function =
579 static_cast<int>(strstr(program + first_lbrace,
"function") - program);
582 CHECK_EQ(
'{', program[second_lbrace]);
583 i::FunctionEntry entry2 = data->GetFunctionEntry(second_lbrace);
584 CHECK(entry2.is_valid());
585 CHECK_EQ(
'}', program[entry2.end_pos() - 1]);
595 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
597 size_t kProgramSize = 1024 * 1024;
599 memset(program.
get(),
'(', kProgramSize);
600 program[kProgramSize] =
'\0';
605 reinterpret_cast<const i::byte*>(program.get()),
606 static_cast<unsigned>(kProgramSize));
621 : data_(data), length_(static_cast<size_t>(length)) { }
638 #define CHECK_EQU(v1, v2) CHECK_EQ(static_cast<int>(v1), static_cast<int>(v2))
644 if (end == 0) end = length;
645 unsigned sub_length = end - start;
650 for (
unsigned i = 0; i < length; i++) {
651 uc16_buffer[i] =
static_cast<i::uc16>(ascii_source[i]);
664 reinterpret_cast<const i::byte*>(ascii_source), end);
674 int32_t c1 = uc16_stream.Advance();
685 while (i > start + sub_length / 4) {
687 int32_t c0 = ascii_source[i - 1];
691 uc16_stream.PushBack(c0);
698 int32_t c1 = uc16_stream.Advance();
708 uc16_stream.PushBack(c0);
716 unsigned halfway = start + sub_length / 2;
717 uc16_stream.SeekForward(halfway - i);
731 int32_t c1 = uc16_stream.Advance();
743 int32_t c1 = uc16_stream.Advance();
759 static const unsigned kBigStringSize = 4096;
760 char buffer[kBigStringSize + 1];
761 for (
unsigned i = 0; i < kBigStringSize; i++) {
762 buffer[i] =
static_cast<char>(i & 0x7f);
775 static const int kMaxUC16Char =
static_cast<int>(kMaxUC16CharU);
777 static const int kAllUtf8CharsSize =
781 static const unsigned kAllUtf8CharsSizeU =
782 static_cast<unsigned>(kAllUtf8CharsSize);
784 char buffer[kAllUtf8CharsSizeU];
786 for (
int i = 0; i <= kMaxUC16Char; i++) {
791 ASSERT(cursor == kAllUtf8CharsSizeU);
795 for (
int i = 0; i <= kMaxUC16Char; i++) {
801 for (
int i = kMaxUC16Char; i >= 0; i--) {
807 while (stream.
pos() < kMaxUC16CharU) {
812 if (i <= kMaxUC16Char) {
840 }
while (expected_tokens[i] != i::Token::ILLEGAL);
847 const char* str1 =
"{ foo get for : */ <- \n\n /*foo*/ bib";
849 static_cast<unsigned>(strlen(str1)));
852 i::Token::IDENTIFIER,
853 i::Token::IDENTIFIER,
860 i::Token::IDENTIFIER,
866 const char* str2 =
"case default const {THIS\nPART\nSKIPPED} do";
868 static_cast<unsigned>(strlen(str2)));
884 const char* str3 =
"{}}}}";
895 for (
int i = 0; i <= 4; i++) {
896 expectations3[6 - i] = i::Token::ILLEGAL;
897 expectations3[5 - i] = i::Token::EOS;
899 reinterpret_cast<const i::byte*>(str3),
900 static_cast<unsigned>(strlen(str3)));
908 reinterpret_cast<const i::byte*>(re_source),
909 static_cast<unsigned>(strlen(re_source)));
921 i::String::FlatContent content = val->GetFlatContent();
922 CHECK(content.IsAscii());
924 for (
int i = 0; i < actual.length(); i++) {
968 static int Utf8LengthHelper(
const char* s) {
970 int character_length = len;
971 for (
int i = 0; i < len; i++) {
972 unsigned char c = s[i];
973 int input_offset = 0;
974 int output_adjust = 0;
976 if (c < 0xc0)
continue;
983 if ((c & 7) == 0 && ((s[i + 1] & 0x30) == 0)) {
990 character_length -= 2;
991 }
else if (c >= 0xe0) {
992 if ((c & 0xf) == 0 && ((s[i + 1] & 0x20) == 0)) {
1001 if ((c & 0x1e) == 0) {
1011 for (
int j = 1; j <= input_offset; j++) {
1012 if ((s[i + j] & 0xc0) != 0x80) {
1021 character_length -= output_adjust;
1025 return character_length;
1030 v8::internal::FLAG_harmony_scoping =
true;
1039 const char* outer_prefix;
1040 const char* inner_source;
1041 const char* outer_suffix;
1046 const SourceData source_data[] = {
1049 {
" with ({}) ",
"{\n"
1054 {
" with ({}) ",
"statement",
"\n"
1057 " ",
"statement;",
"\n"
1059 {
" try {} catch ",
"(e) { block; }",
" more;",
1061 {
" try {} catch ",
"(e) { block; }",
"; more;",
1063 {
" try {} catch ",
"(e) {\n"
1067 {
" try {} catch ",
"(e) { block; }",
" finally { block; } more;",
1079 " function fun",
"(a,b) { infunction; }",
" more;",
1082 " function fun",
"(a,b) {\n"
1086 {
" (function fun",
"(a,b) { infunction; }",
")();",
1088 {
" for ",
"(let x = 1 ; x < 10; ++ x) { block; }",
" more;",
1090 {
" for ",
"(let x = 1 ; x < 10; ++ x) { block; }",
"; more;",
1092 {
" for ",
"(let x = 1 ; x < 10; ++ x) {\n"
1096 {
" for ",
"(let x = 1 ; x < 10; ++ x) statement;",
" more;",
1098 {
" for ",
"(let x = 1 ; x < 10; ++ x) statement",
"\n"
1100 {
" for ",
"(let x = 1 ; x < 10; ++ x)\n"
1103 {
" for ",
"(let x in {}) { block; }",
" more;",
1105 {
" for ",
"(let x in {}) { block; }",
"; more;",
1107 {
" for ",
"(let x in {}) {\n"
1111 {
" for ",
"(let x in {}) statement;",
" more;",
1113 {
" for ",
"(let x in {}) statement",
"\n"
1115 {
" for ",
"(let x in {})\n"
1121 {
" 'foo\355\240\201\355\260\211';\n"
1122 " (function fun",
"(a,b) { infunction; }",
")();",
1125 {
" 'foo\360\220\220\212';\n"
1126 " (function fun",
"(a,b) { infunction; }",
")();",
1129 {
" 'foo\340\277\277';\n"
1130 " (function fun",
"(a,b) { infunction; }",
")();",
1133 {
" 'foo\355\240\201\355\211';\n"
1134 " (function fun",
"(a,b) { infunction; }",
")();",
1137 {
" 'foo\340\277';\n"
1138 " (function fun",
"(a,b) { infunction; }",
")();",
1142 " (function fun",
"(a,b) { infunction; }",
")();",
1145 {
" 'foo\340\203\277';\n"
1146 " (function fun",
"(a,b) { infunction; }",
")();",
1149 {
" 'foo\340\201\277';\n"
1150 " (function fun",
"(a,b) { infunction; }",
")();",
1153 {
" 'foo\355\240\201';\n"
1154 " (function fun",
"(a,b) { infunction; }",
")();",
1157 {
" 'foo\355\240\201\340\277\277';\n"
1158 " (function fun",
"(a,b) { infunction; }",
")();",
1162 {
" 'foo\355\240\201\360\215\260\211';\n"
1163 " (function fun",
"(a,b) { infunction; }",
")();",
1166 {
" 'foo\355\260\211';\n"
1167 " (function fun",
"(a,b) { infunction; }",
")();",
1170 {
" 'foo\303\277';\n"
1171 " (function fun",
"(a,b) { infunction; }",
")();",
1175 " (function fun",
"(a,b) { infunction; }",
")();",
1178 {
" 'foo\301\277';\n"
1179 " (function fun",
"(a,b) { infunction; }",
")();",
1182 {
" 'foo\370\277\277\277\277';\n"
1183 " (function fun",
"(a,b) { infunction; }",
")();",
1186 {
" 'foo\374\277\277\277\277\277';\n"
1187 " (function fun",
"(a,b) { infunction; }",
")();",
1190 {
" 'foo\376\277\277\277\277\277\277';\n"
1191 " (function fun",
"(a,b) { infunction; }",
")();",
1194 {
" 'foo\377\277\277\277\277\277\277\277';\n"
1195 " (function fun",
"(a,b) { infunction; }",
")();",
1198 " (function fun",
"(a,b) { 'bar\355\240\201\355\260\213'; }",
")();",
1201 " (function fun",
"(a,b) { 'bar\360\220\220\214'; }",
")();",
1215 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
1217 for (
int i = 0; source_data[i].outer_prefix; i++) {
1218 int kPrefixLen = Utf8LengthHelper(source_data[i].outer_prefix);
1219 int kInnerLen = Utf8LengthHelper(source_data[i].inner_source);
1220 int kSuffixLen = Utf8LengthHelper(source_data[i].outer_suffix);
1221 int kPrefixByteLen =
i::StrLength(source_data[i].outer_prefix);
1222 int kInnerByteLen =
i::StrLength(source_data[i].inner_source);
1223 int kSuffixByteLen =
i::StrLength(source_data[i].outer_suffix);
1224 int kProgramSize = kPrefixLen + kInnerLen + kSuffixLen;
1225 int kProgramByteSize = kPrefixByteLen + kInnerByteLen + kSuffixByteLen;
1228 source_data[i].outer_prefix,
1229 source_data[i].inner_source,
1230 source_data[i].outer_suffix);
1235 CHECK_EQ(source->length(), kProgramSize);
1248 CHECK(scope->is_global_scope());
1249 CHECK_EQ(scope->start_position(), 0);
1250 CHECK_EQ(scope->end_position(), kProgramSize);
1251 CHECK_EQ(scope->inner_scopes()->length(), 1);
1254 CHECK_EQ(inner_scope->scope_type(), source_data[i].scope_type);
1255 CHECK_EQ(inner_scope->start_position(), kPrefixLen);
1258 CHECK_EQ(inner_scope->end_position(), kPrefixLen + kInnerLen);
1271 for (
int i = 0; i < args.
length(); i++) {
1281 bool has_exception =
false;
1283 isolate, format_fun, builtins, 2, arg_handles, &has_exception);
1284 CHECK(!has_exception);
1285 CHECK(result->IsString());
1286 for (
int i = 0; i < args.
length(); i++) {
1312 template <
typename Traits>
1341 scanner.Initialize(&stream);
1348 i::FunctionLiteral*
function;
1360 if (
function ==
NULL) {
1365 CHECK(maybe_object->To(&exception));
1372 "Parser failed on:\n"
1376 "However, we expected no error.",
1377 source->ToCString().get(), message_string->ToCString().get());
1381 if (!data.has_error()) {
1383 "Parser failed on:\n"
1387 "However, the preparser succeeded",
1388 source->ToCString().get(), message_string->ToCString().get());
1393 if (!message_string->Equals(*preparser_message)) {
1395 "Expected parser and preparser to produce the same error on:\n"
1397 "However, found the following error messages\n"
1399 "\tpreparser: %s\n",
1400 source->ToCString().get(),
1401 message_string->ToCString().get(),
1402 preparser_message->ToCString().get());
1405 }
else if (data.has_error()) {
1407 "Preparser failed on:\n"
1411 "However, the parser succeeded",
1412 source->ToCString().get(),
FormatMessage(&data)->ToCString().get());
1414 }
else if (result ==
kError) {
1416 "Expected error on:\n"
1418 "However, parser and preparser succeeded",
1419 source->ToCString().get());
1427 size_t flag_list_length,
1431 for (
int bits = 0; bits < (1 << flag_list_length); bits++) {
1433 for (
size_t flag_index = 0; flag_index < flag_list_length; flag_index++) {
1434 if ((bits & (1 << flag_index)) != 0) flags.
Add(flag_list[flag_index]);
1442 const char* context_data[][2] = {
1445 {
"if (true) ",
" else {}" },
1446 {
"if (true) {} else ",
"" },
1447 {
"if (true) ",
"" },
1448 {
"do ",
" while (false)" },
1449 {
"while (false) ",
"" },
1450 {
"for (;;) ",
"" },
1451 {
"with ({})",
"" },
1452 {
"switch (12) { case 12: ",
"}" },
1453 {
"switch (12) { default: ",
"}" },
1454 {
"switch (12) { ",
"case 12: }" },
1459 const char* statement_data[] = {
1467 "if (false) {} else ;",
1468 "if (false) {} else {}",
1469 "if (false) {} else 12",
1473 "do {} while (false)",
1489 "switch ({}) { default: }"
1494 "try {} catch(e) {}",
1495 "try {} finally {}",
1496 "try {} catch(e) {} finally {}",
1501 const char* termination_data[] = {
1516 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
1522 for (
int i = 0; context_data[i][0] !=
NULL; ++i) {
1523 for (
int j = 0; statement_data[j] !=
NULL; ++j) {
1524 for (
int k = 0; termination_data[k] !=
NULL; ++k) {
1527 int kTerminationLen =
i::StrLength(termination_data[k]);
1529 int kProgramSize = kPrefixLen + kStatementLen + kTerminationLen
1535 "label: for (;;) { %s%s%s%s }",
1538 termination_data[k],
1539 context_data[i][1]);
1540 CHECK(length == kProgramSize);
1561 v8::internal::FLAG_min_preparse_length = 1;
1567 const char* script =
1568 "\"use strict\"; \n"
1569 "a = function() { \n"
1570 " b = function() { \n"
1577 CHECK_EQ(
"SyntaxError: Octal literals are not allowed in strict mode.",
1583 const char* statement_data[],
1586 int flags_len = 0) {
1593 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
1600 flags = default_flags;
1603 for (
int i = 0; context_data[i][0] !=
NULL; ++i) {
1604 for (
int j = 0; statement_data[j] !=
NULL; ++j) {
1608 int kProgramSize = kPrefixLen + kStatementLen + kSuffixLen;
1616 context_data[i][1]);
1617 CHECK(length == kProgramSize);
1632 const char* context_data[][2] = {
1633 {
"\"use strict\";",
"" },
1634 {
"var eval; function test_func() {\"use strict\"; ",
"}"},
1638 const char* statement_data[] = {
1642 "var foo, arguments;",
1643 "try { } catch (eval) { }",
1644 "try { } catch (arguments) { }",
1645 "function eval() { }",
1646 "function arguments() { }",
1647 "function foo(eval) { }",
1648 "function foo(arguments) { }",
1649 "function foo(bar, eval) { }",
1650 "function foo(bar, arguments) { }",
1653 "var foo = eval = 1;",
1654 "var foo = arguments = 1;",
1666 TEST(NoErrorsEvalAndArgumentsSloppy) {
1669 const char* context_data[][2] = {
1671 {
"function test_func() {",
"}"},
1675 const char* statement_data[] = {
1679 "var foo, arguments;",
1680 "try { } catch (eval) { }",
1681 "try { } catch (arguments) { }",
1682 "function eval() { }",
1683 "function arguments() { }",
1684 "function foo(eval) { }",
1685 "function foo(arguments) { }",
1686 "function foo(bar, eval) { }",
1687 "function foo(bar, arguments) { }",
1690 "var foo = eval = 1;",
1691 "var foo = arguments = 1;",
1703 TEST(NoErrorsEvalAndArgumentsStrict) {
1704 const char* context_data[][2] = {
1705 {
"\"use strict\";",
"" },
1706 {
"function test_func() { \"use strict\";",
"}" },
1710 const char* statement_data[] = {
1714 "var foo = arguments;",
1715 "var foo = { eval: 1 };",
1716 "var foo = { arguments: 1 };",
1717 "var foo = { }; foo.eval = {};",
1718 "var foo = { }; foo.arguments = {};",
1726 TEST(ErrorsFutureStrictReservedWords) {
1731 const char* context_data[][2] = {
1732 {
"\"use strict\";",
"" },
1733 {
"function test_func() {\"use strict\"; ",
"}"},
1737 const char* statement_data[] = {
1739 "var foo, interface;",
1740 "try { } catch (interface) { }",
1741 "function interface() { }",
1742 "function foo(interface) { }",
1743 "function foo(bar, interface) { }",
1745 "var foo = interface = 1;",
1755 TEST(NoErrorsFutureStrictReservedWords) {
1756 const char* context_data[][2] = {
1758 {
"function test_func() {",
"}"},
1762 const char* statement_data[] = {
1764 "var foo, interface;",
1765 "try { } catch (interface) { }",
1766 "function interface() { }",
1767 "function foo(interface) { }",
1768 "function foo(bar, interface) { }",
1770 "var foo = interface = 1;",
1784 const char* context_data[][2] = {
1786 {
"\"use strict\";",
"" },
1787 {
"var eval; function test_func() {",
"}"},
1788 {
"var eval; function test_func() {\"use strict\"; ",
"}"},
1792 const char* statement_data[] = {
1795 "try { } catch (super) { }",
1796 "function super() { }",
1797 "function foo(super) { }",
1798 "function foo(bar, super) { }",
1800 "var foo = super = 1;",
1803 "function foo super",
1814 const char* context_data[][2] = {
1816 {
"function is_not_gen() {",
"}" },
1820 const char* statement_data[] = {
1823 "try { } catch (yield) { }",
1824 "function yield() { }",
1825 "function foo(yield) { }",
1826 "function foo(bar, yield) { }",
1828 "var foo = yield = 1;",
1839 const char* context_data[][2] = {
1840 {
"function * is_gen() {",
"}" },
1844 const char* statement_data[] = {
1847 "try { } catch (yield) { }",
1848 "function yield() { }",
1854 "var foo = yield = 1;",
1867 const char* context_data[][2] = {
1868 {
"\"use strict\";",
"" },
1869 {
"\"use strict\"; function is_not_gen() {",
"}" },
1870 {
"function test_func() {\"use strict\"; ",
"}"},
1874 const char* statement_data[] = {
1877 "try { } catch (yield) { }",
1878 "function yield() { }",
1879 "function foo(yield) { }",
1880 "function foo(bar, yield) { }",
1882 "var foo = yield = 1;",
1893 const char* context_data[][2] = {
1894 {
"function * is_gen() {",
"}" },
1898 const char* statement_data[] = {
1914 const char* context_data[][2] = {
1916 {
"\"use strict\";",
""},
1920 const char* statement_data[] = {
1921 "function eval() {\"use strict\";}",
1922 "function arguments() {\"use strict\";}",
1923 "function interface() {\"use strict\";}",
1924 "function yield() {\"use strict\";}",
1926 "function super() { }",
1927 "function super() {\"use strict\";}",
1935 TEST(NoErrorsNameOfStrictFunction) {
1936 const char* context_data[][2] = {
1941 const char* statement_data[] = {
1942 "function eval() { }",
1943 "function arguments() { }",
1944 "function interface() { }",
1945 "function yield() { }",
1954 TEST(ErrorsIllegalWordsAsLabelsSloppy) {
1956 const char* context_data[][2] = {
1958 {
"function test_func() {",
"}" },
1962 const char* statement_data[] = {
1963 "super: while(true) { break super; }",
1971 TEST(ErrorsIllegalWordsAsLabelsStrict) {
1973 const char* context_data[][2] = {
1974 {
"\"use strict\";",
"" },
1975 {
"function test_func() {\"use strict\"; ",
"}"},
1979 const char* statement_data[] = {
1980 "super: while(true) { break super; }",
1981 "interface: while(true) { break interface; }",
1982 "yield: while(true) { break yield; }",
1990 TEST(NoErrorsIllegalWordsAsLabels) {
1992 const char* context_data[][2] = {
1994 {
"function test_func() {",
"}" },
1995 {
"\"use strict\";",
"" },
1996 {
"\"use strict\"; function test_func() {",
"}" },
2000 const char* statement_data[] = {
2001 "mylabel: while(true) { break mylabel; }",
2002 "eval: while(true) { break eval; }",
2003 "arguments: while(true) { break arguments; }",
2013 const char* context_data[][2] = {
2015 {
"function test_func() {",
"}" },
2019 const char* statement_data[] = {
2020 "(mylabel): while(true) { break mylabel; }",
2028 TEST(NoErrorsParenthesizedDirectivePrologue) {
2030 const char* context_data[][2] = {
2035 const char* statement_data[] = {
2036 "(\"use strict\"); var eval;",
2045 const char* context_data[][2] = {
2047 {
"\"use strict\";",
""},
2051 const char* statement_data[] = {
2052 "var foo = {}; foo.{;",
2053 "var foo = {}; foo.};",
2054 "var foo = {}; foo.=;",
2055 "var foo = {}; foo.888;",
2056 "var foo = {}; foo.-;",
2057 "var foo = {}; foo.--;",
2067 const char* context_data[][2] = {
2069 {
"\"use strict\";",
""},
2073 const char* statement_data[] = {
2074 "var foo = {}; foo.if;",
2075 "var foo = {}; foo.yield;",
2076 "var foo = {}; foo.super;",
2077 "var foo = {}; foo.interface;",
2078 "var foo = {}; foo.eval;",
2079 "var foo = {}; foo.arguments;",
2087 TEST(DontRegressPreParserDataSizes) {
2093 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
2096 const char* program;
2101 {
"{label: 42}", 1, 0}, {
"{label: 42; label2: 43}", 2, 0},
2102 {
"var x = 42;", 1, 0}, {
"var x = 42, y = 43;", 2, 0},
2103 {
"var x = {y: 1};", 2, 0},
2104 {
"var x = {}; x.y = 1", 2, 0},
2106 {
"var x = {get foo(){} };", 3, 1},
2108 {
"var x = {if: 1};", 2, 0},
2109 {
"var x = {}; x.if = 1", 2, 0},
2110 {
"var x = {get if(){} };", 3, 1},
2112 {
"function foo() {}", 1, 1}, {
"function foo() {} function bar() {}", 2, 2},
2114 {
"function lazy() { var a, b, c; }", 1, 1},
2115 {
"function lazy() { a: 1; b: 2; c: 3; }", 1, 1},
2116 {
"function lazy() { function a() {} function b() {} function c() {} }", 1,
2121 const int kDataPerFunction = 5;
2125 for (
int i = 0; test_cases[i].program; i++) {
2126 const char* program = test_cases[i].program;
2128 reinterpret_cast<const i::byte*>(program),
2129 static_cast<unsigned>(strlen(program)));
2139 if (F::symbol_ids(&log) != test_cases[i].
symbols) {
2141 "Expected preparse data for program:\n"
2143 "to contain %d symbols, however, received %d symbols.\n",
2144 program, test_cases[i].symbols, F::symbol_ids(&log));
2147 if (F::function_position(&log) !=
2148 test_cases[i].functions * kDataPerFunction) {
2150 "Expected preparse data for program:\n"
2152 "to contain %d functions, however, received %d functions.\n",
2153 program, test_cases[i].functions,
2154 F::function_position(&log) / kDataPerFunction);
2158 CHECK(!data.has_error());
2163 TEST(FunctionDeclaresItselfStrict) {
2168 const char* context_data[][2] = {
2169 {
"function eval() {",
"}"},
2170 {
"function arguments() {",
"}"},
2171 {
"function yield() {",
"}"},
2172 {
"function interface() {",
"}"},
2173 {
"function foo(eval) {",
"}"},
2174 {
"function foo(arguments) {",
"}"},
2175 {
"function foo(yield) {",
"}"},
2176 {
"function foo(interface) {",
"}"},
2177 {
"function foo(bar, eval) {",
"}"},
2178 {
"function foo(bar, arguments) {",
"}"},
2179 {
"function foo(bar, yield) {",
"}"},
2180 {
"function foo(bar, interface) {",
"}"},
2181 {
"function foo(bar, bar) {",
"}"},
2185 const char* strict_statement_data[] = {
2190 const char* non_strict_statement_data[] = {
2200 TEST(ErrorsTryWithoutCatchOrFinally) {
2201 const char* context_data[][2] = {
2206 const char* statement_data[] = {
2209 "try { } catch (e) foo();",
2210 "try { } catch { }",
2211 "try { } finally foo();",
2220 const char* context_data[][2] = {
2225 const char* statement_data[] = {
2226 "try { } catch (e) { }",
2227 "try { } catch (e) { } finally { }",
2228 "try { } finally { }",
2237 const char* context_data[][2] = {
2242 const char* statement_data[] = {
2252 const char* context_data[][2] = {
2257 const char* statement_data[] = {
2269 const char* context_data[][2] = {
2274 const char* statement_data[] = {
2275 "%someintrinsic(arg)",
2286 const char* context_data[][2] = {
2292 const char* statement_data[] = {
2306 "new foo.bar().baz;",
2309 "new foo[bar][baz];",
2310 "new foo[bar]()[baz];",
2311 "new foo[bar].baz(baz)()[bar].baz;",
2315 "(new new Function(\"this.x = 1\")).x;",
2316 "new new Test_Two(String, 2).v(0123).length;",
2325 const char* context_data[][2] = {
2331 const char* statement_data[] = {
2343 TEST(StrictObjectLiteralChecking) {
2344 const char* strict_context_data[][2] = {
2345 {
"\"use strict\"; var myobject = {",
"};"},
2348 const char* non_strict_context_data[][2] = {
2349 {
"var myobject = {",
"};"},
2354 const char* statement_data[] = {
2356 "\"foo\": 1, \"foo\": 2",
2357 "foo: 1, \"foo\": 2",
2370 TEST(ErrorsObjectLiteralChecking) {
2371 const char* context_data[][2] = {
2372 {
"\"use strict\"; var myobject = {",
"};"},
2373 {
"var myobject = {",
"};"},
2377 const char* statement_data[] = {
2378 "foo: 1, get foo() {}",
2379 "foo: 1, set foo() {}",
2380 "\"foo\": 1, get \"foo\"() {}",
2381 "\"foo\": 1, set \"foo\"() {}",
2387 "foo: 1, get \"foo\"() {}",
2388 "foo: 1, set \"foo\"() {}",
2389 "\"foo\": 1, get foo() {}",
2390 "\"foo\": 1, set foo() {}",
2391 "1: 1, get \"1\"() {}",
2392 "1: 1, set \"1\"() {}",
2393 "\"1\": 1, get 1() {}"
2394 "\"1\": 1, set 1() {}"
2397 "get foo() \"error\"",
2405 TEST(NoErrorsObjectLiteralChecking) {
2406 const char* context_data[][2] = {
2407 {
"var myobject = {",
"};"},
2408 {
"\"use strict\"; var myobject = {",
"};"},
2412 const char* statement_data[] = {
2414 "\"foo\": 1, \"bar\": 2",
2417 "foo: bar = 5 + baz",
2427 "foo: 1, get bar() {}",
2428 "foo: 1, set bar(b) {}",
2429 "\"foo\": 1, get \"bar\"() {}",
2430 "\"foo\": 1, set \"bar\"() {}",
2434 "get bar() {}, set bar() {}",
2435 "get bar(x) {}, set bar(x) {}",
2436 "get bar(x, y) {}, set bar(x, y) {}",
2452 const char* context_data[][2] = {
2458 char statement[Code::kMaxArguments * 2 + 1];
2459 for (
int i = 0; i < Code::kMaxArguments; ++i) {
2460 statement[2 * i] =
'0';
2461 statement[2 * i + 1] =
',';
2463 statement[Code::kMaxArguments * 2] = 0;
2465 const char* statement_data[] = {
2478 const char* strict_context_data[][2] = {
2479 {
"\"use strict\"; ",
""},
2483 const char* sloppy_context_data[][2] = {
2489 const char* sloppy_statement_data[] = {
2494 "delete interface;",
2499 const char* good_statement_data[] = {
2508 "delete new foo();",
2509 "delete new foo(bar);",
2514 const char* bad_statement_data[] = {
2531 const char* assignment_context_data[][2] = {
2533 {
"\"use strict\"; ",
" = 1;"},
2537 const char* prefix_context_data[][2] = {
2539 {
"\"use strict\"; ++",
";"},
2543 const char* postfix_context_data[][2] = {
2545 {
"\"use strict\"; ",
"++;"},
2550 const char* good_statement_data[] = {
2564 const char* bad_statement_data_common[] = {
2573 "new new foo()[bar]",
2574 "new new foo().bar",
2579 const char* bad_statement_data_for_assignment[] = {
static Handle< Object > SetElement(Handle< JSObject > object, uint32_t index, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, bool check_prototype=true, SetPropertyMode set_mode=SET_PROPERTY)
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
const char * data() const
#define CHECK_EQ(expected, value)
PreParseResult PreParseProgram()
static void FakeWritingSymbolIdInPreParseData(CompleteParserRecorder *log, int number)
TestExternalResource(uint16_t *data, int length)
Vector< const char * > BuildArgs()
MaybeObject * pending_exception()
Local< Value > Exception() const
int GetSymbolIdentifier()
static int symbol_position(CompleteParserRecorder *log)
Handle< Script > NewScript(Handle< String > source)
static const unsigned kMaxTwoByteChar
static Handle< T > cast(Handle< S > that)
Handle< String > NewStringFromAscii(Vector< const char > str, PretenureFlag pretenure=NOT_TENURED)
void SetHarmonyScoping(bool scoping)
void set_allow_modules(bool allow)
#define IGNORE_TOKEN(name, string, precedence)
static int symbol_ids(CompleteParserRecorder *log)
void set_allow_harmony_numeric_literals(bool allow)
void TestParserSync(const char *source, const ParserFlag *flag_list, size_t flag_list_length, ParserSyncTestResult result=kSuccessOrError)
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 trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot testing_bool_flag testing_int_flag string flag tmp file in which to serialize heap Print the time it takes to lazily compile hydrogen code stubs concurrent_recompilation concurrent_sweeping Print usage including on console Map counters to a file Enable debugger compile events enable GDBJIT enable GDBJIT interface for all code objects dump only objects containing this substring stress the GC compactor to flush out pretty print source code print source AST function name where to insert a breakpoint print scopes for builtins trace contexts operations print stuff during garbage collection report code statistics after GC report handles after GC trace cache state transitions print interface inference details prints when objects are turned into dictionaries report heap spill statistics along with trace isolate state changes trace regexp bytecode execution Minimal Log all events to the log file Log API events to the log file Log heap samples on garbage collection for the hp2ps tool log positions Log suspect operations Used with turns on browser compatible mode for profiling v8 log
#define ASSERT(condition)
V8_INLINE const CachedData * GetCachedData() const
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 trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot testing_bool_flag testing_int_flag string flag tmp file in which to serialize heap Print the time it takes to lazily compile hydrogen code stubs concurrent_recompilation concurrent_sweeping Print usage including on console Map counters to a file Enable debugger compile events enable GDBJIT enable GDBJIT interface for all code objects dump only objects containing this substring stress the GC compactor to flush out pretty print source code print source AST function name where to insert a breakpoint print scopes for builtins trace contexts operations print stuff during garbage collection report code statistics after GC report handles after GC trace cache state transitions print interface inference details prints when objects are turned into dictionaries report heap spill statistics along with trace isolate state changes trace regexp bytecode execution Minimal Log all events to the log file Log API events to the log file Log heap samples on garbage collection for the hp2ps tool log positions Log suspect operations Used with turns on browser compatible mode for profiling v8 log
void set_allow_natives_syntax(bool allow)
void set_allow_harmony_scoping(bool allow)
void SetHarmonyModules(bool modules)
Handle< Object > GetProperty(Handle< JSReceiver > obj, const char *name)
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 trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot testing_bool_flag testing_int_flag string flag tmp file in which to serialize heap Print the time it takes to lazily compile hydrogen code stubs concurrent_recompilation concurrent_sweeping Print usage message
void TestStreamScanner(i::Utf16CharacterStream *stream, i::Token::Value *expected_tokens, int skip_pos=0, int skip_to=0)
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 trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot testing_bool_flag testing_int_flag string flag tmp file in which to serialize heap Print the time it takes to lazily compile hydrogen code stubs concurrent_recompilation concurrent_sweeping Print usage including flags
i::Handle< i::String > FormatMessage(i::ScriptDataImpl *data)
static Local< UnboundScript > CompileUnbound(Isolate *isolate, Source *source, CompileOptions options=kNoCompileOptions)
StackGuard * stack_guard()
Handle< String > NewStringFromUtf8(Vector< const char > str, PretenureFlag pretenure=NOT_TENURED)
UnicodeCache * unicode_cache()
virtual const char * Data()=0
virtual bool HasError()=0
#define CHECK_EQU(v1, v2)
static const char * String(Value tok)
ZoneList< Scope * > * inner_scopes()
FunctionLiteral * function() const
void SeekForward(int pos)
static Local< Script > Compile(Handle< String > source, ScriptOrigin *origin=NULL, ScriptData *script_data=NULL)
void set_allow_lazy(bool allow)
static void MemMove(void *dest, const void *src, size_t size)
static i::Isolate * i_isolate()
bool has_pending_exception()
Handle< JSBuiltinsObject > js_builtins_object()
static unsigned Encode(char *out, uchar c, int previous, bool replace_invalid=false)
static v8::internal::Handle< To > OpenHandle(v8::Local< From > handle)
#define CHECK_NE(unexpected, value)
static int function_position(CompleteParserRecorder *log)
void Initialize(Utf16CharacterStream *source)
Vector< const char > CStrVector(const char *data)
static ScriptDataImpl * PreParse(Isolate *isolate, Utf16CharacterStream *source)
int StrLength(const char *string)
static void Print(const char *format,...)
const char * BuildMessage()
Vector< unsigned > ExtractData()
static Local< Context > New(Isolate *isolate, ExtensionConfiguration *extensions=NULL, Handle< ObjectTemplate > global_template=Handle< ObjectTemplate >(), Handle< Value > global_object=Handle< Value >())
static int SNPrintF(Vector< char > str, const char *format,...)
void TestParserSyncWithFlags(i::Handle< i::String > source, i::EnumSet< ParserFlag > flags, ParserSyncTestResult result)
Location location() const
Handle< String > NewExternalStringFromTwoByte(const ExternalTwoByteString::Resource *resource)
enable upcoming ES6 features enable harmony block scoping enable harmony symbols(a.k.a.private names)") DEFINE_bool(harmony_proxies
void set_allow_for_of(bool allow)
static Handle< Object > Call(Isolate *isolate, Handle< Object > callable, Handle< Object > receiver, int argc, Handle< Object > argv[], bool *pending_exception, bool convert_receiver=false)
bool Contains(E element) const
void TestCharacterStream(const char *ascii_source, unsigned length, unsigned start=0, unsigned end=0)
void set_allow_generators(bool allow)
void SetStrictMode(StrictMode strict_mode)
Scanner::Location MessageLocation()
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 trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function info
static Local< String > NewExternal(Isolate *isolate, ExternalStringResource *resource)
#define ASSERT_EQ(v1, v2)
static const unsigned kMaxThreeByteChar
void TestScanRegExp(const char *re_source, const char *expected)
static const unsigned kMaxOneByteChar
const uint16_t * data() const
Token::Value peek() const
ScriptResource(const char *data, size_t length)
static Local< Script > Compile(Isolate *isolate, Source *source, CompileOptions options=kNoCompileOptions)
void SetParserFlags(i::ParserBase< Traits > *parser, i::EnumSet< ParserFlag > flags)
static bool Parse(CompilationInfo *info, bool allow_lazy=false)
static ScriptData * PreCompile(Handle< String > source)
void DeleteArray(T *array)
void SetStackLimit(uintptr_t limit)
unsigned SeekForward(unsigned code_unit_count)
bool ScanRegExpPattern(bool seen_equal)
Handle< String > AllocateInternalizedString(Isolate *isolate)
Handle< JSArray > NewJSArray(ElementsKind elements_kind, int length, int capacity, ArrayStorageAllocationMode mode=INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, PretenureFlag pretenure=NOT_TENURED)
static const int kNoPreviousCharacter
virtual void PushBack(uc32 character)
void RunParserSyncTest(const char *context_data[][2], const char *statement_data[], ParserSyncTestResult result, const ParserFlag *flags=NULL, int flags_len=0)
static v8::Isolate * isolate()
static Local< String > NewFromUtf8(Isolate *isolate, const char *data, NewStringType type=kNormalString, int length=-1)