Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Side by Side Diff: test/cctest/test-parsing.cc

Issue 2522193002: Merged: Squashed multiple commits. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/unicode-decoder.h ('k') | test/unittests/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 TestScanRegExp("/[\\u123]/flipperwald", "[\\u123]"); 693 TestScanRegExp("/[\\u123]/flipperwald", "[\\u123]");
694 // Escaped ']'s wont end the character class. 694 // Escaped ']'s wont end the character class.
695 TestScanRegExp("/[\\]/]/flipperwald", "[\\]/]"); 695 TestScanRegExp("/[\\]/]/flipperwald", "[\\]/]");
696 // Escaped slashes are not terminating. 696 // Escaped slashes are not terminating.
697 TestScanRegExp("/\\//flipperwald", "\\/"); 697 TestScanRegExp("/\\//flipperwald", "\\/");
698 // Starting with '=' works too. 698 // Starting with '=' works too.
699 TestScanRegExp("/=/", "="); 699 TestScanRegExp("/=/", "=");
700 TestScanRegExp("/=?/", "=?"); 700 TestScanRegExp("/=?/", "=?");
701 } 701 }
702 702
703 static int Ucs2CharLength(unibrow::uchar c) {
704 if (c == unibrow::Utf8::kIncomplete || c == unibrow::Utf8::kBufferEmpty) {
705 return 0;
706 } else if (c < 0xffff) {
707 return 1;
708 } else {
709 return 2;
710 }
711 }
703 712
704 static int Utf8LengthHelper(const char* s) { 713 static int Utf8LengthHelper(const char* s) {
705 int len = i::StrLength(s); 714 unibrow::Utf8::Utf8IncrementalBuffer buffer(unibrow::Utf8::kBufferEmpty);
706 int character_length = len; 715 int length = 0;
707 for (int i = 0; i < len; i++) { 716 for (; *s != '\0'; s++) {
708 unsigned char c = s[i]; 717 unibrow::uchar tmp = unibrow::Utf8::ValueOfIncremental(*s, &buffer);
709 int input_offset = 0; 718 length += Ucs2CharLength(tmp);
710 int output_adjust = 0;
711 if (c > 0x7f) {
712 if (c < 0xc0) continue;
713 if (c >= 0xf0) {
714 if (c >= 0xf8) {
715 // 5 and 6 byte UTF-8 sequences turn into a kBadChar for each UTF-8
716 // byte.
717 continue; // Handle first UTF-8 byte.
718 }
719 if ((c & 7) == 0 && ((s[i + 1] & 0x30) == 0)) {
720 // This 4 byte sequence could have been coded as a 3 byte sequence.
721 // Record a single kBadChar for the first byte and continue.
722 continue;
723 }
724 input_offset = 3;
725 // 4 bytes of UTF-8 turn into 2 UTF-16 code units.
726 character_length -= 2;
727 } else if (c >= 0xe0) {
728 if ((c & 0xf) == 0 && ((s[i + 1] & 0x20) == 0)) {
729 // This 3 byte sequence could have been coded as a 2 byte sequence.
730 // Record a single kBadChar for the first byte and continue.
731 continue;
732 }
733 if (c == 0xed) {
734 unsigned char d = s[i + 1];
735 if ((d < 0x80) || (d > 0x9f)) {
736 // This 3 byte sequence is part of a surrogate pair which is not
737 // supported by UTF-8. Record a single kBadChar for the first byte
738 // and continue.
739 continue;
740 }
741 }
742 input_offset = 2;
743 // 3 bytes of UTF-8 turn into 1 UTF-16 code unit.
744 output_adjust = 2;
745 } else {
746 if ((c & 0x1e) == 0) {
747 // This 2 byte sequence could have been coded as a 1 byte sequence.
748 // Record a single kBadChar for the first byte and continue.
749 continue;
750 }
751 input_offset = 1;
752 // 2 bytes of UTF-8 turn into 1 UTF-16 code unit.
753 output_adjust = 1;
754 }
755 bool bad = false;
756 for (int j = 1; j <= input_offset; j++) {
757 if ((s[i + j] & 0xc0) != 0x80) {
758 // Bad UTF-8 sequence turns the first in the sequence into kBadChar,
759 // which is a single UTF-16 code unit.
760 bad = true;
761 break;
762 }
763 }
764 if (!bad) {
765 i += input_offset;
766 character_length -= output_adjust;
767 }
768 }
769 } 719 }
770 return character_length; 720 unibrow::uchar tmp = unibrow::Utf8::ValueOfIncrementalFinish(&buffer);
721 length += Ucs2CharLength(tmp);
722 return length;
771 } 723 }
772 724
773 725
774 TEST(ScopeUsesArgumentsSuperThis) { 726 TEST(ScopeUsesArgumentsSuperThis) {
775 static const struct { 727 static const struct {
776 const char* prefix; 728 const char* prefix;
777 const char* suffix; 729 const char* suffix;
778 } surroundings[] = { 730 } surroundings[] = {
779 { "function f() {", "}" }, 731 { "function f() {", "}" },
780 { "var f = () => {", "};" }, 732 { "var f = () => {", "};" },
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 // parts of the source that belong to the global scope. 939 // parts of the source that belong to the global scope.
988 struct SourceData { 940 struct SourceData {
989 const char* outer_prefix; 941 const char* outer_prefix;
990 const char* inner_source; 942 const char* inner_source;
991 const char* outer_suffix; 943 const char* outer_suffix;
992 i::ScopeType scope_type; 944 i::ScopeType scope_type;
993 i::LanguageMode language_mode; 945 i::LanguageMode language_mode;
994 }; 946 };
995 947
996 const SourceData source_data[] = { 948 const SourceData source_data[] = {
997 { " with ({}) ", "{ block; }", " more;", i::WITH_SCOPE, i::SLOPPY }, 949 {" with ({}) ", "{ block; }", " more;", i::WITH_SCOPE, i::SLOPPY},
998 { " with ({}) ", "{ block; }", "; more;", i::WITH_SCOPE, i::SLOPPY }, 950 {" with ({}) ", "{ block; }", "; more;", i::WITH_SCOPE, i::SLOPPY},
999 { " with ({}) ", "{\n" 951 {" with ({}) ",
1000 " block;\n" 952 "{\n"
1001 " }", "\n" 953 " block;\n"
1002 " more;", i::WITH_SCOPE, i::SLOPPY }, 954 " }",
1003 { " with ({}) ", "statement;", " more;", i::WITH_SCOPE, i::SLOPPY }, 955 "\n"
1004 { " with ({}) ", "statement", "\n" 956 " more;",
1005 " more;", i::WITH_SCOPE, i::SLOPPY }, 957 i::WITH_SCOPE, i::SLOPPY},
1006 { " with ({})\n" 958 {" with ({}) ", "statement;", " more;", i::WITH_SCOPE, i::SLOPPY},
1007 " ", "statement;", "\n" 959 {" with ({}) ", "statement",
1008 " more;", i::WITH_SCOPE, i::SLOPPY }, 960 "\n"
1009 { " try {} catch ", "(e) { block; }", " more;", 961 " more;",
1010 i::CATCH_SCOPE, i::SLOPPY }, 962 i::WITH_SCOPE, i::SLOPPY},
1011 { " try {} catch ", "(e) { block; }", "; more;", 963 {" with ({})\n"
1012 i::CATCH_SCOPE, i::SLOPPY }, 964 " ",
1013 { " try {} catch ", "(e) {\n" 965 "statement;",
1014 " block;\n" 966 "\n"
1015 " }", "\n" 967 " more;",
1016 " more;", i::CATCH_SCOPE, i::SLOPPY }, 968 i::WITH_SCOPE, i::SLOPPY},
1017 { " try {} catch ", "(e) { block; }", " finally { block; } more;", 969 {" try {} catch ", "(e) { block; }", " more;", i::CATCH_SCOPE,
1018 i::CATCH_SCOPE, i::SLOPPY }, 970 i::SLOPPY},
1019 { " start;\n" 971 {" try {} catch ", "(e) { block; }", "; more;", i::CATCH_SCOPE,
1020 " ", "{ let block; }", " more;", i::BLOCK_SCOPE, i::STRICT }, 972 i::SLOPPY},
1021 { " start;\n" 973 {" try {} catch ",
1022 " ", "{ let block; }", "; more;", i::BLOCK_SCOPE, i::STRICT }, 974 "(e) {\n"
1023 { " start;\n" 975 " block;\n"
1024 " ", "{\n" 976 " }",
1025 " let block;\n" 977 "\n"
1026 " }", "\n" 978 " more;",
1027 " more;", i::BLOCK_SCOPE, i::STRICT }, 979 i::CATCH_SCOPE, i::SLOPPY},
1028 { " start;\n" 980 {" try {} catch ", "(e) { block; }", " finally { block; } more;",
1029 " function fun", "(a,b) { infunction; }", " more;", 981 i::CATCH_SCOPE, i::SLOPPY},
1030 i::FUNCTION_SCOPE, i::SLOPPY }, 982 {" start;\n"
1031 { " start;\n" 983 " ",
1032 " function fun", "(a,b) {\n" 984 "{ let block; }", " more;", i::BLOCK_SCOPE, i::STRICT},
1033 " infunction;\n" 985 {" start;\n"
1034 " }", "\n" 986 " ",
1035 " more;", i::FUNCTION_SCOPE, i::SLOPPY }, 987 "{ let block; }", "; more;", i::BLOCK_SCOPE, i::STRICT},
1036 { " start;\n", "(a,b) => a + b", "; more;", 988 {" start;\n"
1037 i::FUNCTION_SCOPE, i::SLOPPY }, 989 " ",
1038 { " start;\n", "(a,b) => { return a+b; }", "\nmore;", 990 "{\n"
1039 i::FUNCTION_SCOPE, i::SLOPPY }, 991 " let block;\n"
1040 { " start;\n" 992 " }",
1041 " (function fun", "(a,b) { infunction; }", ")();", 993 "\n"
1042 i::FUNCTION_SCOPE, i::SLOPPY }, 994 " more;",
1043 { " for ", "(let x = 1 ; x < 10; ++ x) { block; }", " more;", 995 i::BLOCK_SCOPE, i::STRICT},
1044 i::BLOCK_SCOPE, i::STRICT }, 996 {" start;\n"
1045 { " for ", "(let x = 1 ; x < 10; ++ x) { block; }", "; more;", 997 " function fun",
1046 i::BLOCK_SCOPE, i::STRICT }, 998 "(a,b) { infunction; }", " more;", i::FUNCTION_SCOPE, i::SLOPPY},
1047 { " for ", "(let x = 1 ; x < 10; ++ x) {\n" 999 {" start;\n"
1048 " block;\n" 1000 " function fun",
1049 " }", "\n" 1001 "(a,b) {\n"
1050 " more;", i::BLOCK_SCOPE, i::STRICT }, 1002 " infunction;\n"
1051 { " for ", "(let x = 1 ; x < 10; ++ x) statement;", " more;", 1003 " }",
1052 i::BLOCK_SCOPE, i::STRICT }, 1004 "\n"
1053 { " for ", "(let x = 1 ; x < 10; ++ x) statement", "\n" 1005 " more;",
1054 " more;", i::BLOCK_SCOPE, i::STRICT }, 1006 i::FUNCTION_SCOPE, i::SLOPPY},
1055 { " for ", "(let x = 1 ; x < 10; ++ x)\n" 1007 {" start;\n", "(a,b) => a + b", "; more;", i::FUNCTION_SCOPE, i::SLOPPY},
1056 " statement;", "\n" 1008 {" start;\n", "(a,b) => { return a+b; }", "\nmore;", i::FUNCTION_SCOPE,
1057 " more;", i::BLOCK_SCOPE, i::STRICT }, 1009 i::SLOPPY},
1058 { " for ", "(let x in {}) { block; }", " more;", 1010 {" start;\n"
1059 i::BLOCK_SCOPE, i::STRICT }, 1011 " (function fun",
1060 { " for ", "(let x in {}) { block; }", "; more;", 1012 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1061 i::BLOCK_SCOPE, i::STRICT }, 1013 {" for ", "(let x = 1 ; x < 10; ++ x) { block; }", " more;",
1062 { " for ", "(let x in {}) {\n" 1014 i::BLOCK_SCOPE, i::STRICT},
1063 " block;\n" 1015 {" for ", "(let x = 1 ; x < 10; ++ x) { block; }", "; more;",
1064 " }", "\n" 1016 i::BLOCK_SCOPE, i::STRICT},
1065 " more;", i::BLOCK_SCOPE, i::STRICT }, 1017 {" for ",
1066 { " for ", "(let x in {}) statement;", " more;", 1018 "(let x = 1 ; x < 10; ++ x) {\n"
1067 i::BLOCK_SCOPE, i::STRICT }, 1019 " block;\n"
1068 { " for ", "(let x in {}) statement", "\n" 1020 " }",
1069 " more;", i::BLOCK_SCOPE, i::STRICT }, 1021 "\n"
1070 { " for ", "(let x in {})\n" 1022 " more;",
1071 " statement;", "\n" 1023 i::BLOCK_SCOPE, i::STRICT},
1072 " more;", i::BLOCK_SCOPE, i::STRICT }, 1024 {" for ", "(let x = 1 ; x < 10; ++ x) statement;", " more;",
1073 // Check that 6-byte and 4-byte encodings of UTF-8 strings do not throw 1025 i::BLOCK_SCOPE, i::STRICT},
1074 // the preparser off in terms of byte offsets. 1026 {" for ", "(let x = 1 ; x < 10; ++ x) statement",
1075 // 6 byte encoding. 1027 "\n"
1076 { " 'foo\355\240\201\355\260\211';\n" 1028 " more;",
1077 " (function fun", "(a,b) { infunction; }", ")();", 1029 i::BLOCK_SCOPE, i::STRICT},
1078 i::FUNCTION_SCOPE, i::SLOPPY }, 1030 {" for ",
1079 // 4 byte encoding. 1031 "(let x = 1 ; x < 10; ++ x)\n"
1080 { " 'foo\360\220\220\212';\n" 1032 " statement;",
1081 " (function fun", "(a,b) { infunction; }", ")();", 1033 "\n"
1082 i::FUNCTION_SCOPE, i::SLOPPY }, 1034 " more;",
1083 // 3 byte encoding of \u0fff. 1035 i::BLOCK_SCOPE, i::STRICT},
1084 { " 'foo\340\277\277';\n" 1036 {" for ", "(let x in {}) { block; }", " more;", i::BLOCK_SCOPE,
1085 " (function fun", "(a,b) { infunction; }", ")();", 1037 i::STRICT},
1086 i::FUNCTION_SCOPE, i::SLOPPY }, 1038 {" for ", "(let x in {}) { block; }", "; more;", i::BLOCK_SCOPE,
1087 // Broken 6 byte encoding with missing last byte. 1039 i::STRICT},
1088 { " 'foo\355\240\201\355\211';\n" 1040 {" for ",
1089 " (function fun", "(a,b) { infunction; }", ")();", 1041 "(let x in {}) {\n"
1090 i::FUNCTION_SCOPE, i::SLOPPY }, 1042 " block;\n"
1091 // Broken 3 byte encoding of \u0fff with missing last byte. 1043 " }",
1092 { " 'foo\340\277';\n" 1044 "\n"
1093 " (function fun", "(a,b) { infunction; }", ")();", 1045 " more;",
1094 i::FUNCTION_SCOPE, i::SLOPPY }, 1046 i::BLOCK_SCOPE, i::STRICT},
1095 // Broken 3 byte encoding of \u0fff with missing 2 last bytes. 1047 {" for ", "(let x in {}) statement;", " more;", i::BLOCK_SCOPE,
1096 { " 'foo\340';\n" 1048 i::STRICT},
1097 " (function fun", "(a,b) { infunction; }", ")();", 1049 {" for ", "(let x in {}) statement",
1098 i::FUNCTION_SCOPE, i::SLOPPY }, 1050 "\n"
1099 // Broken 3 byte encoding of \u00ff should be a 2 byte encoding. 1051 " more;",
1100 { " 'foo\340\203\277';\n" 1052 i::BLOCK_SCOPE, i::STRICT},
1101 " (function fun", "(a,b) { infunction; }", ")();", 1053 {" for ",
1102 i::FUNCTION_SCOPE, i::SLOPPY }, 1054 "(let x in {})\n"
1103 // Broken 3 byte encoding of \u007f should be a 2 byte encoding. 1055 " statement;",
1104 { " 'foo\340\201\277';\n" 1056 "\n"
1105 " (function fun", "(a,b) { infunction; }", ")();", 1057 " more;",
1106 i::FUNCTION_SCOPE, i::SLOPPY }, 1058 i::BLOCK_SCOPE, i::STRICT},
1107 // Unpaired lead surrogate. 1059 // Check that 6-byte and 4-byte encodings of UTF-8 strings do not throw
1108 { " 'foo\355\240\201';\n" 1060 // the preparser off in terms of byte offsets.
1109 " (function fun", "(a,b) { infunction; }", ")();", 1061 // 2 surrogates, encode a character that doesn't need a surrogate.
1110 i::FUNCTION_SCOPE, i::SLOPPY }, 1062 {" 'foo\355\240\201\355\260\211';\n"
1111 // Unpaired lead surrogate where following code point is a 3 byte sequence. 1063 " (function fun",
1112 { " 'foo\355\240\201\340\277\277';\n" 1064 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1113 " (function fun", "(a,b) { infunction; }", ")();", 1065 // 4 byte encoding.
1114 i::FUNCTION_SCOPE, i::SLOPPY }, 1066 {" 'foo\360\220\220\212';\n"
1115 // Unpaired lead surrogate where following code point is a 4 byte encoding 1067 " (function fun",
1116 // of a trail surrogate. 1068 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1117 { " 'foo\355\240\201\360\215\260\211';\n" 1069 // 3 byte encoding of \u0fff.
1118 " (function fun", "(a,b) { infunction; }", ")();", 1070 {" 'foo\340\277\277';\n"
1119 i::FUNCTION_SCOPE, i::SLOPPY }, 1071 " (function fun",
1120 // Unpaired trail surrogate. 1072 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1121 { " 'foo\355\260\211';\n" 1073 // 3 byte surrogate, followed by broken 2-byte surrogate w/ impossible 2nd
1122 " (function fun", "(a,b) { infunction; }", ")();", 1074 // byte and last byte missing.
1123 i::FUNCTION_SCOPE, i::SLOPPY }, 1075 {" 'foo\355\240\201\355\211';\n"
1124 // 2 byte encoding of \u00ff. 1076 " (function fun",
1125 { " 'foo\303\277';\n" 1077 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1126 " (function fun", "(a,b) { infunction; }", ")();", 1078 // Broken 3 byte encoding of \u0fff with missing last byte.
1127 i::FUNCTION_SCOPE, i::SLOPPY }, 1079 {" 'foo\340\277';\n"
1128 // Broken 2 byte encoding of \u00ff with missing last byte. 1080 " (function fun",
1129 { " 'foo\303';\n" 1081 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1130 " (function fun", "(a,b) { infunction; }", ")();", 1082 // Broken 3 byte encoding of \u0fff with missing 2 last bytes.
1131 i::FUNCTION_SCOPE, i::SLOPPY }, 1083 {" 'foo\340';\n"
1132 // Broken 2 byte encoding of \u007f should be a 1 byte encoding. 1084 " (function fun",
1133 { " 'foo\301\277';\n" 1085 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1134 " (function fun", "(a,b) { infunction; }", ")();", 1086 // Broken 3 byte encoding of \u00ff should be a 2 byte encoding.
1135 i::FUNCTION_SCOPE, i::SLOPPY }, 1087 {" 'foo\340\203\277';\n"
1136 // Illegal 5 byte encoding. 1088 " (function fun",
1137 { " 'foo\370\277\277\277\277';\n" 1089 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1138 " (function fun", "(a,b) { infunction; }", ")();", 1090 // Broken 3 byte encoding of \u007f should be a 2 byte encoding.
1139 i::FUNCTION_SCOPE, i::SLOPPY }, 1091 {" 'foo\340\201\277';\n"
1140 // Illegal 6 byte encoding. 1092 " (function fun",
1141 { " 'foo\374\277\277\277\277\277';\n" 1093 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1142 " (function fun", "(a,b) { infunction; }", ")();", 1094 // Unpaired lead surrogate.
1143 i::FUNCTION_SCOPE, i::SLOPPY }, 1095 {" 'foo\355\240\201';\n"
1144 // Illegal 0xfe byte 1096 " (function fun",
1145 { " 'foo\376\277\277\277\277\277\277';\n" 1097 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1146 " (function fun", "(a,b) { infunction; }", ")();", 1098 // Unpaired lead surrogate where following code point is a 3 byte
1147 i::FUNCTION_SCOPE, i::SLOPPY }, 1099 // sequence.
1148 // Illegal 0xff byte 1100 {" 'foo\355\240\201\340\277\277';\n"
1149 { " 'foo\377\277\277\277\277\277\277\277';\n" 1101 " (function fun",
1150 " (function fun", "(a,b) { infunction; }", ")();", 1102 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1151 i::FUNCTION_SCOPE, i::SLOPPY }, 1103 // Unpaired lead surrogate where following code point is a 4 byte encoding
1152 { " 'foo';\n" 1104 // of a trail surrogate.
1153 " (function fun", "(a,b) { 'bar\355\240\201\355\260\213'; }", ")();", 1105 {" 'foo\355\240\201\360\215\260\211';\n"
1154 i::FUNCTION_SCOPE, i::SLOPPY }, 1106 " (function fun",
1155 { " 'foo';\n" 1107 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1156 " (function fun", "(a,b) { 'bar\360\220\220\214'; }", ")();", 1108 // Unpaired trail surrogate.
1157 i::FUNCTION_SCOPE, i::SLOPPY }, 1109 {" 'foo\355\260\211';\n"
1158 { NULL, NULL, NULL, i::EVAL_SCOPE, i::SLOPPY } 1110 " (function fun",
1159 }; 1111 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1112 // 2 byte encoding of \u00ff.
1113 {" 'foo\303\277';\n"
1114 " (function fun",
1115 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1116 // Broken 2 byte encoding of \u00ff with missing last byte.
1117 {" 'foo\303';\n"
1118 " (function fun",
1119 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1120 // Broken 2 byte encoding of \u007f should be a 1 byte encoding.
1121 {" 'foo\301\277';\n"
1122 " (function fun",
1123 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1124 // Illegal 5 byte encoding.
1125 {" 'foo\370\277\277\277\277';\n"
1126 " (function fun",
1127 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1128 // Illegal 6 byte encoding.
1129 {" 'foo\374\277\277\277\277\277';\n"
1130 " (function fun",
1131 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1132 // Illegal 0xfe byte
1133 {" 'foo\376\277\277\277\277\277\277';\n"
1134 " (function fun",
1135 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1136 // Illegal 0xff byte
1137 {" 'foo\377\277\277\277\277\277\277\277';\n"
1138 " (function fun",
1139 "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY},
1140 {" 'foo';\n"
1141 " (function fun",
1142 "(a,b) { 'bar\355\240\201\355\260\213'; }", ")();", i::FUNCTION_SCOPE,
1143 i::SLOPPY},
1144 {" 'foo';\n"
1145 " (function fun",
1146 "(a,b) { 'bar\360\220\220\214'; }", ")();", i::FUNCTION_SCOPE,
1147 i::SLOPPY},
1148 {NULL, NULL, NULL, i::EVAL_SCOPE, i::SLOPPY}};
1160 1149
1161 i::Isolate* isolate = CcTest::i_isolate(); 1150 i::Isolate* isolate = CcTest::i_isolate();
1162 i::Factory* factory = isolate->factory(); 1151 i::Factory* factory = isolate->factory();
1163 1152
1164 v8::HandleScope handles(CcTest::isolate()); 1153 v8::HandleScope handles(CcTest::isolate());
1165 v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate()); 1154 v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate());
1166 v8::Context::Scope context_scope(context); 1155 v8::Context::Scope context_scope(context);
1167 1156
1168 isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - 1157 isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() -
1169 128 * 1024); 1158 128 * 1024);
(...skipping 7149 matching lines...) Expand 10 before | Expand all | Expand 10 after
8319 const char* data[] = { 8308 const char* data[] = {
8320 "const arguments = 1", 8309 "const arguments = 1",
8321 "let arguments", 8310 "let arguments",
8322 "var arguments", 8311 "var arguments",
8323 NULL 8312 NULL
8324 }; 8313 };
8325 // clang-format on 8314 // clang-format on
8326 RunParserSyncTest(context_data, data, kSuccess); 8315 RunParserSyncTest(context_data, data, kSuccess);
8327 } 8316 }
8328 } 8317 }
OLDNEW
« no previous file with comments | « src/unicode-decoder.h ('k') | test/unittests/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698