30 if (expected.IsSmi()) {
32 return expected.
ptr() == actual.
ptr();
36 if (expected.IsDouble()) {
37 if (actual.IsDouble()) {
40 dbl1 ^= expected.
ptr();
46 if (expected.IsBool()) {
47 if (actual.IsBool()) {
48 return expected.
ptr() == actual.
ptr();
62 EXPECT_EQ(first->
type, second->
type);
63 switch (first->
type) {
110 std::unique_ptr<Message>
message =
120 std::unique_ptr<Message>
message =
130 std::unique_ptr<Message>
message =
135 const Object& serialized_object =
142 EXPECT_NOTNULL(
root);
156 const Object& serialized_object =
163 EXPECT_NOTNULL(
root);
165 EXPECT_EQ(smi.
Value(),
root->value.as_int32);
178 const Object& serialized_object =
185 EXPECT_NOTNULL(
root);
187 EXPECT_EQ(smi.
Value(),
root->value.as_int32);
201 const Object& serialized_object =
203 EXPECT(serialized_object.IsMint());
208 EXPECT_NOTNULL(
root);
225#if defined(ARCH_IS_64_BIT) && !defined(DART_COMPRESSED_POINTERS)
267 const Object& serialized_object =
274 EXPECT_NOTNULL(
root);
276 EXPECT_EQ(dbl.
value(),
root->value.as_double);
289 const Object& serialized_object =
298 EXPECT_NOTNULL(
root);
300 EXPECT_EQ(
true,
root->value.as_bool);
313 const Object& serialized_object =
320 EXPECT_NOTNULL(
root);
322 EXPECT_EQ(
false,
root->value.as_bool);
329 std::unique_ptr<Message>
message =
337 EXPECT_EQ(
static_cast<uint64_t
>(12345), obj.
Id());
342 EXPECT_NOTNULL(
root);
344 int64_t
id =
root->value.as_capability.id;
345 EXPECT_EQ(12345,
id);
349#define TEST_ROUND_TRIP_IDENTICAL(object) \
351 const Object& before = Object::Handle(object); \
352 std::unique_ptr<Message> message = \
353 WriteMessage( false, before, ILLEGAL_PORT, \
354 Message::kNormalPriority); \
355 const Object& after = Object::Handle(ReadMessage(thread, message.get())); \
356 EXPECT(before.ptr() == after.ptr()); \
391 EXPECT_STREQ(cstr,
root->value.as_string);
396 TestString(
"This string shall be serialized");
412 const int kArrayLength = 10;
415 for (
int i = 0;
i < kArrayLength;
i++) {
431 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
432 for (
int i = 0;
i < kArrayLength;
i++) {
442 const int kArrayLength = 10;
447 for (
int i = 0;
i < kArrayLength;
i++) {
463 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
464 for (
int i = 0;
i < kArrayLength;
i++) {
476 root.value.as_array.values =
nullptr;
499 root.value.as_typed_data.length =
509 root.value.as_typed_data.length =
519 root.value.as_external_typed_data.length =
525TEST_CASE(FailSerializeLargeUnmodifiableExternalTypedData) {
529 root.value.as_external_typed_data.length =
537 const int kArrayLength = 0;
551 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
552 EXPECT(
root->value.as_array.values ==
nullptr);
558 const int kTypedDataLength = 256;
561 for (
int i = 0;
i < kTypedDataLength;
i++) {
562 typed_data.SetUint8(
i,
i);
564 std::unique_ptr<Message>
message =
577 EXPECT_EQ(kTypedDataLength,
root->value.as_typed_data.length);
578 for (
int i = 0;
i < kTypedDataLength;
i++) {
584#define TEST_TYPED_ARRAY(darttype, ctype) \
586 StackZone zone(thread); \
587 const int kArrayLength = 127; \
588 TypedData& array = TypedData::Handle( \
589 TypedData::New(kTypedData##darttype##ArrayCid, kArrayLength)); \
590 intptr_t scale = array.ElementSizeInBytes(); \
591 for (int i = 0; i < kArrayLength; i++) { \
592 array.Set##darttype((i * scale), i); \
594 std::unique_ptr<Message> message = \
595 WriteMessage( false, array, ILLEGAL_PORT, \
596 Message::kNormalPriority); \
597 TypedData& serialized_array = TypedData::Handle(); \
598 serialized_array ^= ReadMessage(thread, message.get()); \
599 for (int i = 0; i < kArrayLength; i++) { \
600 EXPECT_EQ(static_cast<ctype>(i), \
601 serialized_array.Get##darttype(i* scale)); \
605#define TEST_EXTERNAL_TYPED_ARRAY(darttype, ctype) \
607 StackZone zone(thread); \
608 ctype data[] = {0, 11, 22, 33, 44, 55, 66, 77}; \
609 intptr_t length = ARRAY_SIZE(data); \
610 ExternalTypedData& array = ExternalTypedData::Handle( \
611 ExternalTypedData::New(kExternalTypedData##darttype##ArrayCid, \
612 reinterpret_cast<uint8_t*>(data), length)); \
613 intptr_t scale = array.ElementSizeInBytes(); \
614 std::unique_ptr<Message> message = \
615 WriteMessage( false, array, ILLEGAL_PORT, \
616 Message::kNormalPriority); \
617 ExternalTypedData& serialized_array = ExternalTypedData::Handle(); \
618 serialized_array ^= ReadMessage(thread, message.get()); \
619 for (int i = 0; i < length; i++) { \
620 EXPECT_EQ(static_cast<ctype>(data[i]), \
621 serialized_array.Get##darttype(i* scale)); \
625#define TEST_UNMODIFIABLE_EXTERNAL_TYPED_ARRAY(darttype, ctype) \
627 StackZone zone(thread); \
628 ctype data[] = {0, 11, 22, 33, 44, 55, 66, 77}; \
629 intptr_t length = ARRAY_SIZE(data); \
630 ExternalTypedData& array = ExternalTypedData::Handle( \
631 ExternalTypedData::New(kExternalTypedData##darttype##ArrayCid, \
632 reinterpret_cast<uint8_t*>(data), length)); \
633 TypedDataView& view = TypedDataView::Handle(TypedDataView::New( \
634 kUnmodifiableTypedData##darttype##ArrayViewCid, array, 0, length)); \
635 intptr_t scale = array.ElementSizeInBytes(); \
636 std::unique_ptr<Message> message = WriteMessage( \
637 false, view, ILLEGAL_PORT, Message::kNormalPriority); \
638 TypedDataView& serialized_view = TypedDataView::Handle(); \
639 serialized_view ^= ReadMessage(thread, message.get()); \
640 for (int i = 0; i < length; i++) { \
641 EXPECT_EQ(static_cast<ctype>(data[i]), \
642 serialized_view.Get##darttype(i* scale)); \
687 const int kTypedDataLength = 0;
690 std::unique_ptr<Message>
message =
704 EXPECT_EQ(kTypedDataLength,
root->value.as_typed_data.length);
705 EXPECT(
root->value.as_typed_data.values ==
nullptr);
711 const char* kScriptChars =
713 " Fields(int i, int j) : fld1 = i, fld2 = j {}\n"
716 " final int bigint_fld = 0xfffffffffff;\n"
717 " static int? fld3;\n"
718 " static const int smi_sfld = 10;\n"
719 " static const int bigint_sfld = 0xfffffffffff;\n"
722 " static void equals(x, y) {\n"
723 " if (x != y) throw new ArgumentError('not equal');\n"
726 "class FieldsTest {\n"
727 " static Fields testMain() {\n"
728 " Expect.equals(true, Fields.bigint_sfld == 0xfffffffffff);\n"
729 " Fields obj = new Fields(10, 20);\n"
730 " Expect.equals(true, obj.bigint_fld == 0xfffffffffff);\n"
737 uint8_t* isolate_snapshot_data_buffer;
789 free(isolate_snapshot_data_buffer);
794 const char* dart_function) {
818 EXPECT_NOTNULL(
root);
820 EXPECT_STREQ(expected,
root->value.as_string);
834 EXPECT_NOTNULL(
root);
840 "final int kArrayLength = 10;\n"
844 "getAsciiString() {\n"
845 " return \"Hello, world!\";\n"
847 "getNonAsciiString() {\n"
848 " return \"Blåbærgrød\";\n"
850 "getNonBMPString() {\n"
851 " return \"\\u{10000}\\u{1F601}\\u{1F637}\\u{20000}\";\n"
853 "getLeadSurrogateString() {\n"
854 " return String.fromCharCodes([0xd800]);\n"
856 "getTrailSurrogateString() {\n"
857 " return \"\\u{10000}\".substring(1);\n"
859 "getSurrogatesString() {\n"
860 " return String.fromCharCodes([0xdc00, 0xdc00, 0xd800, 0xd800]);\n"
862 "getCrappyString() {\n"
863 " return String.fromCharCodes([0xd800, 32, 0xdc00, 32]);\n"
866 " return List.filled(kArrayLength, null);\n"
871 EXPECT(isolate !=
nullptr);
882 ascii_string_result =
888 non_ascii_string_result =
894 non_bmp_string_result =
900 lead_surrogate_string_result =
906 trail_surrogate_string_result =
912 surrogates_string_result =
918 crappy_string_result =
939 EXPECT_NOTNULL(
root);
941 EXPECT_EQ(42,
root->value.as_int32);
945 CheckString(non_ascii_string_result,
"Blåbærgrød");
961 const int kArrayLength = 10;
962 const char* kScriptChars =
963 "final int kArrayLength = 10;\n"
965 " return List.filled(kArrayLength, null);\n"
968 " var list = List<int>.filled(kArrayLength, 0);\n"
969 " for (var i = 0; i < kArrayLength; i++) list[i] = i;\n"
972 "getStringList() {\n"
973 " var list = List<String>.filled(kArrayLength, '');\n"
974 " for (var i = 0; i < kArrayLength; i++) list[i] = i.toString();\n"
978 " var list = List<dynamic>.filled(kArrayLength, null);\n"
1004 EXPECT_NOTNULL(
root);
1006 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1007 for (
int i = 0;
i < kArrayLength;
i++) {
1017 EXPECT_NOTNULL(
root);
1019 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1020 for (
int i = 0;
i < kArrayLength;
i++) {
1022 EXPECT_EQ(
i,
root->value.as_array.values[
i]->value.as_int32);
1031 EXPECT_NOTNULL(
root);
1033 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1034 for (
int i = 0;
i < kArrayLength;
i++) {
1038 EXPECT_STREQ(
buffer,
root->value.as_array.values[
i]->value.as_string);
1046 EXPECT_NOTNULL(
root);
1048 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1051 EXPECT_EQ(0,
root->value.as_array.values[0]->value.as_int32);
1053 EXPECT_STREQ(
"1",
root->value.as_array.values[1]->value.as_string);
1055 EXPECT_EQ(2.2,
root->value.as_array.values[2]->value.as_double);
1057 EXPECT_EQ(
true,
root->value.as_array.values[3]->value.as_bool);
1059 for (
int i = 0;
i < kArrayLength;
i++) {
1071 const int kArrayLength = 10;
1072 const char* kScriptChars =
1073 "final int kArrayLength = 10;\n"
1075 " return [null, null, null, null, null, null, null, null, null, null];\n"
1078 " return [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];\n"
1080 "getStringList() {\n"
1081 " return ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];\n"
1084 " return <dynamic>[[],"
1090 " [0, 1, 2, 3, 4, 5],"
1091 " [0, 1, 2, 3, 4, 5, 6],"
1092 " [0, 1, 2, 3, 4, 5, 6, 7],"
1093 " [0, 1, 2, 3, 4, 5, 6, 7, 8]];\n"
1095 "getMixedList() {\n"
1100 " list.add(true);\n"
1102 " list.add(<dynamic>[[]]);\n"
1103 " list.add(<dynamic>[<dynamic>[[]]]);\n"
1104 " list.add(<dynamic>[1, <dynamic>[2, [3]]]);\n"
1105 " list.add(<dynamic>[1, <dynamic>[1, 2, [1, 2, 3]]]);\n"
1106 " list.add([1, 2, 3]);\n"
1128 EXPECT_NOTNULL(
root);
1130 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1131 for (
int i = 0;
i < kArrayLength;
i++) {
1141 EXPECT_NOTNULL(
root);
1143 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1144 for (
int i = 0;
i < kArrayLength;
i++) {
1146 EXPECT_EQ(
i,
root->value.as_array.values[
i]->value.as_int32);
1155 EXPECT_NOTNULL(
root);
1157 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1158 for (
int i = 0;
i < kArrayLength;
i++) {
1162 EXPECT_STREQ(
buffer,
root->value.as_array.values[
i]->value.as_string);
1170 EXPECT_NOTNULL(
root);
1172 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1173 for (
int i = 0;
i < kArrayLength;
i++) {
1177 for (
int j = 0; j <
i; j++) {
1189 EXPECT_NOTNULL(
root);
1191 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1194 EXPECT_EQ(0,
root->value.as_array.values[0]->value.as_int32);
1196 EXPECT_STREQ(
"1",
root->value.as_array.values[1]->value.as_string);
1198 EXPECT_EQ(2.2,
root->value.as_array.values[2]->value.as_double);
1200 EXPECT_EQ(
true,
root->value.as_array.values[3]->value.as_bool);
1202 for (
int i = 0;
i < kArrayLength;
i++) {
1212 element =
root->value.as_array.values[4];
1216 element =
root->value.as_array.values[5];
1223 element =
root->value.as_array.values[6];
1233 element =
root->value.as_array.values[7];
1237 EXPECT_EQ(1,
e->value.as_int32);
1243 EXPECT_EQ(2,
e->value.as_int32);
1249 EXPECT_EQ(3,
e->value.as_int32);
1252 element =
root->value.as_array.values[8];
1258 EXPECT_EQ(1,
e->value.as_int32);
1262 for (
int i = 0;
i < 2;
i++) {
1265 EXPECT_EQ(
i + 1,
e->value.as_int32);
1270 for (
int i = 0;
i < 3;
i++) {
1273 EXPECT_EQ(
i + 1,
e->value.as_int32);
1277 element =
root->value.as_array.values[9];
1279 for (
int i = 0;
i < 3;
i++) {
1282 EXPECT_EQ(
i + 1,
e->value.as_int32);
1291 const int kArrayLength = 10;
1292 const char* kScriptChars =
1293 "import 'dart:typed_data';\n"
1294 "final int kArrayLength = 10;\n"
1295 "getStringList() {\n"
1296 " var s = 'Hello, world!';\n"
1297 " var list = List<String>.filled(kArrayLength, '');\n"
1298 " for (var i = 0; i < kArrayLength; i++) list[i] = s;\n"
1302 " var mint = 0x7FFFFFFFFFFFFFFF;\n"
1303 " var list = List.filled(kArrayLength, 0);\n"
1304 " for (var i = 0; i < kArrayLength; i++) list[i] = mint;\n"
1307 "getDoubleList() {\n"
1309 " var list = List<double>.filled(kArrayLength, 0.0);\n"
1310 " for (var i = 0; i < kArrayLength; i++) list[i] = d;\n"
1313 "getTypedDataList() {\n"
1314 " var byte_array = Uint8List(256);\n"
1315 " var list = List<dynamic>.filled(kArrayLength, null);\n"
1316 " for (var i = 0; i < kArrayLength; i++) list[i] = byte_array;\n"
1319 "getTypedDataViewList() {\n"
1320 " var uint8_list = Uint8List(256);\n"
1321 " uint8_list[64] = 1;\n"
1322 " var uint8_list_view =\n"
1323 " Uint8List.view(uint8_list.buffer, 64, 128);\n"
1324 " var list = List<dynamic>.filled(kArrayLength, null);\n"
1325 " for (var i = 0; i < kArrayLength; i++) list[i] = uint8_list_view;\n"
1328 "getMixedList() {\n"
1329 " var list = List<dynamic>.filled(kArrayLength, null);\n"
1330 " for (var i = 0; i < kArrayLength; i++) {\n"
1331 " list[i] = ((i % 2) == 0) ? 'A' : 2.72;\n"
1335 "getSelfRefList() {\n"
1336 " var list = List<dynamic>.filled(kArrayLength, null, growable: true);\n"
1337 " for (var i = 0; i < kArrayLength; i++) {\n"
1338 " list[i] = list;\n"
1361 EXPECT_NOTNULL(
root);
1363 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1364 for (
int i = 0;
i < kArrayLength;
i++) {
1366 EXPECT_EQ(
root->value.as_array.values[0], element);
1376 EXPECT_NOTNULL(
root);
1378 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1379 for (
int i = 0;
i < kArrayLength;
i++) {
1381 EXPECT_EQ(
root->value.as_array.values[0], element);
1391 EXPECT_NOTNULL(
root);
1393 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1397 for (
int i = 1;
i < kArrayLength;
i++) {
1398 element =
root->value.as_array.values[
i];
1408 EXPECT_NOTNULL(
root);
1410 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1411 for (
int i = 0;
i < kArrayLength;
i++) {
1413 EXPECT_EQ(
root->value.as_array.values[0], element);
1421 std::unique_ptr<Message>
message =
1425 EXPECT_NOTNULL(
root);
1427 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1428 for (
int i = 0;
i < kArrayLength;
i++) {
1430 EXPECT_EQ(
root->value.as_array.values[0], element);
1443 EXPECT_NOTNULL(
root);
1445 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1449 element =
root->value.as_array.values[1];
1452 for (
int i = 2;
i < kArrayLength;
i++) {
1453 element =
root->value.as_array.values[
i];
1455 EXPECT_EQ(
root->value.as_array.values[0], element);
1469 EXPECT_NOTNULL(
root);
1471 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1472 for (
int i = 0;
i < kArrayLength;
i++) {
1475 EXPECT_EQ(
root, element);
1484 const int kArrayLength = 10;
1485 const char* kScriptChars =
1486 "import 'dart:typed_data';\n"
1487 "final int kArrayLength = 10;\n"
1488 "getStringList() {\n"
1489 " var s = 'Hello, world!';\n"
1490 " var list = [s, s, s, s, s, s, s, s, s, s];\n"
1494 " var mint = 0x7FFFFFFFFFFFFFFF;\n"
1495 " var list = [mint, mint, mint, mint, mint,\n"
1496 " mint, mint, mint, mint, mint];\n"
1499 "getDoubleList() {\n"
1501 " var list = [3.14, 3.14, 3.14, 3.14, 3.14, 3.14];\n"
1502 " list.add(3.14);\n"
1503 " list.add(3.14);\n"
1504 " list.add(3.14);\n"
1505 " list.add(3.14);\n"
1508 "getTypedDataList() {\n"
1509 " var byte_array = new Uint8List(256);\n"
1511 " for (var i = 0; i < kArrayLength; i++) {\n"
1512 " list.add(byte_array);\n"
1516 "getTypedDataViewList() {\n"
1517 " var uint8_list = new Uint8List(256);\n"
1518 " uint8_list[64] = 1;\n"
1519 " var uint8_list_view =\n"
1520 " new Uint8List.view(uint8_list.buffer, 64, 128);\n"
1522 " for (var i = 0; i < kArrayLength; i++) {\n"
1523 " list.add(uint8_list_view);\n"
1527 "getMixedList() {\n"
1529 " for (var i = 0; i < kArrayLength; i++) {\n"
1530 " list.add(((i % 2) == 0) ? '.' : 2.72);\n"
1534 "getSelfRefList() {\n"
1536 " for (var i = 0; i < kArrayLength; i++) {\n"
1537 " list.add(list);\n"
1560 EXPECT_NOTNULL(
root);
1562 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1563 for (
int i = 0;
i < kArrayLength;
i++) {
1565 EXPECT_EQ(
root->value.as_array.values[0], element);
1575 EXPECT_NOTNULL(
root);
1577 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1578 for (
int i = 0;
i < kArrayLength;
i++) {
1580 EXPECT_EQ(
root->value.as_array.values[0], element);
1590 EXPECT_NOTNULL(
root);
1592 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1596 for (
int i = 1;
i < kArrayLength;
i++) {
1597 element =
root->value.as_array.values[
i];
1607 EXPECT_NOTNULL(
root);
1609 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1610 for (
int i = 0;
i < kArrayLength;
i++) {
1612 EXPECT_EQ(
root->value.as_array.values[0], element);
1620 std::unique_ptr<Message>
message =
1624 EXPECT_NOTNULL(
root);
1626 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1627 for (
int i = 0;
i < kArrayLength;
i++) {
1629 EXPECT_EQ(
root->value.as_array.values[0], element);
1642 EXPECT_NOTNULL(
root);
1644 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1648 element =
root->value.as_array.values[1];
1651 for (
int i = 2;
i < kArrayLength;
i++) {
1654 EXPECT_EQ(
root->value.as_array.values[0], element);
1668 EXPECT_NOTNULL(
root);
1670 EXPECT_EQ(kArrayLength,
root->value.as_array.length);
1671 for (
int i = 0;
i < kArrayLength;
i++) {
1674 EXPECT_EQ(
root, element);
1691 static const char* kScriptChars =
1692 "import 'dart:typed_data';\n"
1693 "getTypedDataList() {\n"
1694 " var list = List<dynamic>.filled(13, null);\n"
1696 " list[index++] = Int8List(256);\n"
1697 " list[index++] = Uint8List(256);\n"
1698 " list[index++] = Int16List(256);\n"
1699 " list[index++] = Uint16List(256);\n"
1700 " list[index++] = Int32List(256);\n"
1701 " list[index++] = Uint32List(256);\n"
1702 " list[index++] = Int64List(256);\n"
1703 " list[index++] = Uint64List(256);\n"
1704 " list[index++] = Float32List(256);\n"
1705 " list[index++] = Float64List(256);\n"
1706 " list[index++] = Int32x4List(256);\n"
1707 " list[index++] = Float32x4List(256);\n"
1708 " list[index++] = Float64x2List(256);\n"
1711 "getTypedDataViewList() {\n"
1712 " var list = List<dynamic>.filled(45, null);\n"
1714 " list[index++] = Int8List.view(Int8List(256).buffer);\n"
1715 " list[index++] = Uint8List.view(Uint8List(256).buffer);\n"
1716 " list[index++] = Int16List.view(new Int16List(256).buffer);\n"
1717 " list[index++] = Uint16List.view(new Uint16List(256).buffer);\n"
1718 " list[index++] = Int32List.view(new Int32List(256).buffer);\n"
1719 " list[index++] = Uint32List.view(new Uint32List(256).buffer);\n"
1720 " list[index++] = Int64List.view(new Int64List(256).buffer);\n"
1721 " list[index++] = Uint64List.view(new Uint64List(256).buffer);\n"
1722 " list[index++] = Float32List.view(new Float32List(256).buffer);\n"
1723 " list[index++] = Float64List.view(new Float64List(256).buffer);\n"
1724 " list[index++] = Int32x4List.view(new Int32x4List(256).buffer);\n"
1725 " list[index++] = Float32x4List.view(new Float32x4List(256).buffer);\n"
1726 " list[index++] = Float64x2List.view(new Float64x2List(256).buffer);\n"
1728 " list[index++] = Int8List.view(new Int16List(256).buffer);\n"
1729 " list[index++] = Uint8List.view(new Uint16List(256).buffer);\n"
1730 " list[index++] = Int8List.view(new Int32List(256).buffer);\n"
1731 " list[index++] = Uint8List.view(new Uint32List(256).buffer);\n"
1732 " list[index++] = Int8List.view(new Int64List(256).buffer);\n"
1733 " list[index++] = Uint8List.view(new Uint64List(256).buffer);\n"
1734 " list[index++] = Int8List.view(new Float32List(256).buffer);\n"
1735 " list[index++] = Uint8List.view(new Float32List(256).buffer);\n"
1736 " list[index++] = Int8List.view(new Float64List(256).buffer);\n"
1737 " list[index++] = Uint8List.view(new Float64List(256).buffer);\n"
1738 " list[index++] = Int8List.view(new Int32x4List(256).buffer);\n"
1739 " list[index++] = Uint8List.view(new Int32x4List(256).buffer);\n"
1740 " list[index++] = Int8List.view(new Float32x4List(256).buffer);\n"
1741 " list[index++] = Uint8List.view(new Float32x4List(256).buffer);\n"
1742 " list[index++] = Int8List.view(new Float64x2List(256).buffer);\n"
1743 " list[index++] = Uint8List.view(new Float64x2List(256).buffer);\n"
1745 " list[index++] = Int16List.view(new Int8List(256).buffer);\n"
1746 " list[index++] = Uint16List.view(new Uint8List(256).buffer);\n"
1747 " list[index++] = Int16List.view(new Int32List(256).buffer);\n"
1748 " list[index++] = Uint16List.view(new Uint32List(256).buffer);\n"
1749 " list[index++] = Int16List.view(new Int64List(256).buffer);\n"
1750 " list[index++] = Uint16List.view(new Uint64List(256).buffer);\n"
1751 " list[index++] = Int16List.view(new Float32List(256).buffer);\n"
1752 " list[index++] = Uint16List.view(new Float32List(256).buffer);\n"
1753 " list[index++] = Int16List.view(new Float64List(256).buffer);\n"
1754 " list[index++] = Uint16List.view(new Float64List(256).buffer);\n"
1755 " list[index++] = Int16List.view(new Int32x4List(256).buffer);\n"
1756 " list[index++] = Uint16List.view(new Int32x4List(256).buffer);\n"
1757 " list[index++] = Int16List.view(new Float32x4List(256).buffer);\n"
1758 " list[index++] = Uint16List.view(new Float32x4List(256).buffer);\n"
1759 " list[index++] = Int16List.view(new Float64x2List(256).buffer);\n"
1760 " list[index++] = Uint16List.view(new Float64x2List(256).buffer);\n"
1763 "getMultipleTypedDataViewList() {\n"
1764 " var list = List<dynamic>.filled(13, null);\n"
1766 " var data = Uint8List(256).buffer;\n"
1767 " list[index++] = Int8List.view(data);\n"
1768 " list[index++] = Uint8List.view(data);\n"
1769 " list[index++] = Int16List.view(data);\n"
1770 " list[index++] = Uint16List.view(data);\n"
1771 " list[index++] = Int32List.view(data);\n"
1772 " list[index++] = Uint32List.view(data);\n"
1773 " list[index++] = Int64List.view(data);\n"
1774 " list[index++] = Uint64List.view(data);\n"
1775 " list[index++] = Float32List.view(data);\n"
1776 " list[index++] = Float64List.view(data);\n"
1777 " list[index++] = Int32x4List.view(data);\n"
1778 " list[index++] = Float32x4List.view(data);\n"
1779 " list[index++] = Float64x2List.view(data);\n"
1801 EXPECT_NOTNULL(
root);
1821 EXPECT_EQ(
i,
root->value.as_array.length);
1825 std::unique_ptr<Message>
message =
1829 EXPECT_NOTNULL(
root);
1869 EXPECT_EQ(
i,
root->value.as_array.length);
1873 std::unique_ptr<Message>
message =
1877 EXPECT_NOTNULL(
root);
1897 EXPECT_EQ(
root->value.as_array.values[0]->value.as_typed_data.values,
1898 root->value.as_array.values[
i]->value.as_typed_data.values);
1901 EXPECT_EQ(
i,
root->value.as_array.length);
1916 const char* kScriptChars =
1917 "import 'dart:isolate';\n"
1919 " var messageCount = 0;\n"
1920 " var exception = '';\n"
1921 " var port = new RawReceivePort();\n"
1922 " var sendPort = port.sendPort;\n"
1923 " port.handler = (message) {\n"
1924 " if (messageCount < 9) {\n"
1925 " exception = '$exception${message}';\n"
1927 " exception = '$exception${message.length}';\n"
1928 " for (int i = 0; i < message.length; i++) {\n"
1929 " exception = '$exception${message[i]}';\n"
1932 " messageCount++;\n"
1933 " if (messageCount == 13) throw new Exception(exception);\n"
1935 " return sendPort;\n"
1953 object.value.as_bool =
true;
1957 object.value.as_bool =
false;
1961 object.value.as_int32 = 123;
1965 object.value.as_string =
const_cast<char*
>(
"456");
1969 object.value.as_string =
const_cast<char*
>(
"æøå");
1973 object.value.as_string =
const_cast<char*
>(
"");
1977 object.value.as_double = 3.14;
1981 object.value.as_array.length = 0;
1984 const int kArrayLength = 10;
1990 for (
int i = 0;
i < kArrayLength;
i++) {
2001 uint8_t
data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
2003 object.value.as_typed_data.values =
data;
2008 uint8_t* external_data =
reinterpret_cast<uint8_t*
>(
malloc(
sizeof(
data)));
2009 memmove(external_data,
data,
sizeof(
data));
2011 object.value.as_external_typed_data.data = external_data;
2012 object.value.as_external_typed_data.peer = external_data;
2018 static const uint8_t unmodifiable_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
2019 object.value.as_external_typed_data.length =
ARRAY_SIZE(unmodifiable_data);
2020 object.value.as_external_typed_data.data =
2021 const_cast<uint8_t*
>(unmodifiable_data);
2022 object.value.as_external_typed_data.peer =
nullptr;
2023 object.value.as_external_typed_data.callback =
NoopFinalizer;
2031 "nulltruefalse123456æøå3.14[]"
2032 "100123456789901234567890123456789012345678\n",
2041 uint8_t
buffer[4] = {0, 0, 0, 0};
static ObjectPtr UnwrapHandle(Dart_Handle object)
static Dart_Handle CheckAndFinalizePendingClasses(Thread *thread)
static constexpr intptr_t kMaxElements
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
virtual bool CanonicalizeEquals(const Instance &other) const
void SetAt(intptr_t index, const Object &value) const
static const Bool & False()
static const Bool & True()
static CapabilityPtr New(uint64_t id, Heap::Space space=Heap::kNew)
static DoublePtr New(double d, Heap::Space space=Heap::kNew)
static intptr_t MaxElements(intptr_t class_id)
void WriteFullSnapshot(GrowableArray< LoadingUnitSerializationData * > *data=nullptr)
static constexpr intptr_t kInitialSize
static IntegerPtr New(const String &str, Heap::Space space=Heap::kNew)
static Isolate * Current()
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static ClassPtr pc_descriptors_class()
static ClassPtr class_class()
static ClassPtr exception_handlers_class()
static ClassPtr instructions_class()
static ClassPtr type_arguments_class()
static ClassPtr context_class()
static ClassPtr code_class()
virtual const char * ToCString() const
static ClassPtr library_class()
static ClassPtr field_class()
static ClassPtr script_class()
static ClassPtr context_scope_class()
static ClassPtr function_class()
static SmiPtr New(intptr_t value)
static constexpr intptr_t kMaxValue
static constexpr intptr_t kMinValue
bool Equals(const String &str) const
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
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_Isolate CreateTestIsolate(const char *name=nullptr, void *isolate_group_data=nullptr, void *isolate_data=nullptr)
static Dart_Isolate CreateTestIsolateFromSnapshot(uint8_t *buffer, const char *name=nullptr)
static Thread * Current()
Isolate * isolate() const
int64_t TotalElapsedTime() const
static TypePtr ObjectType()
static bool IsTypedData(const Instance &obj)
static intptr_t MaxElements(intptr_t class_id)
static TypedDataPtr New(intptr_t class_id, intptr_t len, Heap::Space space=Heap::kNew)
static bool IsValid(const uint8_t *utf8_array, intptr_t array_len)
struct _Dart_Handle * Dart_Handle
@ Dart_TypedData_kFloat32x4
@ Dart_TypedData_kInt32x4
@ Dart_TypedData_kFloat64x2
@ Dart_TypedData_kFloat32
@ Dart_TypedData_kFloat64
@ Dart_TypedData_kInvalid
#define CHECK_API_SCOPE(thread)
@ Dart_CObject_kNumberOfTypes
@ Dart_CObject_kUnmodifiableExternalTypedData
@ Dart_CObject_kTypedData
@ Dart_CObject_kUnsupported
@ Dart_CObject_kExternalTypedData
@ Dart_CObject_kCapability
#define HANDLESCOPE(thread)
const uint8_t * isolate_snapshot_data
constexpr int64_t kMaxInt64
static bool Equals(const Object &expected, const Object &actual)
constexpr int64_t kMinInt64
ObjectPtr ReadMessage(Thread *thread, Message *message)
DART_EXPORT void Dart_EnterScope()
static std::unique_ptr< Message > GetSerialized(Dart_Handle lib, const char *dart_function)
DART_EXPORT bool Dart_ErrorHasException(Dart_Handle handle)
static void CheckStringInvalid(Dart_Handle dart_string)
DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, Dart_Handle name, int number_of_arguments, Dart_Handle *arguments)
DART_EXPORT bool Dart_IsKernel(const uint8_t *buffer, intptr_t buffer_size)
DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library, Dart_Handle class_name)
constexpr int32_t kMinInt32
void * malloc(size_t size)
void TestString(BaseTextBuffer *f, LoopInfo *loop, const GrowableArray< BlockEntryInstr * > &preorder)
DART_EXPORT const char * Dart_GetError(Dart_Handle handle)
DART_EXPORT uint8_t * Dart_ScopeAllocate(intptr_t size)
Dart_CObject * SerializeAndDeserializeMint(Zone *zone, const Mint &mint)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
void CheckMint(int64_t value)
static void CompareDartCObjects(Dart_CObject *first, Dart_CObject *second)
static void CheckEncodeDecodeMessage(Zone *zone, Dart_CObject *root)
static void CheckString(Dart_Handle dart_string, const char *expected)
Dart_CObject * ReadApiMessage(Zone *zone, Message *message)
static const char * kCustomIsolateScriptChars
ISOLATE_UNIT_TEST_CASE(StackAllocatedDestruction)
TEST_CASE(DirectoryCurrent)
Dart_Handle NewString(const char *str)
DART_EXPORT Dart_Handle Dart_RunLoop()
DART_EXPORT void Dart_ExitScope()
std::unique_ptr< Message > WriteMessage(bool same_group, const Object &obj, Dart_Port dest_port, Message::Priority priority)
static void NoopFinalizer(void *isolate_callback_data, void *peer)
constexpr int32_t kMaxInt32
std::unique_ptr< Message > WriteApiMessage(Zone *zone, Dart_CObject *obj, Dart_Port dest_port, Message::Priority priority)
DART_EXPORT bool Dart_PostCObject(Dart_Port port_id, Dart_CObject *message)
DART_EXPORT bool Dart_IsString(Dart_Handle object)
static int8_t data[kExtLength]
static void MallocFinalizer(void *isolate_callback_data, void *peer)
DART_EXPORT Dart_Handle Dart_SendPortGetId(Dart_Handle port, Dart_Port *port_id)
DART_EXPORT void Dart_ShutdownIsolate()
static void CheckTypedData(Dart_CObject *object, Dart_TypedData_Type typed_data_type, int len)
VM_UNIT_TEST_CASE(DirectoryCurrentNoScope)
static void ExpectEncodeFail(Zone *zone, Dart_CObject *root)
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
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
#define TEST_EXTERNAL_TYPED_ARRAY(darttype, ctype)
#define TEST_TYPED_ARRAY(darttype, ctype)
#define TEST_UNMODIFIABLE_EXTERNAL_TYPED_ARRAY(darttype, ctype)
#define TEST_ROUND_TRIP_IDENTICAL(object)
union _Dart_CObject::@86 value
struct _Dart_CObject::@86::@88 as_capability
struct _Dart_CObject::@86::@90 as_typed_data
struct _Dart_CObject::@86::@89 as_array
struct _Dart_CObject ** values
#define EXPECT_VALID(handle)
#define ARRAY_SIZE(array)