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();
190 const auto& instances =
196 for (intptr_t
i = 0;
i < (1 << 16); ++
i) {
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,
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);
256 instance2 ^=
instance.GetField(field);
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";
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'};
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) {
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'};
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'};
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++) {
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));)
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++) {
2102 intptr_t used_size = 0;
2105 EXPECT_EQ(kArrayLen + 1, array.
Capacity());
2106 EXPECT_EQ(0, array.
Length());
2107 for (intptr_t
i = 0;
i < 2;
i++) {
2116 new_array ^= obj.
ptr();
2117 EXPECT_EQ(2, new_array.
Length());
2126 EXPECT_EQ(kArrayLen, array.
Capacity());
2127 EXPECT_EQ(0, array.
Length());
2128 for (intptr_t
i = 0;
i < 3;
i++) {
2137 new_array ^= obj.
ptr();
2138 EXPECT_EQ(3, new_array.
Length());
2147 EXPECT_EQ((kArrayLen + 3), array.
Capacity());
2148 EXPECT_EQ(0, array.
Length());
2149 for (intptr_t
i = 0;
i < 1;
i++) {
2158 new_array ^= obj.
ptr();
2159 EXPECT_EQ(1, new_array.
Length());
2168 EXPECT_EQ(0, array.
Length());
2169 for (intptr_t
i = 0;
i < 1;
i++) {
2175 GCTestHelper::WaitForGCTasks();
2178 EXPECT_EQ(1, new_array.
Length());
2180 GCTestHelper::WaitForGCTasks();
2183 EXPECT_LT(capacity_after, capacity_before);
2184 EXPECT_EQ(1, new_array.
Length());
2188 const intptr_t kSmallSize = 42;
2189 const intptr_t kLargeSize = 1000;
2198 EXPECT_EQ(small.LengthInBytes(), kSmallSize * small.ElementSizeInBytes());
2201 small.SetUint8(
i,
static_cast<uint8_t
>(random.
NextUInt64() & 0xff));
2205 EXPECT_EQ(small.GetClassId(), big.GetClassId());
2206 EXPECT_EQ(big.LengthInBytes(), kLargeSize * big.ElementSizeInBytes());
2209 EXPECT_EQ(small.GetUint8(
i), big.GetUint8(
i));
2213 EXPECT_EQ(0, big.GetUint8(
i));
2219 uint8_t
data[] = {253, 254, 255, 0, 1, 2, 3, 4};
2225 EXPECT_EQ(data_length, int8_array.
Length());
2226 for (intptr_t
i = 0;
i < data_length; ++
i) {
2227 int8_array.SetInt8(
i,
data[
i]);
2230 EXPECT_EQ(-3, int8_array.GetInt8(0));
2231 EXPECT_EQ(253, int8_array.GetUint8(0));
2233 EXPECT_EQ(-2, int8_array.GetInt8(1));
2234 EXPECT_EQ(254, int8_array.GetUint8(1));
2236 EXPECT_EQ(-1, int8_array.GetInt8(2));
2237 EXPECT_EQ(255, int8_array.GetUint8(2));
2239 EXPECT_EQ(0, int8_array.GetInt8(3));
2240 EXPECT_EQ(0, int8_array.GetUint8(3));
2242 EXPECT_EQ(1, int8_array.GetInt8(4));
2243 EXPECT_EQ(1, int8_array.GetUint8(4));
2245 EXPECT_EQ(2, int8_array.GetInt8(5));
2246 EXPECT_EQ(2, int8_array.GetUint8(5));
2248 EXPECT_EQ(3, int8_array.GetInt8(6));
2249 EXPECT_EQ(3, int8_array.GetUint8(6));
2251 EXPECT_EQ(4, int8_array.GetInt8(7));
2252 EXPECT_EQ(4, int8_array.GetUint8(7));
2257 EXPECT_EQ(data_length, int8_array.
Length());
2258 for (intptr_t
i = 0;
i < data_length; ++
i) {
2259 int8_array2.SetInt8(
i,
data[
i]);
2262 for (intptr_t
i = 0;
i < data_length; ++
i) {
2263 EXPECT_EQ(int8_array.GetInt8(
i), int8_array2.GetInt8(
i));
2265 for (intptr_t
i = 0;
i < data_length; ++
i) {
2266 int8_array.SetInt8(
i, 123 +
i);
2268 for (intptr_t
i = 0;
i < data_length; ++
i) {
2269 EXPECT(int8_array.GetInt8(
i) != int8_array2.GetInt8(
i));
2274 uint8_t
data[] = {253, 254, 255, 0, 1, 2, 3, 4};
2279 kExternalTypedDataInt8ArrayCid,
data, data_length));
2281 EXPECT_EQ(data_length, int8_array.
Length());
2285 kExternalTypedDataUint8ArrayCid,
data, data_length));
2287 EXPECT_EQ(data_length, uint8_array.
Length());
2291 kExternalTypedDataUint8ClampedArrayCid,
data, data_length));
2293 EXPECT_EQ(data_length, uint8_clamped_array.
Length());
2295 EXPECT_EQ(-3, int8_array.GetInt8(0));
2296 EXPECT_EQ(253, uint8_array.GetUint8(0));
2297 EXPECT_EQ(253, uint8_clamped_array.GetUint8(0));
2299 EXPECT_EQ(-2, int8_array.GetInt8(1));
2300 EXPECT_EQ(254, uint8_array.GetUint8(1));
2301 EXPECT_EQ(254, uint8_clamped_array.GetUint8(1));
2303 EXPECT_EQ(-1, int8_array.GetInt8(2));
2304 EXPECT_EQ(255, uint8_array.GetUint8(2));
2305 EXPECT_EQ(255, uint8_clamped_array.GetUint8(2));
2307 EXPECT_EQ(0, int8_array.GetInt8(3));
2308 EXPECT_EQ(0, uint8_array.GetUint8(3));
2309 EXPECT_EQ(0, uint8_clamped_array.GetUint8(3));
2311 EXPECT_EQ(1, int8_array.GetInt8(4));
2312 EXPECT_EQ(1, uint8_array.GetUint8(4));
2313 EXPECT_EQ(1, uint8_clamped_array.GetUint8(4));
2315 EXPECT_EQ(2, int8_array.GetInt8(5));
2316 EXPECT_EQ(2, uint8_array.GetUint8(5));
2317 EXPECT_EQ(2, uint8_clamped_array.GetUint8(5));
2319 for (intptr_t
i = 0;
i < int8_array.
Length(); ++
i) {
2320 EXPECT_EQ(int8_array.GetUint8(
i), uint8_array.GetUint8(
i));
2323 int8_array.SetInt8(2, -123);
2324 uint8_array.SetUint8(0, 123);
2325 for (intptr_t
i = 0;
i < int8_array.
Length(); ++
i) {
2326 EXPECT_EQ(int8_array.GetInt8(
i), uint8_array.GetInt8(
i));
2329 uint8_clamped_array.SetUint8(0, 123);
2330 for (intptr_t
i = 0;
i < int8_array.
Length(); ++
i) {
2331 EXPECT_EQ(int8_array.GetUint8(
i), uint8_clamped_array.GetUint8(
i));
2337 const char* url_chars =
"builtin:test-case";
2338 const char* source_chars =
"This will not compile.";
2345 EXPECT_EQ(17, str.
Length());
2346 EXPECT_EQ(
'b', str.
CharAt(0));
2347 EXPECT_EQ(
':', str.
CharAt(7));
2348 EXPECT_EQ(
'e', str.
CharAt(16));
2350 EXPECT_EQ(22, str.
Length());
2351 EXPECT_EQ(
'T', str.
CharAt(0));
2352 EXPECT_EQ(
'n', str.
CharAt(10));
2353 EXPECT_EQ(
'.', str.
CharAt(21));
2357 const char* url_chars =
"";
2359 const char* source_chars =
"abc";
2367 EXPECT_STREQ(
"abc", str.ToCString());
2368 str =
script.GetSnippet(1, 1, 1, 2);
2369 EXPECT_STREQ(
"a", str.ToCString());
2370 str =
script.GetSnippet(1, 2, 1, 4);
2371 EXPECT_STREQ(
"bc", str.ToCString());
2373 str =
script.GetLine(-500);
2374 EXPECT_STREQ(
"", str.ToCString());
2376 EXPECT_STREQ(
"", str.ToCString());
2378 EXPECT_STREQ(
"", str.ToCString());
2379 str =
script.GetLine(10000);
2380 EXPECT_STREQ(
"", str.ToCString());
2382 str =
script.GetSnippet(-1, 1, 1, 2);
2384 str =
script.GetSnippet(2, 1, 2, 2);
2386 str =
script.GetSnippet(1, 1, 1, 5);
2391 const char* kScript =
"main() {}";
2399 const int kNumVariables = 5;
2409 variable = context.
At(kNumVariables - 1);
2414 smi ^= context.
At(0);
2415 EXPECT_EQ(2, smi.
Value());
2416 smi ^= context.
At(2);
2417 EXPECT_EQ(3, smi.
Value());
2426 const intptr_t parent_scope_function_level = 0;
2428 new LocalScope(
nullptr, parent_scope_function_level, 0);
2430 const intptr_t local_scope_function_level = 1;
2432 new LocalScope(parent_scope, local_scope_function_level, 0);
2435 const String& ta = Symbols::FunctionTypeArgumentsVar();
2437 TokenPosition::kNoSource, TokenPosition::kNoSource, ta, dynamic_type);
2442 TokenPosition::kNoSource, TokenPosition::kNoSource,
a, dynamic_type);
2447 TokenPosition::kNoSource, TokenPosition::kNoSource,
b, dynamic_type);
2452 TokenPosition::kNoSource, TokenPosition::kNoSource, c, dynamic_type);
2455 bool test_only =
false;
2495 const int num_parameters = 0;
2497 bool found_captured_vars =
false;
2499 Function::null_function(), first_parameter_index, num_parameters,
2500 first_local_index,
nullptr, &found_captured_vars);
2503 EXPECT_EQ(0, next_index.
value() -
2504 first_local_index.
value());
2505 const intptr_t parent_scope_context_level = 1;
2506 EXPECT_EQ(parent_scope_context_level, parent_scope->
context_level());
2507 EXPECT(found_captured_vars);
2509 const intptr_t local_scope_context_level = 5;
2512 Function::null_function(), local_scope_context_level));
2519 EXPECT_EQ(parent_scope_context_level - local_scope_context_level,
2525 EXPECT_EQ(parent_scope_context_level - local_scope_context_level,
2535 EXPECT_EQ(parent_scope_context_level - local_scope_context_level,
2551 UntaggedFunction::kRegularFunction,
false,
false,
2553 functions.
SetAt(0, parent);
2569 Closure::New(Object::null_type_arguments(), Object::null_type_arguments(),
2572 EXPECT_EQ(closure_class.
id(), kClosureCid);
2574 EXPECT_EQ(closure_function.
ptr(),
function.ptr());
2576 EXPECT_EQ(closure_context.
ptr(), context.
ptr());
2587 EXPECT_STREQ(
"Library:'dart:core' Class: bool", bool_class.
ToCString());
2588 EXPECT_STREQ(
"true",
Bool::True().ToCString());
2592 EXPECT_STREQ(
"Sugarbowl",
2619 return Library::New(library_name);
2627 const Class& owner_class =
2634 UntaggedFunction::kRegularFunction,
true,
false,
false,
2643 GenerateIncrement(&_assembler_);
2646 thread->isolate_group()->program_lock());
2664 GenerateIncrement(&_assembler_);
2667 thread->isolate_group()->program_lock());
2675 *(
reinterpret_cast<char*
>(payload_start) + 1) = 1;
2676 if (!FLAG_write_protect_code) {
2679 FATAL(
"Test requires --write-protect-code; skip by forcing expected crash");
2687 uword unchecked_offset) {
2688 code.SetActiveInstructions(instructions, unchecked_offset);
2689 code.set_instructions(instructions);
2697 const char* kHello =
"Hello World!";
2698 word expected_length =
static_cast<word>(strlen(kHello));
2701 GenerateEmbedStringInCode(&_assembler_, kHello);
2705 thread->isolate_group()->program_lock());
2713 string_object ^=
result.ptr();
2715 for (
int i = 0;
i < expected_length;
i++) {
2724 const intptr_t kSmiTestValue = 5;
2727 GenerateEmbedSmiInCode(&_assembler_, kSmiTestValue);
2731 thread->isolate_group()->program_lock());
2740#if defined(ARCH_IS_64_BIT) && !defined(DART_COMPRESSED_POINTERS)
2743 extern void GenerateEmbedSmiInCode(compiler::Assembler * assembler,
2746 compiler::ObjectPoolBuilder object_pool_builder;
2747 compiler::Assembler _assembler_(&object_pool_builder);
2748 GenerateEmbedSmiInCode(&_assembler_, kSmiTestValue);
2751 SafepointWriteRwLocker locker(thread,
2752 thread->isolate_group()->program_lock());
2763 const int kNumEntries = 4;
2767 const bool kNeedsStackTrace =
true;
2768 const bool kNoStackTrace =
false;
2769 exception_handlers.
SetHandlerInfo(0, -1, 20u, kNeedsStackTrace,
false,
true);
2770 exception_handlers.
SetHandlerInfo(1, 0, 30u, kNeedsStackTrace,
false,
true);
2771 exception_handlers.
SetHandlerInfo(2, -1, 40u, kNoStackTrace,
true,
true);
2772 exception_handlers.
SetHandlerInfo(3, 1, 150u, kNoStackTrace,
true,
true);
2777 GenerateIncrement(&_assembler_);
2779 thread->isolate_group()->program_lock());
2783 code.set_exception_handlers(exception_handlers);
2792 EXPECT_EQ(-1,
info.outer_try_index);
2796 EXPECT_EQ(20u,
info.handler_pc_offset);
2807 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 10, 1,
2809 builder->AddDescriptor(UntaggedPcDescriptors::kDeopt, 20, 2,
2811 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 30, 3,
2813 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 10, 4,
2815 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 10, 5,
2817 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 80, 6,
2821 descriptors ^=
builder->FinalizePcDescriptors(0);
2826 GenerateIncrement(&_assembler_);
2828 thread->isolate_group()->program_lock());
2832 code.set_pc_descriptors(descriptors);
2844 EXPECT_EQ(UntaggedPcDescriptors::kOther, iter.
Kind());
2849 EXPECT_EQ(UntaggedPcDescriptors::kDeopt, iter.
Kind());
2870 EXPECT_EQ(UntaggedPcDescriptors::kOther, iter.
Kind());
2879 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 100, 1,
2881 builder->AddDescriptor(UntaggedPcDescriptors::kDeopt, 200, 2,
2883 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 300, 3,
2885 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 100, 4,
2887 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 100, 5,
2889 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 800, 6,
2893 descriptors ^=
builder->FinalizePcDescriptors(0);
2898 GenerateIncrement(&_assembler_);
2900 thread->isolate_group()->program_lock());
2904 code.set_pc_descriptors(descriptors);
2916 EXPECT_EQ(UntaggedPcDescriptors::kOther, iter.
Kind());
2921 EXPECT_EQ(UntaggedPcDescriptors::kDeopt, iter.
Kind());
2942 EXPECT_EQ(UntaggedPcDescriptors::kOther, iter.
Kind());
2960 field_name,
true,
false,
false,
true,
false, cls, Object::dynamic_type(),
2964 thread->isolate_group()->program_lock());
2965 thread->isolate_group()->RegisterStaticField(field, Object::sentinel());
2997 const bool is_static =
false;
2998 const bool is_const =
false;
2999 const bool is_abstract =
false;
3000 const bool is_external =
false;
3001 const bool is_native =
false;
3004 UntaggedFunction::kRegularFunction, is_static, is_const,
3005 is_abstract, is_external, is_native, cls,
3011 const intptr_t
id = 12;
3012 const intptr_t num_args_tested = 1;
3014 const intptr_t kTypeArgsLen = 0;
3015 const intptr_t kNumArgs = 1;
3017 kTypeArgsLen, kNumArgs, Object::null_array()));
3019 o1 = ICData::New(
function, target_name, args_descriptor,
id, num_args_tested,
3032 intptr_t test_class_id = -1;
3035 EXPECT_EQ(kSmiCid, test_class_id);
3036 EXPECT_EQ(target1.
ptr(), test_target.
ptr());
3037 EXPECT_EQ(kSmiCid, o1.
GetCidAt(0));
3039 o1.
GetCheckAt(0, &test_class_ids, &test_target);
3040 EXPECT_EQ(1, test_class_ids.
length());
3041 EXPECT_EQ(kSmiCid, test_class_ids[0]);
3042 EXPECT_EQ(target1.
ptr(), test_target.
ptr());
3049 EXPECT_EQ(kDoubleCid, test_class_id);
3050 EXPECT_EQ(target2.
ptr(), test_target.
ptr());
3051 EXPECT_EQ(kDoubleCid, o1.
GetCidAt(1));
3059 o2 = ICData::New(
function, target_name, args_descriptor, 57, 2,
3066 classes.
Add(kSmiCid);
3067 classes.
Add(kSmiCid);
3070 o2.
GetCheckAt(0, &test_class_ids, &test_target);
3071 EXPECT_EQ(2, test_class_ids.
length());
3072 EXPECT_EQ(kSmiCid, test_class_ids[0]);
3073 EXPECT_EQ(kSmiCid, test_class_ids[1]);
3074 EXPECT_EQ(target1.
ptr(), test_target.
ptr());
3077 const intptr_t kNumArgsChecked = 0;
3080 kNumArgsChecked, ICData::kInstance));
3089 const Class& empty_class1 =
3092 const Class& empty_class2 =
3097 EXPECT_EQ(0,
cache.NumberOfChecks());
3106 cache.AddCheck(class_id_or_fun, dest_type, targ_0, targ_1, targ_2, targ_3,
3108 EXPECT_EQ(1,
cache.NumberOfChecks());
3117 cache.GetCheck(0, &test_class_id_or_fun, &test_dest_type, &test_targ_0,
3118 &test_targ_1, &test_targ_2, &test_targ_3, &test_targ_4,
3120 EXPECT_EQ(class_id_or_fun.
ptr(), test_class_id_or_fun.
ptr());
3121 EXPECT_EQ(dest_type.
ptr(), test_dest_type.
ptr());
3122 EXPECT_EQ(targ_0.
ptr(), test_targ_0.
ptr());
3123 EXPECT_EQ(targ_1.
ptr(), test_targ_1.
ptr());
3124 EXPECT_EQ(targ_2.
ptr(), test_targ_2.
ptr());
3125 EXPECT_EQ(targ_3.
ptr(), test_targ_3.
ptr());
3126 EXPECT_EQ(targ_4.
ptr(), test_targ_4.
ptr());
3132 const auto& args_descriptor =
3147 cache.EnsureContains(cidA, valueA);
3151 cache.EnsureContains(cidB, valueB);
3162 for (intptr_t
i = 0;
i < 100; ++
i) {
3170 for (intptr_t
i = 0;
i < 100; ++
i) {
3191 EXPECT_STREQ(
f.ToCString(),
3193 EXPECT_STREQ(
f.ToCString(),
3320 const char* kScriptChars =
3322 " throw 'MyException';\n"
3325 "class _OtherClass {\n"
3326 " _OtherClass._named() {\n"
3331 "set globalVar(var value) {\n"
3332 " new _OtherClass._named();\n"
3336 " globalVar = null;\n"
3341 " (() => foo())();\n"
3344 " static get field {\n"
3357 " (() => new MyClass())();\n"
3363 const char* lib_url =
"file:///test-lib";
3367 "Unhandled exception:\n"
3369 "#0 baz (%1$s:2:3)\n"
3370 "#1 new _OtherClass._named (%1$s:7:5)\n"
3371 "#2 globalVar= (%1$s:12:7)\n"
3372 "#3 _bar (%1$s:16:3)\n"
3373 "#4 MyClass.field (%1$s:25:5)\n"
3374 "#5 MyClass.foo.fooHelper (%1$s:30:7)\n"
3375 "#6 MyClass.foo (%1$s:32:5)\n"
3376 "#7 new MyClass.<anonymous closure> (%1$s:21:12)\n"
3377 "#8 new MyClass (%1$s:21:18)\n"
3378 "#9 main.<anonymous closure> (%1$s:37:14)\n"
3379 "#10 main (%1$s:37:24)",
3418 GCTestHelper::CollectNewSpace();
3435 weak1.set_key(key1);
3436 weak1.set_value(value1);
3440 weak2.set_key(key2);
3441 weak2.set_value(value2);
3443 GCTestHelper::CollectNewSpace();
3461 weak1.set_value(value1);
3466 weak2.set_value(value2);
3468 GCTestHelper::CollectNewSpace();
3504 weak1.set_key(key1);
3505 weak1.set_value(value1);
3509 weak2.set_key(key2);
3510 weak2.set_value(value2);
3530 weak1.set_value(value1);
3535 weak2.set_value(value2);
3558 GCTestHelper::CollectNewSpace();
3574 weak1.set_value(value1);
3579 weak2.set_value(value2);
3581 GCTestHelper::CollectNewSpace();
3618 weak1.set_value(value1);
3623 weak2.set_value(value2);
3638 const auto& type_arguments =
3642 weak.SetTypeArguments(type_arguments);
3646 GCTestHelper::CollectNewSpace();
3669 const auto& type_arguments =
3673 weak.SetTypeArguments(type_arguments);
3677 GCTestHelper::CollectNewSpace();
3702 const auto& type_arguments =
3704 const auto& weak_reference =
3707 weak_reference.set_target(
target);
3708 weak_reference.SetTypeArguments(type_arguments);
3711 weak_property.set_key(
key);
3712 weak_property.set_value(weak_reference);
3716 GCTestHelper::CollectNewSpace();
3721 const auto& weak_reference =
3722 WeakReference::CheckedHandle(
Z, weak_property.value());
3728 WeakReference_Clear_ReachableThroughWeakProperty_NewSpace) {
3733 WeakReference_Clear_ReachableThroughWeakProperty_OldSpace) {
3746 const auto& type_arguments =
3748 const auto& weak_reference =
3750 weak_reference.set_target(
target);
3751 weak_reference.SetTypeArguments(type_arguments);
3754 weak_property.set_key(
key);
3755 weak_property.set_value(weak_reference);
3759 GCTestHelper::CollectNewSpace();
3764 const auto& weak_reference =
3765 WeakReference::CheckedHandle(
Z, weak_property.value());
3771 WeakReference_Preserve_ReachableThroughWeakProperty_NewSpace) {
3776 WeakReference_Preserve_ReachableThroughWeakProperty_OldSpace) {
3787 array.
SetAt(0, target0);
3788 array.
SetAt(1, target1);
3795 GCTestHelper::CollectNewSpace();
3809 array.
SetAt(0, target0);
3810 array.
SetAt(1, target1);
3845 finalizer.set_isolate(thread->
isolate());
3849 entry.set_value(
value);
3856 entry.set_detach(detach);
3858 entry.set_token(token);
3861 GCTestHelper::CollectNewSpace();
3911 finalizer.set_isolate(thread->
isolate());
3915 entry.set_value(
value);
3917 entry.set_token(token);
3922 entry.set_detach(detach);
3926 GCTestHelper::CollectNewSpace();
3970 finalizer.set_isolate(thread->
isolate());
3981 entry.set_token(token);
3982 entry.set_detach(detach);
3987 entry.set_value(
value);
3991 GCTestHelper::CollectNewSpace();
4042 finalizer.set_isolate(thread->
isolate());
4046 entry.set_detach(detach);
4049 entry.set_token(entry);
4056 entry.set_value(
object);
4058 value =
object.ptr();
4063 GCTestHelper::CollectNewSpace();
4070 EXPECT_EQ(entry.ptr(), entry.token());
4117 finalizer.set_isolate(thread->
isolate());
4120 entry.set_detach(detach);
4121 entry.set_token(token);
4123 entry.set_value(
value);
4127 GCTestHelper::CollectNewSpace();
4151 bool collect_old_space,
4152 bool collect_new_space,
4153 bool evacuate_new_space_and_collect_old_space,
4156 bool clear_detach_1,
4157 bool clear_detach_2) {
4165 intptr_t queue_length_start = 0;
4172 finalizer.set_isolate(thread->
isolate());
4173 const auto& entry1 =
4175 const auto& entry2 =
4181 entry1.set_token(token1);
4186 entry2.set_token(token2);
4187 entry2.set_detach(detach2);
4194 entry1.set_value(
object);
4195 if (!clear_value_1) {
4196 value1 =
object.ptr();
4200 entry1.set_detach(
object);
4201 if (!clear_detach_1) {
4202 detach1 =
object.ptr();
4206 entry2.set_value(
object);
4207 if (!clear_value_2) {
4208 value2 =
object.ptr();
4212 entry2.set_detach(
object);
4213 if (!clear_detach_2) {
4214 detach2 =
object.ptr();
4218 if (collect_old_space) {
4219 GCTestHelper::CollectOldSpace();
4221 if (collect_new_space) {
4222 GCTestHelper::CollectNewSpace();
4224 if (evacuate_new_space_and_collect_old_space) {
4235 const intptr_t expect_num_cleared =
4236 (clear_value_1 ? 1 : 0) + (clear_value_2 ? 1 : 0);
4237 EXPECT_EQ(expect_num_cleared,
4240 const intptr_t expect_num_messages = expect_num_cleared == 0 ? 0 : 1;
4244 EXPECT_EQ(expect_num_messages + queue_length_start, aq.
queue()->
Length());
4254 bool clear_detach_1,
4255 bool clear_detach_2) {
4256 const bool collect_old_space =
true;
4257 const bool collect_new_space = space ==
Heap::kNew;
4258 const bool evacuate_new_space_and_collect_old_space = !collect_new_space;
4265 thread, spaces, collect_old_space, collect_new_space,
4266 evacuate_new_space_and_collect_old_space, clear_value_1, clear_value_2,
4267 clear_detach_1, clear_detach_2);
4317 for (
const bool collect_new_space : {
false,
true}) {
4319 const bool collect_old_space =
true;
4321 const bool evacuate_new_space_and_collect_old_space =
true;
4322 for (intptr_t test_j = 0; test_j < 16; test_j++) {
4323 const bool clear_value_1 = (test_j >> 0 & 0x1) == 0x1;
4324 const bool clear_value_2 = (test_j >> 1 & 0x1) == 0x1;
4325 const bool clear_detach_1 = (test_j >> 2 & 0x1) == 0x1;
4326 const bool clear_detach_2 = (test_j >> 3 & 0x1) == 0x1;
4328 thread, spaces, collect_old_space, collect_new_space,
4329 evacuate_new_space_and_collect_old_space, clear_value_1,
4330 clear_value_2, clear_detach_1, clear_detach_2);
4334#define FINALIZER_CROSS_GEN_TEST_CASE(n) \
4335 ISOLATE_UNIT_TEST_CASE(Finalizer_CrossGen_##n) { \
4336 Finalizer_TwoEntriesCrossGen(thread, n); \
4339#define REPEAT_512(V) \
4855#undef FINALIZER_CROSS_GEN_TEST_CASE
4884 finalizer.set_isolate(thread->isolate());
4886 const auto& detach1 =
4889 const auto& detach2 =
4895 const auto& entry1 =
4897 entry1.set_detach(detach1);
4898 entry1.set_token(token1);
4900 const auto& entry2 =
4902 entry2.set_detach(detach2);
4903 entry2.set_token(token2);
4907 const auto& value1 =
4909 entry1.set_value(value1);
4910 const auto& value2 =
4912 entry2.set_value(value2);
4917 GCTestHelper::CollectNewSpace();
4921 GCTestHelper::CollectOldSpace();
4926 finalizer.set_entries_collected(
4931 GCTestHelper::CollectNewSpace();
4934 GCTestHelper::CollectOldSpace();
4935 GCTestHelper::CollectNewSpace();
4939 intptr_t* token =
reinterpret_cast<intptr_t*
>(peer);
4946 bool collect_new_space,
4947 bool evacuate_new_space_and_collect_old_space,
4950 bool clear_detach_1,
4951 bool clear_detach_2) {
4956 intptr_t token1_memory = 0;
4957 intptr_t token2_memory = 0;
4962 intptr_t queue_length_start = 0;
4972 const auto& finalizer =
4975 finalizer.set_isolate(thread->
isolate());
4977 const auto& isolate_finalizers =
4980 weak1.set_target(finalizer);
4981 isolate_finalizers.Add(
weak1);
4985 finalizer.set_all_entries(all_entries);
4986 const auto& all_entries_data =
Array::Handle(all_entries.data());
4988 const auto& entry1 =
4990 all_entries_data.SetAt(0, entry1);
4992 const auto& entry2 =
4994 all_entries_data.SetAt(1, entry2);
4995 all_entries.set_used_data(2);
4997 const intptr_t external_size1 = 1024;
4998 const intptr_t external_size2 = 2048;
4999 entry1.set_external_size(external_size1);
5000 entry2.set_external_size(external_size2);
5008 entry1.set_token(token1);
5014 entry2.set_token(token2);
5015 entry2.set_detach(detach2);
5023 entry1.set_value(
object);
5024 if (!clear_value_1) {
5025 value1 =
object.ptr();
5029 entry1.set_detach(
object);
5030 if (!clear_detach_1) {
5031 detach1 =
object.ptr();
5036 entry2.set_value(
object);
5037 if (!clear_value_2) {
5038 value2 =
object.ptr();
5042 entry2.set_detach(
object);
5043 if (!clear_detach_2) {
5044 detach2 =
object.ptr();
5049 GCTestHelper::CollectOldSpace();
5050 if (collect_new_space) {
5052 GCTestHelper::CollectNewSpace();
5054 if (evacuate_new_space_and_collect_old_space) {
5066 const intptr_t expect_num_cleared =
5067 (clear_value_1 ? 1 : 0) + (clear_value_2 ? 1 : 0);
5068 EXPECT_EQ(expect_num_cleared,
5071 EXPECT_EQ(clear_value_1 ? 1 : 0, token1_memory);
5072 EXPECT_EQ(clear_value_2 ? 1 : 0, token2_memory);
5074 const intptr_t expect_num_messages = expect_num_cleared == 0 ? 0 : 1;
5078 EXPECT_EQ(expect_num_messages + queue_length_start, aq.
queue()->
Length());
5082 entry1.set_token(entry1);
5083 entry2.set_token(entry2);
5086 all_entries.set_used_data(0);
5097 for (
const bool collect_new_space : {
true,
false}) {
5099 const bool evacuate_new_space_and_collect_old_space =
true;
5100 const bool clear_value_1 =
true;
5101 const bool clear_value_2 =
true;
5102 const bool clear_detach_1 =
false;
5103 const bool clear_detach_2 =
false;
5105 "collect_new_space: %s evacuate_new_space_and_collect_old_space: %s\n",
5106 collect_new_space ?
"true" :
"false",
5107 evacuate_new_space_and_collect_old_space ?
"true" :
"false");
5109 evacuate_new_space_and_collect_old_space,
5110 clear_value_1, clear_value_2,
5111 clear_detach_1, clear_detach_2);
5115#define FINALIZER_NATIVE_CROSS_GEN_TEST_CASE(n) \
5116 ISOLATE_UNIT_TEST_CASE(NativeFinalizer_CrossGen_##n) { \
5117 NativeFinalizer_TwoEntriesCrossGen(thread, n); \
5122#undef FINALIZER_NATIVE_CROSS_GEN_TEST_CASE
5129 const char* kScript = R
"(
5132class AImpl implements A {}
5133class ASub extends A {}
5134// Wonky class order and non-alphabetic naming on purpose.
5137class A implements Finalizable {}
5138class Z implements A {}
5139class D implements C {}
5150 class_x.EnsureIsFinalized(thread);
5151 EXPECT(class_x.is_isolate_unsendable());
5154 class_a_impl.EnsureIsFinalized(thread);
5155 EXPECT(class_a_impl.is_isolate_unsendable());
5158 class_a_sub.EnsureIsFinalized(thread);
5159 EXPECT(class_a_sub.is_isolate_unsendable());
5163 const char* kScriptChars = R
"(
5164abstract class AInterface {}
5166abstract class BInterface {}
5167class BImplementation implements BInterface {}
5169abstract class CInterface {}
5170class CImplementation1 implements CInterface {}
5171class CImplementation2 implements CInterface {}
5173abstract class DInterface {}
5174abstract class DSubinterface implements DInterface {}
5176abstract class EInterface {}
5177abstract class ESubinterface implements EInterface {}
5178class EImplementation implements ESubinterface {}
5180abstract class FInterface {}
5181abstract class FSubinterface implements FInterface {}
5182class FImplementation1 implements FSubinterface {}
5183class FImplementation2 implements FSubinterface {}
5186 new BImplementation();
5187 new CImplementation1();
5188 new CImplementation2();
5189 new EImplementation();
5190 new FImplementation1();
5191 new FImplementation2();
5208 const Class& BImplementation =
5214 const Class& CImplementation1 =
5216 const Class& CImplementation2 =
5229 const Class& EImplementation =
5237 const Class& FImplementation1 =
5239 const Class& FImplementation2 =
5255 EXPECT(library.IsLibrary());
5258 EXPECT(returned_referent.IsLibrary());
5259 EXPECT_EQ(returned_referent.
ptr(), library.
ptr());
5263 EXPECT_NE(reference.
ptr(), other_reference.
ptr());
5265 EXPECT_NE(reference.
ptr(), other_reference.
ptr());
5269 EXPECT(obj.IsMirrorReference());
5292 const Field& field =
5309 UntaggedFunction::kRegularFunction,
false,
false,
5311 functions.
SetAt(0, parent);
5329 intptr_t good_closure_index =
5331 EXPECT_GE(good_closure_index, 0);
5334 EXPECT_EQ(bad_closure_index, -1);
5355 UntaggedFunction::kRegularFunction,
false,
false,
5357 functions.
SetAt(0, parent);
5365 const String& invocation_dispatcher_name =
5370 invocation_dispatcher_name, args_desc,
5371 UntaggedFunction::kNoSuchMethodDispatcher,
true );
5374 intptr_t invocation_dispatcher_index =
5377 EXPECT_GE(invocation_dispatcher_index, 0);
5380 invocation_dispatcher_from_index ^=
5383 EXPECT_EQ(invocation_dispatcher.
ptr(),
5384 invocation_dispatcher_from_index.
ptr());
5387 intptr_t bad_invocation_dispatcher_index =
5389 EXPECT_EQ(bad_invocation_dispatcher_index, -1);
5393 if (
data.IsError()) {
5395 Error::Cast(
data).ToErrorCString());
5398 const Array& metadata = Array::Cast(
data);
5402 for (
int i = 0;
i < metadata.
Length();
i++) {
5403 elem = metadata.
At(
i);
5410 const char* kScriptChars =
5414 " const Meta(this.m); \n"
5417 "const metafoo = 'metafoo'; \n"
5418 "const metabar = 'meta' 'bar'; \n"
5421 "@Meta(0) String? gVar; \n"
5424 "get tlGetter => gVar; \n"
5433 " @metabar @Meta('baa') \n"
5434 " int aFunc(a,b) => a + b; \n"
5487 const char* kScriptChars =
5489 " static test1(int a) {\n"
5490 " return a > 1 ? a + 1 : a;\n"
5492 " static test2(a) {\n"
5493 " return a > 1 ? a + 1 : a;\n"
5495 " static test3(b) {\n"
5496 " return b > 1 ? b + 1 : b;\n"
5498 " static test4(b) {\n"
5499 " return b > 1 ? b - 1 : b;\n"
5501 " static test5(b) {\n"
5502 " return b > 1 ? b - 2 : b;\n"
5505 " return a > 1 ? a + 1 : a;\n"
5509 " static /* Different declaration style. */\n"
5511 " /* Returns a + 1 for a > 1, a otherwise. */\n"
5516 " static test5(b) {\n"
5521 " return a > 1 ? a + 1 : a;\n"
5531 const Class& class_a =
5533 const Class& class_b =
5568 const char* kScriptChars =
5579 const int kBreakpointLine = 5;
5619 const int kBreakpointLine = 8;
5631 bool* auto_setup_scope) {
5632 ASSERT(auto_setup_scope !=
nullptr);
5633 *auto_setup_scope =
true;
5634 const char* cstr =
nullptr;
5637 EXPECT_STREQ(cstr,
"setBreakpoint");
5642 const char* kOriginalScript =
"test() {}";
5656 char*
error =
nullptr;
5661 EXPECT_NE(
nullptr, child);
5662 EXPECT_EQ(
nullptr,
error);
5666 const char* kReloadScript =
5668 @pragma("vm:external-name", "setBreakpoint")
5669 external setBreakpoint();
5675 baz(); // this line gets a breakpoint
5706 EXPECT_EQ(
nullptr,
error);
5710class ToggleBreakpointTask :
public ThreadPool::Task {
5714 std::atomic<bool>*
done)
5715 : isolate_group_(isolate_group), isolate_(isolate), done_(
done) {}
5716 virtual void Run() {
5719 const int kBreakpointLine = 5;
5721 for (intptr_t
i = 0;
i < 1000;
i++) {
5725 int64_t breakpoint_id;
5727 TransitionNativeToVM transition(t);
5730 breakpoint_id = breakpoint_id_handle.AsInt64Value();
5741 IsolateGroup* isolate_group_;
5743 std::atomic<bool>* done_;
5747 const char* kScriptChars =
5770 char*
error =
nullptr;
5775 EXPECT_NE(
nullptr, child);
5776 EXPECT_EQ(
nullptr,
error);
5781 std::atomic<bool>
done =
false;
5788 TransitionNativeToVM transition(thread);
5790 const Library& vmlib =
5796 func_b.CanBeInlined();
5809 EXPECT_EQ(
nullptr,
error);
5818 cls = object_store->null_class();
5819 array = cls.fields();
5822 array = cls.current_functions();
5827 array = cls.fields();
5830 array = cls.current_functions();
5835 array = cls.fields();
5838 array = cls.current_functions();
5846 : objects_(objects) {}
5849 if (obj->IsPseudoObject()) {
5854 if (handle.IsString() || handle.IsArray()) {
5857 objects_->Add(&handle);
5861 GrowableArray<Object*>* objects_;
5867 TransitionVMToNative transition(thread);
5875 GrowableArray<Object*> objects;
5878 ObjectAccumulator acc(&objects);
5879 iteration.IterateObjects(&acc);
5881 for (intptr_t
i = 0;
i < objects.length(); ++
i) {
5888 objects[
i]->ToCString();
5895 TransitionVMToNative transition(thread);
5903 GrowableArray<Object*> objects;
5907 iteration.IterateObjects(&acc);
5909 for (intptr_t
i = 0;
i < objects.length(); ++
i) {
5911 objects[
i]->PrintJSON(&
js,
false);
5912 EXPECT_SUBSTRING(
"\"type\":",
js.ToCString());
5925 Class& cls =
Class::Handle(isolate->group()->object_store()->bool_class());
5926 cls.PrintJSON(&
js,
true);
5927 const char* json_str =
js.ToCString();
5934 "{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"bool\","
5935 "\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":\"@"
5937 "\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core\\/bool.dart\","
5938 "\"_kind\":\"kernel\"}},"
5939 "\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
5940 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}}",
5947 Class& cls =
Class::Handle(isolate->group()->object_store()->bool_class());
5952 func.PrintJSON(&
js,
true);
5953 const char* json_str =
js.ToCString();
5959 "{\"type\":\"@Function\",\"fixedId\":true,\"id\":\"\","
5960 "\"name\":\"toString\",\"owner\":{\"type\":\"@Class\","
5961 "\"fixedId\":true,\"id\":\"\",\"name\":\"bool\","
5962 "\"location\":{\"type\":\"SourceLocation\","
5963 "\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
5964 "\"id\":\"\",\"uri\":\"dart:core\\/bool.dart\","
5965 "\"_kind\":\"kernel\"}},"
5966 "\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
5967 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
5968 "\"_kind\":\"RegularFunction\",\"static\":false,\"const\":false,"
5969 "\"implicit\":false,\"abstract\":false,"
5970 "\"_intrinsic\":false,\"_native\":false,\"isGetter\":false,"
5971 "\"isSetter\":false,\"location\":{\"type\":\"SourceLocation\","
5972 "\"script\":{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
5973 "\"uri\":\"dart:core\\/bool.dart\",\"_kind\":\"kernel\"}}}",
5981 lib.PrintJSON(&
js,
true);
5982 const char* json_str =
js.ToCString();
5986 "{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
5987 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}",
5994 const char* json_str =
js.ToCString();
6000 "{\"type\":\"@Instance\",\"_vmType\":\"Bool\",\"class\":{\"type\":\"@"
6001 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"bool\",\"location\":{"
6002 "\"type\":\"SourceLocation\",\"script\":{\"type\":\"@Script\","
6003 "\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core\\/bool.dart\",\"_"
6004 "kind\":\"kernel\"}},\"library\":"
6005 "{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\",\"name\":\"dart."
6006 "core\",\"uri\":\"dart:core\"}},\"identityHashCode\":0,\"kind\":"
6007 "\"Bool\",\"fixedId\":true,\"id\":\"objects\\/bool-true\","
6008 "\"valueAsString\":\"true\"}",
6015 smi.PrintJSON(&
js,
true);
6016 const char* json_str =
js.ToCString();
6023 "{\"type\":\"@Instance\",\"_vmType\":\"Smi\",\"class\":{\"type\":\"@"
6024 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_Smi\",\"_vmName\":"
6025 "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
6026 "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6027 "patch\\/integers.dart\",\"_kind\":\"kernel\"}"
6028 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6029 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6030 "\"identityHashCode\":0,\"kind\":\"Int\",\"fixedId\":true,\"id\":"
6031 "\"objects\\/int-7\",\"valueAsString\":\"7\"}",
6038 smi.PrintJSON(&
js,
true);
6039 const char* json_str =
js.ToCString();
6047 "{\"type\":\"@Instance\",\"_vmType\":\"Mint\",\"class\":{\"type\":\"@"
6048 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_Mint\",\"_vmName\":"
6049 "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
6050 "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6051 "patch\\/integers.dart\",\"_kind\":\"kernel\"}"
6052 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6053 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6054 "\"identityHashCode\":0,\"id\":\"\",\"kind\":\"Int\",\"valueAsString\":"
6055 "\"-9223372036854775808\"}",
6062 dub.PrintJSON(&
js,
true);
6063 const char* json_str =
js.ToCString();
6071 "{\"type\":\"@Instance\",\"_vmType\":\"Double\",\"class\":{\"type\":\"@"
6072 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_Double\",\"_vmName\":"
6073 "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
6074 "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6075 "patch\\/double.dart\",\"_kind\":\"kernel\"}"
6076 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6077 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6078 "\"identityHashCode\":0,\"id\":\"\",\"kind\":\"Double\","
6079 "\"valueAsString\":\"0.1234\"}",
6086 str.PrintJSON(&
js,
true);
6087 const char* json_str =
js.ToCString();
6095 "{\"type\":\"@Instance\",\"_vmType\":\"String\",\"class\":{\"type\":\"@"
6096 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_OneByteString\",\"_"
6097 "vmName\":\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{"
6098 "\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6099 "patch\\/string_patch.dart\",\"_kind\":\"kernel\"}"
6100 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6101 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6102 "\"identityHashCode\":0,\"id\":\"\",\"kind\":\"String\",\"length\":2,"
6103 "\"valueAsString\":\"dw\"}",
6110 array.PrintJSON(&
js,
true);
6111 const char* json_str =
js.ToCString();
6120 "{\"type\":\"@Instance\",\"_vmType\":\"Array\",\"class\":{\"type\":\"@"
6121 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_List\",\"_vmName\":"
6122 "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
6123 "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-patch\\/"
6124 "array.dart\",\"_kind\":\"kernel\"}},"
6125 "\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
6126 "\"name\":\"dart.core\",\"uri\":\"dart:core\"},\"typeParameters\":[{"
6128 "Instance\",\"_vmType\":\"TypeParameter\",\"class\":{\"type\":\"@"
6129 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_TypeParameter\",\"_"
6130 "vmName\":\"\",\"location\":{\"type\":"
6131 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6132 "\"id\":\"\",\"uri\":\"dart:core-patch\\/"
6133 "type_patch.dart\",\"_kind\":\"kernel\"}},"
6134 "\"library\":{\"type\":\"@Library\",\"fixedId\":"
6135 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6136 "\"identityHashCode\":",
6140 "\"id\":\"\",\"kind\":\"TypeParameter\",\"name\":\"X0\","
6141 "\"parameterizedClass\":{\"type\":\"@Instance\",\"_vmType\":\"Class\","
6142 "\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\",\"name\":"
6143 "\"Null\",\"location\":{\"type\":\"SourceLocation\",\"script\":{"
6144 "\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:"
6146 "null.dart\",\"_kind\":\"kernel\"}},"
6147 "\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
6148 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\","
6149 "\"fixedId\":true,\"id\":\"\",\"valueAsString\":\"null\"}}]},"
6150 "\"identityHashCode\":0,\"id\":\"\",\"kind\":\"List\",\"length\":0}",
6157 const GrowableObjectArray& array =
6159 array.PrintJSON(&
js,
true);
6160 const char* json_str =
js.ToCString();
6169 "{\"type\":\"@Instance\",\"_vmType\":\"GrowableObjectArray\",\"class\":"
6170 "{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_"
6171 "GrowableList\",\"_vmName\":\"\",\"location\":{\"type\":"
6172 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6173 "\"id\":\"\",\"uri\":\"dart:core-patch\\/"
6174 "growable_array.dart\",\"_kind\":\"kernel\"}"
6175 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6176 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"},"
6177 "\"typeParameters\":[{\"type\":\"@Instance\",\"_vmType\":"
6178 "\"TypeParameter\",\"class\":{\"type\":\"@Class\",\"fixedId\":true,"
6179 "\"id\":\"\",\"name\":\"_TypeParameter\",\"_vmName\":\""
6180 "\",\"location\":{\"type\":\"SourceLocation\",\"script\":{"
6181 "\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6183 "type_patch.dart\",\"_kind\":\"kernel\"}"
6184 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6185 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6186 "\"identityHashCode\":",
6190 "\"id\":\"\",\"kind\":\"TypeParameter\",\"name\":\"X0\","
6191 "\"parameterizedClass\":{\"type\":\"@Instance\","
6192 "\"_vmType\":\"Class\",\"class\":{\"type\":\"@Class\",\"fixedId\":true,"
6193 "\"id\":\"\",\"name\":\"Null\",\"location\":{\"type\":"
6194 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6195 "\"id\":\"\",\"uri\":\"dart:core\\/"
6196 "null.dart\",\"_kind\":\"kernel\"}"
6197 "},\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
6198 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\","
6199 "\"fixedId\":true,\"id\":\"\",\"valueAsString\":\"null\"}}]},"
6200 "\"identityHashCode\":0,\"id\":\"\",\"kind\":\"List\",\"length\":0}",
6207 array.PrintJSON(&
js,
true);
6208 const char* json_str =
js.ToCString();
6217 "{\"type\":\"@Instance\",\"_vmType\":\"Map\",\"class\":{"
6218 "\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_"
6219 "Map\",\"_vmName\":\"\",\"location\":{\"type\":"
6220 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6221 "\"id\":\"\",\"uri\":\"dart:collection-patch\\/"
6222 "compact_hash.dart\",\"_kind\":\"kernel\"}"
6223 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6224 "true,\"id\":\"\",\"name\":\"dart.collection\",\"uri\":\"dart:"
6225 "collection\"},\"typeParameters\":[{\"type\":\"@Instance\",\"_vmType\":"
6226 "\"TypeParameter\",\"class\":{\"type\":\"@Class\",\"fixedId\":true,"
6227 "\"id\":\"\",\"name\":\"_TypeParameter\",\"_vmName\":\""
6228 "\",\"location\":{\"type\":\"SourceLocation\",\"script\":{"
6229 "\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6231 "type_patch.dart\",\"_kind\":\"kernel\"}"
6232 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6233 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6234 "\"identityHashCode\":",
6238 "\"id\":\"\",\"kind\":\"TypeParameter\",\"name\":\"X0\","
6239 "\"parameterizedClass\":{\"type\":\"@Instance\","
6240 "\"_vmType\":\"Class\",\"class\":{\"type\":\"@Class\",\"fixedId\":true,"
6241 "\"id\":\"\",\"name\":\"Null\",\"location\":{\"type\":"
6242 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6243 "\"id\":\"\",\"uri\":\"dart:core\\/"
6244 "null.dart\",\"_kind\":\"kernel\"}"
6245 "},\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
6246 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\","
6247 "\"fixedId\":true,\"id\":\"\",\"valueAsString\":\"null\"}},{\"type\":"
6248 "\"@Instance\",\"_vmType\":\"TypeParameter\",\"class\":{\"type\":\"@"
6249 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_TypeParameter\",\"_"
6250 "vmName\":\"\",\"location\":{\"type\":"
6251 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6252 "\"id\":\"\",\"uri\":\"dart:core-patch\\/"
6253 "type_patch.dart\",\"_kind\":\"kernel\"}"
6254 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6255 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6256 "\"identityHashCode\":",
6260 "\"id\":\"\",\"kind\":\"TypeParameter\",\"name\":\"X1\","
6261 "\"parameterizedClass\":{\"type\":\"@Instance\","
6262 "\"_vmType\":\"Class\",\"class\":{\"type\":\"@Class\",\"fixedId\":true,"
6263 "\"id\":\"\",\"name\":\"Null\",\"location\":{\"type\":"
6264 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6265 "\"id\":\"\",\"uri\":\"dart:core\\/"
6266 "null.dart\",\"_kind\":\"kernel\"}"
6267 "},\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
6268 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\","
6269 "\"fixedId\":true,\"id\":\"\",\"valueAsString\":\"null\"}}]},"
6270 "\"identityHashCode\":0,\"id\":\"\",\"kind\":\"Map\",\"length\":0}",
6277 tag.PrintJSON(&
js,
true);
6278 const char* json_str =
js.ToCString();
6286 "\"type\":\"@Instance\",\"_vmType\":\"UserTag\",\"class\":{\"type\":\"@"
6287 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_UserTag\",\"_"
6288 "vmName\":\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{"
6289 "\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:"
6290 "developer-patch\\/"
6291 "profiler.dart\",\"_kind\":\"kernel\"}},\"library\":{\"type\":\"@"
6293 "\"fixedId\":true,\"id\":\"\",\"name\":\"dart.developer\",\"uri\":"
6294 "\"dart:developer\"}},"
6296 "\"identityHashCode\":",
6300 "\"kind\":\"UserTag\",\"label\":\"Default\"}",
6309 type.PrintJSON(&
js,
true);
6310 const char* json_str =
js.ToCString();
6318 "{\"type\":\"@Instance\",\"_vmType\":\"Type\",\"class\":{\"type\":\"@"
6319 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_Type\",\"_vmName\":"
6320 "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
6321 "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6322 "patch\\/type_patch.dart\",\"_kind\":\"kernel\"}"
6323 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6324 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6326 "\"identityHashCode\":",
6329 "\"kind\":\"Type\","
6330 "\"fixedId\":true,\"id\":\"\","
6331 "\"typeClass\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
6332 "\"name\":\"bool\",\"location\":{\"type\":\"SourceLocation\","
6333 "\"script\":{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":"
6334 "\"dart:core\\/bool.dart\",\"_kind\":\"kernel\"}"
6335 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6336 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6337 "\"name\":\"bool\"}",
6343 Object::null_object().PrintJSON(&
js,
true);
6344 const char* json_str =
js.ToCString();
6350 "{\"type\":\"@Instance\",\"_vmType\":\"null\",\"class\":{\"type\":\"@"
6351 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"Null\",\"location\":{"
6352 "\"type\":\"SourceLocation\",\"script\":{\"type\":\"@Script\","
6353 "\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core\\/null.dart\",\"_"
6354 "kind\":\"kernel\"}},\"library\":"
6355 "{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\",\"name\":\"dart."
6356 "core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\",\"fixedId\":true,"
6357 "\"id\":\"objects\\/null\",\"valueAsString\":\"null\"}",
6363 Object::sentinel().PrintJSON(&
js,
true);
6365 "{\"type\":\"Sentinel\","
6366 "\"kind\":\"NotInitialized\","
6367 "\"valueAsString\":\"<not initialized>\"}",
6373 Object::transition_sentinel().PrintJSON(&
js,
true);
6375 "{\"type\":\"Sentinel\","
6376 "\"kind\":\"BeingInitialized\","
6377 "\"valueAsString\":\"<being initialized>\"}",
6386 const char* kScript =
6388 " bool operator==(covariant A other) { return true; }\n"
6399 TransitionNativeToVM transition(thread);
6415 const char* kScript =
6417 " return \"foo\".hashCode;\n"
6444 const char* value_script,
6446 bool check_identity =
true,
6447 bool check_hashcode =
true) {
6452 "valueHashCode() {\n"
6453 " return value().hashCode;\n"
6456 "valueIdentityHashCode() {\n"
6457 " return identityHashCode(value());\n"
6466 if (check_hashcode) {
6476 const auto& value_dart = Instance::CheckedHandle(
6478 int64_t hashcode_dart;
6479 if (check_hashcode) {
6484 const int64_t identity_hashcode_dart =
6487 if (hashcode_canonicalize_vm == 0) {
6488 hashcode_canonicalize_vm = Instance::Cast(value_dart).CanonicalizeHash();
6491 bool success =
true;
6493 if (check_hashcode) {
6494 success &= hashcode_dart == hashcode_canonicalize_vm;
6496 if (check_identity) {
6497 success &= identity_hashcode_dart == hashcode_canonicalize_vm;
6503 "Dart hashCode or Dart identityHashCode does not equal VM "
6504 "CanonicalizeHash for %s\n",
6505 value_dart.ToCString());
6509 identity_hashcode_dart, identity_hashcode_dart);
6511 hashcode_canonicalize_vm, hashcode_canonicalize_vm);
6518 const char* kScript =
6526 uint32_t kInt1HashCode = 0;
6535 const char* kScript =
6537 " return 0x8000000;\n"
6543 const char* kScript =
6551 const char* kScript =
6559 const char* kScript =
6567 const char* kScript =
6576 const char* kScript =
6584 const char* kScript =
6585 "const type = dynamic;\n"
6595 const char* kScript =
6596 "const type = int;\n"
6606 const char* kScript =
6608 " var map = {'x': 3, 'y': 4, 'z': 5, 'w': 6};\n"
6609 " map.remove('y');\n"
6610 " map.remove('w');\n"
6618 TransitionNativeToVM transition(thread);
6621 ASSERT(dart_map.IsMap());
6622 const Map& cc_map =
Map::Cast(dart_map);
6624 EXPECT_EQ(2, cc_map.Length());
6626 Map::Iterator iterator(cc_map);
6629 EXPECT(iterator.MoveNext());
6630 object = iterator.CurrentKey();
6631 EXPECT_STREQ(
"x",
object.ToCString());
6632 object = iterator.CurrentValue();
6633 EXPECT_STREQ(
"3",
object.ToCString());
6635 EXPECT(iterator.MoveNext());
6636 object = iterator.CurrentKey();
6637 EXPECT_STREQ(
"z",
object.ToCString());
6638 object = iterator.CurrentValue();
6639 EXPECT_STREQ(
"5",
object.ToCString());
6641 EXPECT(!iterator.MoveNext());
6644template <
class LinkedHashBase>
6646 const LinkedHashBase& map2,
6653 const intptr_t data1_length =
Smi::Value(map1.used_data());
6654 const intptr_t data2_length =
Smi::Value(map2.used_data());
6655 const bool data_length_equal = data1_length == data2_length;
6656 bool data_equal = data_length_equal;
6657 if (data_length_equal) {
6660 for (intptr_t
i = 0;
i < data1_length;
i++) {
6661 object1 ^= data1.At(
i);
6662 object2 ^= data2.At(
i);
6663 data_equal &= object1.CanonicalizeEquals(object2);
6668 THR_Print(
"LinkedHashBaseEqual Data not equal.\n");
6669 THR_Print(
"LinkedHashBaseEqual data1.length %" Pd " data1.length %" Pd
6671 data1_length, data2_length);
6673 for (intptr_t
i = 0;
i < data1_length;
i++) {
6674 object1 ^= data1.At(
i);
6675 THR_Print(
"LinkedHashBaseEqual data1[%" Pd "] %s\n",
i,
6676 object1.ToCString());
6678 for (intptr_t
i = 0;
i < data2_length;
i++) {
6679 object1 ^= data2.At(
i);
6680 THR_Print(
"LinkedHashBaseEqual data2[%" Pd "] %s\n",
i,
6681 object1.ToCString());
6689 intptr_t hash_mask1 =
Smi::Value(map1.hash_mask());
6691 intptr_t hash_mask2 =
Smi::Value(map2.hash_mask());
6692 const bool hash_masks_equal = hash_mask1 == hash_mask2;
6693 if (!hash_masks_equal) {
6695 THR_Print(
"LinkedHashBaseEqual Hash masks not equal.\n");
6696 THR_Print(
"LinkedHashBaseEqual hash_mask1 %" Px " hash_mask2 %" Px " \n",
6697 hash_mask1, hash_mask2);
6704 EXPECT(!index2.IsNull());
6705 ASSERT(index1.ElementType() == kUint32ArrayElement);
6706 ASSERT(index2.ElementType() == kUint32ArrayElement);
6707 const intptr_t kElementSize = 4;
6708 ASSERT(kElementSize == index1.ElementSizeInBytes());
6709 const bool index_length_equal = index1.Length() == index2.Length();
6710 bool index_equal = index_length_equal;
6711 if (index_length_equal) {
6712 for (intptr_t
i = 0;
i < index1.Length();
i++) {
6713 const uint32_t index1_val = index1.GetUint32(
i * kElementSize);
6714 const uint32_t index2_val = index2.GetUint32(
i * kElementSize);
6715 index_equal &= index1_val == index2_val;
6718 if (!index_equal && print_diff) {
6719 THR_Print(
"LinkedHashBaseEqual Indices not equal.\n");
6720 THR_Print(
"LinkedHashBaseEqual index1.length %" Pd " index2.length %" Pd
6722 index1.Length(), index2.Length());
6723 for (intptr_t
i = 0;
i < index1.Length();
i++) {
6724 const uint32_t index_val = index1.GetUint32(
i * kElementSize);
6728 for (intptr_t
i = 0;
i < index2.Length();
i++) {
6729 const uint32_t index_val = index2.GetUint32(
i * kElementSize);
6740 const TypeArguments& type_arguments) {
6744 for (intptr_t
i = 0;
i < used_data;
i++) {
6748 map.set_used_data(used_data);
6749 map.SetTypeArguments(type_arguments);
6750 map.set_deleted_keys(0);
6751 map.ComputeAndSetHashMask();
6759 const char* kScript = R
"(
6760enum ExperimentalFlag {
6761 alternativeInvalidationStrategy,
6764 constructorTearoffs,
6765 controlFlowCollections,
6770 nonfunctionTypeAliases,
6779final Map<ExperimentalFlag?, bool> expiredExperimentalFlagsNonConst = {
6780 ExperimentalFlag.alternativeInvalidationStrategy: false,
6781 ExperimentalFlag.constFunctions: false,
6782 ExperimentalFlag.constantUpdate2018: true,
6783 ExperimentalFlag.constructorTearoffs: false,
6784 ExperimentalFlag.controlFlowCollections: true,
6785 ExperimentalFlag.extensionMethods: false,
6786 ExperimentalFlag.extensionTypes: false,
6787 ExperimentalFlag.genericMetadata: false,
6788 ExperimentalFlag.nonNullable: false,
6789 ExperimentalFlag.nonfunctionTypeAliases: false,
6790 ExperimentalFlag.setLiterals: true,
6791 ExperimentalFlag.spreadCollections: true,
6792 ExperimentalFlag.testExperiment: false,
6793 ExperimentalFlag.tripleShift: false,
6794 ExperimentalFlag.valueClass: false,
6795 ExperimentalFlag.variance: false,
6799 return expiredExperimentalFlagsNonConst;
6803 return ExperimentalFlag.alternativeInvalidationStrategy;
6807 return firstKey().hashCode;
6810firstKeyIdentityHashCode() {
6811 return identityHashCode(firstKey());
6814bool lookupSpreadCollections(Map map) =>
6815 map[ExperimentalFlag.spreadCollections];
6817bool? lookupNull(Map map) => map[null];
6837 TransitionNativeToVM transition(thread);
6838 const auto& non_const_map =
6840 const auto& non_const_type_args =
6842 const auto& non_const_data =
Array::Handle(non_const_map.data());
6844 non_const_data,
Smi::Value(non_const_map.used_data()),
6845 non_const_type_args));
6846 ASSERT(non_const_map.GetClassId() == kMapCid);
6847 ASSERT(const_map.GetClassId() == kConstMapCid);
6848 ASSERT(!non_const_map.IsCanonical());
6849 ASSERT(const_map.IsCanonical());
6855 lib,
NewString(
"lookupSpreadCollections"), 1, &const_argument);
6865 TransitionNativeToVM transition(thread);
6866 const auto& non_const_object =
6868 const auto& non_const_map =
Map::Cast(non_const_object);
6869 const auto& const_object =
6871 const auto& const_map =
Map::Cast(const_object);
6873 EXPECT(non_const_map.GetClassId() != const_map.GetClassId());
6882 return object.IsMap() ||
object.IsSet();
6889template <
class LinkedHashBase,
int kMutableC
id,
int kImmutableC
id>
6904 const auto& non_const_object =
6907 non_const_object.IsMap();
6914 EXPECT_EQ(non_const_value.GetClassId(), kMutableCid);
6915 EXPECT_EQ(const_value.GetClassId(), kImmutableCid);
6917 EXPECT(const_value.IsCanonical());
6924 HashBaseNonConstEqualsConst<Map, kMapCid, kConstMapCid>(
script,
check_data);
6929 HashBaseNonConstEqualsConst<Set, kSetCid, kConstSetCid>(
script,
check_data);
6933 const char* kScript = R
"(
6934constValue() => const {1: 42, 'foo': 499, 2: 'bar'};
6936nonConstValue() => {1: 42, 'foo': 499, 2: 'bar'};
6946 const char* kScript = R
"(
6947constValue() => const {1: 42, 'foo': 499, null: 'bar'};
6949nonConstValue() => {1: 42, 'foo': 499, null: 'bar'};
6959 const char* kScript = R
"(
6960enum ExperimentalFlag {
6961 alternativeInvalidationStrategy,
6964 constructorTearoffs,
6965 controlFlowCollections,
6970 nonfunctionTypeAliases,
6979const Map<ExperimentalFlag, bool> expiredExperimentalFlags = {
6980 ExperimentalFlag.alternativeInvalidationStrategy: false,
6981 ExperimentalFlag.constFunctions: false,
6982 ExperimentalFlag.constantUpdate2018: true,
6983 ExperimentalFlag.constructorTearoffs: false,
6984 ExperimentalFlag.controlFlowCollections: true,
6985 ExperimentalFlag.extensionMethods: false,
6986 ExperimentalFlag.extensionTypes: false,
6987 ExperimentalFlag.genericMetadata: false,
6988 ExperimentalFlag.nonNullable: false,
6989 ExperimentalFlag.nonfunctionTypeAliases: false,
6990 ExperimentalFlag.setLiterals: true,
6991 ExperimentalFlag.spreadCollections: true,
6992 ExperimentalFlag.testExperiment: false,
6993 ExperimentalFlag.tripleShift: false,
6994 ExperimentalFlag.valueClass: false,
6995 ExperimentalFlag.variance: false,
6998final Map<ExperimentalFlag, bool> expiredExperimentalFlagsNonConst = {
6999 ExperimentalFlag.alternativeInvalidationStrategy: false,
7000 ExperimentalFlag.constFunctions: false,
7001 ExperimentalFlag.constantUpdate2018: true,
7002 ExperimentalFlag.constructorTearoffs: false,
7003 ExperimentalFlag.controlFlowCollections: true,
7004 ExperimentalFlag.extensionMethods: false,
7005 ExperimentalFlag.extensionTypes: false,
7006 ExperimentalFlag.genericMetadata: false,
7007 ExperimentalFlag.nonNullable: false,
7008 ExperimentalFlag.nonfunctionTypeAliases: false,
7009 ExperimentalFlag.setLiterals: true,
7010 ExperimentalFlag.spreadCollections: true,
7011 ExperimentalFlag.testExperiment: false,
7012 ExperimentalFlag.tripleShift: false,
7013 ExperimentalFlag.valueClass: false,
7014 ExperimentalFlag.variance: false,
7017constValue() => expiredExperimentalFlags;
7019nonConstValue() => expiredExperimentalFlagsNonConst;
7029 const char* kScript = R
"(
7059const nonSizeAlignment = <Abi, Map<NativeType, int>>{
7061 Abi.wordSize32Align32: {
7062 NativeType.kDouble: 4,
7063 NativeType.kInt64: 4,
7064 NativeType.kUint64: 4
7066 Abi.wordSize32Align64: {},
7069final nonSizeAlignmentNonConst = <Abi, Map<NativeType, int>>{
7071 Abi.wordSize32Align32: {
7072 NativeType.kDouble: 4,
7073 NativeType.kInt64: 4,
7074 NativeType.kUint64: 4
7076 Abi.wordSize32Align64: {},
7079constValue() => nonSizeAlignment;
7081nonConstValue() => nonSizeAlignmentNonConst;
7091 const char* kScript = R
"(
7093 var set = {'x', 'y', 'z', 'w'};
7104 TransitionNativeToVM transition(thread);
7107 ASSERT(dart_set.IsSet());
7108 const Set& cc_set =
Set::Cast(dart_set);
7110 EXPECT_EQ(2, cc_set.Length());
7112 Set::Iterator iterator(cc_set);
7115 EXPECT(iterator.MoveNext());
7116 object = iterator.CurrentKey();
7117 EXPECT_STREQ(
"x",
object.ToCString());
7119 EXPECT(iterator.MoveNext());
7120 object = iterator.CurrentKey();
7121 EXPECT_STREQ(
"z",
object.ToCString());
7123 EXPECT(!iterator.MoveNext());
7129 const TypeArguments& type_arguments) {
7133 for (intptr_t
i = 0;
i < used_data;
i++) {
7137 set.set_used_data(used_data);
7138 set.SetTypeArguments(type_arguments);
7139 set.set_deleted_keys(0);
7140 set.ComputeAndSetHashMask();
7147 const char* kScript = R
"(
7149 return {1, 2, 3, 5, 8, 13};
7152bool containsFive(Set set) => set.contains(5);
7163 TransitionNativeToVM transition(thread);
7164 const auto& non_const_object =
7166 const auto& non_const_set =
Set::Cast(non_const_object);
7167 ASSERT(non_const_set.GetClassId() == kSetCid);
7168 ASSERT(!non_const_set.IsCanonical());
7170 const auto& non_const_data =
Array::Handle(non_const_set.data());
7171 const auto& non_const_type_args =
7174 non_const_data,
Smi::Value(non_const_set.used_data()),
7175 non_const_type_args));
7176 ASSERT(const_set.GetClassId() == kConstSetCid);
7177 ASSERT(const_set.IsCanonical());
7188 TransitionNativeToVM transition(thread);
7189 const auto& non_const_object =
7191 const auto& non_const_set =
Set::Cast(non_const_object);
7192 const auto& const_object =
7194 const auto& const_set =
Set::Cast(const_object);
7196 EXPECT(non_const_set.GetClassId() != const_set.GetClassId());
7205 const char* kScript = R
"(
7206constValue() => const {1, 2, 3, 5, 8, 13};
7208nonConstValue() => {1, 2, 3, 5, 8, 13};
7211 constValue().contains(null);
7218 const char* kScript = R
"(
7219const Set<String> tokensThatMayFollowTypeArg = {
7245final Set<String> tokensThatMayFollowTypeArgNonConst = {
7271constValue() => tokensThatMayFollowTypeArg;
7273nonConstValue() => tokensThatMayFollowTypeArgNonConst;
7276 constValue().contains(null);
7284 Zone* zone = thread->zone();
7285 GrowableHandlePtrArray<const String> pieces(zone, n);
7287 for (
int i = 0;
i < n;
i++) {
7288 pieces.Add(*
data[
i]);
7291 const String& res1 =
7294 EXPECT(res1.Equals(res2));
7300 &Symbols::isPaused()};
7305 const intptr_t kWideCharsLen = 7;
7306 uint16_t wide_chars[kWideCharsLen] = {
'H',
'e',
'l',
'l',
'o', 256,
'!'};
7307 const String& two_str =
7317 &Symbols::isPaused()};
7328 TestResult
tests[] = {
7329 {
"(dynamic, dynamic) => void",
"(dynamic, dynamic) => void"},
7330 {
"_List@915557746",
"_List"},
7331 {
"_HashMap@600006304<K, V>(dynamic) => V",
7332 "_HashMap<K, V>(dynamic) => V"},
7333 {
"set:foo",
"foo="},
7335 {
"_ReceivePortImpl@709387912",
"_ReceivePortImpl"},
7336 {
"_ReceivePortImpl@709387912._internal@709387912",
7337 "_ReceivePortImpl._internal"},
7338 {
"_C@6328321&_E@6328321&_F@6328321",
"_C&_E&_F"},
7340 {
"get:foo@6328321",
"foo"},
7341 {
"_MyClass@6328321.",
"_MyClass"},
7342 {
"_MyClass@6328321.named",
"_MyClass.named"},
7358 int32_t char_codes[] = {0, 0x0a, 0x0d, 0x7f, 0xff,
7359 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff};
7368 const char* kScriptChars =
7369 "void foo<T extends C<T>>(T x) {}\n"
7370 "void bar<M extends U<M>>(M x) {}\n"
7371 "abstract class C<T> {}\n"
7372 "abstract class U<T> extends C<T> {}\n";
7374 TransitionNativeToVM transition(thread);
7393 const AbstractType& sub,
7394 const AbstractType& super,
7396 if (sub.IsSubtypeOf(super,
Heap::kNew) != is_subtype) {
7398 buffer.AddString(
"Expected ");
7400 buffer.Printf(
" to %s a subtype of ", is_subtype ?
"be" :
"not be");
7402 expect.Fail(
"%s",
buffer.buffer());
7406#define EXPECT_SUBTYPE(sub, super) \
7407 CheckSubtypeRelation(Expect(__FILE__, __LINE__), sub, super, true);
7408#define EXPECT_NOT_SUBTYPE(sub, super) \
7409 CheckSubtypeRelation(Expect(__FILE__, __LINE__), sub, super, false);
7412 const auto& closure_class =
7414 const auto& closure_type =
Type::Handle(closure_class.DeclarationType());
7422 const auto& function_type =
7431 EXPECT_SUBTYPE(closure_type_nonnullable, function_type_nullable);
7432 EXPECT_SUBTYPE(closure_type_nonnullable, function_type_nonnullable);
7437 const auto& future_or_class =
7440 tav_function_nullable.SetTypeAt(0, function_type_nullable);
7441 tav_function_nullable = tav_function_nullable.Canonicalize(thread);
7443 tav_function_nonnullable.SetTypeAt(0, function_type_nonnullable);
7444 tav_function_nonnullable = tav_function_nonnullable.Canonicalize(thread);
7446 auto& future_or_function_type_nullable =
7449 auto& future_or_function_type_nonnullable =
7453 EXPECT_SUBTYPE(closure_type_nonnullable, future_or_function_type_nullable);
7454 EXPECT_SUBTYPE(closure_type_nonnullable, future_or_function_type_nonnullable);
7455 EXPECT_SUBTYPE(closure_type_nullable, future_or_function_type_nullable);
7457 future_or_function_type_nonnullable);
7464 auto& type_function_int_nullary =
7469 auto& type_nullable_function_int_nullary =
7478#undef EXPECT_NOT_SUBTYPE
7479#undef EXPECT_SUBTYPE
7482 const AbstractType& expected,
7483 const AbstractType& got,
7485 if (got.IsEquivalent(expected, kind))
return;
7489 buffer.AddString(
", got ");
7491 expect.Fail(
"%s",
buffer.buffer());
7494#define EXPECT_TYPES_EQUAL(expected, got) \
7495 ExpectTypesEquivalent(Expect(__FILE__, __LINE__), expected, got, \
7496 TypeEquality::kCanonical);
7499 const char* kScript = R
"(
7501 class A1<X, Y> implements B<List<Y>> {}
7502 class A2<X, Y> extends A1<Y, X> {}
7506 TransitionNativeToVM transition(thread);
7507 Zone*
const zone = thread->zone();
7509 const auto& root_lib =
7511 EXPECT(!root_lib.IsNull());
7519 const auto& decl_type_b =
Type::Handle(zone, class_b.DeclarationType());
7520 const auto& decl_type_list =
Type::Handle(zone, class_list.DeclarationType());
7521 const auto& null_tav = Object::null_type_arguments();
7525 const auto& decl_type_a1 =
Type::Handle(zone, class_a1.DeclarationType());
7526 const auto& decl_type_args_a1 =
7528 const auto& type_arg_a1_y =
7529 TypeParameter::CheckedHandle(zone, decl_type_args_a1.TypeAt(1));
7531 tav_a1_y.SetTypeAt(0, type_arg_a1_y);
7532 tav_a1_y = tav_a1_y.Canonicalize(thread);
7533 auto& type_list_a1_y = Type::CheckedHandle(
7534 zone, decl_type_list.InstantiateFrom(tav_a1_y, null_tav,
kAllFree,
7536 type_list_a1_y ^= type_list_a1_y.Canonicalize(thread);
7538 tav_list_a1_y.SetTypeAt(0, type_list_a1_y);
7539 tav_list_a1_y = tav_list_a1_y.Canonicalize(thread);
7540 auto& type_b_list_a1_y = Type::CheckedHandle(
7541 zone, decl_type_b.InstantiateFrom(tav_list_a1_y, null_tav,
kAllFree,
7543 type_b_list_a1_y ^= type_b_list_a1_y.Canonicalize(thread);
7545 const auto& inst_b_a1 =
7546 Type::Handle(zone, class_a1.GetInstantiationOf(zone, class_b));
7547 EXPECT(!inst_b_a1.IsNull());
7553 const auto& decl_type_a2 =
Type::Handle(zone, class_a2.DeclarationType());
7554 const auto& decl_type_args_a2 =
7556 const auto& type_arg_a2_x =
7557 TypeParameter::CheckedHandle(zone, decl_type_args_a2.TypeAt(0));
7559 tav_a2_x.SetTypeAt(0, type_arg_a2_x);
7560 tav_a2_x = tav_a2_x.Canonicalize(thread);
7561 auto& type_list_a2_x = Type::CheckedHandle(
7562 zone, decl_type_list.InstantiateFrom(tav_a2_x, null_tav,
kAllFree,
7564 type_list_a2_x ^= type_list_a2_x.Canonicalize(thread);
7566 tav_list_a2_x.SetTypeAt(0, type_list_a2_x);
7567 tav_list_a2_x = tav_list_a2_x.Canonicalize(thread);
7568 auto& type_b_list_a2_x = Type::CheckedHandle(
7569 zone, decl_type_b.InstantiateFrom(tav_list_a2_x, null_tav,
kAllFree,
7571 type_b_list_a2_x ^= type_b_list_a2_x.Canonicalize(thread);
7573 const auto& inst_b_a2 =
7574 Type::Handle(zone, class_a2.GetInstantiationOf(zone, class_b));
7580#undef EXPECT_TYPES_EQUAL
7582#define EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(expected, got) \
7583 ExpectTypesEquivalent(Expect(__FILE__, __LINE__), expected, got, \
7584 TypeEquality::kSyntactical);
7589 const auto& future_or_class =
7592 tav.SetTypeAt(0, param);
7602 const auto& future_class =
Class::Handle(object_store->future_class());
7604 tav.SetTypeAt(0, param);
7616 auto normalized_future_or = [&](
const AbstractType& param,
7638 const auto& type_nullable_object =
7648 const auto& type_non_nullable_object =
7649 Type::Handle(object_store->non_nullable_object_type());
7658 const auto& type_never =
Type::Handle(object_store->never_type());
7659 const auto& expected =
7669 const auto& type_null =
Type::Handle(object_store->null_type());
7670 const auto& expected =
7685 const auto& type_nullable_int =
7695TEST_CASE(AbstractType_InstantiatedFutureOrIsNormalized) {
7696 const char* kScript = R
"(
7699FutureOr<T>? foo<T>() { return null; }
7700FutureOr<T?> bar<T>() { return null; }
7705 TransitionNativeToVM transition(thread);
7706 Zone*
const zone = thread->zone();
7709 const auto& null_tav = Object::null_type_arguments();
7710 auto instantiate_future_or =
7711 [&](
const AbstractType&
generic,
7712 const AbstractType& param) -> AbstractTypePtr {
7714 tav.SetTypeAt(0, param);
7719 const auto& root_lib =
7721 EXPECT(!root_lib.IsNull());
7727 const auto& nullable_future_or_T =
7729 const auto& future_or_nullable_T =
7732 const auto& type_nullable_object =
7734 const auto& type_non_nullable_object =
7735 Type::Handle(object_store->non_nullable_object_type());
7743 instantiate_future_or(nullable_future_or_T, Object::dynamic_type()));
7749 instantiate_future_or(nullable_future_or_T, Object::void_type()));
7755 instantiate_future_or(nullable_future_or_T, type_nullable_object));
7763 instantiate_future_or(future_or_nullable_T, Object::dynamic_type()));
7769 instantiate_future_or(future_or_nullable_T, Object::void_type()));
7775 instantiate_future_or(future_or_nullable_T, type_nullable_object));
7783 instantiate_future_or(future_or_nullable_T, type_non_nullable_object));
7791 instantiate_future_or(nullable_future_or_T, type_non_nullable_object));
7795 const auto& type_never =
Type::Handle(object_store->never_type());
7796 const auto& type_null =
Type::Handle(object_store->null_type());
7801 const auto& expected =
7804 instantiate_future_or(future_or_nullable_T, type_never));
7811 const auto& expected =
7814 instantiate_future_or(nullable_future_or_T, type_never));
7821 const auto& expected =
7824 instantiate_future_or(future_or_nullable_T, type_null));
7831 const auto& expected =
7834 instantiate_future_or(nullable_future_or_T, type_null));
7838 const auto& type_nullable_int =
7840 const auto& type_non_nullable_int =
7849 instantiate_future_or(future_or_nullable_T, type_non_nullable_int));
7859 instantiate_future_or(future_or_nullable_T, type_nullable_int));
7869 instantiate_future_or(nullable_future_or_T, type_nullable_int));
7879 instantiate_future_or(nullable_future_or_T, type_non_nullable_int));
7884#define __ assembler->
7887 __ EnterDartFrame(0);
7890 const intptr_t uninstantiated_offset =
7892 const intptr_t inst_type_args_offset =
7894 const intptr_t fun_type_args_offset =
7898 uninstantiated_offset);
7900 inst_type_args_offset);
7902 fun_type_args_offset);
7904 __ Call(StubCode::InstantiateTypeArguments());
7909 __ LeaveDartFrame();
7916 Zone*
const zone = thread->zone();
7918 zone, thread->isolate_group()->class_table()->At(kInstanceCid));
7923 zone,
Function::New(signature, symbol, UntaggedFunction::kRegularFunction,
7924 false,
false,
false,
false,
false, klass,
7925 TokenPosition::kNoSource));
7927 compiler::ObjectPoolBuilder pool_builder;
7928 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
7929 compiler::Assembler assembler(&pool_builder);
7938 invoke_instantiate_tav.set_object_pool(
pool.ptr());
7939 invoke_instantiate_tav.set_owner(
function);
7940 invoke_instantiate_tav.set_exception_handlers(
7942#if defined(TARGET_ARCH_IA32)
7943 EXPECT_EQ(0,
pool.Length());
7945 EXPECT_EQ(1,
pool.Length());
7947 return invoke_instantiate_tav.ptr();
7950#if !defined(PRODUCT)
7957 buffer.AddString(
"class D<T> {}\n");
7958 for (intptr_t
i = 0;
i < num_classes;
i++) {
7959 buffer.Printf(
"class C%" Pd " { String toString() => 'C%" Pd "'; }\n",
i,
7962 buffer.AddString(
"main() {\n");
7963 for (intptr_t
i = 0;
i < num_classes;
i++) {
7964 buffer.Printf(
" C%" Pd "().toString();\n",
i);
7976 TransitionNativeToVM transition(thread);
7977 Zone*
const zone = thread->zone();
7979 const auto& root_lib =
7981 EXPECT(!root_lib.IsNull());
7984 ASSERT(!class_d.IsNull());
7985 const auto& decl_type_d =
Type::Handle(zone, class_d.DeclarationType());
7986 const auto& decl_type_d_type_args =
7989 EXPECT(!decl_type_d_type_args.HasInstantiations());
7994 const auto& function_type_args = Object::null_type_arguments();
8001 const auto& invoke_instantiate_tav =
8003 const auto& invoke_instantiate_tav_arguments =
8005 const auto& invoke_instantiate_tav_args_descriptor =
8007 for (intptr_t
i = 0;
i < num_classes; ++
i) {
8008 const bool updated_cache_is_linear =
8012 ASSERT(!class_c.IsNull());
8013 decl_type_c = class_c.DeclarationType();
8015 instantiator_type_args.SetTypeAt(0, decl_type_c);
8016 instantiator_type_args = instantiator_type_args.Canonicalize(thread);
8018#if !defined(PRODUCT)
8027 intptr_t old_capacity;
8029 SafepointMutexLocker ml(
8030 thread->isolate_group()->type_arguments_canonicalization_mutex());
8031 TypeArguments::Cache
cache(zone, decl_type_d_type_args);
8032 EXPECT_EQ(
i,
cache.NumOccupied());
8034 cache.FindKeyOrUnused(instantiator_type_args, function_type_args);
8036 old_capacity =
cache.NumEntries();
8039 decl_type_d_type_args.InstantiateAndCanonicalizeFrom(instantiator_type_args,
8040 function_type_args);
8043 TypeArguments::Cache::KeyLocation loc;
8044 bool storage_changed;
8046 SafepointMutexLocker ml(
8047 thread->isolate_group()->type_arguments_canonicalization_mutex());
8048 TypeArguments::Cache
cache(zone, decl_type_d_type_args);
8049 EXPECT_EQ(
i + 1,
cache.NumOccupied());
8052 loc =
cache.FindKeyOrUnused(instantiator_type_args, function_type_args);
8054 storage_changed =
cache.NumEntries() != old_capacity;
8057#if defined(TARGET_ARCH_IA32)
8058 const bool stub_checks_hash_caches =
false;
8060 const bool stub_checks_hash_caches =
true;
8064 if (updated_cache_is_linear || stub_checks_hash_caches) {
8065 invoke_instantiate_tav_arguments.SetAt(0, decl_type_d_type_args);
8066 invoke_instantiate_tav_arguments.SetAt(1, instantiator_type_args);
8067 invoke_instantiate_tav_arguments.SetAt(2, function_type_args);
8068 result_type_args ^= DartEntry::InvokeCode(
8069 invoke_instantiate_tav, invoke_instantiate_tav_args_descriptor,
8070 invoke_instantiate_tav_arguments, thread);
8071 EXPECT_EQ(1, result_type_args.Length());
8072 result_type = result_type_args.TypeAt(0);
8076#if !defined(PRODUCT)
8082 result_type_args = decl_type_d_type_args.InstantiateAndCanonicalizeFrom(
8083 instantiator_type_args, function_type_args);
8084 result_type = result_type_args.TypeAt(0);
8089 SafepointMutexLocker ml(
8090 thread->isolate_group()->type_arguments_canonicalization_mutex());
8091 TypeArguments::Cache
cache(zone, decl_type_d_type_args);
8092 EXPECT_EQ(
i + 1,
cache.NumOccupied());
8094 cache.FindKeyOrUnused(instantiator_type_args, function_type_args);
8096 EXPECT_EQ(loc.entry, loc2.entry);
8100 first_instantiator_type_args = instantiator_type_args.ptr();
8101 }
else if (storage_changed) {
8103 SafepointMutexLocker ml(
8104 thread->isolate_group()->type_arguments_canonicalization_mutex());
8105 TypeArguments::Cache
cache(zone, decl_type_d_type_args);
8106 EXPECT_EQ(
i + 1,
cache.NumOccupied());
8111 cache.FindKeyOrUnused(instantiator_type_args, function_type_args);
8119TEST_CASE(TypeArguments_Cache_SomeInstantiations) {
8126#if !defined(DEBUG) && !defined(USING_MEMORY_SANITIZER) && \
8127 !defined(USING_THREAD_SANITIZER) && !defined(USING_LEAK_SANITIZER) && \
8128 !defined(USING_UNDEFINED_BEHAVIOR_SANITIZER) && !defined(USING_SIMULATOR)
8129TEST_CASE(TypeArguments_Cache_ManyInstantiations) {
8130 const intptr_t kNumClasses = 100000;
8132 "too few classes to trigger change to a hash-based cache");
8137#undef EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT
8140 const SubtypeTestCache&
cache) {
8141 const intptr_t used_inputs =
cache.num_inputs();
8143 FAIL(
"Invalid number of used inputs: %" Pd "", used_inputs);
8147 for (intptr_t
i = 0;
i <
cache.NumEntries();
i++) {
8148 if (!
cache.IsOccupied(
i))
continue;
8151 const intptr_t
cid =
8158 int check_ordering = used_inputs;
8161#define USED_INPUT_CASE(Input, ExpectedCids) \
8162 case (Input) + 1: { \
8163 RELEASE_ASSERT((Input) + 1 == check_ordering); \
8164 const intptr_t cid = \
8165 array.At(entry_start + (Input))->GetClassIdMayBeSmi(); \
8166 if (!(ExpectedCids)) { \
8167 FAIL("expected: " #ExpectedCids ", got: cid %" Pd "", cid); \
8172 switch (used_inputs) {
8192 cid == kSmiCid ||
cid == kFunctionTypeCid);
8198#undef USED_INPUT_CASE
8215 const SubtypeTestCache&
cache,
8216 const Object& instance_class_id_or_signature,
8217 const AbstractType& destination_type,
8218 const TypeArguments& instance_type_arguments,
8219 const TypeArguments& instantiator_type_arguments,
8220 const TypeArguments& function_type_arguments,
8221 const TypeArguments& parent_function_type_arguments,
8222 const TypeArguments& delayed_type_arguments,
8223 const Bool& expected_result,
8225 const auto& tav_null = TypeArguments::null_type_arguments();
8226 const intptr_t num_inputs =
cache.num_inputs();
8227 const bool was_hash =
cache.IsHash();
8228 const intptr_t old_count =
cache.NumberOfChecks();
8229 intptr_t expected_index, got_index;
8232 instance_class_id_or_signature, destination_type, instance_type_arguments,
8233 instantiator_type_arguments, function_type_arguments,
8234 parent_function_type_arguments, delayed_type_arguments,
nullptr,
8237 SafepointMutexLocker ml(
8238 thread->isolate_group()->subtype_test_cache_mutex());
8240 cache.AddCheck(instance_class_id_or_signature, destination_type,
8241 instance_type_arguments, instantiator_type_arguments,
8242 function_type_arguments, parent_function_type_arguments,
8243 delayed_type_arguments, expected_result);
8244 EXPECT(expected_index >= 0);
8246 EXPECT_EQ(old_count + 1,
cache.NumberOfChecks());
8247 EXPECT(
cache.HasCheck(instance_class_id_or_signature, destination_type,
8248 instance_type_arguments, instantiator_type_arguments,
8249 function_type_arguments, parent_function_type_arguments,
8250 delayed_type_arguments, &got_index, got_result));
8251 EXPECT_EQ(expected_index, got_index);
8252 EXPECT(got_result->ptr() == expected_result.ptr());
8255 EXPECT(
cache.HasCheck(instance_class_id_or_signature, destination_type,
8256 tav_null, instantiator_type_arguments,
8257 function_type_arguments,
8258 parent_function_type_arguments,
8259 delayed_type_arguments, &got_index, got_result));
8260 EXPECT_EQ(expected_index, got_index);
8261 EXPECT(got_result->ptr() == expected_result.ptr());
8265 instance_class_id_or_signature, destination_type, tav_null,
8266 instantiator_type_arguments, function_type_arguments,
8267 parent_function_type_arguments, delayed_type_arguments,
8272 EXPECT(
cache.HasCheck(instance_class_id_or_signature, destination_type,
8273 instance_type_arguments, tav_null,
8274 function_type_arguments,
8275 parent_function_type_arguments,
8276 delayed_type_arguments, &got_index, got_result));
8277 EXPECT_EQ(expected_index, got_index);
8278 EXPECT(got_result->ptr() == expected_result.ptr());
8282 instance_class_id_or_signature, destination_type,
8283 instance_type_arguments, tav_null, function_type_arguments,
8284 parent_function_type_arguments, delayed_type_arguments,
8289 EXPECT(
cache.HasCheck(instance_class_id_or_signature, destination_type,
8290 instance_type_arguments, instantiator_type_arguments,
8291 tav_null, parent_function_type_arguments,
8292 delayed_type_arguments, &got_index, got_result));
8293 EXPECT_EQ(expected_index, got_index);
8294 EXPECT(got_result->ptr() == expected_result.ptr());
8297 EXPECT(!
cache.HasCheck(instance_class_id_or_signature, destination_type,
8298 instance_type_arguments, instantiator_type_arguments,
8299 tav_null, parent_function_type_arguments,
8300 delayed_type_arguments,
8306 EXPECT(
cache.HasCheck(instance_class_id_or_signature, destination_type,
8307 instance_type_arguments, instantiator_type_arguments,
8308 function_type_arguments, tav_null,
8309 delayed_type_arguments, &got_index, got_result));
8310 EXPECT_EQ(expected_index, got_index);
8311 EXPECT(got_result->ptr() == expected_result.ptr());
8314 EXPECT(!
cache.HasCheck(instance_class_id_or_signature, destination_type,
8315 instance_type_arguments, instantiator_type_arguments,
8316 function_type_arguments, tav_null,
8317 delayed_type_arguments,
nullptr,
8323 EXPECT(
cache.HasCheck(instance_class_id_or_signature, destination_type,
8324 instance_type_arguments, instantiator_type_arguments,
8325 function_type_arguments,
8326 parent_function_type_arguments, tav_null, &got_index,
8328 EXPECT_EQ(expected_index, got_index);
8329 EXPECT(got_result->ptr() == expected_result.ptr());
8332 EXPECT(!
cache.HasCheck(instance_class_id_or_signature, destination_type,
8333 instance_type_arguments, instantiator_type_arguments,
8334 function_type_arguments,
8335 parent_function_type_arguments, tav_null,
8342 EXPECT(
cache.HasCheck(instance_class_id_or_signature, Object::void_type(),
8343 instance_type_arguments, instantiator_type_arguments,
8344 function_type_arguments,
8345 parent_function_type_arguments,
8346 delayed_type_arguments, &got_index, got_result));
8347 EXPECT_EQ(expected_index, got_index);
8348 EXPECT(got_result->ptr() == expected_result.ptr());
8351 EXPECT(!
cache.HasCheck(instance_class_id_or_signature, Object::void_type(),
8352 instance_type_arguments, instantiator_type_arguments,
8353 function_type_arguments,
8354 parent_function_type_arguments,
8355 delayed_type_arguments,
8363 intptr_t num_classes,
8366 buffer.AddString(
"class D {}\n");
8367 buffer.AddString(
"D createInstanceD() => D();");
8368 buffer.AddString(
"D Function() createClosureD() => () => D();\n");
8369 for (intptr_t
i = 0;
i < num_classes;
i++) {
8370 buffer.Printf(R
"(class C%)" Pd R"( extends D {}
8372 R"(C%)" Pd R"( createInstanceC%)" Pd R"(() => C%)" Pd
8375 R"(C%)" Pd R"( Function() createClosureC%)" Pd
8376 R"(() => () => C%)" Pd
8388 TransitionNativeToVM transition(thread);
8389 Zone*
const zone = thread->zone();
8391 const auto& root_lib =
8393 EXPECT(!root_lib.IsNull());
8396 ASSERT(!class_d.IsNull());
8398 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
8401 const auto& instance_d =
8402 Instance::CheckedHandle(zone,
Invoke(root_lib,
"createInstanceD"));
8403 auto& type_instance_d_int =
8404 Type::CheckedHandle(zone, instance_d.GetType(
Heap::kNew));
8405 const auto& closure_d =
8406 Instance::CheckedHandle(zone,
Invoke(root_lib,
"createClosureD"));
8407 ASSERT(!closure_d.IsNull());
8408 auto& type_closure_d_int =
8409 FunctionType::CheckedHandle(zone, closure_d.GetType(
Heap::kNew));
8422 auto& instance_type_arguments =
8425 instance_type_arguments = instance_type_arguments.Canonicalize(thread);
8426 auto& instantiator_type_arguments =
8429 instantiator_type_arguments =
8430 instantiator_type_arguments.Canonicalize(thread);
8431 auto& function_type_arguments =
8434 function_type_arguments = function_type_arguments.Canonicalize(thread);
8435 auto& parent_function_type_arguments =
8437 parent_function_type_arguments.SetTypeAt(
8439 parent_function_type_arguments =
8440 parent_function_type_arguments.Canonicalize(thread);
8441 auto& delayed_type_arguments =
8444 delayed_type_arguments = delayed_type_arguments.Canonicalize(thread);
8446 for (intptr_t
i = 0;
i < num_classes; ++
i) {
8453 ASSERT(!class_c.IsNull());
8455 SafepointWriteRwLocker ml(thread,
8456 thread->isolate_group()->program_lock());
8459 auto const instance_name =
OS::SCreate(zone,
"createInstanceC%" Pd "",
i);
8460 instance_c ^=
Invoke(root_lib, instance_name);
8461 EXPECT(!instance_c.IsClosure());
8462 instance_class_id_or_signature =
Smi::New(instance_c.GetClassId());
8464 for (intptr_t
i = 0;
i < 5;
i++) {
8466 thread, *stcs[
i], instance_class_id_or_signature, type_instance_d_int,
8467 instance_type_arguments, instantiator_type_arguments,
8468 function_type_arguments, parent_function_type_arguments,
8469 delayed_type_arguments, expected_result, &got_result);
8475 instance_class_id_or_signature = closure_c.function();
8476 instance_class_id_or_signature =
8477 Function::Cast(instance_class_id_or_signature).signature();
8481 thread, *stcs[
i], instance_class_id_or_signature, type_closure_d_int,
8482 instance_type_arguments, instantiator_type_arguments,
8483 function_type_arguments, parent_function_type_arguments,
8484 delayed_type_arguments, expected_result, &got_result);
8489 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::kNonNullable, 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
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 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)
ObjectAccumulator(GrowableArray< Object * > *objects)
static ObjectPoolPtr NewFromBuilder(const compiler::ObjectPoolBuilder &builder)
bool IsFreeListElement() const
UntaggedObject * untag() const
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()
bool Run(Args &&... args)
static Thread * Current()
Isolate * isolate() const
IsolateGroup * isolate_group() const
ToggleBreakpointTask(IsolateGroup *isolate_group, Dart_Isolate isolate, std::atomic< bool > *done)
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 StringType()
static TypePtr BoolType()
static TypePtr DynamicType()
static TypePtr New(const Class &clazz, const TypeArguments &arguments, Nullability nullability=Nullability::kNonNullable, Heap::Space space=Heap::kOld)
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 ObjectPtr FromAddr(uword addr)
static uword ToAddr(const UntaggedObject *raw_obj)
intptr_t HeapSize() const
static int SNPrint(char *str, size_t size, const char *format,...) PRINTF_ATTRIBUTE(3
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
const uint8_t uint32_t uint32_t GError ** error
Dart_NativeFunction function
#define HANDLESCOPE(thread)
static float max(float r, float g, float b)
static constexpr intptr_t kWordSize
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)
ISOLATE_UNIT_TEST_CASE_WITH_EXPECTATION(SafepointOperation_NonDeoptAndDeoptNesting, "Crash")
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)
CAllocUniquePtr< char > CStringUniquePtr
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)
ISOLATE_UNIT_TEST_CASE(StackAllocatedDestruction)
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)
TEST_CASE(DirectoryCurrent)
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 void CollectAllGarbage(Thread *thread, JSONStream *js)
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)
@ kCurrentAndEnclosingFree
static void WeakReference_Clear_ReachableThroughWeakProperty(Thread *thread, Heap::Space space)
static TypePtr CreateFutureOrType(const AbstractType ¶m, Nullability nullability)
DECLARE_FLAG(bool, show_invisible_frames)
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
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 buffer
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 set
std::function< void()> closure
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 EXPECT_VALID(handle)
#define ARRAY_SIZE(array)