40#define Z (thread->zone())
73 interface.set_is_implemented_unsafe();
77 interface.set_is_implemented_unsafe();
92 UntaggedFunction::kRegularFunction,
false,
false,
98 UntaggedFunction::kRegularFunction,
false,
false,
101 const int kNumFixedParameters = 2;
102 const int kNumOptionalParameters = 3;
103 const bool kAreOptionalPositional =
true;
106 kAreOptionalPositional);
112 UntaggedFunction::kRegularFunction,
false,
false,
119 UntaggedFunction::kRegularFunction,
true,
false,
126 UntaggedFunction::kRegularFunction,
true,
false,
132 UntaggedFunction::kRegularFunction,
true,
false,
164 EXPECT_EQ(0,
function.num_fixed_parameters());
170 EXPECT_EQ(kNumFixedParameters,
function.num_fixed_parameters());
171 EXPECT_EQ(kNumOptionalParameters,
function.NumOptionalParameters());
175 auto zone = thread->zone();
176 auto isolate_group = thread->isolate_group();
177 auto class_table = isolate_group->class_table();
179 const intptr_t start_cid = class_table->NumCids();
180 const intptr_t num_classes = std::numeric_limits<uint16_t>::max() - start_cid;
190 const auto& instances =
196 for (intptr_t i = 0; i < (1 << 16); ++i) {
199 EXPECT(cls.
id() > std::numeric_limits<uint16_t>::max());
204 for (intptr_t i = 0; i < num_classes; ++i) {
207 EXPECT_EQ(start_cid + i, cls.
id());
209 const intptr_t num_fields = (i % 10);
211 for (intptr_t f = 0; f < num_fields; ++f) {
214 field = Field::New(
name,
false,
false,
false,
true,
false, cls,
217 fields.
SetAt(f, field);
223 thread->isolate_group()->program_lock());
230 for (intptr_t f = 0; f < num_fields; ++f) {
231 field ^= fields.
At(f);
238 EXPECT_EQ((1 << 16) - 1, class_table->NumCids());
241 isolate_group->heap()->CollectAllGarbage();
244 for (intptr_t i = 0; i < num_classes; ++i) {
252 EXPECT_EQ((i % 10), fields.
Length());
254 for (intptr_t f = 0; f < fields.
Length(); ++f) {
255 field ^= fields.
At(f);
274 EXPECT_NE(type_arguments1.
ptr(), type_arguments2.
ptr());
280 type_arguments3 ^= type_arguments2.
Canonicalize(thread);
281 EXPECT_EQ(type_arguments1.
ptr(), type_arguments3.
ptr());
285 const char* kScript =
289 " * Description of foo().\n"
291 " foo(a) { return '''\"}'''; }\n"
293 " var bar = '\\'}';\n"
319 const Class& empty_class =
337 const Class& one_field_class =
349 Field::New(field_name,
false,
false,
false,
true,
false, one_field_class,
352 one_fields.
SetAt(0, field);
371 EXPECT(smi_object.IsSmi());
372 EXPECT_EQ(5, smi.
Value());
376 EXPECT(!smi_object.IsSmi());
387#if defined(ARCH_IS_64_BIT) && !defined(DART_COMPRESSED_POINTERS)
403 EXPECT_EQ(1,
a.CompareWith(
b));
404 EXPECT_EQ(-1,
b.CompareWith(
a));
405 EXPECT_EQ(0,
a.CompareWith(
a));
413 EXPECT_EQ(-1,
a.CompareWith(mint1));
414 EXPECT_EQ(1,
a.CompareWith(mint2));
427 const int kMonkeyLen = 4;
428 const uint8_t monkey_utf8[kMonkeyLen] = {0xf0, 0x9f, 0x90, 0xb5};
429 const String& monkey_face =
431 const int kDogLen = 4;
433 const uint8_t dog_utf8[kDogLen] = {0xf0, 0x9f, 0x90, 0xb6};
435 EXPECT_EQ(0, monkey_face.
CompareTo(monkey_face));
436 EXPECT_EQ(0, dog_face.
CompareTo(dog_face));
440 const int kDominoLen = 4;
442 const uint8_t domino_utf8[kDominoLen] = {0xf0, 0x9f, 0x80, 0xb6};
463 "file:///usr/local/johnmccutchan/workspace/dart-repo/dart/test.dart";
465 "file%3A%2F%2F%2Fusr%2Flocal%2Fjohnmccutchan%2Fworkspace%2F"
466 "dart-repo%2Fdart%2Ftest.dart";
474 "file:///usr/local/johnmccutchan/workspace/dart-repo/dart/test.dart";
476 "file%3A%2F%2F%2Fusr%2Flocal%2Fjohnmccutchan%2Fworkspace%2F"
477 "dart-repo%2Fdart%2Ftest.dart";
481 EXPECT(output.Equals(decoded));
499 const intptr_t kInputLen = 3;
500 const uint16_t
kInput[kInputLen] = {
'x',
'/', 256};
502 const intptr_t kOutputLen = 10;
503 const uint16_t
kOutput[kOutputLen] = {
'x',
'%',
'2',
'F',
'%',
504 'C',
'4',
'%',
'8',
'0'};
507 EXPECT(output.Equals(encoded));
515#if !defined(ARCH_IS_64_BIT) || defined(DART_COMPRESSED_POINTERS)
521 EXPECT_EQ(v, med.
value());
552 EXPECT_EQ(1,
a.CompareWith(
b));
553 EXPECT_EQ(-1,
b.CompareWith(
a));
554 EXPECT_EQ(0,
a.CompareWith(
a));
560 EXPECT_EQ(1,
a.CompareWith(smi1));
561 EXPECT_EQ(1,
a.CompareWith(smi2));
571 EXPECT_EQ(mint1.
value(), mint_value);
572 EXPECT_EQ(mint2.
value(), mint_value);
573 EXPECT_EQ(mint1.
ptr(), mint2.
ptr());
579 const double dbl_const = 5.0;
583 EXPECT(dbl_object.IsDouble());
584 EXPECT_EQ(dbl_const, dbl.
value());
588 const double dbl_const = -5.0;
592 EXPECT(dbl_object.IsDouble());
593 EXPECT_EQ(dbl_const, dbl.
value());
597 const double dbl_const = 0.0;
601 EXPECT(dbl_object.IsDouble());
602 EXPECT_EQ(dbl_const, dbl.
value());
606 const double dbl_const = 5.0;
611 EXPECT_EQ(dbl_const, dbl1.
value());
612 EXPECT_EQ(dbl_const, dbl2.
value());
613 EXPECT_EQ(dbl_const, dbl3.
value());
614 EXPECT_EQ(dbl1.
ptr(), dbl2.
ptr());
615 EXPECT_EQ(dbl1.
ptr(), dbl3.
ptr());
619 const double dbl_const = 2.0;
651 EXPECT_EQ(2.0, dbl1.
value());
677 const char* kHello =
"Hello World!";
678 int32_t hello_len = strlen(kHello);
685 EXPECT_EQ(hello_len, str.
Length());
686 EXPECT_EQ(
'H', str.
CharAt(0));
687 EXPECT_EQ(
'e', str.
CharAt(1));
688 EXPECT_EQ(
'l', str.
CharAt(2));
689 EXPECT_EQ(
'l', str.
CharAt(3));
690 EXPECT_EQ(
'o', str.
CharAt(4));
691 EXPECT_EQ(
' ', str.
CharAt(5));
692 EXPECT_EQ(
'W', str.
CharAt(6));
693 EXPECT_EQ(
'o', str.
CharAt(7));
694 EXPECT_EQ(
'r', str.
CharAt(8));
695 EXPECT_EQ(
'l', str.
CharAt(9));
696 EXPECT_EQ(
'd', str.
CharAt(10));
697 EXPECT_EQ(
'!', str.
CharAt(11));
699 const uint8_t* motto =
700 reinterpret_cast<const uint8_t*
>(
"Dart's bescht wos je hets gits");
702 EXPECT_EQ(4, str2.
Length());
703 EXPECT_EQ(
'b', str2.
CharAt(0));
704 EXPECT_EQ(
'e', str2.
CharAt(1));
705 EXPECT_EQ(
's', str2.
CharAt(2));
706 EXPECT_EQ(
'c', str2.
CharAt(3));
727 const intptr_t kCharsLen = 8;
728 const uint8_t chars[kCharsLen] = {1, 2, 127, 64, 92, 0, 55, 55};
730 EXPECT_EQ(kCharsLen, str8.
Length());
731 EXPECT_EQ(1, str8.
CharAt(0));
732 EXPECT_EQ(127, str8.
CharAt(2));
733 EXPECT_EQ(64, str8.
CharAt(3));
734 EXPECT_EQ(0, str8.
CharAt(5));
735 EXPECT_EQ(55, str8.
CharAt(6));
736 EXPECT_EQ(55, str8.
CharAt(7));
737 const intptr_t kCharsIndex = 3;
739 EXPECT_EQ((kCharsLen - kCharsIndex), sub1.
Length());
740 EXPECT_EQ(64, sub1.
CharAt(0));
741 EXPECT_EQ(92, sub1.
CharAt(1));
742 EXPECT_EQ(0, sub1.
CharAt(2));
743 EXPECT_EQ(55, sub1.
CharAt(3));
744 EXPECT_EQ(55, sub1.
CharAt(4));
746 const intptr_t kWideCharsLen = 7;
747 uint16_t wide_chars[kWideCharsLen] = {
'H',
'e',
'l',
'l',
'o', 256,
'!'};
750 EXPECT(two_str.IsInstance());
751 EXPECT(two_str.IsString());
754 EXPECT_EQ(kWideCharsLen, two_str.
Length());
755 EXPECT_EQ(
'H', two_str.
CharAt(0));
756 EXPECT_EQ(256, two_str.
CharAt(5));
757 const intptr_t kWideCharsIndex = 3;
759 EXPECT_EQ((kWideCharsLen - kWideCharsIndex), sub2.
Length());
760 EXPECT_EQ(
'l', sub2.
CharAt(0));
761 EXPECT_EQ(
'o', sub2.
CharAt(1));
762 EXPECT_EQ(256, sub2.
CharAt(2));
763 EXPECT_EQ(
'!', sub2.
CharAt(3));
773 const int32_t four_chars[] = {
'C', 0xFF,
'h', 0xFFFF,
'a', 0x10FFFF,
'r'};
775 EXPECT_EQ(four_str.
Hash(), four_str.
Hash());
778 EXPECT_EQ(8, four_str.
Length());
779 EXPECT_EQ(
'C', four_str.
CharAt(0));
780 EXPECT_EQ(0xFF, four_str.
CharAt(1));
781 EXPECT_EQ(
'h', four_str.
CharAt(2));
782 EXPECT_EQ(0xFFFF, four_str.
CharAt(3));
783 EXPECT_EQ(
'a', four_str.
CharAt(4));
784 EXPECT_EQ(0xDBFF, four_str.
CharAt(5));
785 EXPECT_EQ(0xDFFF, four_str.
CharAt(6));
786 EXPECT_EQ(
'r', four_str.
CharAt(7));
790 const uint16_t char16[] = {0x00, 0x7F, 0xFF};
794 EXPECT_EQ(0x00, str8.
CharAt(0));
795 EXPECT_EQ(0x7F, str8.
CharAt(1));
796 EXPECT_EQ(0xFF, str8.
CharAt(2));
801 const int32_t char32[] = {0x00, 0x1F, 0x7F};
805 EXPECT_EQ(0x00, str8.
CharAt(0));
806 EXPECT_EQ(0x1F, str8.
CharAt(1));
807 EXPECT_EQ(0x7F, str8.
CharAt(2));
812 const int32_t char32[] = {0, 0x7FFF, 0xFFFF};
816 EXPECT_EQ(0x0000, str16.
CharAt(0));
817 EXPECT_EQ(0x7FFF, str16.
CharAt(1));
818 EXPECT_EQ(0xFFFF, str16.
CharAt(2));
823 const char* hello_str =
"Hello World!";
839 EXPECT_EQ(0, empty1.
Length());
843 EXPECT_EQ(0, empty2.
Length());
849 EXPECT_EQ(0, empty3.
Length());
854 EXPECT_EQ(0, array1.
Length());
856 EXPECT_EQ(0, empty4.
Length());
859 EXPECT_EQ(10, array2.
Length());
860 for (
int i = 0; i < array2.
Length(); ++i) {
865 EXPECT_EQ(0, empty5.
Length());
868 EXPECT_EQ(123, array3.
Length());
872 EXPECT_EQ(0, empty6.
Length());
873 for (
int i = 0; i < array3.
Length(); ++i) {
874 array3.
SetAt(i, empty6);
878 EXPECT_EQ(0, empty7.
Length());
884 EXPECT_EQ(0, str1.
Length());
889 EXPECT_EQ(3, str2.
Length());
895 EXPECT_EQ(3, str3.
Length());
900 EXPECT_EQ(3, str4.
Length());
906 EXPECT_EQ(2, array1.
Length());
907 array1.
SetAt(0, str1);
908 array1.
SetAt(1, str2);
911 EXPECT_EQ(3, str5.
Length());
915 EXPECT_EQ(2, array2.
Length());
916 array2.
SetAt(0, str1);
917 array2.
SetAt(1, str2);
920 EXPECT_EQ(3, str6.
Length());
924 EXPECT_EQ(3, array3.
Length());
925 array3.
SetAt(0, str2);
926 array3.
SetAt(1, str1);
927 array3.
SetAt(2, str2);
930 EXPECT_EQ(6, str7.
Length());
937 const char* one =
"one";
938 intptr_t one_len = strlen(one);
941 EXPECT_EQ(one_len, onestr.
Length());
943 const char* three =
"three";
944 intptr_t three_len = strlen(three);
947 EXPECT_EQ(three_len, threestr.
Length());
953 const char* one_three =
"onethree";
958 const char* three_one =
"threeone";
959 intptr_t three_one_len = strlen(three_one);
960 EXPECT_EQ(three_one_len, str4.
Length());
966 EXPECT_EQ(2, array1.
Length());
967 array1.
SetAt(0, onestr);
968 array1.
SetAt(1, threestr);
971 intptr_t one_three_len = strlen(one_three);
972 EXPECT_EQ(one_three_len, str5.
Length());
976 EXPECT_EQ(2, array2.
Length());
977 array2.
SetAt(0, threestr);
978 array2.
SetAt(1, onestr);
981 EXPECT_EQ(three_one_len, str6.
Length());
985 EXPECT_EQ(3, array3.
Length());
986 array3.
SetAt(0, onestr);
987 array3.
SetAt(1, threestr);
988 array3.
SetAt(2, onestr);
991 const char* one_three_one =
"onethreeone";
992 intptr_t one_three_one_len = strlen(one_three_one);
993 EXPECT_EQ(one_three_one_len, str7.
Length());
997 EXPECT_EQ(3, array4.
Length());
998 array4.
SetAt(0, threestr);
999 array4.
SetAt(1, onestr);
1000 array4.
SetAt(2, threestr);
1003 const char* three_one_three =
"threeonethree";
1004 intptr_t three_one_three_len = strlen(three_one_three);
1005 EXPECT_EQ(three_one_three_len, str8.
Length());
1013 EXPECT_EQ(0, str1.
Length());
1015 uint16_t two[] = {0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9};
1016 intptr_t two_len =
sizeof(two) /
sizeof(two[0]);
1019 EXPECT_EQ(two_len, str2.
Length());
1025 EXPECT_EQ(two_len, str3.
Length());
1030 EXPECT_EQ(two_len, str4.
Length());
1036 EXPECT_EQ(2, array1.
Length());
1037 array1.
SetAt(0, str1);
1038 array1.
SetAt(1, str2);
1041 EXPECT_EQ(two_len, str5.
Length());
1045 EXPECT_EQ(2, array2.
Length());
1046 array2.
SetAt(0, str1);
1047 array2.
SetAt(1, str2);
1050 EXPECT_EQ(two_len, str6.
Length());
1054 EXPECT_EQ(3, array3.
Length());
1055 array3.
SetAt(0, str2);
1056 array3.
SetAt(1, str1);
1057 array3.
SetAt(2, str2);
1060 EXPECT_EQ(two_len * 2, str7.
Length());
1061 uint16_t twotwo[] = {0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9,
1062 0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9};
1063 intptr_t twotwo_len =
sizeof(twotwo) /
sizeof(twotwo[0]);
1070 const uint16_t one[] = {0x05D0, 0x05D9, 0x05D9, 0x05DF};
1071 intptr_t one_len =
sizeof(one) /
sizeof(one[0]);
1074 EXPECT_EQ(one_len, str1.
Length());
1076 const uint16_t two[] = {0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9};
1077 intptr_t two_len =
sizeof(two) /
sizeof(two[0]);
1080 EXPECT_EQ(two_len, str2.
Length());
1086 const uint16_t one_two[] = {0x05D0, 0x05D9, 0x05D9, 0x05DF, 0x05E6,
1087 0x05D5, 0x05D5, 0x05D9, 0x05D9};
1088 intptr_t one_two_len =
sizeof(one_two) /
sizeof(one_two[0]);
1089 EXPECT_EQ(one_two_len, one_two_str.
Length());
1094 const uint16_t two_one[] = {0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9,
1095 0x05D0, 0x05D9, 0x05D9, 0x05DF};
1096 intptr_t two_one_len =
sizeof(two_one) /
sizeof(two_one[0]);
1097 EXPECT_EQ(two_one_len, two_one_str.
Length());
1103 EXPECT_EQ(2, array1.
Length());
1104 array1.
SetAt(0, str1);
1105 array1.
SetAt(1, str2);
1108 EXPECT_EQ(one_two_len, str3.
Length());
1112 EXPECT_EQ(2, array2.
Length());
1113 array2.
SetAt(0, str2);
1114 array2.
SetAt(1, str1);
1117 EXPECT_EQ(two_one_len, str4.
Length());
1121 EXPECT_EQ(3, array3.
Length());
1122 array3.
SetAt(0, str1);
1123 array3.
SetAt(1, str2);
1124 array3.
SetAt(2, str1);
1127 const uint16_t one_two_one[] = {0x05D0, 0x05D9, 0x05D9, 0x05DF, 0x05E6,
1128 0x05D5, 0x05D5, 0x05D9, 0x05D9, 0x05D0,
1129 0x05D9, 0x05D9, 0x05DF};
1130 intptr_t one_two_one_len =
sizeof(one_two_one) /
sizeof(one_two_one[0]);
1131 EXPECT_EQ(one_two_one_len, str5.
Length());
1135 EXPECT_EQ(3, array4.
Length());
1136 array4.
SetAt(0, str2);
1137 array4.
SetAt(1, str1);
1138 array4.
SetAt(2, str2);
1141 const uint16_t two_one_two[] = {0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9,
1142 0x05D0, 0x05D9, 0x05D9, 0x05DF, 0x05E6,
1143 0x05D5, 0x05D5, 0x05D9, 0x05D9};
1144 intptr_t two_one_two_len =
sizeof(two_one_two) /
sizeof(two_one_two[0]);
1145 EXPECT_EQ(two_one_two_len, str6.
Length());
1153 EXPECT_EQ(0, str1.
Length());
1155 int32_t four[] = {0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1};
1156 intptr_t four_len =
sizeof(four) /
sizeof(four[0]);
1157 intptr_t expected_len = (four_len * 2);
1160 EXPECT_EQ(expected_len, str2.
Length());
1165 EXPECT_EQ(expected_len, str3.
Length());
1170 EXPECT_EQ(expected_len, str4.
Length());
1176 EXPECT_EQ(2, array1.
Length());
1177 array1.
SetAt(0, str1);
1178 array1.
SetAt(1, str2);
1181 EXPECT_EQ(expected_len, str5.
Length());
1185 EXPECT_EQ(2, array2.
Length());
1186 array2.
SetAt(0, str1);
1187 array2.
SetAt(1, str2);
1190 EXPECT_EQ(expected_len, str6.
Length());
1194 EXPECT_EQ(3, array3.
Length());
1195 array3.
SetAt(0, str2);
1196 array3.
SetAt(1, str1);
1197 array3.
SetAt(2, str2);
1200 int32_t fourfour[] = {0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1,
1201 0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1};
1202 intptr_t fourfour_len =
sizeof(fourfour) /
sizeof(fourfour[0]);
1203 EXPECT_EQ((fourfour_len * 2), str7.
Length());
1204 const String& fourfour_str =
1211 const int32_t one[] = {0x105D0, 0x105D9, 0x105D9, 0x105DF};
1212 intptr_t one_len =
sizeof(one) /
sizeof(one[0]);
1215 EXPECT_EQ((one_len * 2), onestr.
Length());
1217 const int32_t two[] = {0x105E6, 0x105D5, 0x105D5, 0x105D9, 0x105D9};
1218 intptr_t two_len =
sizeof(two) /
sizeof(two[0]);
1221 EXPECT_EQ((two_len * 2), twostr.
Length());
1227 const int32_t one_two[] = {0x105D0, 0x105D9, 0x105D9, 0x105DF, 0x105E6,
1228 0x105D5, 0x105D5, 0x105D9, 0x105D9};
1229 intptr_t one_two_len =
sizeof(one_two) /
sizeof(one_two[0]);
1230 EXPECT_EQ((one_two_len * 2), str1.
Length());
1231 const String& one_two_str =
1237 const int32_t two_one[] = {0x105E6, 0x105D5, 0x105D5, 0x105D9, 0x105D9,
1238 0x105D0, 0x105D9, 0x105D9, 0x105DF};
1239 intptr_t two_one_len =
sizeof(two_one) /
sizeof(two_one[0]);
1240 EXPECT_EQ((two_one_len * 2), str2.
Length());
1241 const String& two_one_str =
1248 EXPECT_EQ(2, array1.
Length());
1249 array1.
SetAt(0, onestr);
1250 array1.
SetAt(1, twostr);
1253 EXPECT_EQ((one_two_len * 2), str3.
Length());
1257 EXPECT_EQ(2, array2.
Length());
1258 array2.
SetAt(0, twostr);
1259 array2.
SetAt(1, onestr);
1262 EXPECT_EQ((two_one_len * 2), str4.
Length());
1266 EXPECT_EQ(3, array3.
Length());
1267 array3.
SetAt(0, onestr);
1268 array3.
SetAt(1, twostr);
1269 array3.
SetAt(2, onestr);
1272 const int32_t one_two_one[] = {0x105D0, 0x105D9, 0x105D9, 0x105DF, 0x105E6,
1273 0x105D5, 0x105D5, 0x105D9, 0x105D9, 0x105D0,
1274 0x105D9, 0x105D9, 0x105DF};
1275 intptr_t one_two_one_len =
sizeof(one_two_one) /
sizeof(one_two_one[0]);
1276 EXPECT_EQ((one_two_one_len * 2), str5.
Length());
1277 const String& one_two_one_str =
1282 EXPECT_EQ(3, array4.
Length());
1283 array4.
SetAt(0, twostr);
1284 array4.
SetAt(1, onestr);
1285 array4.
SetAt(2, twostr);
1288 const int32_t two_one_two[] = {0x105E6, 0x105D5, 0x105D5, 0x105D9, 0x105D9,
1289 0x105D0, 0x105D9, 0x105D9, 0x105DF, 0x105E6,
1290 0x105D5, 0x105D5, 0x105D9, 0x105D9};
1291 intptr_t two_one_two_len =
sizeof(two_one_two) /
sizeof(two_one_two[0]);
1292 EXPECT_EQ((two_one_two_len * 2), str6.
Length());
1293 const String& two_one_two_str =
1300 const uint8_t one[] = {
'o',
'n',
'e',
' ',
'b',
'y',
't',
'e'};
1301 intptr_t one_len =
sizeof(one) /
sizeof(one[0]);
1304 EXPECT_EQ(one_len, onestr.
Length());
1307 uint16_t two[] = {0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9};
1308 intptr_t two_len =
sizeof(two) /
sizeof(two[0]);
1311 EXPECT_EQ(two_len, twostr.
Length());
1318 uint16_t one_two[] = {
'o',
'n',
'e',
' ',
'b',
'y',
't',
1319 'e', 0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9};
1320 intptr_t one_two_len =
sizeof(one_two) /
sizeof(one_two[0]);
1321 EXPECT_EQ(one_two_len, one_two_str.
Length());
1326 uint16_t two_one[] = {0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9,
'o',
'n',
1327 'e',
' ',
'b',
'y',
't',
'e'};
1328 intptr_t two_one_len =
sizeof(two_one) /
sizeof(two_one[0]);
1329 EXPECT_EQ(two_one_len, two_one_str.
Length());
1335 EXPECT_EQ(3, array1.
Length());
1336 array1.
SetAt(0, onestr);
1337 array1.
SetAt(1, twostr);
1338 array1.
SetAt(2, onestr);
1342 uint16_t one_two_one[] = {
'o',
'n',
'e',
' ',
'b',
'y',
't',
1343 'e', 0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9,
'o',
1344 'n',
'e',
' ',
'b',
'y',
't',
'e'};
1345 intptr_t one_two_one_len =
sizeof(one_two_one) /
sizeof(one_two_one[0]);
1346 EXPECT(one_two_one_str.
Equals(one_two_one, one_two_one_len));
1349 EXPECT_EQ(3, array2.
Length());
1350 array2.
SetAt(0, twostr);
1351 array2.
SetAt(1, onestr);
1352 array2.
SetAt(2, twostr);
1356 uint16_t two_one_two[] = {0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9,
'o',
1357 'n',
'e',
' ',
'b',
'y',
't',
1358 'e', 0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9};
1359 intptr_t two_one_two_len =
sizeof(two_one_two) /
sizeof(two_one_two[0]);
1360 EXPECT(two_one_two_str.
Equals(two_one_two, two_one_two_len));
1368 uint16_t clef_utf16[] = {0xD834, 0xDD1E};
1370 int32_t clef_utf32[] = {0x1D11E};
1373 EXPECT_EQ(hash32, clef.
Hash());
1381 const char* onechars =
"\xC3\xB6\xC3\xB1\xC3\xA9";
1392 EXPECT_EQ(onesub.
Length(), 3);
1395 const char* twochars =
1397 "\xE1\xB9\xAB\xE1\xBA\x85\xE1\xB9\x93";
1406 EXPECT_EQ(twosub1.
Length(), 3);
1411 EXPECT_EQ(twosub2.
Length(), 3);
1414 const char* fourchars =
1416 "\xE1\xB9\xAB\xE1\xBA\x85\xE1\xB9\x93"
1417 "\xF0\x9D\x96\xBF\xF0\x9D\x97\x88\xF0\x9D\x97\x8E\xF0\x9D\x97\x8B";
1426 EXPECT_EQ(foursub1.
Length(), 3);
1431 EXPECT_EQ(foursub2.
Length(), 3);
1434 EXPECT_EQ(foursub4.
Length(), 8);
1443 "\xC2\xA0\xC2\xA1\xC2\xA2\xC2\xA3"
1444 "\xC2\xA4\xC2\xA5\xC2\xA6\xC2\xA7"
1445 "\xC2\xA8\xC2\xA9\xC2\xAA\xC2\xAB"
1446 "\xC2\xAC\xC2\xAD\xC2\xAE\xC2\xAF"
1447 "\xC2\xB0\xC2\xB1\xC2\xB2\xC2\xB3"
1448 "\xC2\xB4\xC2\xB5\xC2\xB6\xC2\xB7"
1449 "\xC2\xB8\xC2\xB9\xC2\xBA\xC2\xBB"
1450 "\xC2\xBC\xC2\xBD\xC2\xBE\xC2\xBF"
1451 "\xC3\x80\xC3\x81\xC3\x82\xC3\x83"
1452 "\xC3\x84\xC3\x85\xC3\x86\xC3\x87"
1453 "\xC3\x88\xC3\x89\xC3\x8A\xC3\x8B"
1454 "\xC3\x8C\xC3\x8D\xC3\x8E\xC3\x8F"
1455 "\xC3\x90\xC3\x91\xC3\x92\xC3\x93"
1456 "\xC3\x94\xC3\x95\xC3\x96\xC3\x97"
1457 "\xC3\x98\xC3\x99\xC3\x9A\xC3\x9B"
1458 "\xC3\x9C\xC3\x9D\xC3\x9E\xC3\x9F"
1459 "\xC3\xA0\xC3\xA1\xC3\xA2\xC3\xA3"
1460 "\xC3\xA4\xC3\xA5\xC3\xA6\xC3\xA7"
1461 "\xC3\xA8\xC3\xA9\xC3\xAA\xC3\xAB"
1462 "\xC3\xAC\xC3\xAD\xC3\xAE\xC3\xAF"
1463 "\xC3\xB0\xC3\xB1\xC3\xB2\xC3\xB3"
1464 "\xC3\xB4\xC3\xB5\xC3\xB6\xC3\xB7"
1465 "\xC3\xB8\xC3\xB9\xC3\xBA\xC3\xBB"
1466 "\xC3\xBC\xC3\xBD\xC3\xBE\xC3\xBF";
1467 const uint8_t expected[] = {
1468 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB,
1469 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7,
1470 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0, 0xC1, 0xC2, 0xC3,
1471 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
1472 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB,
1473 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
1474 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3,
1475 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
1479 intptr_t expected_length =
sizeof(expected);
1480 EXPECT_EQ(expected_length, str.
Length());
1481 for (
int i = 0; i < str.
Length(); ++i) {
1482 EXPECT_EQ(expected[i], str.
CharAt(i));
1489 "\xD7\x92\xD7\x9C\xD7\xA2\xD7\x93"
1490 "\xD7\x91\xD7\xA8\xD7\x9B\xD7\x94";
1491 const uint16_t expected[] = {0x5D2, 0x5DC, 0x5E2, 0x5D3,
1492 0x5D1, 0x5E8, 0x5DB, 0x5D4};
1495 intptr_t expected_size =
sizeof(expected) /
sizeof(expected[0]);
1496 EXPECT_EQ(expected_size, str.
Length());
1497 for (
int i = 0; i < str.
Length(); ++i) {
1498 EXPECT_EQ(expected[i], str.
CharAt(i));
1506 "\x0A\x0B\x0D\x0C\x0E\x0F\xC2\xA0"
1507 "\xC2\xB0\xC3\x80\xC3\x90\xC3\xA0"
1508 "\xC3\xB0\xE0\xA8\x80\xE0\xAC\x80"
1509 "\xE0\xB0\x80\xE0\xB4\x80\xE0\xB8"
1510 "\x80\xE0\xBC\x80\xEA\x80\x80\xEB"
1511 "\x80\x80\xEC\x80\x80\xED\x80\x80"
1512 "\xEE\x80\x80\xEF\x80\x80";
1513 const intptr_t expected[] = {
1514 0x000A, 0x000B, 0x000D, 0x000C, 0x000E, 0x000F, 0x00A0, 0x00B0,
1515 0x00C0, 0x00D0, 0x00E0, 0x00F0, 0x0A00, 0x0B00, 0x0C00, 0x0D00,
1516 0x0E00, 0x0F00, 0xA000, 0xB000, 0xC000, 0xD000, 0xE000, 0xF000};
1519 intptr_t expected_size =
sizeof(expected) /
sizeof(expected[0]);
1520 EXPECT_EQ(expected_size, str.
Length());
1521 for (
int i = 0; i < str.
Length(); ++i) {
1522 EXPECT_EQ(expected[i], str.
CharAt(i));
1530 "\xF0\x9D\x91\xA0\xF0\x9D\x91\xA1"
1531 "\xF0\x9D\x91\xA2\xF0\x9D\x91\xA3";
1532 const intptr_t expected[] = {0xd835, 0xdc60, 0xd835, 0xdc61,
1533 0xd835, 0xdc62, 0xd835, 0xdc63};
1536 intptr_t expected_size = (
sizeof(expected) /
sizeof(expected[0]));
1537 EXPECT_EQ(expected_size, str.
Length());
1538 for (
int i = 0; i < str.
Length(); ++i) {
1539 EXPECT_EQ(expected[i], str.
CharAt(i));
1547 "\xE0\xA8\x80\xE0\xAC\x80\xE0\xB0"
1548 "\x80\xE0\xB4\x80\xE0\xB8\x80\xE0"
1549 "\xBC\x80\xEA\x80\x80\xEB\x80\x80"
1550 "\xEC\x80\x80\xED\x80\x80\xEE\x80"
1551 "\x80\xEF\x80\x80\xF0\x9A\x80\x80"
1552 "\xF0\x9B\x80\x80\xF0\x9D\x80\x80"
1553 "\xF0\x9E\x80\x80\xF0\x9F\x80\x80";
1554 const intptr_t expected[] = {
1555 0x0A00, 0x0B00, 0x0C00, 0x0D00, 0x0E00, 0x0F00, 0xA000, 0xB000,
1556 0xC000, 0xD000, 0xE000, 0xF000, 0xD828, 0xDC00, 0xD82c, 0xDC00,
1557 0xD834, 0xDC00, 0xD838, 0xDC00, 0xD83c, 0xDC00,
1561 intptr_t expected_size =
sizeof(expected) /
sizeof(expected[0]);
1562 EXPECT_EQ(expected_size, str.
Length());
1563 for (
int i = 0; i < str.
Length(); ++i) {
1564 EXPECT_EQ(expected[i], str.
CharAt(i));
1572 "\x0A\x0B\x0D\x0C\x0E\x0F\xC2\xA0"
1573 "\xC2\xB0\xC3\x80\xC3\x90\xC3\xA0"
1574 "\xC3\xB0\xE0\xA8\x80\xE0\xAC\x80"
1575 "\xE0\xB0\x80\xE0\xB4\x80\xE0\xB8"
1576 "\x80\xE0\xBC\x80\xEA\x80\x80\xEB"
1577 "\x80\x80\xEC\x80\x80\xED\x80\x80"
1578 "\xEE\x80\x80\xEF\x80\x80\xF0\x9A"
1579 "\x80\x80\xF0\x9B\x80\x80\xF0\x9D"
1580 "\x80\x80\xF0\x9E\x80\x80\xF0\x9F"
1582 const intptr_t expected[] = {
1583 0x000A, 0x000B, 0x000D, 0x000C, 0x000E, 0x000F, 0x00A0, 0x00B0, 0x00C0,
1584 0x00D0, 0x00E0, 0x00F0, 0x0A00, 0x0B00, 0x0C00, 0x0D00, 0x0E00, 0x0F00,
1585 0xA000, 0xB000, 0xC000, 0xD000, 0xE000, 0xF000, 0xD828, 0xDC00, 0xD82c,
1586 0xDC00, 0xD834, 0xDC00, 0xD838, 0xDC00, 0xD83c, 0xDC00,
1590 intptr_t expected_size =
sizeof(expected) /
sizeof(expected[0]);
1591 EXPECT_EQ(expected_size, str.
Length());
1592 for (
int i = 0; i < str.
Length(); ++i) {
1593 EXPECT_EQ(expected[i], str.
CharAt(i));
1599 const char* onesrc =
"abc";
1608 const char* twosrc =
"\xD7\x90\xD7\x91\xD7\x92";
1615 EXPECT(!twostr.
Equals(
"\xD7\x90\xD7\x91\xD7\x92\xD7\x93"));
1617 const char* foursrc =
"\xF0\x90\x8E\xA0\xF0\x90\x8E\xA1\xF0\x90\x8E\xA2";
1622 EXPECT(!fourstr.
Equals(
"\xF0\x90\x8E\xA0\xF0\x90\x8E\xA1"));
1623 EXPECT(fourstr.
Equals(
"\xF0\x90\x8E\xA0\xF0\x90\x8E\xA1\xF0\x90\x8E\xA2"));
1625 !fourstr.
Equals(
"\xF0\x90\x8E\xA0\xF0\x90\x8E\xA1"
1626 "\xF0\x90\x8E\xA2\xF0\x90\x8E\xA3"));
1633 const int32_t chars[] = {
't',
'h',
'i',
's'};
1646 uint8_t characters[] = {
'a',
'\n',
'\f',
'\b',
'\t',
1647 '\v',
'\r',
'\\',
'$',
'z'};
1653 EXPECT_EQ(str.
Length(), len);
1655 const String& escaped_str =
1657 EXPECT(escaped_str.
Equals(
"a\\n\\f\\b\\t\\v\\r\\\\\\$z"));
1659 const String& escaped_empty_str =
1661 EXPECT_EQ(escaped_empty_str.
Length(), 0);
1665 uint16_t characters[] = {
'a',
'\n',
'\f',
'\b',
'\t',
1666 '\v',
'\r',
'\\',
'$',
'z'};
1672 EXPECT_EQ(str.
Length(), len);
1674 const String& escaped_str =
1676 EXPECT(escaped_str.
Equals(
"a\\n\\f\\b\\t\\v\\r\\\\\\$z"));
1678 const String& empty_str =
1680 const String& escaped_empty_str =
1682 EXPECT_EQ(empty_str.
Length(), 0);
1683 EXPECT_EQ(escaped_empty_str.
Length(), 0);
1699 EXPECT_EQ(one.
ptr(), eins.
ptr());
1713 for (
int i = 0; i < 1024; i++) {
1719 EXPECT_EQ(one.
ptr(), eins.
ptr());
1734 EXPECT_EQ(one.
ptr(), ein_symbol.
ptr());
1737 uint16_t char16[] = {
'E',
'l',
'f'};
1739 int32_t char32[] = {
'E',
'l',
'f'};
1749 uint16_t monkey_utf16[] = {0xd83d, 0xdc35};
1752 const char monkey_utf8[] = {
'\xf0',
'\x9f',
'\x90',
'\xb5', 0};
1755 int32_t kMonkeyFace = 0x1f435;
1758 EXPECT_EQ(monkey.
ptr(), monkey2.
ptr());
1761 int32_t kCatFaceWithTearsOfJoy = 0x1f639;
1765 uint16_t cat_utf16[] = {0xd83d, 0xde39};
1768 EXPECT_EQ(cat2.
ptr(), cat.
ptr());
1777 const int kArrayLen = 5;
1779 EXPECT_EQ(kArrayLen, array.
Length());
1782 element = array.
At(kArrayLen - 1);
1784 array.
SetAt(0, array);
1785 array.
SetAt(2, array);
1786 element = array.
At(0);
1787 EXPECT_EQ(array.
ptr(), element.
ptr());
1788 element = array.
At(1);
1790 element = array.
At(2);
1791 EXPECT_EQ(array.
ptr(), element.
ptr());
1794 other_array.
SetAt(0, array);
1795 other_array.
SetAt(2, array);
1800 other_array.
SetAt(1, other_array);
1804 other_array.
SetAt(0, array);
1805 other_array.
SetAt(2, array);
1808 EXPECT_EQ(0, Object::empty_array().Length());
1816 const intptr_t kSmallSize = 100;
1818 const intptr_t kMediumSize = 1000;
1820 const intptr_t kLargeSize = 100000;
1824 for (intptr_t i = 0; i < kSmallSize; i++) {
1829 EXPECT_EQ(kMediumSize, medium.Length());
1830 for (intptr_t i = 0; i < kSmallSize; i++) {
1831 EXPECT_EQ(
Smi::New(i), medium.At(i));
1833 for (intptr_t i = kSmallSize; i < kMediumSize; i++) {
1838 EXPECT_EQ(kLargeSize, large.
Length());
1839 for (intptr_t i = 0; i < kSmallSize; i++) {
1842 for (intptr_t i = kSmallSize; i < kLargeSize; i++) {
1849 thread->isolate_group()->type_arguments_canonicalization_mutex());
1850 const Array& empty_cache = Object::empty_instantiations_cache_array();
1851 DEBUG_ONLY(
EXPECT(TypeArguments::Cache::IsValidStorageLocked(empty_cache));)
1853 EXPECT(cache.IsLinear());
1855 EXPECT_EQ(0, cache.NumOccupied());
1857 EXPECT_EQ(1,
table.Length());
1858 for (
const auto& tuple :
table) {
1876 "Unhandled exception:\n"
1877 "RangeError (length): Invalid value: "
1878 "Not in inclusive range 0..%" Pd ": %" Pd,
1892 ASSERT(kOneTooMany >= 0);
1897 " return List.filled(%" Pd
1911 " return List.filled(%" Pd
1922 intptr_t actual = 0;
1924 EXPECT_EQ(kExpected, actual);
1932 "import 'dart:typed_data';\n"
1953 const intptr_t kOneTooMany =
1955 ASSERT(kOneTooMany >= 0);
1959 "import 'dart:typed_data';\n"
1961 " return new Int8List(%" Pd
1975 "import 'dart:typed_data';\n"
1977 " return new Int8List(%" Pd
1987 intptr_t actual = 0;
1989 EXPECT_EQ(max_elements, actual);
2001 EXPECT_EQ(
' ', it1.
Current());
2003 EXPECT_EQ(0xE7, it1.
Current());
2005 EXPECT_EQ(
' ', it1.
Current());
2012 "\xD7\x9B\xD7\x94"));
2015 EXPECT_EQ(0x5D2, it2.
Current());
2017 EXPECT_EQ(0x5DC, it2.
Current());
2019 EXPECT_EQ(0x5E2, it2.
Current());
2021 EXPECT_EQ(0x5D3, it2.
Current());
2023 EXPECT_EQ(0x5D1, it2.
Current());
2025 EXPECT_EQ(0x5E8, it2.
Current());
2027 EXPECT_EQ(0x5DB, it2.
Current());
2029 EXPECT_EQ(0x5D4, it2.
Current());
2036 "\xF0\x9D\x91\xA3"));
2039 EXPECT_EQ(0x1D460, it3.
Current());
2041 EXPECT_EQ(0x1D461, it3.
Current());
2043 EXPECT_EQ(0x1D462, it3.
Current());
2045 EXPECT_EQ(0x1D463, it3.
Current());
2057 EXPECT_EQ(
'b', it1.
Current());
2059 EXPECT_EQ(
'a', it1.
Current());
2061 EXPECT_EQ(
'r', it1.
Current());
2066 const int kArrayLen = 5;
2073 EXPECT_EQ(kArrayLen, array.
Capacity());
2074 EXPECT_EQ(0, array.
Length());
2075 for (intptr_t i = 0; i < 10; i++) {
2079 EXPECT_EQ(10, array.
Length());
2080 for (intptr_t i = 0; i < 10; i++) {
2085 for (intptr_t i = 0; i < 10; i++) {
2089 EXPECT_EQ(10, array.
Length());
2090 for (intptr_t i = 0; i < 10; i++) {
2103 intptr_t used_size = 0;
2106 EXPECT_EQ(kArrayLen + 1, array.
Capacity());
2107 EXPECT_EQ(0, array.
Length());
2108 for (intptr_t i = 0; i < 2; i++) {
2117 new_array ^= obj.
ptr();
2118 EXPECT_EQ(2, new_array.
Length());
2121#if defined(DART_COMPRESSED_POINTERS)
2123 EXPECT(obj.IsInstance());
2125 EXPECT(obj.IsTypedData());
2126 left_over_array ^= obj.
ptr();
2128 left_over_array.
Length());
2134 EXPECT_EQ(kArrayLen, array.
Capacity());
2135 EXPECT_EQ(0, array.
Length());
2136 for (intptr_t i = 0; i < 3; i++) {
2145 new_array ^= obj.
ptr();
2146 EXPECT_EQ(3, new_array.
Length());
2150 EXPECT(obj.IsTypedData());
2151 left_over_array ^= obj.
ptr();
2153 left_over_array.
Length());
2155 EXPECT(obj.IsInstance());
2160 EXPECT_EQ((kArrayLen + 3), array.
Capacity());
2161 EXPECT_EQ(0, array.
Length());
2162 for (intptr_t i = 0; i < 1; i++) {
2171 new_array ^= obj.
ptr();
2172 EXPECT_EQ(1, new_array.
Length());
2175#if defined(DART_COMPRESSED_POINTERS)
2177 EXPECT(obj.IsInstance());
2179 EXPECT(obj.IsTypedData());
2180 left_over_array ^= obj.
ptr();
2182 left_over_array.
Length());
2187 EXPECT_EQ(0, array.
Length());
2188 for (intptr_t i = 0; i < 1; i++) {
2193 GCTestHelper::CollectAllGarbage();
2194 GCTestHelper::WaitForGCTasks();
2197 EXPECT_EQ(1, new_array.
Length());
2198 GCTestHelper::CollectAllGarbage();
2199 GCTestHelper::WaitForGCTasks();
2202 EXPECT_LT(capacity_after, capacity_before);
2203 EXPECT_EQ(1, new_array.
Length());
2207 const intptr_t kSmallSize = 42;
2208 const intptr_t kLargeSize = 1000;
2217 EXPECT_EQ(small.LengthInBytes(), kSmallSize * small.ElementSizeInBytes());
2220 small.SetUint8(i,
static_cast<uint8_t
>(random.
NextUInt64() & 0xff));
2224 EXPECT_EQ(small.GetClassId(), big.GetClassId());
2225 EXPECT_EQ(big.LengthInBytes(), kLargeSize * big.ElementSizeInBytes());
2228 EXPECT_EQ(small.GetUint8(i), big.GetUint8(i));
2232 EXPECT_EQ(0, big.GetUint8(i));
2238 uint8_t
data[] = {253, 254, 255, 0, 1, 2, 3, 4};
2244 EXPECT_EQ(data_length, int8_array.
Length());
2245 for (intptr_t i = 0; i < data_length; ++i) {
2246 int8_array.SetInt8(i,
data[i]);
2249 EXPECT_EQ(-3, int8_array.GetInt8(0));
2250 EXPECT_EQ(253, int8_array.GetUint8(0));
2252 EXPECT_EQ(-2, int8_array.GetInt8(1));
2253 EXPECT_EQ(254, int8_array.GetUint8(1));
2255 EXPECT_EQ(-1, int8_array.GetInt8(2));
2256 EXPECT_EQ(255, int8_array.GetUint8(2));
2258 EXPECT_EQ(0, int8_array.GetInt8(3));
2259 EXPECT_EQ(0, int8_array.GetUint8(3));
2261 EXPECT_EQ(1, int8_array.GetInt8(4));
2262 EXPECT_EQ(1, int8_array.GetUint8(4));
2264 EXPECT_EQ(2, int8_array.GetInt8(5));
2265 EXPECT_EQ(2, int8_array.GetUint8(5));
2267 EXPECT_EQ(3, int8_array.GetInt8(6));
2268 EXPECT_EQ(3, int8_array.GetUint8(6));
2270 EXPECT_EQ(4, int8_array.GetInt8(7));
2271 EXPECT_EQ(4, int8_array.GetUint8(7));
2276 EXPECT_EQ(data_length, int8_array.
Length());
2277 for (intptr_t i = 0; i < data_length; ++i) {
2278 int8_array2.SetInt8(i,
data[i]);
2281 for (intptr_t i = 0; i < data_length; ++i) {
2282 EXPECT_EQ(int8_array.GetInt8(i), int8_array2.GetInt8(i));
2284 for (intptr_t i = 0; i < data_length; ++i) {
2285 int8_array.SetInt8(i, 123 + i);
2287 for (intptr_t i = 0; i < data_length; ++i) {
2288 EXPECT(int8_array.GetInt8(i) != int8_array2.GetInt8(i));
2293 uint8_t
data[] = {253, 254, 255, 0, 1, 2, 3, 4};
2298 kExternalTypedDataInt8ArrayCid,
data, data_length));
2300 EXPECT_EQ(data_length, int8_array.
Length());
2304 kExternalTypedDataUint8ArrayCid,
data, data_length));
2306 EXPECT_EQ(data_length, uint8_array.
Length());
2310 kExternalTypedDataUint8ClampedArrayCid,
data, data_length));
2312 EXPECT_EQ(data_length, uint8_clamped_array.
Length());
2314 EXPECT_EQ(-3, int8_array.GetInt8(0));
2315 EXPECT_EQ(253, uint8_array.GetUint8(0));
2316 EXPECT_EQ(253, uint8_clamped_array.GetUint8(0));
2318 EXPECT_EQ(-2, int8_array.GetInt8(1));
2319 EXPECT_EQ(254, uint8_array.GetUint8(1));
2320 EXPECT_EQ(254, uint8_clamped_array.GetUint8(1));
2322 EXPECT_EQ(-1, int8_array.GetInt8(2));
2323 EXPECT_EQ(255, uint8_array.GetUint8(2));
2324 EXPECT_EQ(255, uint8_clamped_array.GetUint8(2));
2326 EXPECT_EQ(0, int8_array.GetInt8(3));
2327 EXPECT_EQ(0, uint8_array.GetUint8(3));
2328 EXPECT_EQ(0, uint8_clamped_array.GetUint8(3));
2330 EXPECT_EQ(1, int8_array.GetInt8(4));
2331 EXPECT_EQ(1, uint8_array.GetUint8(4));
2332 EXPECT_EQ(1, uint8_clamped_array.GetUint8(4));
2334 EXPECT_EQ(2, int8_array.GetInt8(5));
2335 EXPECT_EQ(2, uint8_array.GetUint8(5));
2336 EXPECT_EQ(2, uint8_clamped_array.GetUint8(5));
2338 for (intptr_t i = 0; i < int8_array.
Length(); ++i) {
2339 EXPECT_EQ(int8_array.GetUint8(i), uint8_array.GetUint8(i));
2342 int8_array.SetInt8(2, -123);
2343 uint8_array.SetUint8(0, 123);
2344 for (intptr_t i = 0; i < int8_array.
Length(); ++i) {
2345 EXPECT_EQ(int8_array.GetInt8(i), uint8_array.GetInt8(i));
2348 uint8_clamped_array.SetUint8(0, 123);
2349 for (intptr_t i = 0; i < int8_array.
Length(); ++i) {
2350 EXPECT_EQ(int8_array.GetUint8(i), uint8_clamped_array.GetUint8(i));
2356 const char* url_chars =
"builtin:test-case";
2357 const char* source_chars =
"This will not compile.";
2361 EXPECT(!script.IsNull());
2362 EXPECT(script.IsScript());
2364 EXPECT_EQ(17, str.
Length());
2365 EXPECT_EQ(
'b', str.
CharAt(0));
2366 EXPECT_EQ(
':', str.
CharAt(7));
2367 EXPECT_EQ(
'e', str.
CharAt(16));
2368 str = script.Source();
2369 EXPECT_EQ(22, str.
Length());
2370 EXPECT_EQ(
'T', str.
CharAt(0));
2371 EXPECT_EQ(
'n', str.
CharAt(10));
2372 EXPECT_EQ(
'.', str.
CharAt(21));
2376 const char* url_chars =
"";
2378 const char* source_chars =
"abc";
2382 EXPECT(!script.IsNull());
2383 EXPECT(script.IsScript());
2385 str = script.GetLine(1);
2386 EXPECT_STREQ(
"abc", str.ToCString());
2387 str = script.GetSnippet(1, 1, 1, 2);
2388 EXPECT_STREQ(
"a", str.ToCString());
2389 str = script.GetSnippet(1, 2, 1, 4);
2390 EXPECT_STREQ(
"bc", str.ToCString());
2392 str = script.GetLine(-500);
2393 EXPECT_STREQ(
"", str.ToCString());
2394 str = script.GetLine(0);
2395 EXPECT_STREQ(
"", str.ToCString());
2396 str = script.GetLine(2);
2397 EXPECT_STREQ(
"", str.ToCString());
2398 str = script.GetLine(10000);
2399 EXPECT_STREQ(
"", str.ToCString());
2401 str = script.GetSnippet(-1, 1, 1, 2);
2403 str = script.GetSnippet(2, 1, 2, 2);
2405 str = script.GetSnippet(1, 1, 1, 5);
2410 const char* kScript =
"main() {}";
2418 const int kNumVariables = 5;
2428 variable = context.
At(kNumVariables - 1);
2433 smi ^= context.
At(0);
2434 EXPECT_EQ(2, smi.
Value());
2435 smi ^= context.
At(2);
2436 EXPECT_EQ(3, smi.
Value());
2445 const intptr_t parent_scope_function_level = 0;
2447 new LocalScope(
nullptr, parent_scope_function_level, 0);
2449 const intptr_t local_scope_function_level = 1;
2451 new LocalScope(parent_scope, local_scope_function_level, 0);
2454 const String& ta = Symbols::FunctionTypeArgumentsVar();
2456 TokenPosition::kNoSource, TokenPosition::kNoSource, ta, dynamic_type);
2461 TokenPosition::kNoSource, TokenPosition::kNoSource,
a, dynamic_type);
2466 TokenPosition::kNoSource, TokenPosition::kNoSource,
b, dynamic_type);
2471 TokenPosition::kNoSource, TokenPosition::kNoSource, c, dynamic_type);
2474 bool test_only =
false;
2514 const int num_parameters = 0;
2516 bool found_captured_vars =
false;
2518 Function::null_function(), first_parameter_index, num_parameters,
2519 first_local_index,
nullptr, &found_captured_vars);
2522 EXPECT_EQ(0, next_index.
value() -
2523 first_local_index.
value());
2524 const intptr_t parent_scope_context_level = 1;
2525 EXPECT_EQ(parent_scope_context_level, parent_scope->
context_level());
2526 EXPECT(found_captured_vars);
2528 const intptr_t local_scope_context_level = 5;
2531 Function::null_function(), local_scope_context_level));
2538 EXPECT_EQ(parent_scope_context_level - local_scope_context_level,
2544 EXPECT_EQ(parent_scope_context_level - local_scope_context_level,
2554 EXPECT_EQ(parent_scope_context_level - local_scope_context_level,
2570 UntaggedFunction::kRegularFunction,
false,
false,
2572 functions.
SetAt(0, parent);
2588 Closure::New(Object::null_type_arguments(), Object::null_type_arguments(),
2591 EXPECT_EQ(closure_class.
id(), kClosureCid);
2593 EXPECT_EQ(closure_function.
ptr(),
function.ptr());
2595 EXPECT_EQ(closure_context.
ptr(), context.
ptr());
2606 EXPECT_STREQ(
"Library:'dart:core' Class: bool", bool_class.
ToCString());
2607 EXPECT_STREQ(
"true",
Bool::True().ToCString());
2611 EXPECT_STREQ(
"Sugarbowl",
2638 return Library::New(library_name);
2646 const Class& owner_class =
2653 UntaggedFunction::kRegularFunction,
true,
false,
false,
2662 GenerateIncrement(&_assembler_);
2665 thread->isolate_group()->program_lock());
2683 GenerateIncrement(&_assembler_);
2686 thread->isolate_group()->program_lock());
2694 *(
reinterpret_cast<char*
>(payload_start) + 1) = 1;
2695 if (!FLAG_write_protect_code) {
2698 FATAL(
"Test requires --write-protect-code; skip by forcing expected crash");
2706 uword unchecked_offset) {
2707 code.SetActiveInstructions(instructions, unchecked_offset);
2708 code.set_instructions(instructions);
2716 const char* kHello =
"Hello World!";
2717 word expected_length =
static_cast<word>(strlen(kHello));
2720 GenerateEmbedStringInCode(&_assembler_, kHello);
2724 thread->isolate_group()->program_lock());
2734 for (
int i = 0; i < expected_length; i++) {
2743 const intptr_t kSmiTestValue = 5;
2746 GenerateEmbedSmiInCode(&_assembler_, kSmiTestValue);
2750 thread->isolate_group()->program_lock());
2759#if defined(ARCH_IS_64_BIT) && !defined(DART_COMPRESSED_POINTERS)
2762 extern void GenerateEmbedSmiInCode(compiler::Assembler * assembler,
2765 compiler::ObjectPoolBuilder object_pool_builder;
2766 compiler::Assembler _assembler_(&object_pool_builder);
2767 GenerateEmbedSmiInCode(&_assembler_, kSmiTestValue);
2770 SafepointWriteRwLocker locker(thread,
2771 thread->isolate_group()->program_lock());
2782 const int kNumEntries = 4;
2786 const bool kNeedsStackTrace =
true;
2787 const bool kNoStackTrace =
false;
2788 exception_handlers.
SetHandlerInfo(0, -1, 20u, kNeedsStackTrace,
false,
true);
2789 exception_handlers.
SetHandlerInfo(1, 0, 30u, kNeedsStackTrace,
false,
true);
2790 exception_handlers.
SetHandlerInfo(2, -1, 40u, kNoStackTrace,
true,
true);
2791 exception_handlers.
SetHandlerInfo(3, 1, 150u, kNoStackTrace,
true,
true);
2796 GenerateIncrement(&_assembler_);
2798 thread->isolate_group()->program_lock());
2802 code.set_exception_handlers(exception_handlers);
2811 EXPECT_EQ(-1,
info.outer_try_index);
2815 EXPECT_EQ(20u,
info.handler_pc_offset);
2826 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 10, 1,
2828 builder->AddDescriptor(UntaggedPcDescriptors::kDeopt, 20, 2,
2830 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 30, 3,
2832 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 10, 4,
2834 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 10, 5,
2836 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 80, 6,
2840 descriptors ^= builder->FinalizePcDescriptors(0);
2845 GenerateIncrement(&_assembler_);
2847 thread->isolate_group()->program_lock());
2851 code.set_pc_descriptors(descriptors);
2863 EXPECT_EQ(UntaggedPcDescriptors::kOther, iter.
Kind());
2868 EXPECT_EQ(UntaggedPcDescriptors::kDeopt, iter.
Kind());
2889 EXPECT_EQ(UntaggedPcDescriptors::kOther, iter.
Kind());
2898 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 100, 1,
2900 builder->AddDescriptor(UntaggedPcDescriptors::kDeopt, 200, 2,
2902 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 300, 3,
2904 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 100, 4,
2906 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 100, 5,
2908 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 800, 6,
2912 descriptors ^= builder->FinalizePcDescriptors(0);
2917 GenerateIncrement(&_assembler_);
2919 thread->isolate_group()->program_lock());
2923 code.set_pc_descriptors(descriptors);
2935 EXPECT_EQ(UntaggedPcDescriptors::kOther, iter.
Kind());
2940 EXPECT_EQ(UntaggedPcDescriptors::kDeopt, iter.
Kind());
2961 EXPECT_EQ(UntaggedPcDescriptors::kOther, iter.
Kind());
2979 field_name,
true,
false,
false,
true,
false, cls, Object::dynamic_type(),
2983 thread->isolate_group()->program_lock());
2984 thread->isolate_group()->RegisterStaticField(field, Object::sentinel());
3016 const bool is_static =
false;
3017 const bool is_const =
false;
3018 const bool is_abstract =
false;
3019 const bool is_external =
false;
3020 const bool is_native =
false;
3023 UntaggedFunction::kRegularFunction, is_static, is_const,
3024 is_abstract, is_external, is_native, cls,
3030 const intptr_t
id = 12;
3031 const intptr_t num_args_tested = 1;
3033 const intptr_t kTypeArgsLen = 0;
3034 const intptr_t kNumArgs = 1;
3036 kTypeArgsLen, kNumArgs, Object::null_array()));
3038 o1 = ICData::New(
function, target_name, args_descriptor,
id, num_args_tested,
3051 intptr_t test_class_id = -1;
3054 EXPECT_EQ(kSmiCid, test_class_id);
3055 EXPECT_EQ(target1.
ptr(), test_target.
ptr());
3056 EXPECT_EQ(kSmiCid, o1.
GetCidAt(0));
3058 o1.
GetCheckAt(0, &test_class_ids, &test_target);
3059 EXPECT_EQ(1, test_class_ids.
length());
3060 EXPECT_EQ(kSmiCid, test_class_ids[0]);
3061 EXPECT_EQ(target1.
ptr(), test_target.
ptr());
3068 EXPECT_EQ(kDoubleCid, test_class_id);
3069 EXPECT_EQ(target2.
ptr(), test_target.
ptr());
3070 EXPECT_EQ(kDoubleCid, o1.
GetCidAt(1));
3078 o2 = ICData::New(
function, target_name, args_descriptor, 57, 2,
3085 classes.
Add(kSmiCid);
3086 classes.
Add(kSmiCid);
3089 o2.
GetCheckAt(0, &test_class_ids, &test_target);
3090 EXPECT_EQ(2, test_class_ids.
length());
3091 EXPECT_EQ(kSmiCid, test_class_ids[0]);
3092 EXPECT_EQ(kSmiCid, test_class_ids[1]);
3093 EXPECT_EQ(target1.
ptr(), test_target.
ptr());
3096 const intptr_t kNumArgsChecked = 0;
3099 kNumArgsChecked, ICData::kInstance));
3108 const Class& empty_class1 =
3111 const Class& empty_class2 =
3116 EXPECT_EQ(0, cache.NumberOfChecks());
3125 cache.AddCheck(class_id_or_fun, dest_type, targ_0, targ_1, targ_2, targ_3,
3127 EXPECT_EQ(1, cache.NumberOfChecks());
3136 cache.GetCheck(0, &test_class_id_or_fun, &test_dest_type, &test_targ_0,
3137 &test_targ_1, &test_targ_2, &test_targ_3, &test_targ_4,
3139 EXPECT_EQ(class_id_or_fun.
ptr(), test_class_id_or_fun.
ptr());
3140 EXPECT_EQ(dest_type.
ptr(), test_dest_type.
ptr());
3141 EXPECT_EQ(targ_0.
ptr(), test_targ_0.
ptr());
3142 EXPECT_EQ(targ_1.
ptr(), test_targ_1.
ptr());
3143 EXPECT_EQ(targ_2.
ptr(), test_targ_2.
ptr());
3144 EXPECT_EQ(targ_3.
ptr(), test_targ_3.
ptr());
3145 EXPECT_EQ(targ_4.
ptr(), test_targ_4.
ptr());
3151 const auto& args_descriptor =
3166 cache.EnsureContains(cidA, valueA);
3167 EXPECT(cache.Lookup(cidA) == valueA.ptr());
3170 cache.EnsureContains(cidB, valueB);
3171 EXPECT(cache.Lookup(cidB) == valueB.ptr());
3181 for (intptr_t i = 0; i < 100; ++i) {
3189 for (intptr_t i = 0; i < 100; ++i) {
3210 EXPECT_STREQ(f.ToCString(),
3212 EXPECT_STREQ(f.ToCString(),
3339 const char* kScriptChars =
3341 " throw 'MyException';\n"
3344 "class _OtherClass {\n"
3345 " _OtherClass._named() {\n"
3350 "set globalVar(var value) {\n"
3351 " new _OtherClass._named();\n"
3355 " globalVar = null;\n"
3360 " (() => foo())();\n"
3363 " static get field {\n"
3376 " (() => new MyClass())();\n"
3382 const char* lib_url =
"file:///test-lib";
3386 "Unhandled exception:\n"
3388 "#0 baz (%1$s:2:3)\n"
3389 "#1 new _OtherClass._named (%1$s:7:5)\n"
3390 "#2 globalVar= (%1$s:12:7)\n"
3391 "#3 _bar (%1$s:16:3)\n"
3392 "#4 MyClass.field (%1$s:25:5)\n"
3393 "#5 MyClass.foo.fooHelper (%1$s:30:7)\n"
3394 "#6 MyClass.foo (%1$s:32:5)\n"
3395 "#7 new MyClass.<anonymous closure> (%1$s:21:12)\n"
3396 "#8 new MyClass (%1$s:21:18)\n"
3397 "#9 main.<anonymous closure> (%1$s:37:14)\n"
3398 "#10 main (%1$s:37:24)",
3420 GCTestHelper::CollectAllGarbage();
3437 GCTestHelper::CollectNewSpace();
3454 weak1.set_key(key1);
3455 weak1.set_value(value1);
3459 weak2.set_key(key2);
3460 weak2.set_value(value2);
3462 GCTestHelper::CollectNewSpace();
3480 weak1.set_value(value1);
3485 weak2.set_value(value2);
3487 GCTestHelper::CollectNewSpace();
3506 GCTestHelper::CollectAllGarbage();
3523 weak1.set_key(key1);
3524 weak1.set_value(value1);
3528 weak2.set_key(key2);
3529 weak2.set_value(value2);
3531 GCTestHelper::CollectAllGarbage();
3549 weak1.set_value(value1);
3554 weak2.set_value(value2);
3556 GCTestHelper::CollectAllGarbage();
3577 GCTestHelper::CollectNewSpace();
3593 weak1.set_value(value1);
3598 weak2.set_value(value2);
3600 GCTestHelper::CollectNewSpace();
3621 GCTestHelper::CollectAllGarbage();
3637 weak1.set_value(value1);
3642 weak2.set_value(value2);
3644 GCTestHelper::CollectAllGarbage();
3657 const auto& type_arguments =
3661 weak.SetTypeArguments(type_arguments);
3665 GCTestHelper::CollectNewSpace();
3667 GCTestHelper::CollectAllGarbage();
3688 const auto& type_arguments =
3692 weak.SetTypeArguments(type_arguments);
3696 GCTestHelper::CollectNewSpace();
3698 GCTestHelper::CollectAllGarbage();
3721 const auto& type_arguments =
3723 const auto& weak_reference =
3726 weak_reference.set_target(
target);
3727 weak_reference.SetTypeArguments(type_arguments);
3730 weak_property.set_key(
key);
3731 weak_property.set_value(weak_reference);
3735 GCTestHelper::CollectNewSpace();
3737 GCTestHelper::CollectAllGarbage();
3740 const auto& weak_reference =
3741 WeakReference::CheckedHandle(
Z, weak_property.value());
3747 WeakReference_Clear_ReachableThroughWeakProperty_NewSpace) {
3752 WeakReference_Clear_ReachableThroughWeakProperty_OldSpace) {
3765 const auto& type_arguments =
3767 const auto& weak_reference =
3769 weak_reference.set_target(
target);
3770 weak_reference.SetTypeArguments(type_arguments);
3773 weak_property.set_key(
key);
3774 weak_property.set_value(weak_reference);
3778 GCTestHelper::CollectNewSpace();
3780 GCTestHelper::CollectAllGarbage();
3783 const auto& weak_reference =
3784 WeakReference::CheckedHandle(
Z, weak_property.value());
3790 WeakReference_Preserve_ReachableThroughWeakProperty_NewSpace) {
3795 WeakReference_Preserve_ReachableThroughWeakProperty_OldSpace) {
3806 array.
SetAt(0, target0);
3807 array.
SetAt(1, target1);
3814 GCTestHelper::CollectNewSpace();
3828 array.
SetAt(0, target0);
3829 array.
SetAt(1, target1);
3836 GCTestHelper::CollectAllGarbage();
3864 finalizer.set_isolate(thread->
isolate());
3868 entry.set_value(
value);
3875 entry.set_detach(detach);
3877 entry.set_token(token);
3880 GCTestHelper::CollectNewSpace();
3882 GCTestHelper::CollectAllGarbage();
3930 finalizer.set_isolate(thread->
isolate());
3934 entry.set_value(
value);
3936 entry.set_token(token);
3941 entry.set_detach(detach);
3945 GCTestHelper::CollectNewSpace();
3947 GCTestHelper::CollectAllGarbage();
3989 finalizer.set_isolate(thread->
isolate());
4000 entry.set_token(token);
4001 entry.set_detach(detach);
4006 entry.set_value(
value);
4010 GCTestHelper::CollectNewSpace();
4012 GCTestHelper::CollectAllGarbage();
4061 finalizer.set_isolate(thread->
isolate());
4065 entry.set_detach(detach);
4068 entry.set_token(entry);
4075 entry.set_value(
object);
4077 value =
object.ptr();
4082 GCTestHelper::CollectNewSpace();
4084 GCTestHelper::CollectAllGarbage();
4089 EXPECT_EQ(entry.ptr(), entry.token());
4136 finalizer.set_isolate(thread->
isolate());
4139 entry.set_detach(detach);
4140 entry.set_token(token);
4142 entry.set_value(
value);
4146 GCTestHelper::CollectNewSpace();
4148 GCTestHelper::CollectAllGarbage();
4170 bool collect_old_space,
4171 bool collect_new_space,
4172 bool evacuate_new_space_and_collect_old_space,
4175 bool clear_detach_1,
4176 bool clear_detach_2) {
4184 intptr_t queue_length_start = 0;
4191 finalizer.set_isolate(thread->
isolate());
4192 const auto& entry1 =
4194 const auto& entry2 =
4200 entry1.set_token(token1);
4205 entry2.set_token(token2);
4206 entry2.set_detach(detach2);
4213 entry1.set_value(
object);
4214 if (!clear_value_1) {
4215 value1 =
object.ptr();
4219 entry1.set_detach(
object);
4220 if (!clear_detach_1) {
4221 detach1 =
object.ptr();
4225 entry2.set_value(
object);
4226 if (!clear_value_2) {
4227 value2 =
object.ptr();
4231 entry2.set_detach(
object);
4232 if (!clear_detach_2) {
4233 detach2 =
object.ptr();
4237 if (collect_old_space) {
4238 GCTestHelper::CollectOldSpace();
4240 if (collect_new_space) {
4241 GCTestHelper::CollectNewSpace();
4243 if (evacuate_new_space_and_collect_old_space) {
4244 GCTestHelper::CollectAllGarbage();
4254 const intptr_t expect_num_cleared =
4255 (clear_value_1 ? 1 : 0) + (clear_value_2 ? 1 : 0);
4256 EXPECT_EQ(expect_num_cleared,
4259 const intptr_t expect_num_messages = expect_num_cleared == 0 ? 0 : 1;
4263 EXPECT_EQ(expect_num_messages + queue_length_start, aq.
queue()->
Length());
4273 bool clear_detach_1,
4274 bool clear_detach_2) {
4275 const bool collect_old_space =
true;
4276 const bool collect_new_space = space ==
Heap::kNew;
4277 const bool evacuate_new_space_and_collect_old_space = !collect_new_space;
4284 thread, spaces, collect_old_space, collect_new_space,
4285 evacuate_new_space_and_collect_old_space, clear_value_1, clear_value_2,
4286 clear_detach_1, clear_detach_2);
4336 for (
const bool collect_new_space : {
false,
true}) {
4338 const bool collect_old_space =
true;
4340 const bool evacuate_new_space_and_collect_old_space =
true;
4341 for (intptr_t test_j = 0; test_j < 16; test_j++) {
4342 const bool clear_value_1 = (test_j >> 0 & 0x1) == 0x1;
4343 const bool clear_value_2 = (test_j >> 1 & 0x1) == 0x1;
4344 const bool clear_detach_1 = (test_j >> 2 & 0x1) == 0x1;
4345 const bool clear_detach_2 = (test_j >> 3 & 0x1) == 0x1;
4347 thread, spaces, collect_old_space, collect_new_space,
4348 evacuate_new_space_and_collect_old_space, clear_value_1,
4349 clear_value_2, clear_detach_1, clear_detach_2);
4353#define FINALIZER_CROSS_GEN_TEST_CASE(n) \
4354 ISOLATE_UNIT_TEST_CASE(Finalizer_CrossGen_##n) { \
4355 Finalizer_TwoEntriesCrossGen(thread, n); \
4358#define REPEAT_512(V) \
4874#undef FINALIZER_CROSS_GEN_TEST_CASE
4903 finalizer.set_isolate(thread->isolate());
4905 const auto& detach1 =
4908 const auto& detach2 =
4914 const auto& entry1 =
4916 entry1.set_detach(detach1);
4917 entry1.set_token(token1);
4919 const auto& entry2 =
4921 entry2.set_detach(detach2);
4922 entry2.set_token(token2);
4926 const auto& value1 =
4928 entry1.set_value(value1);
4929 const auto& value2 =
4931 entry2.set_value(value2);
4936 GCTestHelper::CollectNewSpace();
4940 GCTestHelper::CollectOldSpace();
4945 finalizer.set_entries_collected(
4950 GCTestHelper::CollectNewSpace();
4953 GCTestHelper::CollectOldSpace();
4954 GCTestHelper::CollectNewSpace();
4958 intptr_t* token =
reinterpret_cast<intptr_t*
>(peer);
4965 bool collect_new_space,
4966 bool evacuate_new_space_and_collect_old_space,
4969 bool clear_detach_1,
4970 bool clear_detach_2) {
4975 intptr_t token1_memory = 0;
4976 intptr_t token2_memory = 0;
4981 intptr_t queue_length_start = 0;
4991 const auto& finalizer =
4994 finalizer.set_isolate(thread->
isolate());
4996 const auto& isolate_finalizers =
4999 weak1.set_target(finalizer);
5000 isolate_finalizers.Add(
weak1);
5004 finalizer.set_all_entries(all_entries);
5005 const auto& all_entries_data =
Array::Handle(all_entries.data());
5007 const auto& entry1 =
5009 all_entries_data.SetAt(0, entry1);
5011 const auto& entry2 =
5013 all_entries_data.SetAt(1, entry2);
5014 all_entries.set_used_data(2);
5016 const intptr_t external_size1 = 1024;
5017 const intptr_t external_size2 = 2048;
5018 entry1.set_external_size(external_size1);
5019 entry2.set_external_size(external_size2);
5027 entry1.set_token(token1);
5033 entry2.set_token(token2);
5034 entry2.set_detach(detach2);
5042 entry1.set_value(
object);
5043 if (!clear_value_1) {
5044 value1 =
object.ptr();
5048 entry1.set_detach(
object);
5049 if (!clear_detach_1) {
5050 detach1 =
object.ptr();
5055 entry2.set_value(
object);
5056 if (!clear_value_2) {
5057 value2 =
object.ptr();
5061 entry2.set_detach(
object);
5062 if (!clear_detach_2) {
5063 detach2 =
object.ptr();
5068 GCTestHelper::CollectOldSpace();
5069 if (collect_new_space) {
5071 GCTestHelper::CollectNewSpace();
5073 if (evacuate_new_space_and_collect_old_space) {
5075 GCTestHelper::CollectAllGarbage();
5085 const intptr_t expect_num_cleared =
5086 (clear_value_1 ? 1 : 0) + (clear_value_2 ? 1 : 0);
5087 EXPECT_EQ(expect_num_cleared,
5090 EXPECT_EQ(clear_value_1 ? 1 : 0, token1_memory);
5091 EXPECT_EQ(clear_value_2 ? 1 : 0, token2_memory);
5093 const intptr_t expect_num_messages = expect_num_cleared == 0 ? 0 : 1;
5097 EXPECT_EQ(expect_num_messages + queue_length_start, aq.
queue()->
Length());
5101 entry1.set_token(entry1);
5102 entry2.set_token(entry2);
5105 all_entries.set_used_data(0);
5116 for (
const bool collect_new_space : {
true,
false}) {
5118 const bool evacuate_new_space_and_collect_old_space =
true;
5119 const bool clear_value_1 =
true;
5120 const bool clear_value_2 =
true;
5121 const bool clear_detach_1 =
false;
5122 const bool clear_detach_2 =
false;
5124 "collect_new_space: %s evacuate_new_space_and_collect_old_space: %s\n",
5125 collect_new_space ?
"true" :
"false",
5126 evacuate_new_space_and_collect_old_space ?
"true" :
"false");
5128 evacuate_new_space_and_collect_old_space,
5129 clear_value_1, clear_value_2,
5130 clear_detach_1, clear_detach_2);
5134#define FINALIZER_NATIVE_CROSS_GEN_TEST_CASE(n) \
5135 ISOLATE_UNIT_TEST_CASE(NativeFinalizer_CrossGen_##n) { \
5136 NativeFinalizer_TwoEntriesCrossGen(thread, n); \
5141#undef FINALIZER_NATIVE_CROSS_GEN_TEST_CASE
5148 const char* kScript = R
"(
5151class AImpl implements A {}
5152class ASub extends A {}
5153// Wonky class order and non-alphabetic naming on purpose.
5156class A implements Finalizable {}
5157class Z implements A {}
5158class D implements C {}
5169 class_x.EnsureIsFinalized(thread);
5170 EXPECT(class_x.is_isolate_unsendable());
5173 class_a_impl.EnsureIsFinalized(thread);
5174 EXPECT(class_a_impl.is_isolate_unsendable());
5177 class_a_sub.EnsureIsFinalized(thread);
5178 EXPECT(class_a_sub.is_isolate_unsendable());
5182 const char* kScriptChars = R
"(
5183abstract class AInterface {}
5185abstract class BInterface {}
5186class BImplementation implements BInterface {}
5188abstract class CInterface {}
5189class CImplementation1 implements CInterface {}
5190class CImplementation2 implements CInterface {}
5192abstract class DInterface {}
5193abstract class DSubinterface implements DInterface {}
5195abstract class EInterface {}
5196abstract class ESubinterface implements EInterface {}
5197class EImplementation implements ESubinterface {}
5199abstract class FInterface {}
5200abstract class FSubinterface implements FInterface {}
5201class FImplementation1 implements FSubinterface {}
5202class FImplementation2 implements FSubinterface {}
5205 new BImplementation();
5206 new CImplementation1();
5207 new CImplementation2();
5208 new EImplementation();
5209 new FImplementation1();
5210 new FImplementation2();
5227 const Class& BImplementation =
5233 const Class& CImplementation1 =
5235 const Class& CImplementation2 =
5248 const Class& EImplementation =
5256 const Class& FImplementation1 =
5258 const Class& FImplementation2 =
5274 EXPECT(library.IsLibrary());
5277 EXPECT(returned_referent.IsLibrary());
5278 EXPECT_EQ(returned_referent.
ptr(), library.
ptr());
5282 EXPECT_NE(reference.
ptr(), other_reference.
ptr());
5284 EXPECT_NE(reference.
ptr(), other_reference.
ptr());
5288 EXPECT(obj.IsMirrorReference());
5311 const Field& field =
5328 UntaggedFunction::kRegularFunction,
false,
false,
5330 functions.
SetAt(0, parent);
5348 intptr_t good_closure_index =
5350 EXPECT_GE(good_closure_index, 0);
5353 EXPECT_EQ(bad_closure_index, -1);
5374 UntaggedFunction::kRegularFunction,
false,
false,
5376 functions.
SetAt(0, parent);
5384 const String& invocation_dispatcher_name =
5389 invocation_dispatcher_name, args_desc,
5390 UntaggedFunction::kNoSuchMethodDispatcher,
true );
5393 intptr_t invocation_dispatcher_index =
5396 EXPECT_GE(invocation_dispatcher_index, 0);
5399 invocation_dispatcher_from_index ^=
5402 EXPECT_EQ(invocation_dispatcher.
ptr(),
5403 invocation_dispatcher_from_index.
ptr());
5406 intptr_t bad_invocation_dispatcher_index =
5408 EXPECT_EQ(bad_invocation_dispatcher_index, -1);
5412 if (
data.IsError()) {
5414 Error::Cast(
data).ToErrorCString());
5417 const Array& metadata = Array::Cast(
data);
5421 for (
int i = 0; i < metadata.
Length(); i++) {
5422 elem = metadata.
At(i);
5434 " const Meta(this.m); \n"
5437 "const metafoo = 'metafoo'; \n"
5438 "const metabar = 'meta' 'bar'; \n"
5441 "@Meta(0) String%s gVar; \n"
5444 "get tlGetter => gVar; \n"
5453 " @metabar @Meta('baa') \n"
5454 " int aFunc(a,b) => a + b; \n"
5508 const char* kScriptChars =
5510 " static test1(int a) {\n"
5511 " return a > 1 ? a + 1 : a;\n"
5513 " static test2(a) {\n"
5514 " return a > 1 ? a + 1 : a;\n"
5516 " static test3(b) {\n"
5517 " return b > 1 ? b + 1 : b;\n"
5519 " static test4(b) {\n"
5520 " return b > 1 ? b - 1 : b;\n"
5522 " static test5(b) {\n"
5523 " return b > 1 ? b - 2 : b;\n"
5526 " return a > 1 ? a + 1 : a;\n"
5530 " static /* Different declaration style. */\n"
5532 " /* Returns a + 1 for a > 1, a otherwise. */\n"
5537 " static test5(b) {\n"
5542 " return a > 1 ? a + 1 : a;\n"
5552 const Class& class_a =
5554 const Class& class_b =
5589 const char* kScriptChars =
5600 const int kBreakpointLine = 5;
5640 const int kBreakpointLine = 8;
5652 bool* auto_setup_scope) {
5653 ASSERT(auto_setup_scope !=
nullptr);
5654 *auto_setup_scope =
true;
5655 const char* cstr =
nullptr;
5658 EXPECT_STREQ(cstr,
"setBreakpoint");
5663 const char* kOriginalScript =
"test() {}";
5677 char*
error =
nullptr;
5682 EXPECT_NE(
nullptr, child);
5683 EXPECT_EQ(
nullptr,
error);
5687 const char* kReloadScript =
5689 @pragma("vm:external-name", "setBreakpoint")
5690 external setBreakpoint();
5696 baz(); // this line gets a breakpoint
5727 EXPECT_EQ(
nullptr,
error);
5731class ToggleBreakpointTask :
public ThreadPool::Task {
5733 ToggleBreakpointTask(IsolateGroup* isolate_group,
5735 std::atomic<bool>*
done)
5736 : isolate_group_(isolate_group), isolate_(isolate), done_(
done) {}
5737 virtual void Run() {
5740 const int kBreakpointLine = 5;
5742 for (intptr_t i = 0; i < 1000; i++) {
5746 int64_t breakpoint_id;
5748 TransitionNativeToVM transition(t);
5751 breakpoint_id = breakpoint_id_handle.AsInt64Value();
5762 IsolateGroup* isolate_group_;
5764 std::atomic<bool>* done_;
5768 const char* kScriptChars =
5791 char*
error =
nullptr;
5796 EXPECT_NE(
nullptr, child);
5797 EXPECT_EQ(
nullptr,
error);
5802 std::atomic<bool>
done =
false;
5809 TransitionNativeToVM transition(thread);
5811 const Library& vmlib =
5817 func_b.CanBeInlined();
5830 EXPECT_EQ(
nullptr,
error);
5839 cls = object_store->null_class();
5840 array = cls.fields();
5843 array = cls.current_functions();
5848 array = cls.fields();
5851 array = cls.current_functions();
5856 array = cls.fields();
5859 array = cls.current_functions();
5867 : objects_(objects) {}
5870 if (obj->IsPseudoObject()) {
5875 if (handle.IsString() || handle.IsArray()) {
5878 objects_->Add(&handle);
5882 GrowableArray<Object*>* objects_;
5888 TransitionVMToNative transition(thread);
5895 GCTestHelper::CollectAllGarbage();
5896 GrowableArray<Object*> objects;
5899 ObjectAccumulator acc(&objects);
5900 iteration.IterateObjects(&acc);
5902 for (intptr_t i = 0; i < objects.length(); ++i) {
5909 objects[i]->ToCString();
5916 TransitionVMToNative transition(thread);
5923 GCTestHelper::CollectAllGarbage();
5924 GrowableArray<Object*> objects;
5928 iteration.IterateObjects(&acc);
5930 for (intptr_t i = 0; i < objects.length(); ++i) {
5932 objects[i]->PrintJSON(&js,
false);
5933 EXPECT_SUBSTRING(
"\"type\":", js.ToCString());
5946 Class& cls =
Class::Handle(isolate->group()->object_store()->bool_class());
5947 cls.PrintJSON(&js,
true);
5948 const char* json_str =
js.ToCString();
5955 "{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"bool\","
5956 "\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":\"@"
5958 "\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core\\/bool.dart\","
5959 "\"_kind\":\"kernel\"}},"
5960 "\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
5961 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}}",
5968 Class& cls =
Class::Handle(isolate->group()->object_store()->bool_class());
5973 func.PrintJSON(&js,
true);
5974 const char* json_str =
js.ToCString();
5980 "{\"type\":\"@Function\",\"fixedId\":true,\"id\":\"\","
5981 "\"name\":\"toString\",\"owner\":{\"type\":\"@Class\","
5982 "\"fixedId\":true,\"id\":\"\",\"name\":\"bool\","
5983 "\"location\":{\"type\":\"SourceLocation\","
5984 "\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
5985 "\"id\":\"\",\"uri\":\"dart:core\\/bool.dart\","
5986 "\"_kind\":\"kernel\"}},"
5987 "\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
5988 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
5989 "\"_kind\":\"RegularFunction\",\"static\":false,\"const\":false,"
5990 "\"implicit\":false,\"abstract\":false,"
5991 "\"_intrinsic\":false,\"_native\":false,\"isGetter\":false,"
5992 "\"isSetter\":false,\"location\":{\"type\":\"SourceLocation\","
5993 "\"script\":{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
5994 "\"uri\":\"dart:core\\/bool.dart\",\"_kind\":\"kernel\"}}}",
6002 lib.PrintJSON(&js,
true);
6003 const char* json_str =
js.ToCString();
6007 "{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
6008 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}",
6015 const char* json_str =
js.ToCString();
6021 "{\"type\":\"@Instance\",\"_vmType\":\"Bool\",\"class\":{\"type\":\"@"
6022 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"bool\",\"location\":{"
6023 "\"type\":\"SourceLocation\",\"script\":{\"type\":\"@Script\","
6024 "\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core\\/bool.dart\",\"_"
6025 "kind\":\"kernel\"}},\"library\":"
6026 "{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\",\"name\":\"dart."
6027 "core\",\"uri\":\"dart:core\"}},\"identityHashCode\":0,\"kind\":"
6028 "\"Bool\",\"fixedId\":true,\"id\":\"objects\\/bool-true\","
6029 "\"valueAsString\":\"true\"}",
6036 smi.PrintJSON(&js,
true);
6037 const char* json_str =
js.ToCString();
6044 "{\"type\":\"@Instance\",\"_vmType\":\"Smi\",\"class\":{\"type\":\"@"
6045 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_Smi\",\"_vmName\":"
6046 "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
6047 "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6048 "patch\\/integers.dart\",\"_kind\":\"kernel\"}"
6049 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6050 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6051 "\"identityHashCode\":0,\"kind\":\"Int\",\"fixedId\":true,\"id\":"
6052 "\"objects\\/int-7\",\"valueAsString\":\"7\"}",
6059 smi.PrintJSON(&js,
true);
6060 const char* json_str =
js.ToCString();
6068 "{\"type\":\"@Instance\",\"_vmType\":\"Mint\",\"class\":{\"type\":\"@"
6069 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_Mint\",\"_vmName\":"
6070 "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
6071 "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6072 "patch\\/integers.dart\",\"_kind\":\"kernel\"}"
6073 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6074 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6075 "\"identityHashCode\":0,\"id\":\"\",\"kind\":\"Int\",\"valueAsString\":"
6076 "\"-9223372036854775808\"}",
6083 dub.PrintJSON(&js,
true);
6084 const char* json_str =
js.ToCString();
6092 "{\"type\":\"@Instance\",\"_vmType\":\"Double\",\"class\":{\"type\":\"@"
6093 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_Double\",\"_vmName\":"
6094 "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
6095 "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6096 "patch\\/double.dart\",\"_kind\":\"kernel\"}"
6097 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6098 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6099 "\"identityHashCode\":0,\"id\":\"\",\"kind\":\"Double\","
6100 "\"valueAsString\":\"0.1234\"}",
6107 str.PrintJSON(&js,
true);
6108 const char* json_str =
js.ToCString();
6116 "{\"type\":\"@Instance\",\"_vmType\":\"String\",\"class\":{\"type\":\"@"
6117 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_OneByteString\",\"_"
6118 "vmName\":\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{"
6119 "\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6120 "patch\\/string_patch.dart\",\"_kind\":\"kernel\"}"
6121 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6122 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6123 "\"identityHashCode\":0,\"id\":\"\",\"kind\":\"String\",\"length\":2,"
6124 "\"valueAsString\":\"dw\"}",
6131 array.PrintJSON(&js,
true);
6132 const char* json_str =
js.ToCString();
6141 "{\"type\":\"@Instance\",\"_vmType\":\"Array\",\"class\":{\"type\":\"@"
6142 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_List\",\"_vmName\":"
6143 "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
6144 "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-patch\\/"
6145 "array.dart\",\"_kind\":\"kernel\"}},"
6146 "\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
6147 "\"name\":\"dart.core\",\"uri\":\"dart:core\"},\"typeParameters\":[{"
6149 "Instance\",\"_vmType\":\"TypeParameter\",\"class\":{\"type\":\"@"
6150 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_TypeParameter\",\"_"
6151 "vmName\":\"\",\"location\":{\"type\":"
6152 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6153 "\"id\":\"\",\"uri\":\"dart:core-patch\\/"
6154 "type_patch.dart\",\"_kind\":\"kernel\"}},"
6155 "\"library\":{\"type\":\"@Library\",\"fixedId\":"
6156 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6157 "\"identityHashCode\":",
6161 "\"id\":\"\",\"kind\":\"TypeParameter\",\"name\":\"X0\","
6162 "\"parameterizedClass\":{\"type\":\"@Instance\",\"_vmType\":\"Class\","
6163 "\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\",\"name\":"
6164 "\"Null\",\"location\":{\"type\":\"SourceLocation\",\"script\":{"
6165 "\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:"
6167 "null.dart\",\"_kind\":\"kernel\"}},"
6168 "\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
6169 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\","
6170 "\"fixedId\":true,\"id\":\"\",\"valueAsString\":\"null\"}}]},"
6171 "\"identityHashCode\":0,\"id\":\"\",\"kind\":\"List\",\"length\":0}",
6178 const GrowableObjectArray& array =
6180 array.PrintJSON(&js,
true);
6181 const char* json_str =
js.ToCString();
6190 "{\"type\":\"@Instance\",\"_vmType\":\"GrowableObjectArray\",\"class\":"
6191 "{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_"
6192 "GrowableList\",\"_vmName\":\"\",\"location\":{\"type\":"
6193 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6194 "\"id\":\"\",\"uri\":\"dart:core-patch\\/"
6195 "growable_array.dart\",\"_kind\":\"kernel\"}"
6196 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6197 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"},"
6198 "\"typeParameters\":[{\"type\":\"@Instance\",\"_vmType\":"
6199 "\"TypeParameter\",\"class\":{\"type\":\"@Class\",\"fixedId\":true,"
6200 "\"id\":\"\",\"name\":\"_TypeParameter\",\"_vmName\":\""
6201 "\",\"location\":{\"type\":\"SourceLocation\",\"script\":{"
6202 "\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6204 "type_patch.dart\",\"_kind\":\"kernel\"}"
6205 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6206 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6207 "\"identityHashCode\":",
6211 "\"id\":\"\",\"kind\":\"TypeParameter\",\"name\":\"X0\","
6212 "\"parameterizedClass\":{\"type\":\"@Instance\","
6213 "\"_vmType\":\"Class\",\"class\":{\"type\":\"@Class\",\"fixedId\":true,"
6214 "\"id\":\"\",\"name\":\"Null\",\"location\":{\"type\":"
6215 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6216 "\"id\":\"\",\"uri\":\"dart:core\\/"
6217 "null.dart\",\"_kind\":\"kernel\"}"
6218 "},\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
6219 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\","
6220 "\"fixedId\":true,\"id\":\"\",\"valueAsString\":\"null\"}}]},"
6221 "\"identityHashCode\":0,\"id\":\"\",\"kind\":\"List\",\"length\":0}",
6228 array.PrintJSON(&js,
true);
6229 const char* json_str =
js.ToCString();
6238 "{\"type\":\"@Instance\",\"_vmType\":\"Map\",\"class\":{"
6239 "\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_"
6240 "Map\",\"_vmName\":\"\",\"location\":{\"type\":"
6241 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6242 "\"id\":\"\",\"uri\":\"dart:collection-patch\\/"
6243 "compact_hash.dart\",\"_kind\":\"kernel\"}"
6244 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6245 "true,\"id\":\"\",\"name\":\"dart.collection\",\"uri\":\"dart:"
6246 "collection\"},\"typeParameters\":[{\"type\":\"@Instance\",\"_vmType\":"
6247 "\"TypeParameter\",\"class\":{\"type\":\"@Class\",\"fixedId\":true,"
6248 "\"id\":\"\",\"name\":\"_TypeParameter\",\"_vmName\":\""
6249 "\",\"location\":{\"type\":\"SourceLocation\",\"script\":{"
6250 "\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6252 "type_patch.dart\",\"_kind\":\"kernel\"}"
6253 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6254 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6255 "\"identityHashCode\":",
6259 "\"id\":\"\",\"kind\":\"TypeParameter\",\"name\":\"X0\","
6260 "\"parameterizedClass\":{\"type\":\"@Instance\","
6261 "\"_vmType\":\"Class\",\"class\":{\"type\":\"@Class\",\"fixedId\":true,"
6262 "\"id\":\"\",\"name\":\"Null\",\"location\":{\"type\":"
6263 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6264 "\"id\":\"\",\"uri\":\"dart:core\\/"
6265 "null.dart\",\"_kind\":\"kernel\"}"
6266 "},\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
6267 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\","
6268 "\"fixedId\":true,\"id\":\"\",\"valueAsString\":\"null\"}},{\"type\":"
6269 "\"@Instance\",\"_vmType\":\"TypeParameter\",\"class\":{\"type\":\"@"
6270 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_TypeParameter\",\"_"
6271 "vmName\":\"\",\"location\":{\"type\":"
6272 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6273 "\"id\":\"\",\"uri\":\"dart:core-patch\\/"
6274 "type_patch.dart\",\"_kind\":\"kernel\"}"
6275 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6276 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6277 "\"identityHashCode\":",
6281 "\"id\":\"\",\"kind\":\"TypeParameter\",\"name\":\"X1\","
6282 "\"parameterizedClass\":{\"type\":\"@Instance\","
6283 "\"_vmType\":\"Class\",\"class\":{\"type\":\"@Class\",\"fixedId\":true,"
6284 "\"id\":\"\",\"name\":\"Null\",\"location\":{\"type\":"
6285 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6286 "\"id\":\"\",\"uri\":\"dart:core\\/"
6287 "null.dart\",\"_kind\":\"kernel\"}"
6288 "},\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
6289 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\","
6290 "\"fixedId\":true,\"id\":\"\",\"valueAsString\":\"null\"}}]},"
6291 "\"identityHashCode\":0,\"id\":\"\",\"kind\":\"Map\",\"length\":0}",
6298 tag.PrintJSON(&js,
true);
6299 const char* json_str =
js.ToCString();
6307 "\"type\":\"@Instance\",\"_vmType\":\"UserTag\",\"class\":{\"type\":\"@"
6308 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_UserTag\",\"_"
6309 "vmName\":\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{"
6310 "\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:"
6311 "developer-patch\\/"
6312 "profiler.dart\",\"_kind\":\"kernel\"}},\"library\":{\"type\":\"@"
6314 "\"fixedId\":true,\"id\":\"\",\"name\":\"dart.developer\",\"uri\":"
6315 "\"dart:developer\"}},"
6317 "\"identityHashCode\":",
6321 "\"kind\":\"UserTag\",\"label\":\"Default\"}",
6330 type.PrintJSON(&js,
true);
6331 const char* json_str =
js.ToCString();
6339 "{\"type\":\"@Instance\",\"_vmType\":\"Type\",\"class\":{\"type\":\"@"
6340 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_Type\",\"_vmName\":"
6341 "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
6342 "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6343 "patch\\/type_patch.dart\",\"_kind\":\"kernel\"}"
6344 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6345 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6347 "\"identityHashCode\":",
6350 "\"kind\":\"Type\","
6351 "\"fixedId\":true,\"id\":\"\","
6352 "\"typeClass\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
6353 "\"name\":\"bool\",\"location\":{\"type\":\"SourceLocation\","
6354 "\"script\":{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":"
6355 "\"dart:core\\/bool.dart\",\"_kind\":\"kernel\"}"
6356 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6357 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6358 "\"name\":\"bool\"}",
6364 Object::null_object().PrintJSON(&js,
true);
6365 const char* json_str =
js.ToCString();
6371 "{\"type\":\"@Instance\",\"_vmType\":\"null\",\"class\":{\"type\":\"@"
6372 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"Null\",\"location\":{"
6373 "\"type\":\"SourceLocation\",\"script\":{\"type\":\"@Script\","
6374 "\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core\\/null.dart\",\"_"
6375 "kind\":\"kernel\"}},\"library\":"
6376 "{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\",\"name\":\"dart."
6377 "core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\",\"fixedId\":true,"
6378 "\"id\":\"objects\\/null\",\"valueAsString\":\"null\"}",
6384 Object::sentinel().PrintJSON(&js,
true);
6386 "{\"type\":\"Sentinel\","
6387 "\"kind\":\"NotInitialized\","
6388 "\"valueAsString\":\"<not initialized>\"}",
6394 Object::transition_sentinel().PrintJSON(&js,
true);
6396 "{\"type\":\"Sentinel\","
6397 "\"kind\":\"BeingInitialized\","
6398 "\"valueAsString\":\"<being initialized>\"}",
6407 const char* kScript =
6409 " bool operator==(covariant A other) { return true; }\n"
6420 TransitionNativeToVM transition(thread);
6436 const char* kScript =
6438 " return \"foo\".hashCode;\n"
6465 const char* value_script,
6467 bool check_identity =
true,
6468 bool check_hashcode =
true) {
6473 "valueHashCode() {\n"
6474 " return value().hashCode;\n"
6477 "valueIdentityHashCode() {\n"
6478 " return identityHashCode(value());\n"
6488 if (check_hashcode) {
6498 const auto& value_dart = Instance::CheckedHandle(
6500 int64_t hashcode_dart;
6501 if (check_hashcode) {
6506 const int64_t identity_hashcode_dart =
6509 if (hashcode_canonicalize_vm == 0) {
6510 hashcode_canonicalize_vm = Instance::Cast(value_dart).CanonicalizeHash();
6513 bool success =
true;
6515 if (check_hashcode) {
6516 success &= hashcode_dart == hashcode_canonicalize_vm;
6518 if (check_identity) {
6519 success &= identity_hashcode_dart == hashcode_canonicalize_vm;
6525 "Dart hashCode or Dart identityHashCode does not equal VM "
6526 "CanonicalizeHash for %s\n",
6527 value_dart.ToCString());
6531 identity_hashcode_dart, identity_hashcode_dart);
6533 hashcode_canonicalize_vm, hashcode_canonicalize_vm);
6540 const char* kScript =
6548 uint32_t kInt1HashCode = 0;
6557 const char* kScript =
6559 " return 0x8000000;\n"
6565 const char* kScript =
6573 const char* kScript =
6581 const char* kScript =
6589 const char* kScript =
6598 const char* kScript =
6606 const char* kScript =
6607 "const type = dynamic;\n"
6617 const char* kScript =
6618 "const type = int;\n"
6628 const char* kScript =
6630 " var map = {'x': 3, 'y': 4, 'z': 5, 'w': 6};\n"
6631 " map.remove('y');\n"
6632 " map.remove('w');\n"
6640 TransitionNativeToVM transition(thread);
6643 ASSERT(dart_map.IsMap());
6644 const Map& cc_map =
Map::Cast(dart_map);
6646 EXPECT_EQ(2, cc_map.Length());
6648 Map::Iterator iterator(cc_map);
6651 EXPECT(iterator.MoveNext());
6652 object = iterator.CurrentKey();
6653 EXPECT_STREQ(
"x",
object.ToCString());
6654 object = iterator.CurrentValue();
6655 EXPECT_STREQ(
"3",
object.ToCString());
6657 EXPECT(iterator.MoveNext());
6658 object = iterator.CurrentKey();
6659 EXPECT_STREQ(
"z",
object.ToCString());
6660 object = iterator.CurrentValue();
6661 EXPECT_STREQ(
"5",
object.ToCString());
6663 EXPECT(!iterator.MoveNext());
6666template <
class LinkedHashBase>
6668 const LinkedHashBase& map2,
6675 const intptr_t data1_length =
Smi::Value(map1.used_data());
6676 const intptr_t data2_length =
Smi::Value(map2.used_data());
6677 const bool data_length_equal = data1_length == data2_length;
6678 bool data_equal = data_length_equal;
6679 if (data_length_equal) {
6682 for (intptr_t i = 0; i < data1_length; i++) {
6683 object1 ^= data1.At(i);
6684 object2 ^= data2.At(i);
6685 data_equal &= object1.CanonicalizeEquals(object2);
6690 THR_Print(
"LinkedHashBaseEqual Data not equal.\n");
6691 THR_Print(
"LinkedHashBaseEqual data1.length %" Pd " data1.length %" Pd
6693 data1_length, data2_length);
6695 for (intptr_t i = 0; i < data1_length; i++) {
6696 object1 ^= data1.At(i);
6697 THR_Print(
"LinkedHashBaseEqual data1[%" Pd "] %s\n", i,
6698 object1.ToCString());
6700 for (intptr_t i = 0; i < data2_length; i++) {
6701 object1 ^= data2.At(i);
6702 THR_Print(
"LinkedHashBaseEqual data2[%" Pd "] %s\n", i,
6703 object1.ToCString());
6711 intptr_t hash_mask1 =
Smi::Value(map1.hash_mask());
6713 intptr_t hash_mask2 =
Smi::Value(map2.hash_mask());
6714 const bool hash_masks_equal = hash_mask1 == hash_mask2;
6715 if (!hash_masks_equal) {
6717 THR_Print(
"LinkedHashBaseEqual Hash masks not equal.\n");
6718 THR_Print(
"LinkedHashBaseEqual hash_mask1 %" Px " hash_mask2 %" Px " \n",
6719 hash_mask1, hash_mask2);
6726 EXPECT(!index2.IsNull());
6727 ASSERT(index1.ElementType() == kUint32ArrayElement);
6728 ASSERT(index2.ElementType() == kUint32ArrayElement);
6729 const intptr_t kElementSize = 4;
6730 ASSERT(kElementSize == index1.ElementSizeInBytes());
6731 const bool index_length_equal = index1.Length() == index2.Length();
6732 bool index_equal = index_length_equal;
6733 if (index_length_equal) {
6734 for (intptr_t i = 0; i < index1.Length(); i++) {
6735 const uint32_t index1_val = index1.GetUint32(i * kElementSize);
6736 const uint32_t index2_val = index2.GetUint32(i * kElementSize);
6737 index_equal &= index1_val == index2_val;
6740 if (!index_equal && print_diff) {
6741 THR_Print(
"LinkedHashBaseEqual Indices not equal.\n");
6742 THR_Print(
"LinkedHashBaseEqual index1.length %" Pd " index2.length %" Pd
6744 index1.Length(), index2.Length());
6745 for (intptr_t i = 0; i < index1.Length(); i++) {
6746 const uint32_t index_val = index1.GetUint32(i * kElementSize);
6750 for (intptr_t i = 0; i < index2.Length(); i++) {
6751 const uint32_t index_val = index2.GetUint32(i * kElementSize);
6762 const TypeArguments& type_arguments) {
6766 for (intptr_t i = 0; i < used_data; i++) {
6770 map.set_used_data(used_data);
6771 map.SetTypeArguments(type_arguments);
6772 map.set_deleted_keys(0);
6773 map.ComputeAndSetHashMask();
6781 const char* kScript = R
"(
6782enum ExperimentalFlag {
6783 alternativeInvalidationStrategy,
6786 constructorTearoffs,
6787 controlFlowCollections,
6792 nonfunctionTypeAliases,
6801final Map<ExperimentalFlag?, bool> expiredExperimentalFlagsNonConst = {
6802 ExperimentalFlag.alternativeInvalidationStrategy: false,
6803 ExperimentalFlag.constFunctions: false,
6804 ExperimentalFlag.constantUpdate2018: true,
6805 ExperimentalFlag.constructorTearoffs: false,
6806 ExperimentalFlag.controlFlowCollections: true,
6807 ExperimentalFlag.extensionMethods: false,
6808 ExperimentalFlag.extensionTypes: false,
6809 ExperimentalFlag.genericMetadata: false,
6810 ExperimentalFlag.nonNullable: false,
6811 ExperimentalFlag.nonfunctionTypeAliases: false,
6812 ExperimentalFlag.setLiterals: true,
6813 ExperimentalFlag.spreadCollections: true,
6814 ExperimentalFlag.testExperiment: false,
6815 ExperimentalFlag.tripleShift: false,
6816 ExperimentalFlag.valueClass: false,
6817 ExperimentalFlag.variance: false,
6821 return expiredExperimentalFlagsNonConst;
6825 return ExperimentalFlag.alternativeInvalidationStrategy;
6829 return firstKey().hashCode;
6832firstKeyIdentityHashCode() {
6833 return identityHashCode(firstKey());
6836bool lookupSpreadCollections(Map map) =>
6837 map[ExperimentalFlag.spreadCollections];
6839bool? lookupNull(Map map) => map[null];
6859 TransitionNativeToVM transition(thread);
6860 const auto& non_const_map =
6862 const auto& non_const_type_args =
6864 const auto& non_const_data =
Array::Handle(non_const_map.data());
6866 non_const_data,
Smi::Value(non_const_map.used_data()),
6867 non_const_type_args));
6868 ASSERT(non_const_map.GetClassId() == kMapCid);
6869 ASSERT(const_map.GetClassId() == kConstMapCid);
6870 ASSERT(!non_const_map.IsCanonical());
6871 ASSERT(const_map.IsCanonical());
6877 lib,
NewString(
"lookupSpreadCollections"), 1, &const_argument);
6887 TransitionNativeToVM transition(thread);
6888 const auto& non_const_object =
6890 const auto& non_const_map =
Map::Cast(non_const_object);
6891 const auto& const_object =
6893 const auto& const_map =
Map::Cast(const_object);
6895 EXPECT(non_const_map.GetClassId() != const_map.GetClassId());
6904 return object.IsMap() ||
object.IsSet();
6911template <
class LinkedHashBase,
int kMutableC
id,
int kImmutableC
id>
6926 const auto& non_const_object =
6929 non_const_object.IsMap();
6936 EXPECT_EQ(non_const_value.GetClassId(), kMutableCid);
6937 EXPECT_EQ(const_value.GetClassId(), kImmutableCid);
6939 EXPECT(const_value.IsCanonical());
6946 HashBaseNonConstEqualsConst<Map, kMapCid, kConstMapCid>(script,
check_data);
6951 HashBaseNonConstEqualsConst<Set, kSetCid, kConstSetCid>(script,
check_data);
6955 const char* kScript = R
"(
6956constValue() => const {1: 42, 'foo': 499, 2: 'bar'};
6958nonConstValue() => {1: 42, 'foo': 499, 2: 'bar'};
6968 const char* kScript = R
"(
6969constValue() => const {1: 42, 'foo': 499, null: 'bar'};
6971nonConstValue() => {1: 42, 'foo': 499, null: 'bar'};
6981 const char* kScript = R
"(
6982enum ExperimentalFlag {
6983 alternativeInvalidationStrategy,
6986 constructorTearoffs,
6987 controlFlowCollections,
6992 nonfunctionTypeAliases,
7001const Map<ExperimentalFlag, bool> expiredExperimentalFlags = {
7002 ExperimentalFlag.alternativeInvalidationStrategy: false,
7003 ExperimentalFlag.constFunctions: false,
7004 ExperimentalFlag.constantUpdate2018: true,
7005 ExperimentalFlag.constructorTearoffs: false,
7006 ExperimentalFlag.controlFlowCollections: true,
7007 ExperimentalFlag.extensionMethods: false,
7008 ExperimentalFlag.extensionTypes: false,
7009 ExperimentalFlag.genericMetadata: false,
7010 ExperimentalFlag.nonNullable: false,
7011 ExperimentalFlag.nonfunctionTypeAliases: false,
7012 ExperimentalFlag.setLiterals: true,
7013 ExperimentalFlag.spreadCollections: true,
7014 ExperimentalFlag.testExperiment: false,
7015 ExperimentalFlag.tripleShift: false,
7016 ExperimentalFlag.valueClass: false,
7017 ExperimentalFlag.variance: false,
7020final Map<ExperimentalFlag, bool> expiredExperimentalFlagsNonConst = {
7021 ExperimentalFlag.alternativeInvalidationStrategy: false,
7022 ExperimentalFlag.constFunctions: false,
7023 ExperimentalFlag.constantUpdate2018: true,
7024 ExperimentalFlag.constructorTearoffs: false,
7025 ExperimentalFlag.controlFlowCollections: true,
7026 ExperimentalFlag.extensionMethods: false,
7027 ExperimentalFlag.extensionTypes: false,
7028 ExperimentalFlag.genericMetadata: false,
7029 ExperimentalFlag.nonNullable: false,
7030 ExperimentalFlag.nonfunctionTypeAliases: false,
7031 ExperimentalFlag.setLiterals: true,
7032 ExperimentalFlag.spreadCollections: true,
7033 ExperimentalFlag.testExperiment: false,
7034 ExperimentalFlag.tripleShift: false,
7035 ExperimentalFlag.valueClass: false,
7036 ExperimentalFlag.variance: false,
7039constValue() => expiredExperimentalFlags;
7041nonConstValue() => expiredExperimentalFlagsNonConst;
7051 const char* kScript = R
"(
7081const nonSizeAlignment = <Abi, Map<NativeType, int>>{
7083 Abi.wordSize32Align32: {
7084 NativeType.kDouble: 4,
7085 NativeType.kInt64: 4,
7086 NativeType.kUint64: 4
7088 Abi.wordSize32Align64: {},
7091final nonSizeAlignmentNonConst = <Abi, Map<NativeType, int>>{
7093 Abi.wordSize32Align32: {
7094 NativeType.kDouble: 4,
7095 NativeType.kInt64: 4,
7096 NativeType.kUint64: 4
7098 Abi.wordSize32Align64: {},
7101constValue() => nonSizeAlignment;
7103nonConstValue() => nonSizeAlignmentNonConst;
7113 const char* kScript = R
"(
7115 var set = {'x', 'y', 'z', 'w'};
7126 TransitionNativeToVM transition(thread);
7129 ASSERT(dart_set.IsSet());
7130 const Set& cc_set =
Set::Cast(dart_set);
7132 EXPECT_EQ(2, cc_set.Length());
7134 Set::Iterator iterator(cc_set);
7137 EXPECT(iterator.MoveNext());
7138 object = iterator.CurrentKey();
7139 EXPECT_STREQ(
"x",
object.ToCString());
7141 EXPECT(iterator.MoveNext());
7142 object = iterator.CurrentKey();
7143 EXPECT_STREQ(
"z",
object.ToCString());
7145 EXPECT(!iterator.MoveNext());
7151 const TypeArguments& type_arguments) {
7155 for (intptr_t i = 0; i < used_data; i++) {
7159 set.set_used_data(used_data);
7160 set.SetTypeArguments(type_arguments);
7161 set.set_deleted_keys(0);
7162 set.ComputeAndSetHashMask();
7169 const char* kScript = R
"(
7171 return {1, 2, 3, 5, 8, 13};
7174bool containsFive(Set set) => set.contains(5);
7185 TransitionNativeToVM transition(thread);
7186 const auto& non_const_object =
7188 const auto& non_const_set =
Set::Cast(non_const_object);
7189 ASSERT(non_const_set.GetClassId() == kSetCid);
7190 ASSERT(!non_const_set.IsCanonical());
7192 const auto& non_const_data =
Array::Handle(non_const_set.data());
7193 const auto& non_const_type_args =
7196 non_const_data,
Smi::Value(non_const_set.used_data()),
7197 non_const_type_args));
7198 ASSERT(const_set.GetClassId() == kConstSetCid);
7199 ASSERT(const_set.IsCanonical());
7210 TransitionNativeToVM transition(thread);
7211 const auto& non_const_object =
7213 const auto& non_const_set =
Set::Cast(non_const_object);
7214 const auto& const_object =
7216 const auto& const_set =
Set::Cast(const_object);
7218 EXPECT(non_const_set.GetClassId() != const_set.GetClassId());
7227 const char* kScript = R
"(
7228constValue() => const {1, 2, 3, 5, 8, 13};
7230nonConstValue() => {1, 2, 3, 5, 8, 13};
7233 constValue().contains(null);
7240 const char* kScript = R
"(
7241const Set<String> tokensThatMayFollowTypeArg = {
7267final Set<String> tokensThatMayFollowTypeArgNonConst = {
7293constValue() => tokensThatMayFollowTypeArg;
7295nonConstValue() => tokensThatMayFollowTypeArgNonConst;
7298 constValue().contains(null);
7306 Zone* zone = thread->zone();
7307 GrowableHandlePtrArray<const String> pieces(zone, n);
7309 for (
int i = 0; i < n; i++) {
7310 pieces.Add(*
data[i]);
7313 const String& res1 =
7316 EXPECT(res1.Equals(res2));
7322 &Symbols::isPaused()};
7327 const intptr_t kWideCharsLen = 7;
7328 uint16_t wide_chars[kWideCharsLen] = {
'H',
'e',
'l',
'l',
'o', 256,
'!'};
7329 const String& two_str =
7339 &Symbols::isPaused()};
7350 TestResult
tests[] = {
7351 {
"(dynamic, dynamic) => void",
"(dynamic, dynamic) => void"},
7352 {
"_List@915557746",
"_List"},
7353 {
"_HashMap@600006304<K, V>(dynamic) => V",
7354 "_HashMap<K, V>(dynamic) => V"},
7355 {
"set:foo",
"foo="},
7357 {
"_ReceivePortImpl@709387912",
"_ReceivePortImpl"},
7358 {
"_ReceivePortImpl@709387912._internal@709387912",
7359 "_ReceivePortImpl._internal"},
7360 {
"_C@6328321&_E@6328321&_F@6328321",
"_C&_E&_F"},
7362 {
"get:foo@6328321",
"foo"},
7363 {
"_MyClass@6328321.",
"_MyClass"},
7364 {
"_MyClass@6328321.named",
"_MyClass.named"},
7380 int32_t char_codes[] = {0, 0x0a, 0x0d, 0x7f, 0xff,
7381 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff};
7390 const char* kScriptChars =
7391 "void foo<T extends C<T>>(T x) {}\n"
7392 "void bar<M extends U<M>>(M x) {}\n"
7393 "abstract class C<T> {}\n"
7394 "abstract class U<T> extends C<T> {}\n";
7396 TransitionNativeToVM transition(thread);
7415 const AbstractType& sub,
7416 const AbstractType& super,
7418 if (sub.IsSubtypeOf(super,
Heap::kNew) != is_subtype) {
7420 buffer.AddString(
"Expected ");
7422 buffer.Printf(
" to %s a subtype of ", is_subtype ?
"be" :
"not be");
7424 expect.Fail(
"%s",
buffer.buffer());
7428#define EXPECT_SUBTYPE(sub, super) \
7429 CheckSubtypeRelation(Expect(__FILE__, __LINE__), sub, super, true);
7430#define EXPECT_NOT_SUBTYPE(sub, super) \
7431 CheckSubtypeRelation(Expect(__FILE__, __LINE__), sub, super, false);
7434 const auto& closure_class =
7436 const auto& closure_type =
Type::Handle(closure_class.DeclarationType());
7447 const auto& function_type =
7459 EXPECT_SUBTYPE(closure_type_nonnullable, function_type_nullable);
7461 EXPECT_SUBTYPE(closure_type_nonnullable, function_type_nonnullable);
7470 const auto& future_or_class =
7473 tav_function_nullable.SetTypeAt(0, function_type_nullable);
7474 tav_function_nullable = tav_function_nullable.Canonicalize(thread);
7476 tav_function_legacy.SetTypeAt(0, function_type_legacy);
7477 tav_function_legacy = tav_function_legacy.Canonicalize(thread);
7479 tav_function_nonnullable.SetTypeAt(0, function_type_nonnullable);
7480 tav_function_nonnullable = tav_function_nonnullable.Canonicalize(thread);
7482 auto& future_or_function_type_nullable =
7485 auto& future_or_function_type_legacy =
7488 auto& future_or_function_type_nonnullable =
7492 EXPECT_SUBTYPE(closure_type_nonnullable, future_or_function_type_nullable);
7494 EXPECT_SUBTYPE(closure_type_nonnullable, future_or_function_type_nonnullable);
7495 EXPECT_SUBTYPE(closure_type_legacy, future_or_function_type_nullable);
7496 EXPECT_SUBTYPE(closure_type_legacy, future_or_function_type_legacy);
7497 EXPECT_SUBTYPE(closure_type_legacy, future_or_function_type_nonnullable);
7498 EXPECT_SUBTYPE(closure_type_nullable, future_or_function_type_nullable);
7499 EXPECT_SUBTYPE(closure_type_nullable, future_or_function_type_legacy);
7501 future_or_function_type_nonnullable);
7508 auto& type_function_int_nullary =
7513 auto& type_nullable_function_int_nullary =
7522#undef EXPECT_NOT_SUBTYPE
7523#undef EXPECT_SUBTYPE
7526 const AbstractType& expected,
7527 const AbstractType& got,
7529 if (got.IsEquivalent(expected, kind))
return;
7533 buffer.AddString(
", got ");
7535 expect.Fail(
"%s",
buffer.buffer());
7538#define EXPECT_TYPES_EQUAL(expected, got) \
7539 ExpectTypesEquivalent(Expect(__FILE__, __LINE__), expected, got, \
7540 TypeEquality::kCanonical);
7543 const char* kScript = R
"(
7545 class A1<X, Y> implements B<List<Y>> {}
7546 class A2<X, Y> extends A1<Y, X> {}
7550 TransitionNativeToVM transition(thread);
7551 Zone*
const zone = thread->zone();
7553 const auto& root_lib =
7555 EXPECT(!root_lib.IsNull());
7563 const auto& decl_type_b =
Type::Handle(zone, class_b.DeclarationType());
7564 const auto& decl_type_list =
Type::Handle(zone, class_list.DeclarationType());
7565 const auto& null_tav = Object::null_type_arguments();
7569 const auto& decl_type_a1 =
Type::Handle(zone, class_a1.DeclarationType());
7570 const auto& decl_type_args_a1 =
7572 const auto& type_arg_a1_y =
7573 TypeParameter::CheckedHandle(zone, decl_type_args_a1.TypeAt(1));
7575 tav_a1_y.SetTypeAt(0, type_arg_a1_y);
7576 tav_a1_y = tav_a1_y.Canonicalize(thread);
7577 auto& type_list_a1_y = Type::CheckedHandle(
7578 zone, decl_type_list.InstantiateFrom(tav_a1_y, null_tav,
kAllFree,
7580 type_list_a1_y ^= type_list_a1_y.Canonicalize(thread);
7582 tav_list_a1_y.SetTypeAt(0, type_list_a1_y);
7583 tav_list_a1_y = tav_list_a1_y.Canonicalize(thread);
7584 auto& type_b_list_a1_y = Type::CheckedHandle(
7585 zone, decl_type_b.InstantiateFrom(tav_list_a1_y, null_tav,
kAllFree,
7587 type_b_list_a1_y ^= type_b_list_a1_y.Canonicalize(thread);
7589 const auto& inst_b_a1 =
7590 Type::Handle(zone, class_a1.GetInstantiationOf(zone, class_b));
7591 EXPECT(!inst_b_a1.IsNull());
7597 const auto& decl_type_a2 =
Type::Handle(zone, class_a2.DeclarationType());
7598 const auto& decl_type_args_a2 =
7600 const auto& type_arg_a2_x =
7601 TypeParameter::CheckedHandle(zone, decl_type_args_a2.TypeAt(0));
7603 tav_a2_x.SetTypeAt(0, type_arg_a2_x);
7604 tav_a2_x = tav_a2_x.Canonicalize(thread);
7605 auto& type_list_a2_x = Type::CheckedHandle(
7606 zone, decl_type_list.InstantiateFrom(tav_a2_x, null_tav,
kAllFree,
7608 type_list_a2_x ^= type_list_a2_x.Canonicalize(thread);
7610 tav_list_a2_x.SetTypeAt(0, type_list_a2_x);
7611 tav_list_a2_x = tav_list_a2_x.Canonicalize(thread);
7612 auto& type_b_list_a2_x = Type::CheckedHandle(
7613 zone, decl_type_b.InstantiateFrom(tav_list_a2_x, null_tav,
kAllFree,
7615 type_b_list_a2_x ^= type_b_list_a2_x.Canonicalize(thread);
7617 const auto& inst_b_a2 =
7618 Type::Handle(zone, class_a2.GetInstantiationOf(zone, class_b));
7624#undef EXPECT_TYPES_EQUAL
7626#define EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(expected, got) \
7627 ExpectTypesEquivalent(Expect(__FILE__, __LINE__), expected, got, \
7628 TypeEquality::kSyntactical);
7633 const auto& future_or_class =
7636 tav.SetTypeAt(0, param);
7646 const auto& future_class =
Class::Handle(object_store->future_class());
7648 tav.SetTypeAt(0, param);
7660 auto normalized_future_or = [&](
const AbstractType& param,
7682 const auto& type_nullable_object =
7692 const auto& type_non_nullable_object =
7693 Type::Handle(object_store->non_nullable_object_type());
7702 const auto& type_legacy_object =
7712 const auto& type_never =
Type::Handle(object_store->never_type());
7713 const auto& expected =
7723 const auto& type_null =
Type::Handle(object_store->null_type());
7724 const auto& expected =
7739 const auto& type_nullable_int =
7749TEST_CASE(AbstractType_InstantiatedFutureOrIsNormalized) {
7750 const char* kScript = R
"(
7753FutureOr<T>? foo<T>() { return null; }
7754FutureOr<T?> bar<T>() { return null; }
7759 TransitionNativeToVM transition(thread);
7760 Zone*
const zone = thread->zone();
7763 const auto& null_tav = Object::null_type_arguments();
7764 auto instantiate_future_or =
7765 [&](
const AbstractType&
generic,
7766 const AbstractType& param) -> AbstractTypePtr {
7768 tav.SetTypeAt(0, param);
7773 const auto& root_lib =
7775 EXPECT(!root_lib.IsNull());
7781 const auto& nullable_future_or_T =
7783 const auto& future_or_nullable_T =
7786 const auto& type_nullable_object =
7788 const auto& type_non_nullable_object =
7789 Type::Handle(object_store->non_nullable_object_type());
7790 const auto& type_legacy_object =
7799 instantiate_future_or(nullable_future_or_T, Object::dynamic_type()));
7805 instantiate_future_or(nullable_future_or_T, Object::void_type()));
7811 instantiate_future_or(nullable_future_or_T, type_nullable_object));
7819 instantiate_future_or(future_or_nullable_T, Object::dynamic_type()));
7825 instantiate_future_or(future_or_nullable_T, Object::void_type()));
7831 instantiate_future_or(future_or_nullable_T, type_nullable_object));
7839 instantiate_future_or(future_or_nullable_T, type_non_nullable_object));
7847 instantiate_future_or(future_or_nullable_T, type_legacy_object));
7855 instantiate_future_or(nullable_future_or_T, type_non_nullable_object));
7863 instantiate_future_or(nullable_future_or_T, type_legacy_object));
7867 const auto& type_never =
Type::Handle(object_store->never_type());
7868 const auto& type_null =
Type::Handle(object_store->null_type());
7873 const auto& expected =
7876 instantiate_future_or(future_or_nullable_T, type_never));
7883 const auto& expected =
7886 instantiate_future_or(nullable_future_or_T, type_never));
7893 const auto& expected =
7896 instantiate_future_or(future_or_nullable_T, type_null));
7903 const auto& expected =
7906 instantiate_future_or(nullable_future_or_T, type_null));
7910 const auto& type_nullable_int =
7912 const auto& type_non_nullable_int =
7921 instantiate_future_or(future_or_nullable_T, type_non_nullable_int));
7931 instantiate_future_or(future_or_nullable_T, type_nullable_int));
7941 instantiate_future_or(nullable_future_or_T, type_nullable_int));
7951 instantiate_future_or(nullable_future_or_T, type_non_nullable_int));
7956#define __ assembler->
7959 __ EnterDartFrame(0);
7962 const intptr_t uninstantiated_offset =
7964 const intptr_t inst_type_args_offset =
7966 const intptr_t fun_type_args_offset =
7970 uninstantiated_offset);
7972 inst_type_args_offset);
7974 fun_type_args_offset);
7976 __ Call(StubCode::InstantiateTypeArguments());
7981 __ LeaveDartFrame();
7988 Zone*
const zone = thread->zone();
7990 zone, thread->isolate_group()->class_table()->At(kInstanceCid));
7995 zone,
Function::New(signature, symbol, UntaggedFunction::kRegularFunction,
7996 false,
false,
false,
false,
false, klass,
7997 TokenPosition::kNoSource));
7999 compiler::ObjectPoolBuilder pool_builder;
8000 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
8001 compiler::Assembler assembler(&pool_builder);
8010 invoke_instantiate_tav.set_object_pool(
pool.ptr());
8011 invoke_instantiate_tav.set_owner(
function);
8012 invoke_instantiate_tav.set_exception_handlers(
8014#if defined(TARGET_ARCH_IA32)
8015 EXPECT_EQ(0,
pool.Length());
8017 EXPECT_EQ(1,
pool.Length());
8019 return invoke_instantiate_tav.ptr();
8022#if !defined(PRODUCT)
8029 buffer.AddString(
"class D<T> {}\n");
8030 for (intptr_t i = 0; i < num_classes; i++) {
8031 buffer.Printf(
"class C%" Pd " { String toString() => 'C%" Pd "'; }\n", i,
8034 buffer.AddString(
"main() {\n");
8035 for (intptr_t i = 0; i < num_classes; i++) {
8036 buffer.Printf(
" C%" Pd "().toString();\n", i);
8048 TransitionNativeToVM transition(thread);
8049 Zone*
const zone = thread->zone();
8051 const auto& root_lib =
8053 EXPECT(!root_lib.IsNull());
8056 ASSERT(!class_d.IsNull());
8057 const auto& decl_type_d =
Type::Handle(zone, class_d.DeclarationType());
8058 const auto& decl_type_d_type_args =
8061 EXPECT(!decl_type_d_type_args.HasInstantiations());
8066 const auto& function_type_args = Object::null_type_arguments();
8073 const auto& invoke_instantiate_tav =
8075 const auto& invoke_instantiate_tav_arguments =
8077 const auto& invoke_instantiate_tav_args_descriptor =
8079 for (intptr_t i = 0; i < num_classes; ++i) {
8080 const bool updated_cache_is_linear =
8084 ASSERT(!class_c.IsNull());
8085 decl_type_c = class_c.DeclarationType();
8087 instantiator_type_args.SetTypeAt(0, decl_type_c);
8088 instantiator_type_args = instantiator_type_args.Canonicalize(thread);
8090#if !defined(PRODUCT)
8099 intptr_t old_capacity;
8101 SafepointMutexLocker ml(
8102 thread->isolate_group()->type_arguments_canonicalization_mutex());
8103 TypeArguments::Cache
cache(zone, decl_type_d_type_args);
8104 EXPECT_EQ(i,
cache.NumOccupied());
8106 cache.FindKeyOrUnused(instantiator_type_args, function_type_args);
8108 old_capacity =
cache.NumEntries();
8111 decl_type_d_type_args.InstantiateAndCanonicalizeFrom(instantiator_type_args,
8112 function_type_args);
8115 TypeArguments::Cache::KeyLocation loc;
8116 bool storage_changed;
8118 SafepointMutexLocker ml(
8119 thread->isolate_group()->type_arguments_canonicalization_mutex());
8120 TypeArguments::Cache
cache(zone, decl_type_d_type_args);
8121 EXPECT_EQ(i + 1,
cache.NumOccupied());
8124 loc =
cache.FindKeyOrUnused(instantiator_type_args, function_type_args);
8126 storage_changed =
cache.NumEntries() != old_capacity;
8129#if defined(TARGET_ARCH_IA32)
8130 const bool stub_checks_hash_caches =
false;
8132 const bool stub_checks_hash_caches =
true;
8136 if (updated_cache_is_linear || stub_checks_hash_caches) {
8137 invoke_instantiate_tav_arguments.SetAt(0, decl_type_d_type_args);
8138 invoke_instantiate_tav_arguments.SetAt(1, instantiator_type_args);
8139 invoke_instantiate_tav_arguments.SetAt(2, function_type_args);
8140 result_type_args ^= DartEntry::InvokeCode(
8141 invoke_instantiate_tav, invoke_instantiate_tav_args_descriptor,
8142 invoke_instantiate_tav_arguments, thread);
8143 EXPECT_EQ(1, result_type_args.Length());
8144 result_type = result_type_args.TypeAt(0);
8148#if !defined(PRODUCT)
8154 result_type_args = decl_type_d_type_args.InstantiateAndCanonicalizeFrom(
8155 instantiator_type_args, function_type_args);
8156 result_type = result_type_args.TypeAt(0);
8161 SafepointMutexLocker ml(
8162 thread->isolate_group()->type_arguments_canonicalization_mutex());
8163 TypeArguments::Cache
cache(zone, decl_type_d_type_args);
8164 EXPECT_EQ(i + 1,
cache.NumOccupied());
8166 cache.FindKeyOrUnused(instantiator_type_args, function_type_args);
8168 EXPECT_EQ(loc.entry, loc2.entry);
8172 first_instantiator_type_args = instantiator_type_args.ptr();
8173 }
else if (storage_changed) {
8175 SafepointMutexLocker ml(
8176 thread->isolate_group()->type_arguments_canonicalization_mutex());
8177 TypeArguments::Cache
cache(zone, decl_type_d_type_args);
8178 EXPECT_EQ(i + 1,
cache.NumOccupied());
8183 cache.FindKeyOrUnused(instantiator_type_args, function_type_args);
8191TEST_CASE(TypeArguments_Cache_SomeInstantiations) {
8198#if !defined(DEBUG) && !defined(USING_MEMORY_SANITIZER) && \
8199 !defined(USING_THREAD_SANITIZER) && !defined(USING_LEAK_SANITIZER) && \
8200 !defined(USING_UNDEFINED_BEHAVIOR_SANITIZER) && !defined(USING_SIMULATOR)
8201TEST_CASE(TypeArguments_Cache_ManyInstantiations) {
8202 const intptr_t kNumClasses = 100000;
8204 "too few classes to trigger change to a hash-based cache");
8209#undef EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT
8212 const SubtypeTestCache& cache) {
8213 const intptr_t used_inputs = cache.num_inputs();
8215 FAIL(
"Invalid number of used inputs: %" Pd "", used_inputs);
8219 for (intptr_t i = 0; i <
cache.NumEntries(); i++) {
8220 if (!
cache.IsOccupied(i))
continue;
8223 const intptr_t
cid =
8230 int check_ordering = used_inputs;
8233#define USED_INPUT_CASE(Input, ExpectedCids) \
8234 case (Input) + 1: { \
8235 RELEASE_ASSERT((Input) + 1 == check_ordering); \
8236 const intptr_t cid = \
8237 array.At(entry_start + (Input))->GetClassIdMayBeSmi(); \
8238 if (!(ExpectedCids)) { \
8239 FAIL("expected: " #ExpectedCids ", got: cid %" Pd "", cid); \
8244 switch (used_inputs) {
8264 cid == kSmiCid ||
cid == kFunctionTypeCid);
8270#undef USED_INPUT_CASE
8287 const SubtypeTestCache& cache,
8288 const Object& instance_class_id_or_signature,
8289 const AbstractType& destination_type,
8290 const TypeArguments& instance_type_arguments,
8291 const TypeArguments& instantiator_type_arguments,
8292 const TypeArguments& function_type_arguments,
8293 const TypeArguments& parent_function_type_arguments,
8294 const TypeArguments& delayed_type_arguments,
8295 const Bool& expected_result,
8297 const auto& tav_null = TypeArguments::null_type_arguments();
8298 const intptr_t num_inputs =
cache.num_inputs();
8299 const bool was_hash =
cache.IsHash();
8300 const intptr_t old_count =
cache.NumberOfChecks();
8301 intptr_t expected_index, got_index;
8304 instance_class_id_or_signature, destination_type, instance_type_arguments,
8305 instantiator_type_arguments, function_type_arguments,
8306 parent_function_type_arguments, delayed_type_arguments,
nullptr,
8309 SafepointMutexLocker ml(
8310 thread->isolate_group()->subtype_test_cache_mutex());
8312 cache.AddCheck(instance_class_id_or_signature, destination_type,
8313 instance_type_arguments, instantiator_type_arguments,
8314 function_type_arguments, parent_function_type_arguments,
8315 delayed_type_arguments, expected_result);
8316 EXPECT(expected_index >= 0);
8318 EXPECT_EQ(old_count + 1,
cache.NumberOfChecks());
8319 EXPECT(
cache.HasCheck(instance_class_id_or_signature, destination_type,
8320 instance_type_arguments, instantiator_type_arguments,
8321 function_type_arguments, parent_function_type_arguments,
8322 delayed_type_arguments, &got_index, got_result));
8323 EXPECT_EQ(expected_index, got_index);
8324 EXPECT(got_result->ptr() == expected_result.ptr());
8327 EXPECT(
cache.HasCheck(instance_class_id_or_signature, destination_type,
8328 tav_null, instantiator_type_arguments,
8329 function_type_arguments,
8330 parent_function_type_arguments,
8331 delayed_type_arguments, &got_index, got_result));
8332 EXPECT_EQ(expected_index, got_index);
8333 EXPECT(got_result->ptr() == expected_result.ptr());
8337 instance_class_id_or_signature, destination_type, tav_null,
8338 instantiator_type_arguments, function_type_arguments,
8339 parent_function_type_arguments, delayed_type_arguments,
8344 EXPECT(
cache.HasCheck(instance_class_id_or_signature, destination_type,
8345 instance_type_arguments, tav_null,
8346 function_type_arguments,
8347 parent_function_type_arguments,
8348 delayed_type_arguments, &got_index, got_result));
8349 EXPECT_EQ(expected_index, got_index);
8350 EXPECT(got_result->ptr() == expected_result.ptr());
8354 instance_class_id_or_signature, destination_type,
8355 instance_type_arguments, tav_null, function_type_arguments,
8356 parent_function_type_arguments, delayed_type_arguments,
8361 EXPECT(
cache.HasCheck(instance_class_id_or_signature, destination_type,
8362 instance_type_arguments, instantiator_type_arguments,
8363 tav_null, parent_function_type_arguments,
8364 delayed_type_arguments, &got_index, got_result));
8365 EXPECT_EQ(expected_index, got_index);
8366 EXPECT(got_result->ptr() == expected_result.ptr());
8369 EXPECT(!
cache.HasCheck(instance_class_id_or_signature, destination_type,
8370 instance_type_arguments, instantiator_type_arguments,
8371 tav_null, parent_function_type_arguments,
8372 delayed_type_arguments,
8378 EXPECT(
cache.HasCheck(instance_class_id_or_signature, destination_type,
8379 instance_type_arguments, instantiator_type_arguments,
8380 function_type_arguments, tav_null,
8381 delayed_type_arguments, &got_index, got_result));
8382 EXPECT_EQ(expected_index, got_index);
8383 EXPECT(got_result->ptr() == expected_result.ptr());
8386 EXPECT(!
cache.HasCheck(instance_class_id_or_signature, destination_type,
8387 instance_type_arguments, instantiator_type_arguments,
8388 function_type_arguments, tav_null,
8389 delayed_type_arguments,
nullptr,
8395 EXPECT(
cache.HasCheck(instance_class_id_or_signature, destination_type,
8396 instance_type_arguments, instantiator_type_arguments,
8397 function_type_arguments,
8398 parent_function_type_arguments, tav_null, &got_index,
8400 EXPECT_EQ(expected_index, got_index);
8401 EXPECT(got_result->ptr() == expected_result.ptr());
8404 EXPECT(!
cache.HasCheck(instance_class_id_or_signature, destination_type,
8405 instance_type_arguments, instantiator_type_arguments,
8406 function_type_arguments,
8407 parent_function_type_arguments, tav_null,
8414 EXPECT(
cache.HasCheck(instance_class_id_or_signature, Object::void_type(),
8415 instance_type_arguments, instantiator_type_arguments,
8416 function_type_arguments,
8417 parent_function_type_arguments,
8418 delayed_type_arguments, &got_index, got_result));
8419 EXPECT_EQ(expected_index, got_index);
8420 EXPECT(got_result->ptr() == expected_result.ptr());
8423 EXPECT(!cache.HasCheck(instance_class_id_or_signature, Object::void_type(),
8424 instance_type_arguments, instantiator_type_arguments,
8425 function_type_arguments,
8426 parent_function_type_arguments,
8427 delayed_type_arguments,
8431 EXPECT(!was_hash || cache.IsHash());
8435 intptr_t num_classes,
8438 buffer.AddString(
"class D {}\n");
8439 buffer.AddString(
"D createInstanceD() => D();");
8440 buffer.AddString(
"D Function() createClosureD() => () => D();\n");
8441 for (intptr_t i = 0; i < num_classes; i++) {
8442 buffer.Printf(R
"(class C%)" Pd R"( extends D {}
8444 R"(C%)" Pd R"( createInstanceC%)" Pd R"(() => C%)" Pd
8447 R"(C%)" Pd R"( Function() createClosureC%)" Pd
8448 R"(() => () => C%)" Pd
8451 i, i, i, i, i, i, i);
8460 TransitionNativeToVM transition(thread);
8461 Zone*
const zone = thread->zone();
8463 const auto& root_lib =
8465 EXPECT(!root_lib.IsNull());
8468 ASSERT(!class_d.IsNull());
8470 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
8473 const auto& instance_d =
8474 Instance::CheckedHandle(zone,
Invoke(root_lib,
"createInstanceD"));
8475 auto& type_instance_d_int =
8476 Type::CheckedHandle(zone, instance_d.GetType(
Heap::kNew));
8477 const auto& closure_d =
8478 Instance::CheckedHandle(zone,
Invoke(root_lib,
"createClosureD"));
8479 ASSERT(!closure_d.IsNull());
8480 auto& type_closure_d_int =
8481 FunctionType::CheckedHandle(zone, closure_d.GetType(
Heap::kNew));
8494 auto& instance_type_arguments =
8497 instance_type_arguments = instance_type_arguments.Canonicalize(thread);
8498 auto& instantiator_type_arguments =
8501 instantiator_type_arguments =
8502 instantiator_type_arguments.Canonicalize(thread);
8503 auto& function_type_arguments =
8506 function_type_arguments = function_type_arguments.Canonicalize(thread);
8507 auto& parent_function_type_arguments =
8509 parent_function_type_arguments.SetTypeAt(
8511 parent_function_type_arguments =
8512 parent_function_type_arguments.Canonicalize(thread);
8513 auto& delayed_type_arguments =
8516 delayed_type_arguments = delayed_type_arguments.Canonicalize(thread);
8518 for (intptr_t i = 0; i < num_classes; ++i) {
8525 ASSERT(!class_c.IsNull());
8527 SafepointWriteRwLocker ml(thread,
8528 thread->isolate_group()->program_lock());
8531 auto const instance_name =
OS::SCreate(zone,
"createInstanceC%" Pd "", i);
8532 instance_c ^=
Invoke(root_lib, instance_name);
8533 EXPECT(!instance_c.IsClosure());
8534 instance_class_id_or_signature =
Smi::New(instance_c.GetClassId());
8536 for (intptr_t i = 0; i < 5; i++) {
8538 thread, *stcs[i], instance_class_id_or_signature, type_instance_d_int,
8539 instance_type_arguments, instantiator_type_arguments,
8540 function_type_arguments, parent_function_type_arguments,
8541 delayed_type_arguments, expected_result, &got_result);
8547 instance_class_id_or_signature = closure_c.function();
8548 instance_class_id_or_signature =
8549 Function::Cast(instance_class_id_or_signature).signature();
8553 thread, *stcs[i], instance_class_id_or_signature, type_closure_d_int,
8554 instance_type_arguments, instantiator_type_arguments,
8555 function_type_arguments, parent_function_type_arguments,
8556 delayed_type_arguments, expected_result, &got_result);
8561 EXPECT_EQ(expect_hash, stcs[i]->IsHash());
static void check_data(skiatest::Reporter *reporter, SkCachedData *data, int refcnt, CachedState cacheState, LockedState lockedState)
static void done(const char *config, const char *src, const char *srcOptions, const char *name)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static const size_t kBufferSize
#define RELEASE_ASSERT(cond)
static Dart_Handle NewHandle(Thread *thread, ObjectPtr raw)
static ObjectPtr UnwrapHandle(Dart_Handle object)
static ArrayPtr NewBoxed(intptr_t type_args_len, intptr_t num_arguments, const Array &optional_arguments_names, Heap::Space space=Heap::kOld)
static intptr_t InstanceSize()
static constexpr intptr_t kMaxElements
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
virtual bool CanonicalizeEquals(const Instance &other) const
void MakeImmutable() const
static constexpr bool UseCardMarkingForAllocation(const intptr_t array_length)
ObjectPtr At(intptr_t index) const
static ArrayPtr MakeFixedLength(const GrowableObjectArray &growable_array, bool unique=false)
void SetAt(intptr_t index, const Object &value) const
static ArrayPtr Grow(const Array &source, intptr_t new_length, Heap::Space space=Heap::kNew)
static const Bool & False()
static const Bool & True()
StringPtr target_name() const
ArrayPtr arguments_descriptor() const
static constexpr Register kReturnReg
static AbstractTypePtr FinalizeType(const AbstractType &type, FinalizationKind finalization=kCanonicalize)
static bool ProcessPendingClasses()
static void FinalizeTypesInClass(const Class &cls)
static void FinalizeClass(const Class &cls)
void set_is_implemented_unsafe() const
FunctionPtr InvocationDispatcherFunctionFromIndex(intptr_t idx) const
void SetFields(const Array &value) const
TypePtr super_type() const
FunctionPtr GetInvocationDispatcher(const String &target_name, const Array &args_desc, UntaggedFunction::Kind kind, bool create_if_absent) const
FunctionPtr LookupStaticFunction(const String &name) const
void set_interfaces(const Array &value) const
void set_is_declaration_loaded_unsafe() const
intptr_t implementor_cid() const
intptr_t host_instance_size() const
ErrorPtr EnsureIsFinalized(Thread *thread) const
void set_is_synthesized_class_unsafe() const
static ClassPtr New(IsolateGroup *isolate_group, bool register_class=true)
TokenPosition end_token_pos() const
FieldPtr LookupField(const String &name) const
void set_library(const Library &value) const
bool is_implemented() const
void SetFunctions(const Array &value) const
intptr_t FindInvocationDispatcherFunctionIndex(const Function &needle) const
ArrayPtr current_functions() const
static intptr_t FindClosureIndex(const Function &needle)
static void AddClosureFunctionLocked(const Function &function, bool allow_implicit_closure_functions=false)
static FunctionPtr ClosureFunctionFromIndex(intptr_t idx)
static ClosurePtr New(const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, const Function &function, const Object &context, Heap::Space space=Heap::kNew)
static void SetInstructions(const Code &code, const Instructions &instructions, uword unchecked_offset)
static CodePtr FinalizeCodeAndNotify(const Function &function, FlowGraphCompiler *compiler, compiler::Assembler *assembler, PoolAttachment pool_attachment, bool optimized=false, CodeStatistics *stats=nullptr)
static ErrorPtr EnsureUnoptimizedCode(Thread *thread, const Function &function)
static ObjectPtr CompileOptimizedFunction(Thread *thread, const Function &function, intptr_t osr_id=kNoOSRDeoptId)
static ConstMapPtr NewUninitialized(Heap::Space space=Heap::kNew)
static ConstSetPtr NewUninitialized(Heap::Space space=Heap::kNew)
static ContextPtr New(intptr_t num_variables, Heap::Space space=Heap::kNew)
void set_parent(const Context &parent) const
void SetAt(intptr_t context_index, const Object &value) const
ObjectPtr At(intptr_t context_index) const
intptr_t num_variables() const
ContextPtr parent() const
static ObjectPtr InvokeFunction(const Function &function, const Array &arguments)
static ThreadPool * thread_pool()
virtual bool OperatorEquals(const Instance &other) const
virtual bool CanonicalizeEquals(const Instance &other) const
static DoublePtr New(double d, Heap::Space space=Heap::kNew)
static DoublePtr NewCanonical(double d)
intptr_t OuterTryIndex(intptr_t try_index) const
bool HasCatchAll(intptr_t try_index) const
void GetHandlerInfo(intptr_t try_index, ExceptionHandlerInfo *info) const
uword HandlerPCOffset(intptr_t try_index) const
bool NeedsStackTrace(intptr_t try_index) const
void SetHandlerInfo(intptr_t try_index, intptr_t outer_try_index, uword handler_pc_offset, bool needs_stacktrace, bool has_catch_all, bool is_generated) const
intptr_t num_entries() const
static ExceptionHandlersPtr New(intptr_t num_handlers)
static ExternalTypedDataPtr New(intptr_t class_id, uint8_t *data, intptr_t len, Heap::Space space=Heap::kNew, bool perform_eager_msan_initialization_check=true)
static StringPtr NameFromSetter(const String &setter_name)
static bool IsGetterName(const String &function_name)
static bool IsSetterName(const String &function_name)
intptr_t HostOffset() const
static StringPtr GetterName(const String &field_name)
static StringPtr SetterName(const String &field_name)
static StringPtr NameFromGetter(const String &getter_name)
FinalizerEntryPtr next() const
static FinalizerEntryPtr New(const FinalizerBase &finalizer, Heap::Space space=Heap::kNew)
static FinalizerPtr New(Heap::Space space=Heap::kNew)
void set_result_type(const AbstractType &value) const
void set_num_fixed_parameters(intptr_t value) const
void SetNumOptionalParameters(intptr_t num_optional_parameters, bool are_optional_positional) const
static FunctionTypePtr New(intptr_t num_parent_type_arguments=0, Nullability nullability=Nullability::kLegacy, Heap::Space space=Heap::kOld)
bool CanBeInlined() const
static FunctionPtr New(const FunctionType &signature, const String &name, UntaggedFunction::Kind kind, bool is_static, bool is_const, bool is_abstract, bool is_external, bool is_native, const Object &owner, TokenPosition token_pos, Heap::Space space=Heap::kOld)
int32_t SourceFingerprint() const
void set_unoptimized_code(const Code &value) const
static FunctionPtr NewClosureFunction(const String &name, const Function &parent, TokenPosition token_pos)
TypeParameterPtr TypeParameterAt(intptr_t index, Nullability nullability=Nullability::kNonNullable) const
void Add(const Object &value, Heap::Space space=Heap::kNew) const
static GrowableObjectArrayPtr New(Heap::Space space=Heap::kNew)
ObjectPtr At(intptr_t index) const
void SetAt(intptr_t index, const Object &value) const
intptr_t Capacity() const
bool AllocatedExternal(intptr_t size, Space space)
intptr_t CapacityInWords(Space space) const
void AddReceiverCheck(intptr_t receiver_class_id, const Function &target, intptr_t count=1, StaticTypeExactnessState exactness=StaticTypeExactnessState::NotTracking()) const
intptr_t deopt_id() const
intptr_t NumberOfUsedChecks() const
void GetOneClassCheckAt(intptr_t index, intptr_t *class_id, Function *target) const
intptr_t NumArgsTested() const
static ICDataPtr NewForStaticCall(const Function &owner, const Function &target, const Array &arguments_descriptor, intptr_t deopt_id, intptr_t num_args_tested, RebindRule rebind_rule)
void AddCheck(const GrowableArray< intptr_t > &class_ids, const Function &target, intptr_t count=1) const
FunctionPtr GetTargetAt(intptr_t index) const
void GetCheckAt(intptr_t index, GrowableArray< intptr_t > *class_ids, Function *target) const
intptr_t GetCidAt(intptr_t index) const
intptr_t NumberOfChecks() const
FunctionPtr Owner() const
void SetCountAt(intptr_t index, intptr_t value) const
ObjectPtr GetField(const Field &field) const
bool IsIdenticalTo(const Instance &other) const
static intptr_t ElementSizeFor(intptr_t cid)
virtual bool OperatorEquals(const Instance &other) const
static InstancePtr New(const Class &cls, Heap::Space space=Heap::kNew)
static InstructionsPtr FromPayloadStart(uword payload_start)
uword PayloadStart() const
static IntegerPtr New(const String &str, Heap::Space space=Heap::kNew)
static IntegerPtr NewCanonical(const String &str)
virtual bool IsNegative() const
virtual bool IsZero() const
virtual bool Equals(const Instance &other) const
ObjectStore * object_store() const
static IsolateGroup * Current()
static Isolate * Current()
MessageHandler * message_handler() const
void set_finalizers(const GrowableObjectArray &value)
static LibraryPtr CoreLibrary()
void AddObject(const Object &obj, const String &name) const
ObjectPtr GetMetadata(const Object &declaration) const
void AddClass(const Class &cls) const
FunctionPtr LookupFunctionAllowPrivate(const String &name) const
static LibraryPtr AsyncLibrary()
ClassPtr LookupClass(const String &name) const
static LibraryPtr LookupLibrary(Thread *thread, const String &url)
FieldPtr LookupFieldAllowPrivate(const String &name) const
static const LinkedHashBase & Cast(const Object &obj)
int context_level() const
int NumCapturedVariables() const
int function_level() const
static LocalScope * RestoreOuterScope(const ContextScope &context_scope)
VariableIndex AllocateVariables(const Function &function, VariableIndex first_parameter_index, int num_parameters, VariableIndex first_local_index, LocalScope *context_owner, bool *found_captured_variables)
intptr_t num_variables() const
LocalVariable * LookupVariable(const String &name, intptr_t kernel_offset, bool test_only)
bool AddVariable(LocalVariable *variable)
ContextScopePtr PreserveOuterScope(const Function &function, intptr_t current_context_level) const
LocalVariable * LocalLookupVariable(const String &name, intptr_t kernel_offset) const
VariableIndex index() const
LocalScope * owner() const
static constexpr intptr_t kNoKernelOffset
static MapPtr NewDefault(intptr_t class_id=kMapCid, Heap::Space space=Heap::kNew)
virtual int CompareWith(const Integer &other) const
static constexpr int64_t kMinValue
ObjectPtr referent() const
void set_referent(const Object &referent) const
static MirrorReferencePtr New(const Object &referent, Heap::Space space=Heap::kNew)
static NativeFinalizerPtr New(Heap::Space space=Heap::kNew)
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static char * SCreate(Zone *zone, const char *format,...) PRINTF_ATTRIBUTE(2
virtual ~ObjectAccumulator()
virtual void VisitObject(ObjectPtr obj)
static ObjectPoolPtr NewFromBuilder(const compiler::ObjectPoolBuilder &builder)
intptr_t GetClassIdMayBeSmi() const
void PrintJSON(JSONStream *stream, bool ref=true) const
virtual const char * ToCString() const
static ObjectPtr RawCast(ObjectPtr obj)
static ClassPtr void_class()
static Object & ZoneHandle()
static ClassPtr dynamic_class()
static OneByteStringPtr New(intptr_t len, Heap::Space space)
static OneByteStringPtr null()
intptr_t YieldIndex() const
TokenPosition TokenPos() const
intptr_t TryIndex() const
UntaggedPcDescriptors::Kind Kind() const
static PointerPtr New(uword native_address, Heap::Space space=Heap::kNew)
static FunctionPtr ResolveDynamicFunction(Zone *zone, const Class &receiver_class, const String &function_name)
static FunctionPtr ResolveFunction(Zone *zone, const Class &receiver_class, const String &function_name)
static ScriptPtr New(const String &url, const String &source)
bool GetTokenLocation(const TokenPosition &token_pos, intptr_t *line, intptr_t *column=nullptr) const
static SetPtr NewDefault(intptr_t class_id=kSetCid, Heap::Space space=Heap::kNew)
static SmiPtr New(intptr_t value)
virtual bool Equals(const Instance &other) const
virtual int64_t AsInt64Value() const
virtual int CompareWith(const Integer &other) const
static bool IsValid(int64_t value)
virtual double AsDoubleValue() const
static StringPtr FromLatin1(const uint8_t *latin1_array, intptr_t array_len, Heap::Space space=Heap::kNew)
static StringPtr NewFormatted(const char *format,...) PRINTF_ATTRIBUTE(1
bool IsOneByteString() const
virtual ObjectPtr HashCode() const
static uword HashConcat(const String &str1, const String &str2)
static StringPtr ConcatAll(const Array &strings, Heap::Space space=Heap::kNew)
static const char * ScrubName(const String &name, bool is_extension=false)
bool Equals(const String &str) const
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
intptr_t CompareTo(const String &other) const
bool IsTwoByteString() const
uint16_t CharAt(intptr_t index) const
static StringPtr SubString(const String &str, intptr_t begin_index, Heap::Space space=Heap::kNew)
bool StartsWith(const String &other) const
static StringPtr EscapeSpecialCharacters(const String &str)
static StringPtr Concat(const String &str1, const String &str2, Heap::Space space=Heap::kNew)
static StringPtr DecodeIRI(const String &str)
static StringPtr FromUTF16(const uint16_t *utf16_array, intptr_t array_len, Heap::Space space=Heap::kNew)
bool EqualsLatin1(const uint8_t *characters, intptr_t len) const
static bool EqualsIgnoringPrivateKey(const String &str1, const String &str2)
static const char * EncodeIRI(const String &str)
static StringPtr FromUTF32(const int32_t *utf32_array, intptr_t array_len, Heap::Space space=Heap::kNew)
static StringPtr FromUTF8(const uint8_t *utf8_array, intptr_t array_len, Heap::Space space=Heap::kNew)
static SubtypeTestCachePtr New(intptr_t num_inputs)
static constexpr intptr_t kMaxInputs
@ kInstanceDelayedFunctionTypeArguments
@ kInstanceCidOrSignature
@ kInstanceParentFunctionTypeArguments
@ kInstantiatorTypeArguments
static constexpr intptr_t kMaxLinearCacheEntries
static StringPtr FromUTF16(Thread *thread, const uint16_t *utf16_array, intptr_t len)
static StringPtr FromConcatAll(Thread *thread, const GrowableHandlePtrArray< const String > &strs)
static const String & Empty()
static StringPtr New(Thread *thread, const char *cstr)
static const String & Dot()
static Dart_Handle LoadTestScript(const char *script, Dart_NativeEntryResolver resolver, const char *lib_uri=RESOLVED_USER_TEST_URI, bool finalize=true, bool allow_compile_errors=false)
static Dart_Handle ReloadTestScript(const char *script)
static const char * url()
static const char * NullableTag()
bool Run(Args &&... args)
static Thread * Current()
Isolate * isolate() const
IsolateGroup * isolate_group() const
static TokenPosition Deserialize(int32_t value)
static const TokenPosition kMinSource
static TwoByteStringPtr New(intptr_t len, Heap::Space space)
static constexpr intptr_t kMaxLinearCacheEntries
bool Equals(const TypeArguments &other) const
void SetTypeAt(intptr_t index, const AbstractType &value) const
TypeArgumentsPtr Canonicalize(Thread *thread) const
static TypeArgumentsPtr New(intptr_t len, Heap::Space space=Heap::kOld)
static TypePtr VoidType()
static TypePtr BoolType()
static TypePtr New(const Class &clazz, const TypeArguments &arguments, Nullability nullability=Nullability::kLegacy, Heap::Space space=Heap::kOld)
static TypePtr DynamicType()
static TypePtr StringType()
static TypePtr NewNonParameterizedType(const Class &type_class)
static TypedDataPtr Grow(const TypedData ¤t, intptr_t len, Heap::Space space=Heap::kNew)
static intptr_t MaxElements(intptr_t class_id)
static TypedDataPtr New(intptr_t class_id, intptr_t len, Heap::Space space=Heap::kNew)
static intptr_t InstanceSize()
static ObjectPtr FromAddr(uword addr)
static uword ToAddr(const UntaggedObject *raw_obj)
static int SNPrint(char *str, size_t size, const char *format,...) PRINTF_ATTRIBUTE(3
std::unique_ptr< char, decltype(std::free) * > CStringUniquePtr
static constexpr T RoundUp(T x, uintptr_t alignment, uintptr_t offset=0)
void SetAt(intptr_t index, const Object &value) const
ObjectPtr At(intptr_t index) const
static WeakArrayPtr New(intptr_t length, Heap::Space space=Heap::kNew)
static WeakPropertyPtr New(Heap::Space space=Heap::kNew)
void set_key(const Object &key) const
void set_value(const Object &value) const
static WeakReferencePtr New(Heap::Space space=Heap::kNew)
static void SetNativeResolver(BuiltinLibraryId id)
static void SetNativeResolver()
#define THR_Print(format,...)
struct _Dart_Handle * Dart_Handle
struct _Dart_Isolate * Dart_Isolate
struct _Dart_NativeArguments * Dart_NativeArguments
void(* Dart_NativeFunction)(Dart_NativeArguments arguments)
#define FAIL(name, result)
EMSCRIPTEN_KEEPALIVE void empty()
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
static const char * expected_value
static const uint8_t buffer[]
const uint8_t uint32_t uint32_t GError ** error
#define DECLARE_FLAG(type, name)
Dart_NativeFunction function
#define HANDLESCOPE(thread)
constexpr int64_t kMaxInt64
const int kNumTypedDataCidRemainders
static bool Equals(const Object &expected, const Object &actual)
static const ClassId kLastTypedDataCid
static CodePtr CreateInvokeInstantiateTypeArgumentsStub(Thread *thread)
static void GenerateInvokeInstantiateTAVStub(compiler::Assembler *assembler)
bool IsTypedDataClassId(intptr_t index)
void ElideJSONSubstring(const char *prefix, const char *in, char *out, const char *postfix)
static MapPtr ConstructImmutableMap(const Array &input_data, intptr_t used_data, const TypeArguments &type_arguments)
static void WeakReference_Preserve_ReachableThroughWeakProperty(Thread *thread, Heap::Space space)
static void Finalizer_GcFinalizer(Thread *thread, Heap::Space space)
static void SubtypeTestCacheEntryTest(Thread *thread, const SubtypeTestCache &cache, const Object &instance_class_id_or_signature, const AbstractType &destination_type, const TypeArguments &instance_type_arguments, const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, const TypeArguments &parent_function_type_arguments, const TypeArguments &delayed_type_arguments, const Bool &expected_result, Bool *got_result)
void SetBreakpoint(Dart_NativeArguments args)
DART_EXPORT void Dart_EnterScope()
static void CheckSubtypeRelation(const Expect &expect, const AbstractType &sub, const AbstractType &super, bool is_subtype)
static void ExpectTypesEquivalent(const Expect &expect, const AbstractType &expected, const AbstractType &got, TypeEquality kind)
bool IsConcreteTypeClassId(intptr_t index)
const intptr_t kFinalizerTwoEntriesNumObjects
DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate)
static void Finalizer_ClearDetachOne(Thread *thread, Heap::Space space)
DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, Dart_Handle name, int number_of_arguments, Dart_Handle *arguments)
static void HashMapNonConstEqualsConst(const char *script, bool check_data=true)
static Dart_WeakPersistentHandle weak1
static void TestIllegalTypedDataLength(const char *class_name, intptr_t length)
static void Finalizer_ClearValueOne(Thread *thread, Heap::Space space, bool null_token)
static void Finalizer_PreserveOne(Thread *thread, Heap::Space space, bool with_detach)
static FieldPtr GetField(const Class &cls, const char *name)
static void FinalizeAndCanonicalize(AbstractType *type)
static void PrintMetadata(const char *name, const Object &data)
const char *const class_name
Dart_Handle Dart_RemoveBreakpoint(Dart_Handle breakpoint_id_in)
DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value)
static void Finalizer_TwoEntriesCrossGen(Thread *thread, Heap::Space *spaces, bool collect_old_space, bool collect_new_space, bool evacuate_new_space_and_collect_old_space, bool clear_value_1, bool clear_value_2, bool clear_detach_1, bool clear_detach_2)
constexpr uint64_t kMaxUint64
ObjectPtr Invoke(const Library &lib, const char *name)
constexpr intptr_t kWordSizeLog2
FunctionPtr GetFunction(const Library &lib, const char *name)
static bool HashCodeEqualsCanonicalizeHash(const char *value_script, uint32_t hashcode_canonicalize_vm=kCalculateCanonicalizeHash, bool check_identity=true, bool check_hashcode=true)
static FunctionPtr GetDummyTarget(const char *name)
static void CheckConcatAll(const String *data[], intptr_t n)
bool EqualsIgnoringPrivate(const String &name, const String &private_name)
DART_EXPORT Dart_Isolate Dart_CurrentIsolate()
static void TypeArgumentsHashCacheTest(Thread *thread, intptr_t num_classes)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
static void SubtypeTestCacheTest(Thread *thread, intptr_t num_classes, bool expect_hash)
static void SubtypeTestCacheCheckContents(Zone *zone, const SubtypeTestCache &cache)
AsThreadStackResource< RawReloadParticipationScope > ReloadParticipationScope
static ClassPtr CreateDummyClass(const String &class_name, const Script &script)
static const ClassId kFirstTypedDataCid
static constexpr int kCallerSpSlotFromFp
DART_EXPORT Dart_Isolate Dart_CreateIsolateInGroup(Dart_Isolate group_member, const char *name, Dart_IsolateShutdownCallback shutdown_callback, Dart_IsolateCleanupCallback cleanup_callback, void *child_isolate_data, char **error)
DART_EXPORT bool Dart_RunLoopAsync(bool errors_are_fatal, Dart_Port on_error_port, Dart_Port on_exit_port, char **error)
static void HashSetNonConstEqualsConst(const char *script, bool check_data=true)
@ kCurrentAndEnclosingFree
DART_EXPORT Dart_Handle Dart_SetNativeResolver(Dart_Handle library, Dart_NativeEntryResolver resolver, Dart_NativeEntrySymbol symbol)
DART_EXPORT void Dart_ExitIsolate()
ClassPtr GetClass(const Library &lib, const char *name)
const uint32_t kCalculateCanonicalizeHash
static void WeakReference_PreserveOne(Thread *thread, Heap::Space space)
static constexpr intptr_t kCompressedWordSize
Dart_Handle NewString(const char *str)
static void WeakReference_ClearOne(Thread *thread, Heap::Space space)
static void NativeFinalizer_TwoEntriesCrossGen(Thread *thread, Heap::Space *spaces, bool collect_new_space, bool evacuate_new_space_and_collect_old_space, bool clear_value_1, bool clear_value_2, bool clear_detach_1, bool clear_detach_2)
static bool IsLinkedHashBase(const Object &object)
static uint32_t Hash(uint32_t key)
bool TESTING_runtime_fail_on_existing_cache_entry
DART_EXPORT void Dart_ExitScope()
constexpr int32_t kMaxInt32
static LibraryPtr CreateDummyLibrary(const String &library_name)
DART_EXPORT Dart_Handle Dart_ListLength(Dart_Handle list, intptr_t *len)
static FieldPtr CreateTestField(const char *name)
constexpr intptr_t kWordSize
static SetPtr ConstructImmutableSet(const Array &input_data, intptr_t used_data, const TypeArguments &type_arguments)
static constexpr intptr_t kObjectAlignment
static FunctionPtr CreateFunction(const char *name)
static ClassPtr CreateTestClass(const char *name)
static void HashBaseNonConstEqualsConst(const char *script, bool check_data=true)
static void Finalizer_DetachOne(Thread *thread, Heap::Space space, bool clear_value)
const char *const function_name
static int8_t data[kExtLength]
DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle object, const char **cstr)
static void TestIllegalArrayLength(intptr_t length)
static FunctionPtr GetStaticFunction(const Class &cls, const char *name)
Dart_Handle Dart_SetBreakpoint(Dart_Handle script_url_in, intptr_t line_number)
void StripTokenPositions(char *buffer)
static void Finalizer_TwoEntries(Thread *thread, Heap::Space space, bool clear_value_1, bool clear_value_2, bool clear_detach_1, bool clear_detach_2)
static bool LinkedHashBaseEqual(const LinkedHashBase &map1, const LinkedHashBase &map2, bool print_diff, bool check_data=true)
static int NumEntries(const FinalizerEntry &entry, intptr_t acc=0)
void NativeFinalizer_TwoEntriesCrossGen_Finalizer(void *peer)
static Dart_WeakPersistentHandle weak2
static Dart_NativeFunction SetBreakpointResolver(Dart_Handle name, int argument_count, bool *auto_setup_scope)
static void WeakReference_Clear_ReachableThroughWeakProperty(Thread *thread, Heap::Space space)
static TypePtr CreateFutureOrType(const AbstractType ¶m, Nullability nullability)
static TypePtr CreateFutureType(const AbstractType ¶m, Nullability nullability)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent cache
SI auto map(std::index_sequence< I... >, Fn &&fn, const Args &... args) -> skvx::Vec< sizeof...(I), decltype(fn(args[0]...))>
#define EXPECT_SUBTYPE(sub, super)
#define USED_INPUT_CASE(Input, ExpectedCids)
#define EXPECT_TYPES_EQUAL(expected, got)
#define FINALIZER_CROSS_GEN_TEST_CASE(n)
#define EXPECT_NOT_SUBTYPE(sub, super)
#define EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(expected, got)
#define FINALIZER_NATIVE_CROSS_GEN_TEST_CASE(n)
static constexpr Register kInstantiatorTypeArgumentsReg
static constexpr Register kUninstantiatedTypeArgumentsReg
static constexpr Register kResultTypeArgumentsReg
static constexpr Register kFunctionTypeArgumentsReg
#define EXPECT_ERROR(handle, substring)
#define EXPECT_NULL(handle)
#define EXPECT_TRUE(handle)
#define ISOLATE_UNIT_TEST_CASE(name)
#define ISOLATE_UNIT_TEST_CASE_WITH_EXPECTATION(name, expectation)
#define EXPECT_VALID(handle)
#define ARRAY_SIZE(array)