40 params.start_kernel_isolate =
true;
46 const char* kScriptChars =
70 params.start_kernel_isolate =
true;
72 bool was_called =
false;
74 code_observer.
data = &was_called;
77 *
static_cast<bool*
>(observer->
data) =
true;
79 params.code_observer = &code_observer;
100 params.start_kernel_isolate =
true;
103 const char* options_1[] = {
"--old-gen-heap-size=3192",
104 "--new-gen-semi-max-size=32"};
107 EXPECT(FLAG_old_gen_heap_size == 3192);
108 EXPECT(FLAG_new_gen_semi_max_size == 32);
111 const char* options_2[] = {
"--old-gen-heap-size=16384",
112 "--new-gen-semi-max-size=16384"};
116 EXPECT(FLAG_old_gen_heap_size == 0);
119 EXPECT(FLAG_old_gen_heap_size == 16384);
120 EXPECT(FLAG_new_gen_semi_max_size == 16384);
124 const char* options_3[] = {
"--old-gen-heap-size=30720",
125 "--new-gen-semi-max-size=30720"};
129 EXPECT(FLAG_old_gen_heap_size == 0);
132 EXPECT(FLAG_old_gen_heap_size == 30720);
133 EXPECT(FLAG_new_gen_semi_max_size == 30720);
139 const char* kScriptChars =
149 EXPECT_EQ(42,
value);
160 : isolate_(isolate), monitor_(monitor), interrupted_(interrupted) {}
163 const char* kScriptChars =
180 *interrupted_ =
true;
193 bool interrupted =
false;
205 while (!interrupted) {
213 const char* kScriptChars =
214 "void testMain() {\n"
215 " throw new Exception(\"bad news\");\n"
234 EXPECT_STREQ(
ZONE_STR(
"Unhandled exception:\n"
235 "Exception: bad news\n"
236 "#0 testMain (%s:2:3)",
249 const char* kScriptChars =
250 "bar() => throw new Error();\n"
252 "testMain() => foo();\n";
263 intptr_t frame_count = 0;
266 EXPECT_EQ(3, frame_count);
270 intptr_t line_number = 0;
271 intptr_t column_number = 0;
272 const char* cstr =
"";
278 &line_number, &column_number);
281 EXPECT_STREQ(
"bar", cstr);
283 EXPECT_SUBSTRING(
"test-lib", cstr);
284 EXPECT_EQ(1, line_number);
285 EXPECT_EQ(10, column_number);
290 &line_number, &column_number);
293 EXPECT_STREQ(
"foo", cstr);
295 EXPECT_SUBSTRING(
"test-lib", cstr);
296 EXPECT_EQ(2, line_number);
297 EXPECT_EQ(10, column_number);
302 &line_number, &column_number);
305 EXPECT_STREQ(
"testMain", cstr);
307 EXPECT_SUBSTRING(
"test-lib", cstr);
308 EXPECT_EQ(3, line_number);
309 EXPECT_EQ(15, column_number);
319 const char* kScriptChars =
320 "foo(n) => n == 1 ? throw new Error() : foo(n-1);\n"
321 "testMain() => foo(100);\n";
332 intptr_t frame_count = 0;
335 EXPECT_EQ(101, frame_count);
342 intptr_t line_number = 0;
343 intptr_t column_number = 0;
344 const char* cstr =
"";
351 &line_number, &column_number);
354 EXPECT_STREQ(
"foo", cstr);
356 EXPECT_SUBSTRING(
"test-lib", cstr);
357 EXPECT_EQ(1, line_number);
358 EXPECT_EQ(20, column_number);
361 for (intptr_t frame_index = 1; frame_index < (frame_count - 1);
366 &line_number, &column_number);
369 EXPECT_STREQ(
"foo", cstr);
371 EXPECT_SUBSTRING(
"test-lib", cstr);
372 EXPECT_EQ(1, line_number);
373 EXPECT_EQ(40, column_number);
380 &line_number, &column_number);
383 EXPECT_STREQ(
"testMain", cstr);
385 EXPECT_SUBSTRING(
"test-lib", cstr);
386 EXPECT_EQ(2, line_number);
387 EXPECT_EQ(15, column_number);
397 const char* top_frame_func_name,
398 const char* entry_func_name,
399 int expected_line_number,
400 int expected_column_number) {
410 intptr_t frame_count = 0;
417 intptr_t line_number = 0;
418 intptr_t column_number = 0;
419 const char* cstr =
"";
426 &line_number, &column_number);
429 EXPECT_STREQ(top_frame_func_name, cstr);
432 EXPECT_EQ(expected_line_number, line_number);
433 EXPECT_EQ(expected_column_number, column_number);
442TEST_CASE(DartAPI_StackOverflowStackTraceInfoBraceFunction1) {
447 " static foo(int i) { foo(i); }\n"
449 "testMain() => C.foo(10);\n",
450 "C.foo",
"testMain",
line, col);
453TEST_CASE(DartAPI_StackOverflowStackTraceInfoBraceFunction2) {
458 " static foo(int i, int j) {\n"
462 "testMain() => C.foo(10, 11);\n",
463 "C.foo",
"testMain",
line, col);
466TEST_CASE(DartAPI_StackOverflowStackTraceInfoArrowFunction) {
471 " static foo(int i) => foo(i);\n"
473 "testMain() => C.foo(10);\n",
474 "C.foo",
"testMain",
line, col);
478 const char* kScriptChars =
479 "var number_of_ints = 134000000;\n"
481 " new List<int>(number_of_ints)\n"
501 intptr_t frame_count = 0;
504 EXPECT_EQ(102, frame_count);
511 intptr_t line_number = 0;
512 intptr_t column_number = 0;
513 const char* cstr =
"";
514 const char* test_lib =
"file:///test-lib";
521 &line_number, &column_number);
524 EXPECT_STREQ(
"inspectStack", cstr);
526 EXPECT_STREQ(test_lib, cstr);
527 EXPECT_EQ(3, line_number);
528 EXPECT_EQ(24, column_number);
534 &line_number, &column_number);
537 EXPECT_STREQ(
"foo", cstr);
539 EXPECT_STREQ(test_lib, cstr);
540 EXPECT_EQ(4, line_number);
541 EXPECT_EQ(20, column_number);
544 for (intptr_t frame_index = 2; frame_index < (frame_count - 1);
549 &line_number, &column_number);
552 EXPECT_STREQ(
"foo", cstr);
554 EXPECT_STREQ(test_lib, cstr);
555 EXPECT_EQ(4, line_number);
556 EXPECT_EQ(37, column_number);
563 &line_number, &column_number);
566 EXPECT_STREQ(
"testMain", cstr);
568 EXPECT_STREQ(test_lib, cstr);
569 EXPECT_EQ(5, line_number);
570 EXPECT_EQ(15, column_number);
585 bool* auto_setup_scope) {
586 ASSERT(auto_setup_scope !=
nullptr);
587 *auto_setup_scope =
true;
592 const char* kScriptChars = R
"(
593@pragma("vm:external-name", "CurrentStackTraceNative")
594external inspectStack();
595foo(n) => n == 1 ? inspectStack() : foo(n-1);
596testMain() => foo(100);
606 EXPECT_EQ(42,
value);
656 EXPECT_SUBSTRING(
"Unhandled exception:\nExceptionError",
663 const char* exception_cstr =
"";
666 const char* kApiError =
"Api Error Exception Test.";
674 EXPECT_STREQ(kApiError, exception_cstr);
691 const String& fatal_message =
700 const char* kRegularString =
"Regular String Exception Test.";
707 EXPECT_STREQ(kRegularString, exception_cstr);
721 bool* auto_setup_scope) {
722 ASSERT(auto_setup_scope !=
nullptr);
723 *auto_setup_scope =
true;
728 const char* kScriptChars = R
"(
729import 'dart:isolate';
732 Isolate.current.kill(priority: Isolate.immediate);
735@pragma("vm:external-name", "Test_nativeFunc")
736external void nativeFunc(closure);
739 nativeFunc(() => exitRightNow());
752 EXPECT_SUBSTRING(
"No api calls are allowed while unwind is in progress",
756TEST_CASE(DartAPI_EnsureUnwindErrorHandled_WhenSendAndExit) {
757 const char* kScriptChars = R
"(
758import 'dart:isolate';
761 final receivePort = ReceivePort();
762 Isolate.exit(receivePort.sendPort, true);
765@pragma("vm:external-name", "Test_nativeFunc")
766external void nativeFunc(closure);
769 nativeFunc(() => sendAndExitNow());
782 EXPECT_SUBSTRING(
"No api calls are allowed while unwind is in progress",
812 bool* auto_setup_scope) {
813 ASSERT(auto_setup_scope !=
nullptr);
814 *auto_setup_scope =
true;
819 const char* kScriptChars = R
"(
821 return missing_semicolon
824@pragma("vm:external-name", "Test_nativeFunc")
825external void nativeFunc(closure);
828 nativeFunc(() => raiseCompileError());
862 const char* kScriptChars = R
"(
863void throwException() {
864 throw new Exception('myException');
867@pragma("vm:external-name", "Test_nativeFunc")
868external void nativeFunc(closure);
871 nativeFunc(() => throwException());
943 const char* cstr =
nullptr;
945 EXPECT_STREQ(
"dynamic", cstr);
955 const char* cstr =
nullptr;
957 EXPECT_STREQ(
"void", cstr);
967 const char* cstr =
nullptr;
969 EXPECT_STREQ(
"Never", cstr);
1054 Zone* zone = thread->zone();
1061 const Type& null_type_obj = Api::UnwrapTypeHandle(zone,
type);
1071 const Type& bool_type_obj = Api::UnwrapTypeHandle(zone,
type);
1085 "Dart_InstanceGetType expects argument 'instance' to be of "
1090 const char* kScriptChars =
"int getInt() { return 1; }\n";
1104 const char* result_str =
"";
1106 EXPECT_STREQ(result_str,
"getInt");
1110 const char* kScriptChars =
"int getInt() { return 1; }\n";
1122 const char* url =
"";
1129 const char* lib_url =
"";
1134 EXPECT_STREQ(url, lib_url);
1138 const char* kScriptChars =
1139 "int getInt() { return 1; }\n"
1140 "getTearOff() => getInt;\n"
1141 "Function foo = () { print('baz'); };\n"
1143 " static int foo() => 42;\n"
1144 " getTearOff() => bar;\n"
1145 " int bar() => 24;\n"
1147 "Baz getBaz() => Baz();\n";
1178 bool is_static =
false;
1192 const char* kScriptChars =
1193 "int getInt() { return 1; }\n"
1194 "class Foo { String getString() => 'foobar'; }\n";
1206 bool is_static =
false;
1230 const char* kScriptChars =
"int getInt() { return 1; }\n";
1252 const char* kScriptChars =
1254 " static int getInt() {\n"
1257 " double getDouble() {\n"
1274 EXPECT_SUBSTRING(
"getInt",
result);
1281 EXPECT_SUBSTRING(
"getInt",
result);
1288 EXPECT_SUBSTRING(
"Foo",
result);
1291 "Dart_ClassName expects argument 'cls_type' to be non-null.");
1294 "Dart_GetStaticMethodClosure expects argument 'library' to be non-null.");
1297 "Dart_GetStaticMethodClosure expects argument 'cls_type' to be "
1300 "Dart_GetStaticMethodClosure expects argument 'function_name' "
1312 const char* str =
nullptr;
1314 EXPECT_STREQ(
"dart:core", str);
1360 const double kDoubleVal1 = 201.29;
1361 const double kDoubleVal2 = 101.19;
1369 EXPECT_EQ(kDoubleVal1, out1);
1372 EXPECT_EQ(kDoubleVal2, out2);
1377 const char* kScriptChars =
1378 "int getInt() { return 1; }\n"
1379 "double getDouble() { return 1.0; }\n"
1380 "bool getBool() { return false; }\n"
1381 "getNull() { return null; }\n";
1408 const int64_t kIntegerVal1 = 100;
1409 const int64_t kIntegerVal2 = 0xffffffff;
1410 const char* kIntegerVal3 =
"0x123456789123456789123456789";
1411 const uint64_t kIntegerVal4 = 0xffffffffffffffff;
1412 const int64_t kIntegerVal5 = -0x7fffffffffffffff;
1424 EXPECT_EQ(kIntegerVal1,
out);
1434 EXPECT_EQ(kIntegerVal2,
out);
1459 } kIntTestCases[] = {
1464 {-0xABCDEF,
"-0xABCDEF"},
1465 {
DART_INT64_C(-0x7FFFFFFFFFFFFFFF),
"-0x7FFFFFFFFFFFFFFF"},
1470 const size_t kNumberOfIntTestCases =
1471 sizeof(kIntTestCases) /
sizeof(kIntTestCases[0]);
1473 for (
size_t i = 0;
i < kNumberOfIntTestCases; ++
i) {
1476 const char* chars =
nullptr;
1479 EXPECT_STREQ(kIntTestCases[
i].
s, chars);
1529 const int kArrayLength = 10;
1537 EXPECT_EQ(kArrayLength,
len);
1549 for (
int i = 0;
i < kArrayLength;
i++) {
1553 for (
int i = 0;
i < kArrayLength;
i++) {
1564 uint8_t latin1[] = {
'o',
'n',
'e', 0xC2, 0xA2};
1578 EXPECT_EQ(1, char_size);
1579 EXPECT_EQ(4, str_len);
1582 uint8_t data8[] = {
'o',
'n',
'e', 0x7F};
1589 uint8_t latin1_array[] = {0, 0, 0, 0, 0};
1594 for (intptr_t
i = 0;
i <
len;
i++) {
1595 EXPECT_EQ(data8[
i], latin1_array[
i]);
1598 uint16_t data16[] = {
't',
'w',
'o', 0xFFFF};
1605 EXPECT_EQ(2, char_size);
1606 EXPECT_EQ(4, str_len);
1609 int32_t data32[] = {
'f',
'o',
'u',
'r', 0x10FFFF};
1617 const char* ascii =
"string";
1622 const char* null =
nullptr;
1626 uint8_t
data[] = {0xE4, 0xBA, 0x8c};
1631 uint8_t
invalid[] = {0xE4, 0xBA};
1643 const char* kScriptChars =
1644 "String lowSurrogate() {"
1645 " return '\\u{1D11E}'[1];"
1647 "String highSurrogate() {"
1648 " return '\\u{1D11E}'[0];"
1650 "String reversed() => lowSurrogate() + highSurrogate();";
1656 uint8_t* utf8_encoded =
nullptr;
1657 intptr_t utf8_length = 0;
1660 EXPECT_EQ(3, utf8_length);
1662 EXPECT_EQ(239,
static_cast<intptr_t
>(utf8_encoded[0]));
1663 EXPECT_EQ(191,
static_cast<intptr_t
>(utf8_encoded[1]));
1664 EXPECT_EQ(189,
static_cast<intptr_t
>(utf8_encoded[2]));
1671 uint8_t* utf8_encoded_reversed =
nullptr;
1672 intptr_t utf8_length_reversed = 0;
1674 &utf8_length_reversed);
1676 EXPECT_EQ(6, utf8_length_reversed);
1678 uint8_t expected[6] = {239, 191, 189, 239, 191, 189};
1679 for (
int i = 0;
i < 6;
i++) {
1680 EXPECT_EQ(expected[
i], utf8_encoded_reversed[
i]);
1685 const char* kScriptChars =
1686 "String lowSurrogate() {"
1687 " return '\\u{1D11E}'[1];"
1694 uint8_t* utf8_encoded =
nullptr;
1695 intptr_t utf8_length = 0;
1698 EXPECT_EQ(3, utf8_length);
1700 intptr_t utf8_copy_length = 0;
1706 EXPECT_EQ(0, memcmp(utf8_encoded, utf8_encoded_copy, utf8_length));
1712 const int kBigLength = 16 *
MB / 8;
1713 int64_t* big_data =
new int64_t[kBigLength]();
1717 const int kSmallLength = 16 *
KB / 8;
1718 int64_t* small_data =
new int64_t[kSmallLength]();
1720 small_data, kSmallLength);
1734 delete[] small_data;
1739 const char* kScriptChars =
1741 " List a = List.empty(growable: true);"
1748 "List immutable() {"
1749 " return const [0, 1, 2];"
1778 EXPECT_EQ(10,
value);
1784 EXPECT_EQ(20,
value);
1790 EXPECT_EQ(30,
value);
1810 EXPECT_EQ(0,
value);
1816 EXPECT_EQ(1,
value);
1822 EXPECT_EQ(2,
value);
1824 uint8_t native_array[3];
1827 EXPECT_EQ(0, native_array[0]);
1828 EXPECT_EQ(1, native_array[1]);
1829 EXPECT_EQ(2, native_array[2]);
1831 native_array[0] = 10;
1832 native_array[1] = 20;
1833 native_array[2] = 30;
1838 EXPECT_EQ(10, native_array[0]);
1839 EXPECT_EQ(20, native_array[1]);
1840 EXPECT_EQ(30, native_array[2]);
1845 EXPECT_EQ(30,
value);
1854 const int kRangeOffset = 1;
1855 const int kRangeLength = 2;
1867 EXPECT_EQ(20,
value);
1871 EXPECT_EQ(30,
value);
1890 const char* kScriptChars =
1921 EXPECT_EQ(
value, 1);
1981 const char* kScriptChars =
1982 "import 'dart:async';"
1983 "Future testMain() {"
1984 " return new Completer().future;"
2006 const int kSize = 1000;
2008 const char* kScriptChars =
2009 "import 'dart:typed_data';\n"
2010 "List testMain(int size) {\n"
2011 " var a = new Int8List(size);\n"
2012 " var view = new Int8List.view(a.buffer, 0, size);\n"
2023 for (intptr_t
i = 0;
i < kSize; ++
i) {
2026 uint8_t*
data =
new uint8_t[kSize];
2028 for (intptr_t
i = 0;
i < kSize; ++
i) {
2029 EXPECT_EQ(
i & 0xff,
data[
i]);
2038 const int kSize = 1000;
2040 const char* kScriptChars =
2041 "import 'dart:typed_data';\n"
2042 "List testMain(int size) {\n"
2043 " var a = new Int8List(size);\n"
2044 " var view = new Int8List.view(a.buffer, 0, size);\n"
2060TEST_CASE(DartAPI_UnmodifiableTypedDataViewListIsTypedData) {
2061 const int kSize = 1000;
2063 const char* kScriptChars =
2064 "import 'dart:typed_data';\n"
2065 "List testMain(int size) {\n"
2066 " var a = new Int8List(size);\n"
2067 " var view = a.asUnmodifiableView();\n"
2109 for (intptr_t
i = 0;
i < 10; ++
i) {
2112 for (intptr_t
i = 0;
i < 10; ++
i) {
2116 int64_t int64_t_value = -1;
2118 EXPECT_EQ(
i + 1, int64_t_value);
2127 for (intptr_t
i = 0;
i < 10; ++
i) {
2133 for (intptr_t
i = 0;
i < 10; ++
i) {
2142 uint8_t
data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
2143 for (intptr_t
i = 0;
i < 10; ++
i) {
2147 for (intptr_t
i = 0;
i < 10; ++
i) {
2150 int64_t int64_t_value = -1;
2152 EXPECT_EQ(10 -
i, int64_t_value);
2161 for (intptr_t
i = 0;
i < 10; ++
i) {
2179 for (intptr_t
i = 0;
i < 10; ++
i) {
2183 int64_t int64_t_value = -1;
2185 EXPECT_EQ(
i + 1, int64_t_value);
2212 bool* auto_setup_scope) {
2213 ASSERT(auto_setup_scope !=
nullptr);
2214 *auto_setup_scope =
true;
2219 const char* kScriptChars = R
"(
2220import 'dart:typed_data';
2222 static equals(a, b) {
2224 throw 'not equal. expected: $a, got: $b';
2228@pragma("vm:external-name", "CreateByteData")
2229external ByteData createByteData();
2232 var a = createByteData();
2233 Expect.equals(length, a.lengthInBytes);
2234 for (int i = 0; i < length; i+=1) {
2237 for (int i = 0; i < length; i+=2) {
2238 Expect.equals(0x4242, a.getInt16(i));
2257 0x41, 0x42, 0x41, 0x42, 0x41, 0x42, 0x41, 0x42,
2258 0x41, 0x42, 0x41, 0x42, 0x41, 0x42, 0x41, 0x42,
2275 bool* auto_setup_scope) {
2276 ASSERT(auto_setup_scope !=
nullptr);
2277 *auto_setup_scope =
true;
2284 const char* kScriptChars = R
"(
2285import 'dart:typed_data';
2287 static equals(a, b) {
2289 throw 'not equal. expected: $a, got: $b';
2293@pragma("vm:external-name", "CreateExternalByteData")
2294external ByteData createExternalByteData();
2297 var a = createExternalByteData();
2298 Expect.equals(length, a.lengthInBytes);
2299 for (int i = 0; i < length; i+=2) {
2300 Expect.equals(0x4241, a.getInt16(i, Endian.little));
2302 for (int i = 0; i < length; i+=2) {
2304 a.setInt8(i + 1, 0x28);
2306 for (int i = 0; i < length; i+=2) {
2307 Expect.equals(0x2824, a.getInt16(i, Endian.little));
2324 EXPECT_EQ(0x24,
data[
i]);
2325 EXPECT_EQ(0x28,
data[
i + 1]);
2339 const char* kScriptChars =
2341 "extractAndSaveArray(byteData) {\n"
2342 " array = byteData.buffer.asUint8List();\n"
2344 "releaseArray() {\n"
2396 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
2397 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
2414 bool* auto_setup_scope) {
2415 ASSERT(auto_setup_scope !=
nullptr);
2416 *auto_setup_scope =
true;
2421 const char* kScriptChars = R
"(
2422import 'dart:typed_data';
2424 static equals(a, b) {
2426 throw 'not equal. expected: $a, got: $b';
2430@pragma("vm:external-name", "CreateExternalByteData")
2431external ByteData createExternalByteData();
2433 Expect.equals(0x04030201, a.getUint32(0, Endian.little));
2434 Expect.equals(0x08070605, a.getUint32(4, Endian.little));
2435 Expect.equals(0x0c0b0a09, a.getUint32(8, Endian.little));
2436 Expect.equals(0x100f0e0d, a.getUint32(12, Endian.little));
2440 var a = createExternalByteData();
2441 Expect.equals(length, a.lengthInBytes);
2442 for (int i = 0; i < 20; i++) {
2456 int old_oct = FLAG_optimization_counter_threshold;
2457 FLAG_optimization_counter_threshold = 5;
2460 FLAG_optimization_counter_threshold = old_oct;
2472 "Dart_TypedDataAcquireData expects argument 'type'"
2473 " to be non-null.");
2477 "Dart_TypedDataAcquireData expects argument 'data'"
2478 " to be non-null.");
2482 "Dart_TypedDataAcquireData expects argument 'len'"
2483 " to be non-null.");
2487 "Dart_TypedDataAcquireData expects argument 'object'"
2488 " to be non-null.");
2491 "Dart_TypedDataAcquireData expects argument 'object'"
2492 " to be of type 'TypedData'.");
2496 "Dart_TypedDataReleaseData expects argument 'object'"
2497 " to be non-null.");
2500 "Dart_TypedDataReleaseData expects argument 'object'"
2501 " to be of type 'TypedData'.");
2505 FLAG_verify_acquired_data =
false;
2510 FLAG_verify_acquired_data =
true;
2522 dart_args[0] = array;
2534 EXPECT_EQ(expected_type,
type);
2536 int8_t* dataP =
reinterpret_cast<int8_t*
>(
data);
2538 EXPECT_EQ(
i, dataP[
i]);
2565 : isolate_group_(isolate_group), monitor_(monitor), done_(
done) {}
2567 const bool kBypassSafepoint =
false;
2570 for (intptr_t
i = 0;
i < 10;
i++) {
2588 const char* kScriptChars =
2589 "import 'dart:typed_data';\n"
2591 " static equals(a, b) {\n"
2593 " throw new Exception('not equal. expected: $a, got: $b');\n"
2597 "void setMain(var a) {"
2598 " for (var i = 0; i < 10; i++) {"
2602 "bool testMain(var list) {"
2603 " for (var i = 0; i < 10; i++) {"
2604 " Expect.equals((10 + i), list[i]);"
2609 " var a = new Int8List(10);"
2620 for (intptr_t
i = 0;
i < 10;
i++) {
2628 uint8_t
data[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
2631 ext_list_access_test_obj =
2647 FLAG_verify_acquired_data =
false;
2652 FLAG_verify_acquired_data =
true;
2657 const char* kScriptChars =
2658 "import 'dart:typed_data';\n"
2660 " static equals(a, b) {\n"
2662 " throw 'not equal. expected: $a, got: $b';\n"
2666 "void setMain(var list) {"
2667 " Expect.equals(10, list.length);"
2668 " for (var i = 0; i < 10; i++) {"
2672 "bool testMain(var list) {"
2673 " Expect.equals(10, list.length);"
2674 " for (var i = 0; i < 10; i++) {"
2675 " Expect.equals((10 + i), list[i]);"
2680 " var a = new Int8List(100);"
2681 " var view = new Int8List.view(a.buffer, 50, 10);"
2695 FLAG_verify_acquired_data =
false;
2700 FLAG_verify_acquired_data =
true;
2705 const char* kScriptChars =
2706 "import 'dart:typed_data';\n"
2708 " var list = new Int8List(100);"
2709 " for (var i = 0; i < 100; i++) {"
2712 " return list.asUnmodifiableView();"
2731 int8_t* dataP =
reinterpret_cast<int8_t*
>(
data);
2733 EXPECT_EQ(
i, dataP[
i]);
2747TEST_CASE(DartAPI_UnmodifiableTypedDataViewDirectAccessUnverified) {
2748 FLAG_verify_acquired_data =
false;
2752TEST_CASE(DartAPI_UnmodifiableTypedDataViewDirectAccessVerified) {
2753 FLAG_verify_acquired_data =
true;
2758 const char* kScriptChars =
2759 "import 'dart:typed_data';\n"
2761 " static equals(a, b) {\n"
2763 " throw 'not equal. expected: $a, got: $b';\n"
2767 "void setMain(var list) {"
2768 " Expect.equals(10, list.length);"
2769 " for (var i = 0; i < 10; i++) {"
2770 " list.setInt8(i, i);"
2773 "bool testMain(var list) {"
2774 " Expect.equals(10, list.length);"
2775 " for (var i = 0; i < 10; i++) {"
2776 " Expect.equals((10 + i), list.getInt8(i));"
2781 " var a = new Int8List(100);"
2782 " var view = new ByteData.view(a.buffer, 50, 10);"
2796 FLAG_verify_acquired_data =
false;
2801 FLAG_verify_acquired_data =
true;
2805TEST_CASE(DartAPI_NewUnmodifiableExternalTypedDataWithFinalizer) {
2806 const char* kScriptChars = R
"(
2808 static equals(a, b) {
2810 throw 'not equal. expected: $a, got: $b';
2813 static throws(block) {
2815 try { block(); } catch (e) { threw = true; }
2816 if (!threw) throw 'did not throw';
2820 for (var i = 0; i < data.length; i++) {
2821 Expect.equals(i, data[i]);
2822 Expect.throws(() => data[i] = 0);
2826 for (var i = 0; i < data.length; i++) {
2827 Expect.equals(i, data.getUint8(i));
2828 Expect.throws(() => data.setUint8(i, 0));
2834 uint8_t
data[] = {0, 1, 2, 3};
2840 args[0] = typed_data;
2847 int8_t
data[] = {0, 1, 2, 3};
2853 args[0] = typed_data;
2860 uint16_t
data[] = {0, 1, 2, 3};
2867 args[0] = typed_data;
2874 int16_t
data[] = {0, 1, 2, 3};
2880 args[0] = typed_data;
2887 uint32_t
data[] = {0, 1, 2, 3};
2894 args[0] = typed_data;
2901 int32_t
data[] = {0, 1, 2, 3};
2907 args[0] = typed_data;
2914 uint64_t
data[] = {0, 1, 2, 3};
2921 args[0] = typed_data;
2928 int64_t
data[] = {0, 1, 2, 3};
2934 args[0] = typed_data;
2941 float data[] = {0.0f, 1.0f, 2.0f, 3.0f};
2954 double data[] = {0.0, 1.0, 2.0, 3.0};
2961 args[0] = typed_data;
2968 uint8_t
data[] = {0, 1, 2, 3};
2975 args[0] = typed_data;
2983 const char* kScriptChars = R
"(
2984import 'dart:isolate';
2986 var port = new RawReceivePort();
2987 port.handler = (msg) {
2989 if (!identical(original, msg)) throw "got a copy";
2991 port.sendPort.send(original);
2995 uint8_t
data[] = {0, 1, 2, 3};
3001 args[0] = typed_data;
3027 EXPECT_EQ(gc_count_before,
3033 EXPECT_LT(gc_count_before,
3040 intptr_t data_length) {
3045 void* raw_data =
nullptr;
3050 EXPECT_EQ(data_length,
len);
3051 EXPECT_EQ(expected_type,
type);
3054 intptr_t list_length = 0;
3056 EXPECT_EQ(data_length, list_length);
3059 for (intptr_t
i = 0;
i < list_length; ++
i) {
3060 EXPECT_EQ(11 *
i,
data[
i]);
3069 for (intptr_t
i = 0;
i < data_length; ++
i) {
3073 for (intptr_t
i = 0;
i < list_length; ++
i) {
3078 EXPECT_EQ(22 *
i,
value);
3082 for (intptr_t
i = 0;
i < list_length; ++
i) {
3088 for (intptr_t
i = 0;
i < data_length; ++
i) {
3089 EXPECT_EQ(33 *
i,
data[
i]);
3094 uint8_t
data[] = {0, 11, 22, 33, 44, 55, 66, 77};
3103 uint8_t
data[] = {0, 11, 22, 33, 44, 55, 66, 77};
3113 const char* kScriptChars =
3114 "testClamped(List a) {\n"
3115 " if (a[1] != 11) return false;\n"
3117 " if (a[1] != 3) return false;\n"
3119 " if (a[1] != 0) return false;\n"
3121 " if (a[1] != 255) return false;\n"
3125 uint8_t
data[] = {0, 11, 22, 33, 44, 55, 66, 77};
3152 *
static_cast<int*
>(peer) = 42;
3159 uint8_t
data[] = {1, 2, 3, 4};
3169 GCTestHelper::CollectNewSpace();
3176 intptr_t*
count =
reinterpret_cast<intptr_t*
>(peer);
3182 for (intptr_t
i = 0;
i < 10;
i++) {
3196 EXPECT_EQ(20,
count);
3201 intptr_t*
count =
reinterpret_cast<intptr_t*
>(peer);
3209 for (intptr_t
i = 0;
i < 10;
i++) {
3225 EXPECT_EQ(20,
count);
3227 for (intptr_t
i = 0;
i < 20;
i++) {
3233 void* raw_data =
nullptr;
3239 float* float_data =
reinterpret_cast<float*
>(raw_data);
3240 for (
int i = 0;
i <
len * 4;
i++) {
3241 EXPECT_EQ(0.0, float_data[
i]);
3247 const char* kScriptChars =
3248 "import 'dart:typed_data';\n"
3249 "Float32x4List float32x4() {\n"
3250 " return new Float32x4List(10);\n"
3264 float data[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
3265 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
3266 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
3267 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
3280 GCTestHelper::CollectNewSpace();
3291 EXPECT(thread !=
nullptr);
3311 const char* kTestString1 =
"Test String1";
3312 const char* kTestString2 =
"Test String2";
3316 EXPECT(isolate !=
nullptr);
3321 const intptr_t handle_count_start =
state->CountPersistentHandles();
3328 for (
int i = 0;
i < 1000;
i++) {
3333 for (
int i = 1000;
i < 2000;
i++) {
3336 for (
int i = 500;
i < 1500;
i++) {
3339 for (
int i = 500;
i < 1000;
i++) {
3342 for (
int i = 1000;
i < 1500;
i++) {
3351 for (
int i = 0;
i < 500;
i++) {
3356 for (
int i = 500;
i < 1000;
i++) {
3361 for (
int i = 1000;
i < 1500;
i++) {
3366 for (
int i = 1500;
i < 2000;
i++) {
3373 EXPECT_EQ(handle_count_start + 2000,
state->CountPersistentHandles());
3383 EXPECT(isolate !=
nullptr);
3409 const char* kTestString1 =
"Test String1";
3410 const char* kTestString2 =
"Test String2";
3416 EXPECT(isolate !=
nullptr);
3506 GCTestHelper::CollectNewSpace();
3526 GCTestHelper::CollectOldSpace();
3550 GCTestHelper::CollectNewSpace();
3566 GCTestHelper::CollectOldSpace();
3605 void* peer =
reinterpret_cast<void*
>(0);
3611 peer =
reinterpret_cast<void*
>(1);
3635 peer =
reinterpret_cast<void*
>(2);
3641 peer =
reinterpret_cast<void*
>(3);
3650 GCTestHelper::CollectNewSpace();
3662 GCTestHelper::CollectOldSpace();
3678 GCTestHelper::CollectNewSpace();
3691 GCTestHelper::CollectOldSpace();
3716 EXPECT_EQ(ref1,
static_cast<void*
>(
nullptr));
3723 EXPECT_EQ(ref2,
static_cast<void*
>(
nullptr));
3733 EXPECT_EQ(ref3,
static_cast<void*
>(
nullptr));
3736 const char* kScriptChars = R
"(
3739 final class MyStruct extends Struct {
3740 external Pointer notEmpty;
3743 final class MyUnion extends Union {
3744 external Pointer notEmpty;
3755 EXPECT_EQ(ref4,
static_cast<void*
>(
nullptr));
3763 EXPECT_EQ(ref5,
static_cast<void*
>(
nullptr));
3776 EXPECT_EQ(ref1,
static_cast<void*
>(
nullptr));
3783 EXPECT_EQ(ref2,
static_cast<void*
>(
nullptr));
3793 EXPECT_EQ(ref3,
static_cast<void*
>(
nullptr));
3796 const char* kScriptChars = R
"(
3799 final class MyStruct extends Struct {
3800 external Pointer notEmpty;
3803 final class MyUnion extends Union {
3804 external Pointer notEmpty;
3815 EXPECT_EQ(ref4,
static_cast<void*
>(
nullptr));
3823 EXPECT_EQ(ref5,
static_cast<void*
>(
nullptr));
3833 void* isolate_callback_data,
3838TEST_CASE(DartAPI_WeakPersistentHandleCleanupFinalizerAtShutdown) {
3839 const char* kTestString1 =
"Test String1";
3850 void* isolate_callback_data,
3854 *
static_cast<int*
>(peer) = 42;
3860 const char* kTestString1 =
"Test String1";
3894 *
static_cast<int*
>(peer) = 42;
3900 const char* kTestString1 =
"Test String1";
3928 *
static_cast<int*
>(peer) = 42;
3946 GCTestHelper::CollectNewSpace();
3954 *
static_cast<int*
>(peer) = 42;
3969 GCTestHelper::CollectNewSpace();
3991 GCTestHelper::CollectOldSpace();
3993 GCTestHelper::CollectNewSpace();
4018 GCTestHelper::CollectOldSpace();
4020 GCTestHelper::CollectNewSpace();
4029 *
static_cast<int*
>(peer) = 42;
4036 *
static_cast<int*
>(peer) = 42;
4056 GCTestHelper::CollectNewSpace();
4088TEST_CASE(DartAPI_WeakPersistentHandleExternalAllocationSize) {
4093 const intptr_t kWeak1ExternalSize = 1 *
KB;
4105 const intptr_t kWeak2ExternalSize = 2 *
KB;
4120 (kWeak1ExternalSize + kWeak2ExternalSize) /
kWordSize);
4123 GCTestHelper::CollectNewSpace();
4128 GCTestHelper::CollectNewSpace();
4136 GCTestHelper::CollectOldSpace();
4148 const intptr_t kWeak1ExternalSize = 1 *
KB;
4157 const intptr_t kWeak2ExternalSize = 2 *
KB;
4170 (kWeak1ExternalSize + kWeak2ExternalSize) /
kWordSize);
4173 GCTestHelper::CollectNewSpace();
4178 GCTestHelper::CollectNewSpace();
4186 GCTestHelper::CollectOldSpace();
4192TEST_CASE(DartAPI_WeakPersistentHandleExternalAllocationSizeNewspaceGC) {
4196 const intptr_t kWeak1ExternalSize = 500 *
MB;
4229 GCTestHelper::CollectOldSpace();
4234TEST_CASE(DartAPI_FinalizableHandleExternalAllocationSizeNewspaceGC) {
4239 const intptr_t kWeak1ExternalSize = 500 *
MB;
4272 GCTestHelper::CollectOldSpace();
4277TEST_CASE(DartAPI_WeakPersistentHandleExternalAllocationSizeOldspaceGC) {
4286 GCTestHelper::WaitForGCTasks();
4289 const intptr_t kSmallExternalSize = 1 *
KB;
4301 GCTestHelper::WaitForGCTasks();
4302 EXPECT_EQ(kSmallExternalSize,
4306 const intptr_t kHugeExternalSize = (
kWordSize == 4) ? 513 *
MB : 1025 *
MB;
4311 GCTestHelper::WaitForGCTasks();
4320TEST_CASE(DartAPI_FinalizableHandleExternalAllocationSizeOldspaceGC) {
4328 GCTestHelper::WaitForGCTasks();
4331 const intptr_t kSmallExternalSize = 1 *
KB;
4341 GCTestHelper::WaitForGCTasks();
4342 EXPECT_EQ(kSmallExternalSize,
4346 const intptr_t kHugeExternalSize = (
kWordSize == 4) ? 513 *
MB : 1025 *
MB;
4350 GCTestHelper::WaitForGCTasks();
4357TEST_CASE(DartAPI_WeakPersistentHandleExternalAllocationSizeOddReferents) {
4360 const intptr_t kWeak1ExternalSize = 1 *
KB;
4362 const intptr_t kWeak2ExternalSize = 2 *
KB;
4378 (kWeak1ExternalSize + kWeak2ExternalSize) /
kWordSize);
4386 GCTestHelper::CollectOldSpace();
4391TEST_CASE(DartAPI_FinalizableHandleExternalAllocationSizeOddReferents) {
4395 const intptr_t kWeak1ExternalSize = 1 *
KB;
4398 const intptr_t kWeak2ExternalSize = 2 *
KB;
4414 (kWeak1ExternalSize + kWeak2ExternalSize) /
kWordSize);
4424 GCTestHelper::CollectOldSpace();
4438 bool* auto_setup_scope) {
4443 return reinterpret_cast<intptr_t
>(ptr);
4447 if (strcmp(
name,
"returnPtrAsInt") == 0 && argn == 1) {
4454 const char* kScriptChars = R
"(
4456 import 'dart:nativewrappers';
4457 base class SecretKeeper extends NativeFieldWrapperClass1 {
4458 SecretKeeper(int secret) { _keepSecret(secret); }
4459 @pragma("vm:external-name", "SecretKeeper_KeepSecret")
4460 external void _keepSecret(int secret);
4462 // Argument auto-conversion will wrap `o` in `_getNativeField()`.
4463 @Native<IntPtr Function(Pointer<Void>)>(symbol: 'returnPtrAsInt')
4464 external int returnPtrAsInt(NativeFieldWrapperClass1 o);
4465 main() => returnPtrAsInt(SecretKeeper(321));
4482 EXPECT_EQ(321,
value);
4488 const char* kScriptChars = R
"(
4490 import 'dart:nativewrappers';
4491 base class ForgetfulSecretKeeper extends NativeFieldWrapperClass1 {
4492 ForgetfulSecretKeeper(int secret) { /* Forget to init. native field. */ }
4494 // Argument auto-conversion will wrap `o` in `_getNativeField()`.
4495 @Native<IntPtr Function(Pointer<Void>)>(symbol: 'returnPtrAsInt')
4496 external int returnPtrAsInt(NativeFieldWrapperClass1 o);
4497 main() => returnPtrAsInt(ForgetfulSecretKeeper(321));
4519 if (peer == &
weak1) {
4521 }
else if (peer == &
weak2) {
4523 }
else if (peer == &
weak3) {
4577 GCTestHelper::CollectNewSpace();
4656 EXPECT(isolate !=
nullptr);
4669 for (
int i = 0;
i < 100;
i++) {
4673 for (
int i = 0;
i < 100;
i++) {
4675 EXPECT_EQ(
i, val.
Value());
4683 for (
int i = 100;
i < 200;
i++) {
4687 for (
int i = 100;
i < 200;
i++) {
4689 EXPECT_EQ(
i, val.
Value());
4698 for (
int i = 200;
i < 300;
i++) {
4702 for (
int i = 200;
i < 300;
i++) {
4704 EXPECT_EQ(
i, val.
Value());
4727 EXPECT(thread !=
nullptr);
4734 for (
int i = 0;
i < 100;
i++) {
4741 for (
int i = 0;
i < 100;
i++) {
4749 for (
int i = 0;
i < 200;
i++) {
4773 EXPECT_EQ(iso_1, isolate);
4816 intptr_t mydata = 12345;
4819 EXPECT(isolate !=
nullptr);
4829 const uint8_t* kernel_buffer =
nullptr;
4830 intptr_t kernel_buffer_size = 0;
4832 url_str,
source, &kernel_buffer, &kernel_buffer_size);
4833 if (
error !=
nullptr) {
4851 EXPECT_STREQ(
ZONE_STR(
"isolates/%" Pd64, main_port),
id);
4852 free(
const_cast<char*
>(
id));
4866 const char* kScriptChars =
"main() => throw 'HI';";
4882 const char* kScriptChars =
4883 "class MyClass0 {\n"
4886 "class MyClass1 implements MyInterface1 {\n"
4889 "class MyClass2 implements MyInterface0, MyInterface1 {\n"
4892 "abstract class MyInterface0 {\n"
4895 "abstract class MyInterface1 implements MyInterface0 {\n"
4897 "MyClass0 getMyClass0() { return new MyClass0(); }\n"
4898 "MyClass1 getMyClass1() { return new MyClass1(); }\n"
4899 "MyClass2 getMyClass2() { return new MyClass2(); }\n"
4900 "Type getMyClass0Type() { return new MyClass0().runtimeType; }\n"
4901 "Type getMyClass1Type() { return new MyClass1().runtimeType; }\n"
4902 "Type getMyClass2Type() { return new MyClass2().runtimeType; }\n";
4904 bool instanceOf =
false;
4981 const char* kScriptChars =
4982 "class MyClass0<A, B> {\n"
4985 "class MyClass1<A, C> {\n"
4987 "Type type<T>() => T;"
4988 "MyClass0 getMyClass0() {\n"
4989 " return new MyClass0<int, double>();\n"
4991 "Type getMyClass0Type() {\n"
4992 " return type<MyClass0<int, double>>();\n"
4994 "MyClass1 getMyClass1() {\n"
4995 " return new MyClass1<List<int>, List>();\n"
4997 "Type getMyClass1Type() {\n"
4998 " return type<MyClass1<List<int>, List>>();\n"
5000 "MyClass0 getMyClass0_1() {\n"
5001 " return new MyClass0<double, int>();\n"
5003 "Type getMyClass0_1Type() {\n"
5004 " return type<MyClass0<double, int>>();\n"
5006 "MyClass1 getMyClass1_1() {\n"
5007 " return new MyClass1<List<int>, List<double>>();\n"
5009 "Type getMyClass1_1Type() {\n"
5010 " return type<MyClass1<List<int>, List<double>>>();\n"
5012 "Type getIntType() { return int; }\n"
5013 "Type getDoubleType() { return double; }\n"
5014 "Type getListIntType() { return type<List<int>>(); }\n"
5015 "Type getListType() { return List; }\n";
5059 bool instanceOf =
false;
5105 const char* initial_value) {
5111 const char*
value =
"";
5113 EXPECT_STREQ(initial_value,
value);
5116 static int counter = 0;
5133 EXPECT_STREQ(initial_value,
value);
5142 "NoSuchMethodError");
5146 const char* kScriptChars =
5147 "class BaseFields {\n"
5149 " : this.inherited_fld = 'inherited' {\n"
5151 " var inherited_fld;\n"
5152 " static var non_inherited_fld;\n"
5155 "class Fields extends BaseFields {\n"
5157 " : this.instance_fld = 'instance',\n"
5158 " this._instance_fld = 'hidden instance',\n"
5159 " this.final_instance_fld = 'final instance',\n"
5160 " this._final_instance_fld = 'hidden final instance' {\n"
5161 " instance_getset_fld = 'instance getset';\n"
5162 " _instance_getset_fld = 'hidden instance getset';\n"
5165 " static Init() {\n"
5166 " static_fld = 'static';\n"
5167 " _static_fld = 'hidden static';\n"
5168 " static_getset_fld = 'static getset';\n"
5169 " _static_getset_fld = 'hidden static getset';\n"
5172 " var instance_fld;\n"
5173 " var _instance_fld;\n"
5174 " final final_instance_fld;\n"
5175 " final _final_instance_fld;\n"
5176 " static var static_fld;\n"
5177 " static var _static_fld;\n"
5178 " static const const_static_fld = 'const static';\n"
5179 " static const _const_static_fld = 'hidden const static';\n"
5181 " get instance_getset_fld { return _gs_fld1; }\n"
5182 " void set instance_getset_fld(var value) { _gs_fld1 = value; }\n"
5183 " get _instance_getset_fld { return _gs_fld2; }\n"
5184 " void set _instance_getset_fld(var value) { _gs_fld2 = value; }\n"
5188 " static get static_getset_fld { return _gs_fld3; }\n"
5189 " static void set static_getset_fld(var value) { _gs_fld3 = value; }\n"
5190 " static get _static_getset_fld { return _gs_fld4; }\n"
5191 " static void set _static_getset_fld(var value) { _gs_fld4 = value; }\n"
5192 " static var _gs_fld3;\n"
5193 " static var _gs_fld4;\n"
5197 "const const_top_fld = 'const top';\n"
5198 "const _const_top_fld = 'hidden const top';\n"
5200 "get top_getset_fld { return _gs_fld5; }\n"
5201 "void set top_getset_fld(var value) { _gs_fld5 = value; }\n"
5202 "get _top_getset_fld { return _gs_fld6; }\n"
5203 "void set _top_getset_fld(var value) { _gs_fld6 = value; }\n"
5209 " top_fld = 'top';\n"
5210 " _top_fld = 'hidden top';\n"
5211 " top_getset_fld = 'top getset';\n"
5212 " _top_getset_fld = 'hidden top getset';\n"
5213 " return new Fields();\n"
5215 const char* kImportedScriptChars =
5216 "library library_name;\n"
5217 "var imported_fld = 'imported';\n"
5218 "var _imported_fld = 'hidden imported';\n"
5219 "get imported_getset_fld { return _gs_fld1; }\n"
5220 "void set imported_getset_fld(var value) { _gs_fld1 = value; }\n"
5221 "get _imported_getset_fld { return _gs_fld2; }\n"
5222 "void set _imported_getset_fld(var value) { _gs_fld2 = value; }\n"
5226 " imported_getset_fld = 'imported getset';\n"
5227 " _imported_getset_fld = 'hidden imported getset';\n"
5394 const char* kScriptChars =
"var top;\n";
5417 result,
"Dart_SetField expects argument 'value' to be of type Instance.");
5426 const char* kScriptChars =
"late int foo;\n";
5431 EXPECT_SUBSTRING(
"type 'bool' is not a subtype of type 'int' of 'foo'",
5441 bool* auto_setup_scope) {
5442 ASSERT(auto_setup_scope !=
nullptr);
5443 *auto_setup_scope =
false;
5449 const char* kScriptChars =
5450 "class NativeFields extends NativeFieldsWrapper {\n"
5451 " NativeFields(int i, int j) : fld1 = i, fld2 = j {}\n"
5454 " static int? fld3;\n"
5455 " static const int fld4 = 10;\n"
5457 "NativeFields testMain() {\n"
5458 " NativeFields obj = new NativeFields(10, 20);\n"
5479 const char* kScriptChars =
5480 "import 'dart:nativewrappers';"
5481 "final class NativeFields "
5482 "extends NativeFieldWrapperClass2 {\n"
5483 " NativeFields(int i, int j) : fld1 = i, fld2 = j {}\n"
5485 " final int fld2;\n"
5486 " static int? fld3;\n"
5487 " static const int fld4 = 10;\n"
5489 "NativeFields testMain() {\n"
5490 " NativeFields obj = new NativeFields(10, 20);\n"
5495 const int kNumNativeFields = 2;
5524 const char* kScriptChars =
5525 "class NativeFields extends NativeFieldsWrapperClass2 {\n"
5526 " NativeFields(int i, int j) : fld1 = i, fld2 = j {}\n"
5529 " static int? fld3;\n"
5530 " static const int fld4 = 10;\n"
5532 "NativeFields testMain() {\n"
5533 " NativeFields obj = new NativeFields(10, 20);\n"
5550 "'dart:test-lib': Error: line 1 pos 36: "
5551 "class 'NativeFields' is trying to extend a native fields class, "
5552 "but library '%s' has no native resolvers",
5578 EXPECT_EQ(0, field_values[0]);
5579 EXPECT_EQ(0, field_values[1]);
5587 "Dart_GetNativeFieldsOfArgument: "
5588 "expected 0 'num_fields' but was passed in 2");
5594 ASSERT(auto_scope !=
nullptr);
5598 if (!obj.IsString()) {
5603 if (strcmp(
function_name,
"TestNativeFieldsAccess_init") == 0) {
5605 }
else if (strcmp(
function_name,
"TestNativeFieldsAccess_access") == 0) {
5607 }
else if (strcmp(
function_name,
"TestNativeFieldsAccess_invalidAccess") ==
5617 const char* kScriptChars = R
"(
5618 import 'dart:nativewrappers';
5619 base class NativeFields extends NativeFieldWrapperClass2 {
5620 NativeFields(int i, int j) : fld1 = i, fld2 = j {}
5624 static const int fld4 = 10;
5625 @pragma('vm:external-name', 'TestNativeFieldsAccess_init')
5626 external int? initNativeFlds();
5627 @pragma('vm:external-name', 'TestNativeFieldsAccess_access')
5628 external int? accessNativeFlds(int? i);
5630 class NoNativeFields {
5631 int neitherATypedDataNorNull = 0;
5632 @pragma('vm:external-name', 'TestNativeFieldsAccess_invalidAccess')
5633 external invalidAccess();
5635 NativeFields testMain() {
5636 NativeFields obj = new NativeFields(10, 20);
5637 obj.initNativeFlds();
5638 obj.accessNativeFlds(null);
5639 new NoNativeFields().invalidAccess();
5655 const char* kScriptChars =
5656 "import 'dart:nativewrappers';"
5657 "base class NativeFieldsSuper extends NativeFieldWrapperClass1 {\n"
5658 " NativeFieldsSuper() : fld1 = 42 {}\n"
5661 "base class NativeFields extends NativeFieldsSuper {\n"
5664 "int testMain() {\n"
5665 " NativeFields obj = new NativeFields();\n"
5666 " return obj.fld();\n"
5680 EXPECT_EQ(42,
value);
5694 EXPECT_EQ(10,
value);
5698 EXPECT_EQ(20,
value);
5706 EXPECT_EQ(40,
value);
5709 const int kNativeFld0 = 0;
5710 const int kNativeFld1 = 1;
5711 const int kNativeFld2 = 2;
5712 const int kNativeFld3 = 3;
5713 const int kNativeFld4 = 4;
5714 int field_count = 0;
5715 intptr_t field_value = 0;
5717 EXPECT_EQ(4, field_count);
5722 EXPECT_EQ(0, field_value);
5725 EXPECT_EQ(0, field_value);
5728 EXPECT_EQ(0, field_value);
5731 EXPECT_EQ(0, field_value);
5744 EXPECT_EQ(4000, field_value);
5751 EXPECT_EQ(40,
value);
5755 EXPECT_EQ(20,
value);
5760 const char* kScriptChars =
5761 "import 'dart:nativewrappers';"
5762 "final class NativeFields extends "
5763 "NativeFieldWrapperClass4 {\n"
5764 " NativeFields(int i, int j) : fld1 = i, fld2 = j {}\n"
5767 " final int fld2;\n"
5768 " static int? fld3;\n"
5769 " static const int fld4 = 10;\n"
5771 "NativeFields testMain() {\n"
5772 " NativeFields obj = new NativeFields(10, 20);\n"
5789 const char* kScriptChars =
5790 "import 'dart:nativewrappers';\n"
5791 "class NativeFields {\n"
5792 " NativeFields(int i, int j) : fld1 = i, fld2 = j {}\n"
5794 " final int fld2;\n"
5795 " static int? fld3;\n"
5796 " static const int fld4 = 10;\n"
5798 "NativeFields testMain1() {\n"
5799 " NativeFields obj = new NativeFields(10, 20);\n"
5802 "Function testMain2() {\n"
5820 const int kNativeFld0 = 0;
5821 const int kNativeFld1 = 1;
5822 const int kNativeFld2 = 2;
5823 const int kNativeFld3 = 3;
5824 const int kNativeFld4 = 4;
5862 const char* kScriptChars =
5863 "class TestClass {\n"
5864 " static const int fld1 = 7;\n"
5865 " static int fld2 = 11;\n"
5866 " static void testMain() {\n"
5885 EXPECT_EQ(7,
value);
5890 EXPECT_EQ(11,
value);
5900 EXPECT_EQ(13,
value);
5904 const char* kScriptChars =
5905 "class TestClass {\n"
5906 " static int fld2 = 11;\n"
5907 " static void testMain() {\n"
5922 EXPECT_EQ(11,
value);
5926 const char* kScriptChars =
5927 "class TestClass {\n"
5928 " static int fld2 = 11;\n"
5929 " static void testMain() {\n"
5947 EXPECT_EQ(13,
value);
5951 const char* kScriptChars =
5952 "class MyClass implements MyExtraHop {\n"
5953 " MyClass() : foo = 7 {}\n"
5954 " MyClass.named(value) : foo = value {}\n"
5955 " MyClass._hidden(value) : foo = -value {}\n"
5956 " MyClass.exception(value) : foo = value {\n"
5957 " throw 'ConstructorDeath';\n"
5959 " factory MyClass.multiply(value) {\n"
5960 " return new MyClass.named(value * 100);\n"
5965 "abstract class MyExtraHop implements MyInterface {\n"
5966 " factory MyExtraHop.hop(value) = MyClass.named;\n"
5969 "abstract class MyInterface {\n"
5970 " factory MyInterface.named(value) = MyExtraHop.hop;\n"
5971 " factory MyInterface.multiply(value) = MyClass.multiply;\n"
5972 " MyInterface.notfound(value);\n"
5975 "class _MyClass {\n"
5976 " _MyClass._() : foo = 7 {}\n"
6000 bool instanceOf =
false;
6003 int64_t int_value = 0;
6006 EXPECT_EQ(7, int_value);
6026 EXPECT_EQ(7, int_value);
6040 EXPECT_EQ(7, int_value);
6047 EXPECT_EQ(7, int_value);
6057 EXPECT_EQ(11, int_value);
6070 EXPECT_EQ(11, int_value);
6080 EXPECT_EQ(-11, int_value);
6088 EXPECT_EQ(7, int_value);
6101 EXPECT_EQ(-11, int_value);
6120 EXPECT_EQ(1100, int_value);
6134 "Dart_New expects argument 'number_of_arguments' to be non-negative.");
6140 "Dart_New: wrong argument count for constructor 'MyClass.named': "
6141 "0 passed, 1 expected.");
6151 "Dart_New expects argument 'constructor_name' to be of type String.");
6156 "Dart_New: could not find constructor 'MyClass.missing'.");
6176 const char* kScriptChars =
6177 "class MyClass implements MyExtraHop {\n"
6178 " MyClass() : foo = 7 {}\n"
6179 " MyClass.named(value) : foo = value {}\n"
6180 " MyClass._hidden(value) : foo = -value {}\n"
6181 " MyClass.exception(value) : foo = value {\n"
6182 " throw 'ConstructorDeath';\n"
6184 " factory MyClass.multiply(value) {\n"
6185 " return new MyClass.named(value * 100);\n"
6190 "abstract class MyExtraHop implements MyInterface {\n"
6191 " factory MyExtraHop.hop(value) = MyClass.named;\n"
6194 "abstract class MyInterface {\n"
6195 " factory MyInterface.named(value) = MyExtraHop.hop;\n"
6196 " factory MyInterface.multiply(value) = MyClass.multiply;\n"
6197 " MyInterface.notfound(value);\n"
6213 bool instanceOf =
false;
6219 int64_t int_value = 0;
6222 EXPECT_EQ(11, int_value);
6231 int64_t int_value = 0;
6234 EXPECT_EQ(1100, int_value);
6239 const char* kScriptChars =
6240 "class MyIntClass {\n"
6241 " MyIntClass(this.value);\n"
6245 "class MyClass<T> {\n"
6247 " MyClass(this.value);\n"
6248 " factory MyClass.foo(T x) => MyClass<T>(x);\n"
6251 "Type getIntType() { return int; }\n"
6286 const char* kScriptChars =
6287 "class MyIntClass {\n"
6288 " MyIntClass(this.value);\n"
6292 "class MyClass<T> {\n"
6294 " MyClass(this.value);\n"
6297 "Type getIntType() { return int; }\n"
6330 const char* kScriptChars =
6331 "class InvokeClosure {\n"
6332 " InvokeClosure(int i, int j) : fld1 = i, fld2 = j {}\n"
6333 " Function method1(int i) {\n"
6334 " f(int j) => j + i + fld1 + fld2 + fld4; \n"
6338 " final int fld2;\n"
6339 " static const int fld4 = 10;\n"
6341 "Function testMain1() {\n"
6342 " InvokeClosure obj = new InvokeClosure(10, 20);\n"
6343 " return obj.method1(10);\n"
6364 const char* kScriptChars =
6365 "class ZXHandle {}\n"
6366 "class ChannelReadResult {\n"
6367 " final List<ZXHandle?> handles;\n"
6368 " ChannelReadResult(this.handles);\n"
6370 "void expectListOfString(List<String> _) {}\n"
6371 "void expectListOfDynamic(List<dynamic> _) {}\n"
6372 "void expectListOfVoid(List<void> _) {}\n"
6373 "void expectListOfNever(List<Never> _) {}\n";
6392 const int kNumArgs = 1;
6394 args[0] = zxhandle_list;
6399 "Dart_NewListOfType expects argument 'element_type' to be non-null.");
6402 "Dart_NewListOfType expects argument 'element_type' to be of type Type.");
6412 args[0] = string_list;
6420 args[0] = dynamic_list;
6428 args[0] = void_list;
6435 args[0] = never_list;
6441 const char* kScriptChars =
6442 "class ZXHandle {}\n"
6443 "class ChannelReadResult {\n"
6444 " final List<ZXHandle> handles;\n"
6445 " ChannelReadResult(this.handles);\n"
6476 const int kNumArgs = 1;
6478 args[0] = zxhandle_list;
6482 "Dart_NewListOfTypeFilled expects argument 'element_type' to be "
6485 "Dart_NewListOfTypeFilled expects argument 'element_type' to be "
6489 "Dart_NewListOfTypeFilled expects argument 'fill_object' to be non-null"
6490 " for a non-nullable 'element_type'");
6493 "Dart_NewListOfTypeFilled expects argument 'fill_object' to have the same"
6494 " type as 'element_type'.");
6514 const Library& library_obj = Api::UnwrapLibraryHandle(thread->
zone(), lib);
6520 const char* kScriptChars =
6521 "class BaseMethods {\n"
6522 " inheritedMethod(arg) => 'inherited $arg';\n"
6523 " static nonInheritedMethod(arg) => 'noninherited $arg';\n"
6526 "class Methods extends BaseMethods {\n"
6527 " instanceMethod(arg) => 'instance $arg';\n"
6528 " _instanceMethod(arg) => 'hidden instance $arg';\n"
6529 " static staticMethod(arg) => 'static $arg';\n"
6530 " static _staticMethod(arg) => 'hidden static $arg';\n"
6533 "topMethod(arg) => 'top $arg';\n"
6534 "_topMethod(arg) => 'hidden top $arg';\n"
6536 "Methods test() {\n"
6537 " return new Methods();\n"
6563 EXPECT_STREQ(
"instance !!!", str);
6567 "Class 'Methods' has no instance method 'instanceMethod'"
6568 " with matching arguments");
6576 EXPECT_STREQ(
"hidden instance !!!", str);
6585 EXPECT_STREQ(
"inherited !!!", str);
6594 EXPECT_STREQ(
"static !!!", str);
6598 "NoSuchMethodError: No static method 'staticMethod' with "
6599 "matching arguments");
6608 EXPECT_STREQ(
"hidden static !!!", str);
6623 EXPECT_STREQ(
"top !!!", str);
6627 "NoSuchMethodError: No top-level method 'topMethod' with "
6628 "matching arguments");
6637 EXPECT_STREQ(
"hidden top !!!", str);
6641 const char* kScriptChars =
6643 " static _staticMethod(arg) => 'hidden static $arg';\n"
6661 const char* str =
nullptr;
6663 EXPECT_STREQ(
"hidden static !!!", str);
6667 const char* kScriptChars =
"test(arg) => 'hello $arg';\n";
6679 EXPECT_STREQ(
"hello !!!", str);
6686 EXPECT_STREQ(
"hello null", str);
6702 EXPECT_STREQ(
"Dart_Invoke expects arguments[0] to be an Instance handle.",
6713 const char* kScriptChars =
6714 "class BaseMethods {\n"
6715 " inheritedMethod(int arg) => 'inherited $arg';\n"
6716 " static nonInheritedMethod(int arg) => 'noninherited $arg';\n"
6719 "class Methods extends BaseMethods {\n"
6720 " instanceMethod(int arg) => 'instance $arg';\n"
6721 " _instanceMethod(int arg) => 'hidden instance $arg';\n"
6722 " static staticMethod(int arg) => 'static $arg';\n"
6723 " static _staticMethod(int arg) => 'hidden static $arg';\n"
6726 "topMethod(int arg) => 'top $arg';\n"
6727 "_topMethod(int arg) => 'hidden top $arg';\n"
6729 "Methods test() {\n"
6730 " return new Methods();\n"
6734 const char* error_msg =
6735 "type '_OneByteString' is not a subtype of type 'int' of 'arg'";
6737 const char* error_msg =
6738 "type 'String' is not a subtype of type 'int' of 'arg'";
6801 const char*
value =
"";
6803 EXPECT_STREQ(
"null",
value);
6819 "NoSuchMethodError: The setter 'nullHasNoSetters=' was called on null");
6823 const char* kScriptChars =
6825 " static equals(a, b) {\n"
6827 " throw 'not equal. expected: $a, got: $b';\n"
6831 "class TestClass {\n"
6832 " static int fld1 = 0;\n"
6833 " void noSuchMethod(Invocation invocation) {\n"
6837 " var name = invocation.memberName.toString();\n"
6838 " name = name.split('\"')[1];\n"
6839 " if (name == 'fld') {\n"
6840 " Expect.equals(true, invocation.isGetter);\n"
6841 " Expect.equals(false, invocation.isMethod);\n"
6842 " Expect.equals(false, invocation.isSetter);\n"
6843 " } else if (name == 'setfld') {\n"
6844 " Expect.equals(true, invocation.isSetter);\n"
6845 " Expect.equals(false, invocation.isMethod);\n"
6846 " Expect.equals(false, invocation.isGetter);\n"
6847 " } else if (name == 'method') {\n"
6848 " Expect.equals(true, invocation.isMethod);\n"
6849 " Expect.equals(false, invocation.isSetter);\n"
6850 " Expect.equals(false, invocation.isGetter);\n"
6852 " TestClass.fld1 += 1;\n"
6854 " static TestClass testMain() {\n"
6855 " return new TestClass();\n"
6887 EXPECT_EQ(3,
value);
6891 const char* kScriptChars =
6892 "class InvokeClosure {\n"
6893 " InvokeClosure(int i, int j) : fld1 = i, fld2 = j {}\n"
6894 " Function method1(int i) {\n"
6895 " f(int j) => j + i + fld1 + fld2 + fld4; \n"
6898 " static Function method2(int i) {\n"
6899 " n(int j) { throw new Exception('I am an exception'); return 1; }\n"
6903 " final int fld2;\n"
6904 " static const int fld4 = 10;\n"
6906 "Function testMain1() {\n"
6907 " InvokeClosure obj = new InvokeClosure(10, 20);\n"
6908 " return obj.method1(10);\n"
6910 "Function testMain2() {\n"
6911 " return InvokeClosure.method2(10);\n"
6934 EXPECT_EQ(51,
value);
6963 bool* auto_setup_scope) {
6964 ASSERT(auto_setup_scope !=
nullptr);
6965 *auto_setup_scope =
true;
6970 const char* kScriptChars =
6972 @pragma('vm:external-name', 'ThrowException_native')
6973 external int test();
6977 intptr_t size = thread->ZoneSizeInBytes();
6994 EXPECT_EQ(
size, thread->ZoneSizeInBytes());
7006 const int num_native_fields = 2;
7020 const int kNumNativeFields = 2;
7024 const char* cstr =
nullptr;
7025 intptr_t native_fields1[kNumNativeFields];
7026 intptr_t native_fields2[kNumNativeFields];
7047 EXPECT(arg_values[0].as_native_fields.values[0] == 30);
7048 EXPECT(arg_values[0].as_native_fields.values[1] == 40);
7050 EXPECT(arg_values[1].as_int32 == 77);
7054 EXPECT(arg_values[2].as_uint64 == 0x8000000000000000LL);
7056 EXPECT(arg_values[3].as_bool ==
true);
7058 EXPECT(arg_values[4].as_double == 3.14);
7063 EXPECT_STREQ(
"abcdefg", cstr);
7064 EXPECT(arg_values[5].as_string.peer ==
nullptr);
7069 EXPECT_STREQ(
"string", cstr);
7070 EXPECT(arg_values[6].as_string.peer ==
nullptr);
7072 EXPECT(arg_values[7].as_native_fields.values[0] == 60);
7073 EXPECT(arg_values[7].as_native_fields.values[1] == 80);
7077 int field_count = 0;
7080 EXPECT(field_count == 2);
7124 bool* auto_scope_setup) {
7127 if (!obj.IsString()) {
7130 ASSERT(auto_scope_setup !=
nullptr);
7131 *auto_scope_setup =
true;
7136 }
else if (strcmp(
function_name,
"NativeArgument_Access") == 0) {
7143 const char* kScriptChars = R
"(
7144import 'dart:nativewrappers';
7145base class MyObject extends NativeFieldWrapperClass2 {
7146 @pragma("vm:external-name", "NativeArgument_Create")
7147 external static MyObject createObject();
7148 @pragma("vm:external-name", "NativeArgument_Access")
7149 external int accessFields(int arg1,
7157int testMain(String extstr) {
7158 String str = 'abcdefg';
7159 MyObject obj1 = MyObject.createObject();
7160 MyObject obj2 = MyObject.createObject();
7161 return obj1.accessFields(77,
7172 const char* ascii_str =
"string";
7173 intptr_t ascii_str_length = strlen(ascii_str);
7175 reinterpret_cast<const uint8_t*
>(ascii_str), ascii_str_length);
7193 bool* auto_setup_scope) {
7194 ASSERT(auto_setup_scope !=
nullptr);
7195 *auto_setup_scope =
true;
7199TEST_CASE(DartAPI_GetNativeArgumentCount) {
7200 const char* kScriptChars = R
"(
7202 @pragma("vm:external-name", "Name_Does_Not_Matter")
7203 external int method1(int i, int j);
7206 MyObject obj = new MyObject();
7207 return obj.method1(77, 125);
7223 const char* kScriptChars =
7224 "library testlib;\n"
7226 " static var name = 'Class';\n"
7235 "Cannot use legacy types with --sound-null-safety enabled. "
7236 "Use Dart_GetNullableType or Dart_GetNonNullableType instead.");
7255 const char* kScriptChars =
7256 "library testlib;\n"
7258 " static var name = 'Class';\n"
7262 " static var name = '_Class';\n"
7275 const char* name_cstr =
"";
7277 EXPECT_STREQ(
"Class?", name_cstr);
7282 EXPECT_STREQ(
"Class", name_cstr);
7294 EXPECT_STREQ(
"_Class", name_cstr);
7299 EXPECT_STREQ(
"Type 'DoesNotExist' not found in library 'testlib'.",
7315 const char* kScriptChars =
7316 "library testlib;\n"
7318 " static var name = 'Class';\n"
7322 " static var name = '_Class';\n"
7336 const char* name_cstr =
"";
7338 EXPECT_STREQ(
"Class", name_cstr);
7343 EXPECT_STREQ(
"Class", name_cstr);
7356 EXPECT_STREQ(
"_Class", name_cstr);
7361 EXPECT_STREQ(
"Type 'DoesNotExist' not found in library 'testlib'.",
7377 const char* kScriptChars =
7378 "class OtherClass {\n"
7379 " static returnNull() { return null; }\n"
7381 "class InstanceOfTest {\n"
7382 " InstanceOfTest() {}\n"
7383 " static InstanceOfTest testMain() {\n"
7384 " return new InstanceOfTest();\n"
7403 bool is_instance =
false;
7445 const char* kScriptChars =
7462 const char* uri_cstr =
"";
7483 EXPECT_STREQ(
"dart:core", uri_cstr);
7492 const char* kScriptChars =
7493 "import 'library1_dart';"
7495 const char* kLibrary1 =
"file:///library1_dart";
7496 const char* kLibrary1Chars =
7517 "Dart_LookupLibrary expects argument 'url' to be non-null.");
7522 "Dart_LookupLibrary expects argument 'url' to be of type String.");
7534 const char* kLibrary1Chars =
"library library1_name;";
7541 "Dart_LibraryUrl expects argument 'library' to be non-null.");
7546 "Dart_LibraryUrl expects argument 'library' to be of type Library.");
7555 const char* cstr =
nullptr;
7557 EXPECT_SUBSTRING(
"library1_url", cstr);
7574 bool* auto_setup_scope) {
7575 ASSERT(auto_setup_scope !=
nullptr);
7576 *auto_setup_scope =
false;
7582 bool* auto_setup_scope) {
7583 ASSERT(auto_setup_scope !=
nullptr);
7584 *auto_setup_scope =
false;
7589 const char* kScriptChars =
7592 @pragma('vm:external-name', 'SomeNativeFunction')
7593 external static foo();
7595 @pragma('vm:external-name', 'SomeNativeFunction2')
7596 external static bar();
7598 @pragma('vm:external-name', 'SomeNativeFunction3')
7599 external static baz();
7618 "Dart_SetNativeResolver expects argument 'library' to be non-null.");
7622 "Dart_SetNativeResolver expects argument 'library' to be of "
7638 EXPECT_EQ(654321,
value);
7650 EXPECT_EQ(654321,
value);
7658 EXPECT_EQ(123456,
value);
7665 "native function 'SomeNativeFunction3' (0 arguments) "
7672 const char* kScriptChars =
7673 "import 'library1_dart';\n"
7675 "main() { foo = 0; }\n";
7676 const char* kLibrary1Chars =
7677 "library library1_dart;\n"
7678 "import 'library2_dart';\n"
7680 const char* kLibrary2Chars =
7681 "library library2_dart;\n"
7682 "import 'library1_dart';\n"
7690 {
"file:///library1_dart", kLibrary1Chars},
7691 {
"file:///library2_dart", kLibrary2Chars},
7693 int sourcefiles_count =
sizeof(sourcefiles) /
sizeof(
Dart_SourceFile);
7707 const char* kScriptChars =
7708 "import 'file:///library2_dart';\n"
7709 "import 'file:///library1_dart';\n"
7710 "var foo_top = 10; // foo has dup def. So should be an error.\n"
7711 "main() { foo = 0; }\n";
7712 const char* kLibrary1Chars =
7713 "library library1_dart;\n"
7715 const char* kLibrary2Chars =
7716 "library library2_dart;\n"
7724 {
"file:///library2_dart", kLibrary2Chars},
7725 {
"file:///library1_dart", kLibrary1Chars},
7727 int sourcefiles_count =
sizeof(sourcefiles) /
sizeof(
Dart_SourceFile);
7731 "Compilation failed /test-lib:4:10:"
7732 " Error: Setter not found: 'foo'");
7745 const char* kScriptChars =
7746 "import 'library2_dart';\n"
7747 "import 'library1_dart';\n"
7749 const char* kLibrary1Chars =
7750 "library library1_dart;\n"
7752 const char* kLibrary2Chars =
7753 "library library2_dart;\n"
7761 {
"file:///library2_dart", kLibrary2Chars},
7762 {
"file:///library1_dart", kLibrary1Chars},
7764 int sourcefiles_count =
sizeof(sourcefiles) /
sizeof(
Dart_SourceFile);
7776 const char* kScriptChars =
7777 "import 'lib.dart';\n"
7778 "abstract class Y {\n"
7779 " void set handler(void callback(List<int> x));\n"
7782 const char* kLibraryChars =
7783 "library lib.dart;\n"
7784 "abstract class X {\n"
7785 " void set handler(void callback(List<int> x));\n"
7793 {
"file:///lib.dart", kLibraryChars},
7795 int sourcefiles_count =
sizeof(sourcefiles) /
sizeof(
Dart_SourceFile);
7807 const char* kScriptChars =
7808 "import 'lib.dart';\n"
7810 const char* kLibraryChars =
"library lib.dart;\n";
7815 {
"file:///bar/main.dart", kScriptChars},
7816 {
"file:///baz/lib.dart", kLibraryChars},
7817 {
"file:///bar/.packages",
""},
7819 int sourcefiles_count =
sizeof(sourcefiles) /
sizeof(
Dart_SourceFile);
7821 sourcefiles_count, sourcefiles,
nullptr,
true,
7828 TransitionNativeToVM transition(thread);
7832 const Array& lib_scripts =
Array::Handle(lib_obj.LoadedScripts());
7835 for (intptr_t
i = 0;
i < lib_scripts.Length();
i++) {
7839 EXPECT(strstr(uri_str,
"foo:///") == uri_str);
7848TEST_CASE(DartAPI_Multiroot_FailWhenUriIsWrong) {
7849 const char* kScriptChars =
7850 "import 'lib.dart';\n"
7852 const char* kLibraryChars =
"library lib.dart;\n";
7856 {
"file:///bar/main.dart", kScriptChars},
7857 {
"file:///baz/lib.dart", kLibraryChars},
7858 {
"file:///bar/.packages",
"untitled:/"},
7860 int sourcefiles_count =
sizeof(sourcefiles) /
sizeof(
Dart_SourceFile);
7862 sourcefiles_count, sourcefiles,
nullptr,
true,
7864 "foo1:///main.dart",
7868 "Compilation failed Invalid argument(s): Exception when reading "
7869 "'foo1:///.dart_tool");
7920TEST_CASE(DartAPI_PostCObject_DoesNotRunFinalizerOnFailure) {
7922 Utils::StrDup(
"Ownership of this memory remains with the caller");
7927 message.value.as_external_typed_data.length = strlen(my_str);
7928 message.value.as_external_typed_data.data =
7929 reinterpret_cast<uint8_t*
>(my_str);
7930 message.value.as_external_typed_data.peer = my_str;
7948 TestIsolateScope __test_isolate__;
7949 const char* kScriptChars =
7950 "import 'dart:isolate';\n"
7951 "void callPort(SendPort port) {\n"
7952 " var receivePort = new RawReceivePort();\n"
7953 " var replyPort = receivePort.sendPort;\n"
7954 " port.send(<dynamic>[replyPort]);\n"
7955 " receivePort.handler = (message) {\n"
7956 " receivePort.close();\n"
7957 " throw new Exception(message);\n"
7974 dart_args[0] = send_port1;
7983 dart_args[0] = send_port2;
8022TEST_CASE(DartAPI_NativePortPostInteger) {
8023 const char* kScriptChars =
8024 "import 'dart:isolate';\n"
8025 "void callPort(SendPort port) {\n"
8026 " var receivePort = new RawReceivePort();\n"
8027 " var replyPort = receivePort.sendPort;\n"
8028 " port.send(<dynamic>[replyPort]);\n"
8029 " receivePort.handler = (message) {\n"
8030 " receivePort.close();\n"
8031 " throw new Exception(message);\n"
8049 dart_args[0] = send_port1;
8058 dart_args[0] = send_port2;
8079 EXPECT_EQ(10,
message->value.as_typed_data.length);
8080 EXPECT_EQ(42,
message->value.as_typed_data.values[0]);
8081 free(
const_cast<uint8_t*
>(
message->value.as_typed_data.values));
8089 EXPECT_EQ(1,
message->value.as_array.length);
8098TEST_CASE(DartAPI_NativePortPostTransferrableTypedData) {
8099 const char* kScriptChars =
8100 "import 'dart:typed_data';\n"
8101 "import 'dart:isolate';\n"
8102 "void callPort(SendPort port1, SendPort port2) {\n"
8104 " TransferableTypedData.fromList([Uint8List(10)..[0] = 42]);\n"
8106 " TransferableTypedData.fromList([Uint8List(10)..[0] = 42]);\n"
8107 " port1.send(td1);\n"
8108 " port2.send([td2]);\n"
8125 dart_args[0] = send_port1;
8126 dart_args[1] = send_port2;
8149 EXPECT_EQ((0x41 +
i),
message->value.as_typed_data.values[
i]);
8154 delete[]
reinterpret_cast<int8_t*
>(peer);
8157TEST_CASE(DartAPI_NativePortPostExternalTypedData) {
8160 extTypedData[
i] = 0x41 +
i;
8162 const char* kScriptChars =
8163 "import 'dart:typed_data';\n"
8164 "import 'dart:isolate';\n"
8165 "void callPort(SendPort port, Uint8List data) {\n"
8166 " port.send(data);\n"
8184 dart_args[0] = send_port;
8185 dart_args[1] = extdata;
8202TEST_CASE(DartAPI_NativePortPostUserClass) {
8203 const char* kScriptChars =
8204 "import 'dart:isolate';\n"
8206 "void callPort(SendPort port) {\n"
8207 " port.send(new ABC());\n"
8220 dart_args[0] = send_port;
8231 dart_args[0] = send_port;
8253TEST_CASE(DartAPI_NativePortReceiveNull) {
8254 const char* kScriptChars =
8255 "import 'dart:isolate';\n"
8256 "void callPort(SendPort port) {\n"
8257 " var receivePort = new RawReceivePort();\n"
8258 " var replyPort = receivePort.sendPort;\n"
8259 " port.send(null);\n"
8260 " port.send(<dynamic>[replyPort]);\n"
8261 " receivePort.handler = (message) {\n"
8262 " receivePort.close();\n"
8263 " throw new Exception(message);\n"
8276 dart_args[0] = send_port1;
8301 EXPECT_EQ(
message->value.as_int32, 321);
8305TEST_CASE(DartAPI_NativePortReceiveInteger) {
8306 const char* kScriptChars =
8307 "import 'dart:isolate';\n"
8308 "void callPort(SendPort port) {\n"
8309 " var receivePort = new RawReceivePort();\n"
8310 " var replyPort = receivePort.sendPort;\n"
8311 " port.send(321);\n"
8312 " port.send(<dynamic>[replyPort]);\n"
8313 " receivePort.handler = (message) {\n"
8314 " receivePort.close();\n"
8315 " throw new Exception(message);\n"
8328 dart_args[0] = send_port1;
8344 const char* package_root,
8345 const char* package_config,
8349 const char* kScriptChars =
8350 "import 'dart:isolate';\n"
8351 "void main(shouldThrowException) {\n"
8352 " var rp = new RawReceivePort();\n"
8353 " rp.handler = (msg) {\n"
8355 " if (shouldThrowException) {\n"
8356 " throw new Exception('ExceptionFromTimer');\n"
8359 " rp.sendPort.send(1);\n"
8366 ASSERT(isolate !=
nullptr);
8378 EXPECT(err_msg ==
nullptr);
8387 nullptr,
nullptr,
nullptr);
8400 if (throw_exception) {
8472 void* my_group_data =
reinterpret_cast<void*
>(123);
8473 void* my_data =
reinterpret_cast<void*
>(456);
8478 EXPECT(isolate !=
nullptr);
8506 void* isolate_data) {
8529 const char* kScriptChars =
8530 "int add(int a, int b) {\n"
8540 EXPECT(isolate !=
nullptr);
8593 int64_t integer_value = 0;
8596 EXPECT_EQ(
value, integer_value);
8597 double double_value;
8631 bool* auto_setup_scope) {
8632 ASSERT(auto_setup_scope !=
nullptr);
8633 *auto_setup_scope =
false;
8636 if (!obj.IsString()) {
8640 const char* kNativeFoo1 =
"NativeFoo1";
8641 const char* kNativeFoo2 =
"NativeFoo2";
8642 const char* kNativeFoo3 =
"NativeFoo3";
8643 const char* kNativeFoo4 =
"NativeFoo4";
8646 }
else if (strncmp(
function_name, kNativeFoo2, strlen(kNativeFoo2)) == 0) {
8648 }
else if (strncmp(
function_name, kNativeFoo3, strlen(kNativeFoo3)) == 0) {
8650 }
else if (strncmp(
function_name, kNativeFoo4, strlen(kNativeFoo4)) == 0) {
8658TEST_CASE(DartAPI_NativeFunctionClosure) {
8659 const char* kScriptChars =
8662 @pragma('vm:external-name', 'NativeFoo1')
8663 external int foo1();
8665 @pragma('vm:external-name', 'NativeFoo2')
8666 external int foo2(int i);
8668 @pragma('vm:external-name', 'NativeFoo3')
8669 external int foo3([int k = 10000, int l = 1]);
8671 @pragma('vm:external-name', 'NativeFoo4')
8672 external int foo4(int i, [int j = 10, int k = 1]);
8674 int bar1() { var func = foo1; return func(); }
8675 int bar2(int i) { var func = foo2; return func(i); }
8676 int bar30() { var func = foo3; return func(); }
8677 int bar31(int i) { var func = foo3; return func(i); }
8678 int bar32(int i, int j) { var func = foo3; return func(i, j); }
8680 var func = foo4; return func(i); }
8681 int bar42(int i, int j) {
8682 var func = foo4; return func(i, j); }
8683 int bar43(int i, int j, int k) {
8684 var func = foo4; return func(i, j, k); }
8687 static equals(a, b) {
8689 throw 'not equal. expected: $a, got: $b';
8694 Test obj = new Test();
8695 Expect.equals(1, obj.foo1());
8696 Expect.equals(1, obj.bar1());
8698 Expect.equals(10, obj.foo2(10));
8699 Expect.equals(10, obj.bar2(10));
8701 Expect.equals(10001, obj.foo3());
8702 Expect.equals(10001, obj.bar30());
8703 Expect.equals(2, obj.foo3(1));
8704 Expect.equals(2, obj.bar31(1));
8705 Expect.equals(4, obj.foo3(2, 2));
8706 Expect.equals(4, obj.bar32(2, 2));
8708 Expect.equals(12, obj.foo4(1));
8709 Expect.equals(12, obj.bar41(1));
8710 Expect.equals(3, obj.foo4(1, 1));
8711 Expect.equals(3, obj.bar42(1, 1));
8712 Expect.equals(6, obj.foo4(2, 2, 2));
8713 Expect.equals(6, obj.bar43(2, 2, 2));
8735 EXPECT_EQ(0,
value);
8780 bool* auto_setup_scope) {
8781 ASSERT(auto_setup_scope !=
nullptr);
8782 *auto_setup_scope =
false;
8785 if (!obj.IsString()) {
8789 const char* kNativeFoo1 =
"StaticNativeFoo1";
8790 const char* kNativeFoo2 =
"StaticNativeFoo2";
8791 const char* kNativeFoo3 =
"StaticNativeFoo3";
8792 const char* kNativeFoo4 =
"StaticNativeFoo4";
8793 if (strncmp(
function_name, kNativeFoo1, strlen(kNativeFoo1)) == 0) {
8795 }
else if (strncmp(
function_name, kNativeFoo2, strlen(kNativeFoo2)) == 0) {
8797 }
else if (strncmp(
function_name, kNativeFoo3, strlen(kNativeFoo3)) == 0) {
8799 }
else if (strncmp(
function_name, kNativeFoo4, strlen(kNativeFoo4)) == 0) {
8807TEST_CASE(DartAPI_NativeStaticFunctionClosure) {
8808 const char* kScriptChars =
8811 @pragma('vm:external-name', 'StaticNativeFoo1')
8812 external static int foo1();
8814 @pragma('vm:external-name', 'StaticNativeFoo2')
8815 external static int foo2(int i);
8817 @pragma('vm:external-name', 'StaticNativeFoo3')
8818 external static int foo3([int k = 10000, int l = 1]);
8820 @pragma('vm:external-name', 'StaticNativeFoo4')
8821 external static int foo4(int i, [int j = 10, int k = 1]);
8823 int bar1() { var func = foo1; return func(); }
8824 int bar2(int i) { var func = foo2; return func(i); }
8825 int bar30() { var func = foo3; return func(); }
8826 int bar31(int i) { var func = foo3; return func(i); }
8827 int bar32(int i, int j) { var func = foo3; return func(i, j); }
8829 var func = foo4; return func(i); }
8830 int bar42(int i, int j) {
8831 var func = foo4; return func(i, j); }
8832 int bar43(int i, int j, int k) {
8833 var func = foo4; return func(i, j, k); }
8836 static equals(a, b) {
8838 throw 'not equal. expected: $a, got: $b';
8843 Test obj = new Test();
8844 Expect.equals(0, Test.foo1());
8845 Expect.equals(0, obj.bar1());
8847 Expect.equals(10, Test.foo2(10));
8848 Expect.equals(10, obj.bar2(10));
8850 Expect.equals(10001, Test.foo3());
8851 Expect.equals(10001, obj.bar30());
8852 Expect.equals(2, Test.foo3(1));
8853 Expect.equals(2, obj.bar31(1));
8854 Expect.equals(4, Test.foo3(2, 2));
8855 Expect.equals(4, obj.bar32(2, 2));
8857 Expect.equals(12, Test.foo4(1));
8858 Expect.equals(12, obj.bar41(1));
8859 Expect.equals(3, Test.foo4(1, 1));
8860 Expect.equals(3, obj.bar42(1, 1));
8861 Expect.equals(6, Test.foo4(2, 2, 2));
8862 Expect.equals(6, obj.bar43(2, 2, 2));
8884 EXPECT_EQ(0,
value);
8888 uint8_t chars8[1] = {
'a'};
8889 uint16_t chars16[1] = {
'a'};
8890 int32_t chars32[1] = {
'a'};
8893 "expects argument 'length' to be in the range");
8895 "expects argument 'length' to be in the range");
8897 "expects argument 'length' to be in the range");
8899 "expects argument 'length' to be in the range");
8901 "expects argument 'length' to be in the range");
8904 "expects argument 'length' to be in the range");
8906 "expects argument 'length' to be in the range");
8909 "expects argument 'length' to be in the range");
8973 EXPECT_EQ(0, heap->PeerCount());
8979 EXPECT_EQ(1, heap->PeerCount());
8987 EXPECT_EQ(0, heap->PeerCount());
8993TEST_CASE(DartAPI_CollectOneNewSpacePeer) {
9001 EXPECT_EQ(0, heap->PeerCount());
9007 EXPECT_EQ(1, heap->PeerCount());
9010 EXPECT(
out ==
reinterpret_cast<void*
>(&peer));
9012 TransitionNativeToVM transition(thread);
9013 GCTestHelper::CollectNewSpace();
9014 EXPECT_EQ(1, heap->PeerCount());
9018 EXPECT(
out ==
reinterpret_cast<void*
>(&peer));
9022 TransitionNativeToVM transition(thread);
9023 GCTestHelper::CollectNewSpace();
9024 EXPECT_EQ(0, heap->PeerCount());
9039 EXPECT_EQ(0, heap->PeerCount());
9042 EXPECT_EQ(1, heap->PeerCount());
9044 EXPECT(o1 ==
reinterpret_cast<void*
>(&p1));
9048 EXPECT_EQ(1, heap->PeerCount());
9054 EXPECT_EQ(2, heap->PeerCount());
9056 EXPECT(o2 ==
reinterpret_cast<void*
>(&p2));
9058 EXPECT_EQ(1, heap->PeerCount());
9062 EXPECT_EQ(0, heap->PeerCount());
9070TEST_CASE(DartAPI_CollectTwoNewSpacePeers) {
9078 EXPECT_EQ(0, heap->PeerCount());
9084 EXPECT_EQ(1, heap->PeerCount());
9086 EXPECT(o1 ==
reinterpret_cast<void*
>(&p1));
9090 EXPECT_EQ(1, heap->PeerCount());
9096 EXPECT_EQ(2, heap->PeerCount());
9098 EXPECT(o2 ==
reinterpret_cast<void*
>(&p2));
9102 TransitionNativeToVM transition(thread);
9103 GCTestHelper::CollectNewSpace();
9104 EXPECT_EQ(0, heap->PeerCount());
9111 const int kPeerCount = 10;
9114 for (
int i = 0;
i < kPeerCount; ++
i) {
9122 EXPECT_EQ(0, heap->PeerCount());
9124 for (
int i = 0;
i < kPeerCount; ++
i) {
9126 EXPECT_EQ(
i + 1, heap->PeerCount());
9129 EXPECT(o ==
reinterpret_cast<void*
>(&
p[
i]));
9131 EXPECT_EQ(kPeerCount, heap->PeerCount());
9133 TransitionNativeToVM transition(thread);
9134 GCTestHelper::CollectNewSpace();
9135 EXPECT_EQ(kPeerCount, heap->PeerCount());
9136 GCTestHelper::CollectNewSpace();
9137 EXPECT_EQ(kPeerCount, heap->PeerCount());
9149 EXPECT_EQ(0, heap->PeerCount());
9157 EXPECT(
out ==
reinterpret_cast<void*
>(&peer));
9158 EXPECT_EQ(1, heap->PeerCount());
9160 TransitionNativeToVM transition(thread);
9161 GCTestHelper::CollectNewSpace();
9162 GCTestHelper::CollectNewSpace();
9166 TransitionNativeToVM transition(thread);
9173 EXPECT(
out ==
reinterpret_cast<void*
>(&peer));
9174 EXPECT_EQ(1, heap->PeerCount());
9179 EXPECT_EQ(0, heap->PeerCount());
9190 EXPECT_EQ(0, heap->PeerCount());
9196 EXPECT_EQ(1, heap->PeerCount());
9199 EXPECT(
out ==
reinterpret_cast<void*
>(&peer));
9201 TransitionNativeToVM transition(thread);
9202 GCTestHelper::CollectOldSpace();
9203 EXPECT_EQ(1, heap->PeerCount());
9206 EXPECT(
out ==
reinterpret_cast<void*
>(&peer));
9211 EXPECT_EQ(0, heap->PeerCount());
9217TEST_CASE(DartAPI_CollectOneOldSpacePeer) {
9226 EXPECT_EQ(0, heap->PeerCount());
9232 EXPECT_EQ(1, heap->PeerCount());
9235 EXPECT(
out ==
reinterpret_cast<void*
>(&peer));
9237 TransitionNativeToVM transition(thread);
9238 GCTestHelper::CollectOldSpace();
9239 EXPECT_EQ(1, heap->PeerCount());
9242 EXPECT(
out ==
reinterpret_cast<void*
>(&peer));
9246 TransitionNativeToVM transition(thread);
9247 GCTestHelper::CollectOldSpace();
9248 EXPECT_EQ(0, heap->PeerCount());
9260 EXPECT_EQ(0, heap->PeerCount());
9266 EXPECT_EQ(1, heap->PeerCount());
9269 EXPECT(o1 ==
reinterpret_cast<void*
>(&p1));
9273 EXPECT_EQ(1, heap->PeerCount());
9279 EXPECT_EQ(2, heap->PeerCount());
9282 EXPECT(o2 ==
reinterpret_cast<void*
>(&p2));
9284 EXPECT_EQ(1, heap->PeerCount());
9289 EXPECT_EQ(0, heap->PeerCount());
9298TEST_CASE(DartAPI_CollectTwoOldSpacePeers) {
9307 EXPECT_EQ(0, heap->PeerCount());
9313 EXPECT_EQ(1, heap->PeerCount());
9316 EXPECT(o1 ==
reinterpret_cast<void*
>(&p1));
9320 EXPECT_EQ(1, heap->PeerCount());
9326 EXPECT_EQ(2, heap->PeerCount());
9329 EXPECT(o2 ==
reinterpret_cast<void*
>(&p2));
9334 GCTestHelper::CollectOldSpace();
9335 EXPECT_EQ(0, heap->PeerCount());
9339TEST_CASE(DartAPI_StringFromExternalTypedData) {
9340 const char* kScriptChars =
9341 "test(external) {\n"
9342 " var str1 = new String.fromCharCodes(external);\n"
9343 " var str2 = new String.fromCharCodes(new List.from(external));\n"
9344 " if (str2 != str1) throw 'FAIL';\n"
9347 "testView8(external) {\n"
9348 " return test(external.buffer.asUint8List());\n"
9350 "testView16(external) {\n"
9351 " return test(external.buffer.asUint16List());\n"
9357 for (
int i = 0;
i < 64;
i++) {
9365 dart_args[0] = external;
9377 for (
int i = 0;
i < 64;
i++) {
9385 dart_args[0] = external;
9397 for (
int i = 0;
i < 64;
i++) {
9398 data[
i] = 0x2000 +
i * 4;
9405 dart_args[0] = external;
9421 TimelineStream*
stream = Timeline::GetEmbedderStream();
9423 stream->set_enabled(
true);
9428 TimelineEventRecorder* recorder = Timeline::recorder();
9430 IsolateTimelineEventFilter filter(isolate->main_port());
9431 recorder->PrintJSON(&
js, &filter);
9432 const char* json =
js.ToCString();
9433 EXPECT_SUBSTRING(
"\"name\":\"testDurationEvent\"", json);
9434 EXPECT_SUBSTRING(
"\"ph\":\"X\"", json);
9435 EXPECT_SUBSTRING(
"\"ts\":500", json);
9436 EXPECT_SUBSTRING(
"\"dur\":1000", json);
9442 TimelineStream*
stream = Timeline::GetEmbedderStream();
9444 stream->set_enabled(
true);
9449 TimelineEventRecorder* recorder = Timeline::recorder();
9451 IsolateTimelineEventFilter filter(isolate->main_port());
9452 recorder->PrintJSON(&
js, &filter);
9453 const char* json =
js.ToCString();
9454 EXPECT_SUBSTRING(
"\"name\":\"testBeginEvent\"", json);
9455 EXPECT_SUBSTRING(
"\"ph\":\"B\"", json);
9456 EXPECT_SUBSTRING(
"\"ts\":1000", json);
9462 TimelineStream*
stream = Timeline::GetEmbedderStream();
9464 stream->set_enabled(
true);
9469 TimelineEventRecorder* recorder = Timeline::recorder();
9471 IsolateTimelineEventFilter filter(isolate->main_port());
9472 recorder->PrintJSON(&
js, &filter);
9473 const char* json =
js.ToCString();
9474 EXPECT_SUBSTRING(
"\"name\":\"testEndEvent\"", json);
9475 EXPECT_SUBSTRING(
"\"ph\":\"E\"", json);
9476 EXPECT_SUBSTRING(
"\"ts\":1000", json);
9482 TimelineStream*
stream = Timeline::GetEmbedderStream();
9484 stream->set_enabled(
true);
9488 TimelineEventRecorder* recorder = Timeline::recorder();
9490 IsolateTimelineEventFilter filter(isolate->main_port());
9491 recorder->PrintJSON(&
js, &filter);
9492 const char* json =
js.ToCString();
9493 EXPECT_SUBSTRING(
"\"name\":\"testInstantEvent\"", json);
9494 EXPECT_SUBSTRING(
"\"ph\":\"i\"", json);
9495 EXPECT_SUBSTRING(
"\"ts\":1000", json);
9498TEST_CASE(DartAPI_TimelineAsyncDisabled) {
9500 TimelineStream*
stream = Timeline::GetEmbedderStream();
9502 stream->set_enabled(
false);
9503 int64_t async_id = 99;
9508 TimelineEventRecorder* recorder = Timeline::recorder();
9510 TimelineEventFilter filter;
9511 recorder->PrintJSON(&
js, &filter);
9512 EXPECT_NOTSUBSTRING(
"testAsyncEvent",
js.ToCString());
9518 TimelineStream*
stream = Timeline::GetEmbedderStream();
9520 stream->set_enabled(
true);
9521 int64_t async_id = 99;
9527 TimelineEventRecorder* recorder = Timeline::recorder();
9529 IsolateTimelineEventFilter filter(isolate->main_port());
9530 recorder->PrintJSON(&
js, &filter);
9531 const char* json =
js.ToCString();
9532 EXPECT_SUBSTRING(
"\"name\":\"testAsyncEvent\"", json);
9533 EXPECT_SUBSTRING(
"\"ph\":\"b\"", json);
9534 EXPECT_SUBSTRING(
"\"ts\":1000", json);
9535 EXPECT_SUBSTRING(
"\"id\":\"63\"", json);
9538#if defined(SUPPORT_PERFETTO) && !defined(PRODUCT)
9539TEST_CASE(DartAPI_TimelineAsyncInstantRace) {
9540 struct ReportAsyncEventArguments {
9541 Monitor& synchronization_monitor;
9545 Monitor synchronization_monitor;
9546 ReportAsyncEventArguments report_async_event_1_arguments{
9547 synchronization_monitor};
9548 ReportAsyncEventArguments report_async_event_2_arguments{
9549 synchronization_monitor};
9550 TimelineEventRecorder& recorder = *Timeline::recorder();
9552 TimelineEventFilter filter;
9555 TimelineStream*
stream = Timeline::GetEmbedderStream();
9557 stream->set_enabled(
true);
9563 "ReportAsyncEvent1",
9564 [](
uword arguments_ptr) {
9565 ReportAsyncEventArguments& arguments =
9566 *
reinterpret_cast<ReportAsyncEventArguments*
>(arguments_ptr);
9569 0,
nullptr,
nullptr);
9575 reinterpret_cast<uword>(&report_async_event_1_arguments));
9577 "ReportAsyncEvent2",
9578 [](
uword arguments_ptr) {
9579 ReportAsyncEventArguments& arguments =
9580 *
reinterpret_cast<ReportAsyncEventArguments*
>(arguments_ptr);
9583 0,
nullptr,
nullptr);
9589 reinterpret_cast<uword>(&report_async_event_2_arguments));
9590 recorder.PrintPerfettoTimeline(&
js, filter);
9592 MonitorLocker ml(&synchronization_monitor);
9593 while (report_async_event_1_arguments.join_id ==
9595 report_async_event_2_arguments.join_id ==
9612 EXPECT_NE(micros1, micros2);
9613 EXPECT_NE(ticks1, ticks2);
9614 EXPECT_EQ(frequency1, frequency2);
9623 JSONObject obj(&
js);
9624 JSONArray jstream(&obj,
"available");
9625 Timeline::PrintFlagsToJSONArray(&jstream);
9626 const char* js_str =
js.ToCString();
9627#define TIMELINE_STREAM_CHECK(name, ...) EXPECT_SUBSTRING(#name, js_str);
9629#undef TIMELINE_STREAM_CHECK
9634 EXPECT_EQ(
false,
result);
9636 EXPECT_EQ(
false,
result);
9645 Timeline::PrintFlagsToJSONArray(&jstream);
9646 const char* js_str =
js.ToCString();
9647 EXPECT_SUBSTRING(
"GC", js_str);
9648 EXPECT_SUBSTRING(
"API", js_str);
9649 EXPECT_SUBSTRING(
"Compiler", js_str);
9650 EXPECT_NOTSUBSTRING(
"CompilerVerbose", js_str);
9651 EXPECT_NOTSUBSTRING(
"Debugger", js_str);
9652 EXPECT_NOTSUBSTRING(
"Embedder", js_str);
9653 EXPECT_NOTSUBSTRING(
"Isolate", js_str);
9654 EXPECT_NOTSUBSTRING(
"VM", js_str);
9661 JSONObject obj(&
js);
9662 JSONArray jstream(&obj,
"available");
9663 Timeline::PrintFlagsToJSONArray(&jstream);
9664 const char* js_str =
js.ToCString();
9665 EXPECT_NOTSUBSTRING(
"GC", js_str);
9666 EXPECT_NOTSUBSTRING(
"API", js_str);
9667 EXPECT_NOTSUBSTRING(
"Compiler", js_str);
9668 EXPECT_NOTSUBSTRING(
"CompilerVerbose", js_str);
9669 EXPECT_NOTSUBSTRING(
"Debugger", js_str);
9670 EXPECT_NOTSUBSTRING(
"Embedder", js_str);
9671 EXPECT_SUBSTRING(
"Isolate", js_str);
9672 EXPECT_NOTSUBSTRING(
"VM", js_str);
9679 JSONObject obj(&
js);
9680 JSONArray jstream(&obj,
"available");
9681 Timeline::PrintFlagsToJSONArray(&jstream);
9682 const char* js_str =
js.ToCString();
9683 EXPECT_NOTSUBSTRING(
"GC", js_str);
9684 EXPECT_NOTSUBSTRING(
"API", js_str);
9685 EXPECT_NOTSUBSTRING(
"Compiler", js_str);
9686 EXPECT_NOTSUBSTRING(
"CompilerVerbose", js_str);
9687 EXPECT_NOTSUBSTRING(
"Debugger", js_str);
9688 EXPECT_NOTSUBSTRING(
"Embedder", js_str);
9689 EXPECT_NOTSUBSTRING(
"Isolate", js_str);
9690 EXPECT_NOTSUBSTRING(
"VM", js_str);
9701 bool* auto_setup_scope) {
9706 const char* kScriptChars = R
"(
9707@pragma("vm:external-name", "Test_nativeFunc")
9708external void notifyIdle();
9711 for (var i = 0; i < 100; i++) {
9713 for (var j = 0; j < 10000; j++) {
9714 t.add(List.filled(100, null));
9733 bool* auto_setup_scope) {
9738 const char* kScriptChars = R
"(
9739@pragma("vm:external-name", "Test_nativeFunc")
9740external void notifyIdle();
9743 for (var i = 0; i < 100; i++) {
9745 for (var j = 0; j < 10000; j++) {
9746 t.add(List.filled(100, null));
9766 bool* auto_setup_scope) {
9771 const char* kScriptChars = R
"(
9772import 'dart:isolate';
9773@pragma("vm:external-name", "Test_nativeFunc")
9774external void notifyDetach();
9777 for (var i = 0; i < 100; i++) {
9779 for (var j = 0; j < 10000; j++) {
9780 t.add(List.filled(100, null));
9801 bool* auto_setup_scope) {
9802 const char* cstr =
nullptr;
9804 if (strcmp(cstr,
"SetPerformanceModeDefault") == 0) {
9806 }
else if (strcmp(cstr,
"SetPerformanceModeLatency") == 0) {
9813 const char* kScriptChars = R
"(
9814import "dart:typed_data";
9815@pragma("vm:external-name", "SetPerformanceModeDefault")
9816external void setPerformanceModeDefault();
9817@pragma("vm:external-name", "SetPerformanceModeLatency")
9818external void setPerformanceModeLatency();
9820 for (var i = 0; i < 10; i++) {
9821 setPerformanceModeLatency();
9823 for (var j = 0; j < 32; j++) {
9824 t.add(Uint8List(1000000));
9826 setPerformanceModeDefault();
9843 bool* auto_setup_scope) {
9848 const char* kScriptChars = R
"(
9849import 'dart:isolate';
9850@pragma("vm:external-name", "Test_nativeFunc")
9851external void notifyLowMemory();
9854 for (var i = 0; i < 100; i++) {
9856 for (var j = 0; j < 10000; j++) {
9857 t.add(List.filled(100, null));
9874TEST_CASE(DartAPI_InvokeImportedFunction) {
9875 const char* kScriptChars =
9876 "import 'dart:math';\n"
9877 "import 'dart:developer';\n"
9887 "NoSuchMethodError: No top-level method 'max' declared.");
9893 "NoSuchMethodError: No top-level method 'getCurrentTag' declared.");
9896TEST_CASE(DartAPI_InvokeVMServiceMethod) {
9905 uint8_t* response_json = nullptr;
9906 intptr_t response_json_length = 0;
9907 char*
error =
nullptr;
9909 reinterpret_cast<uint8_t*
>(
buffer), strlen(
buffer), &response_json,
9910 &response_json_length, &
error);
9916 response_json_length, [](
void* ignored,
void* peer) { free(peer); });
9921 const char* kScript =
9923 import 'dart:convert';
9924 import 'dart:typed_data';
9925 bool validate(bool condition) {
9927 throw 'Failed to validate InvokeVMServiceMethod() response.';
9931 bool validateResult(Uint8List bytes) {
9932 final map = json.decode(utf8.decode(bytes));
9933 validate(map['jsonrpc'] == '2.0');
9934 validate(map['id'] == 'foo');
9935 validate(map['result']['name'] == 'vm');
9936 validate(map['result']['type'] == 'VM');
9937 validate(map['result'].containsKey('architectureBits'));
9938 validate(map['result'].containsKey('pid'));
9939 validate(map['result'].containsKey('startTime'));
9940 validate(map['result'].containsKey('hostCPU'));
9941 validate(map['result'].containsKey('targetCPU'));
9942 validate(map['result'].containsKey('version'));
9958#if !defined(PRODUCT)
9968 uint8_t* response_json = nullptr;
9969 intptr_t response_json_length = 0;
9970 char*
error =
nullptr;
9974 response_json =
nullptr;
9975 response_json_length = 0;
9977 reinterpret_cast<uint8_t*
>(
buffer), strlen(
buffer), &response_json,
9978 &response_json_length, &
error);
9982 free(response_json);
9991 }
while (
count < 100);
9994TEST_CASE(DartAPI_InvokeVMServiceMethod_Loop) {
10006 printf(
"Response received\n");
10010 uint32_t
count = 0;
10022 }
while (
count < 100);
10035#if !defined(PRODUCT)
10037 intptr_t flow_id_count = 1;
10038 const int64_t flow_ids[1] = {123};
10052 0,
nullptr,
nullptr);
10056 0,
nullptr,
nullptr);
10063 0,
nullptr,
nullptr);
10074 0,
nullptr,
nullptr);
10083 0,
nullptr,
nullptr);
10093 0,
nullptr,
nullptr);
10099TEST_CASE(DartAPI_TimelineEvents_Serialization) {
10107 TimelineStream*
stream = Timeline::GetEmbedderStream();
10109 stream->set_enabled(
true);
10112 TimelineEventRecorder* recorder = Timeline::recorder();
10113 JSONStream js_chrome_timeline;
10114 JSONStream js_perfetto_timeline;
10115 TimelineEventFilter filter;
10116 recorder->PrintJSON(&js_chrome_timeline, &filter);
10117#if defined(SUPPORT_PERFETTO)
10118 recorder->PrintPerfettoTimeline(&js_perfetto_timeline, filter);
10135 FLAG_complete_timeline =
true;
10143 params.start_kernel_isolate =
true;
10154 printf(
"VM waiting for notification\n");
10161 for (intptr_t
i = 0;
i < 50;
i++) {
10170UNIT_TEST_CASE(DartAPI_TimelineEvents_NullFlowIdsHandledGracefully) {
10184 return reinterpret_cast<void*
>(
EchoInt);
10188 const char* kScriptChars = R
"(
10190 @Native<IntPtr Function(Double)>(symbol: 'EchoInt', isLeaf:true)
10191 external int echoInt(double x);
10192 main() => echoInt(7.0);
10206 EXPECT_EQ(7,
value);
10209TEST_CASE(Dart_SetFfiNativeResolver_MissingResolver) {
10210 const char* kScriptChars = R
"(
10212 @Native<IntPtr Function(Double)>(symbol: 'EchoInt', isLeaf:true)
10213 external int echoInt(double x);
10214 main() => echoInt(7.0);
10230TEST_CASE(Dart_SetFfiNativeResolver_DoesNotResolve) {
10231 const char* kScriptChars = R
"(
10233 @Native<Void Function()>(symbol: 'DoesNotResolve')
10234 external void doesNotResolve();
10235 main() => doesNotResolve();
10252 EXPECT_STREQ(default_label.get(),
"Default");
10258 EXPECT_STREQ(default_label.get(), current_label.get());
10264 EXPECT_STREQ(new_tag_label.get(),
"Foo");
10270 EXPECT_STREQ(old_label.get(), default_label.get());
10276 EXPECT_STREQ(current_label.get(), new_tag_label.get());
10281 "Dart_NewUserTag expects argument 'label' to be non-null");
10285 "Dart_SetCurrentUserTag expects argument 'user_tag' to be non-null");
10290#if !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
10300 const char* cls_name,
10301 intptr_t heap_size) {
10303 return strdup(cls_name);
10334 TransitionNativeToVM transition(thread);
10335 thread->HandleInterrupts();
10347TEST_CASE(DartAPI_HeapSampling_UserDefinedClass) {
10348 DisableBackgroundCompilationScope scope;
10349 const char* kScriptChars = R
"(
10353 for (int i = 0; i < 100000; ++i) {
10370 void* context =
reinterpret_cast<void*
>(42);
10380TEST_CASE(DartAPI_HeapSampling_APIAllocations) {
10388 EXPECT(isolate !=
nullptr);
10394#if !defined(PRODUCT)
10405 const intptr_t kNumAllocations = 1000;
10406 for (intptr_t
i = 0;
i < kNumAllocations; ++
i) {
10418#if !defined(PRODUCT)
10455TEST_CASE(DartAPI_HeapSampling_NonTrivialSamplingPeriod) {
10456 DisableBackgroundCompilationScope scope;
10466 const intptr_t kNumAllocations = 1000;
10467 for (intptr_t
i = 0;
i < kNumAllocations; ++
i) {
10473 EXPECT(isolate !=
nullptr);
10484 const char* kScriptChars = R
"(
10487 for (int i = 0; i < 1000; ++i) {
10488 list.add(List.filled(100, 0));
10524 DartAPI_HeapSampling_CorrectSamplingIntervalForOldSpaceAllocations) {
10527 const char* cls_name, intptr_t allocation_size) ->
void* {
10543#if defined(DART_ENABLE_HEAP_SNAPSHOT_WRITER)
10545 struct WriterContext {
10546 intptr_t bytes_written;
10547 bool saw_last_chunk;
10550 WriterContext context = {0,
false};
10552 [](
void* context, uint8_t*
buffer, intptr_t
size,
bool is_last) {
10553 auto ctx =
static_cast<WriterContext*
>(context);
10554 ctx->bytes_written +=
size;
10555 EXPECT(!ctx->saw_last_chunk);
10556 ctx->saw_last_chunk = is_last;
10562 EXPECT_GT(context.bytes_written, 0);
10563 EXPECT(context.saw_last_chunk);
static bool invalid(const SkISize &size)
static void done(const char *config, const char *src, const char *srcOptions, const char *name)
static bool equal(const SkBitmap &a, const SkBitmap &b)
static bool is_equal(SkSurface *a, SkSurface *b)
bool equals(SkDrawable *a, SkDrawable *b)
static const size_t kBufferSize
#define FUNCTION_NAME(name)
static Dart_Handle NewHandle(Thread *thread, ObjectPtr raw)
static Dart_Isolate CastIsolate(Isolate *isolate)
static ObjectPtr UnwrapHandle(Dart_Handle object)
static Dart_Handle NewError(const char *format,...) PRINTF_ATTRIBUTE(1
static constexpr intptr_t kMaxElements
BackgroundGCTask(IsolateGroup *isolate_group, Monitor *monitor, bool *done)
uint16_t num_native_fields() const
intptr_t host_instance_size() const
static ThreadPool * thread_pool()
intptr_t Collections(Space space) const
intptr_t ExternalInWords(Space space) const
InfiniteLoopTask(Dart_Isolate *isolate, Monitor *monitor, bool *interrupted)
static IsolateGroup * Current()
ApiState * api_state() const
static Isolate * Current()
static Dart_IsolateShutdownCallback ShutdownCallback()
static void SetShutdownCallback(Dart_IsolateShutdownCallback cb)
IsolateGroup * group() const
static void SetCleanupCallback(Dart_IsolateCleanupCallback cb)
static Dart_IsolateGroupCreateCallback CreateGroupCallback()
Dart_MessageNotifyCallback message_notify_callback() const
static Dart_IsolateGroupCleanupCallback GroupCleanupCallback()
static void SetGroupCleanupCallback(Dart_IsolateGroupCleanupCallback cb)
static void SetCreateGroupCallback(Dart_IsolateGroupCreateCallback cb)
StringPtr PrivateName(const String &name) const
Monitor::WaitResult Wait(int64_t millis=Monitor::kNoTimeout)
static int Start(const char *name, ThreadStartFunction function, uword parameter)
static void Join(ThreadJoinId id)
static OSThread * Current()
static ThreadJoinId GetCurrentThreadJoinId(OSThread *thread)
static const ThreadJoinId kInvalidThreadJoinId
static void Sleep(int64_t millis)
virtual const char * ToCString() const
static constexpr intptr_t kMaxElements
static PersistentHandle * Cast(Dart_PersistentHandle handle)
static SmiPtr New(intptr_t value)
static constexpr int kPreallocatedStackdepth
bool Equals(const String &str) const
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
static const char * ToCString(Thread *thread, StringPtr ptr)
static void AddToKernelBuffers(const uint8_t *kernel_buffer)
static Dart_Handle LoadTestScriptWithDFE(int sourcefiles_count, Dart_SourceFile sourcefiles[], Dart_NativeEntryResolver resolver=nullptr, bool finalize=true, bool incrementally=true, bool allow_compile_errors=false, const char *entry_script_uri=nullptr, const char *multiroot_filepaths=nullptr, const char *multiroot_scheme=nullptr)
static void AddTestLib(const char *url, const char *source)
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 char * CompileTestScriptWithDFE(const char *url, const char *source, const uint8_t **kernel_buffer, intptr_t *kernel_buffer_size, bool incrementally=true, bool allow_compile_errors=false, const char *multiroot_filepaths=nullptr, const char *multiroot_scheme=nullptr)
static const char * url()
static Dart_Handle LoadTestLibrary(const char *lib_uri, const char *script, Dart_NativeEntryResolver resolver=nullptr)
static Dart_Handle library_handler(Dart_LibraryTag tag, Dart_Handle library, Dart_Handle url)
static Dart_Isolate CreateTestIsolate(const char *name=nullptr, void *isolate_group_data=nullptr, void *isolate_data=nullptr)
static Dart_IsolateShutdownCallback shutdown_callback
static Dart_IsolateGroupCreateCallback create_callback
static const char ** argv
static Dart_IsolateGroupCleanupCallback group_cleanup_callback
static const uint8_t * vm_snapshot_data
bool Run(Args &&... args)
ApiLocalScope * api_top_scope() const
static Thread * Current()
int ZoneSizeInBytes() const
intptr_t CountLocalHandles() const
static void ExitIsolateGroupAsHelper(bool bypass_safepoint)
Isolate * isolate() const
static bool EnterIsolateGroupAsHelper(IsolateGroup *isolate_group, TaskKind kind, bool bypass_safepoint)
static constexpr intptr_t kMaxElements
static TypePtr NullType()
static TypePtr BoolType()
static UnwindErrorPtr New(const String &message, Heap::Space space=Heap::kNew)
static int SNPrint(char *str, size_t size, const char *format,...) PRINTF_ATTRIBUTE(3
static char * StrDup(const char *s)
static constexpr T RoundUp(T x, uintptr_t alignment, uintptr_t offset=0)
#define DART_INITIALIZE_PARAMS_CURRENT_VERSION
Dart_Isolate(* Dart_IsolateGroupCreateCallback)(const char *script_uri, const char *main, const char *package_root, const char *package_config, Dart_IsolateFlags *flags, void *isolate_data, char **error)
@ Dart_PerformanceMode_Default
@ Dart_PerformanceMode_Latency
struct _Dart_Handle * Dart_Handle
struct _Dart_Isolate * Dart_Isolate
struct _Dart_IsolateGroup * Dart_IsolateGroup
struct _Dart_NativeArguments * Dart_NativeArguments
@ Dart_TypedData_kFloat32x4
@ Dart_TypedData_kFloat32
@ Dart_TypedData_kFloat64
@ Dart_TypedData_kUint8Clamped
@ Dart_TypedData_kByteData
@ Dart_TypedData_kInvalid
Dart_Handle Dart_PersistentHandle
void(* Dart_IsolateGroupCleanupCallback)(void *isolate_group_data)
struct _Dart_FinalizableHandle * Dart_FinalizableHandle
void(* Dart_IsolateShutdownCallback)(void *isolate_group_data, void *isolate_data)
void(* Dart_NativeFunction)(Dart_NativeArguments arguments)
@ Dart_NativeArgument_kString
@ Dart_NativeArgument_kNativeFields
@ Dart_NativeArgument_kInstance
@ Dart_NativeArgument_kInt32
@ Dart_NativeArgument_kUint64
@ Dart_NativeArgument_kDouble
@ Dart_NativeArgument_kBool
struct _Dart_WeakPersistentHandle * Dart_WeakPersistentHandle
#define CHECK_API_SCOPE(thread)
#define TIMELINE_STREAM_CHECK(name,...)
@ Dart_CObject_kTypedData
@ Dart_CObject_kExternalTypedData
const EmbeddedViewParams * params
EMSCRIPTEN_KEEPALIVE void empty()
FlutterSemanticsFlag flags
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
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 float min(float r, float g, float b)
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1
DART_EXPORT Dart_Handle Dart_StringToUTF8(Dart_Handle str, uint8_t **utf8_array, intptr_t *length)
void CurrentStackTraceNative(Dart_NativeArguments args)
constexpr int64_t kMaxInt64
static void NewNativePort_sendInteger123(Dart_Port dest_port_id, Dart_CObject *message)
DART_EXPORT bool Dart_IsLibrary(Dart_Handle object)
static void NewNativePort_nativeReceiveInteger(Dart_Port dest_port_id, Dart_CObject *message)
static void NativeFoo4(Dart_NativeArguments args)
static void NotifyIdleShortNative(Dart_NativeArguments args)
DART_EXPORT Dart_Handle Dart_SetFfiNativeResolver(Dart_Handle library, Dart_FfiNativeResolver resolver)
constexpr int64_t kMinInt64
static Dart_NativeFunction native_field_lookup(Dart_Handle name, int argument_count, bool *auto_setup_scope)
static void * shutdown_isolate_group_data
static Dart_NativeFunction native_args_lookup(Dart_Handle name, int argument_count, bool *auto_scope_setup)
DART_EXPORT void Dart_ReportSurvivingAllocations(Dart_HeapSamplingReportCallback callback, void *context, bool force_gc)
static Dart_Handle AllocateNewString(const char *c_str)
DART_EXPORT Dart_Handle Dart_ListGetAt(Dart_Handle list, intptr_t index)
DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle(Dart_Handle object, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
static int64_t GetValue(Dart_Handle arg)
DART_EXPORT Dart_Handle Dart_ClassLibrary(Dart_Handle cls_type)
static void * HeapSamplingCreate(Dart_Isolate isolate, Dart_IsolateGroup isolate_group, const char *cls_name, intptr_t heap_size)
DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void *peer)
static Dart_NativeFunction PropagateError_native_lookup(Dart_Handle name, int argument_count, bool *auto_setup_scope)
DART_EXPORT bool Dart_IsDouble(Dart_Handle object)
DART_EXPORT bool Dart_IsInstance(Dart_Handle object)
DART_EXPORT void Dart_DisableHeapSampling()
DART_EXPORT Dart_Handle Dart_IsNonNullableType(Dart_Handle type, bool *result)
static void FinalizableHandlePeerFinalizer(void *isolate_callback_data, void *peer)
static const char * last_allocation_cls
DART_EXPORT Dart_Handle Dart_SetCurrentUserTag(Dart_Handle user_tag)
constexpr intptr_t kMicrosecondsPerMillisecond
DART_EXPORT bool Dart_IsCompilationError(Dart_Handle object)
void ResetHeapSamplingState(const char *expected_cls=nullptr)
static void IsolateShutdownTestCallback(void *group_data, void *isolate_data)
static void NativeArgumentAccess(Dart_NativeArguments args)
static void DeleteWeakHandleOnFinalization(void *isolate_callback_data, void *peer)
static void FinalizableHandlePeerCleanupFinalizer(void *isolate_callback_data, void *peer)
static void NotifyLowMemoryNative(Dart_NativeArguments args)
DART_EXPORT Dart_Handle Dart_Allocate(Dart_Handle type)
static void MyNativeFunction1(Dart_NativeArguments args)
DART_EXPORT bool Dart_IsBoolean(Dart_Handle object)
Dart_Handle Dart_StackTraceLength(Dart_StackTrace trace, intptr_t *length)
static void SetPerformanceModeLatency(Dart_NativeArguments args)
DART_EXPORT void Dart_EnterScope()
DART_EXPORT bool Dart_IsStringLatin1(Dart_Handle object)
static void * last_allocation_context
DART_EXPORT void Dart_SetPersistentHandle(Dart_PersistentHandle obj1, Dart_Handle obj2)
static void NewNativePort_Transferrable1(Dart_Port dest_port_id, Dart_CObject *message)
Dart_Handle Dart_ActivationFrameInfo(Dart_ActivationFrame activation_frame, Dart_Handle *function_name, Dart_Handle *script_url, intptr_t *line_number, intptr_t *column_number)
DART_EXPORT Dart_Port Dart_GetMainPortId()
DART_EXPORT Dart_Handle Dart_FinalizeLoading(bool complete_futures)
DART_EXPORT Dart_Handle Dart_NewUserTag(const char *label)
DART_EXPORT Dart_Handle Dart_GetStickyError()
static void ExternalTypedDataAccessTests(Dart_Handle obj, Dart_TypedData_Type expected_type, uint8_t data[], intptr_t data_length)
DART_EXPORT char * Dart_GetUserTagLabel(Dart_Handle user_tag)
void NativeFieldLookup(Dart_NativeArguments args)
DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle handle)
static void ExternalByteDataNativeFunction(Dart_NativeArguments args)
DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate)
void PropagateErrorNative(Dart_NativeArguments args)
UNIT_TEST_CASE(PRIORITY_HEAP_WITH_INDEX__INCREASING)
static Dart_NativeFunction SetMode_native_lookup(Dart_Handle name, int argument_count, bool *auto_setup_scope)
DART_EXPORT Dart_Handle Dart_TypeNever()
static bool byte_data_finalizer_run
DART_EXPORT Dart_Handle Dart_DebugName()
DART_EXPORT Dart_Handle Dart_False()
DART_EXPORT bool Dart_ErrorHasException(Dart_Handle handle)
CAllocUniquePtr< char > CStringUniquePtr
static void * SecretKeeperFfiNativeResolver(const char *name, uintptr_t argn)
DART_EXPORT Dart_Handle Dart_GetNativeInstanceField(Dart_Handle obj, int index, intptr_t *value)
DART_EXPORT Dart_Handle Dart_NewStringFromUTF32(const int32_t *utf32_array, intptr_t length)
DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, Dart_Handle name, int number_of_arguments, Dart_Handle *arguments)
static Dart_NativeFunction MyNativeResolver1(Dart_Handle name, int arg_count, bool *auto_setup_scope)
static void SlowWeakPersistentHandle(void *isolate_callback_data, void *peer)
DART_EXPORT Dart_Handle Dart_NewDouble(double value)
Dart_Handle Dart_GetStackTrace(Dart_StackTrace *trace)
DART_EXPORT const char * Dart_IsolateServiceId(Dart_Isolate isolate)
static void UnreachedCallback(void *isolate_callback_data, void *peer)
static void * cleanup_isolate_data
Dart_WeakPersistentHandle delete_on_finalization
DART_EXPORT Dart_Handle Dart_ClassName(Dart_Handle cls_type)
DART_EXPORT Dart_Handle Dart_GetPeer(Dart_Handle object, void **peer)
static Dart_WeakPersistentHandle weak3
static void TestFieldOk(Dart_Handle container, Dart_Handle name, bool final, const char *initial_value)
static void StaticNativeFoo4(Dart_NativeArguments args)
DART_EXPORT bool Dart_HasStickyError()
DART_EXPORT Dart_Handle Dart_StringToLatin1(Dart_Handle str, uint8_t *latin1_array, intptr_t *length)
DART_EXPORT void Dart_NotifyLowMemory()
static Dart_WeakPersistentHandle weak1
DART_EXPORT Dart_Handle Dart_True()
DART_EXPORT Dart_Handle Dart_RootLibrary()
DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library, Dart_Handle class_name)
DART_EXPORT bool Dart_IsNumber(Dart_Handle object)
static void CreateTimelineEvents(uword param)
static bool use_set_return
DART_EXPORT Dart_Handle Dart_NewStringFromUTF16(const uint16_t *utf16_array, intptr_t length)
static void IsolateGroupCleanupTestCallback(void *callback_data)
DART_EXPORT Dart_Handle Dart_IntegerFitsIntoUint64(Dart_Handle integer, bool *fits)
DART_EXPORT Dart_Handle Dart_GetNativeInstanceFieldCount(Dart_Handle obj, int *count)
void * malloc(size_t size)
static void WeakPersistentHandlePeerCleanupFinalizer(void *isolate_callback_data, void *peer)
void TestNativeFieldsAccess_access(Dart_NativeArguments args)
DART_EXPORT Dart_Handle Dart_GetDefaultUserTag()
DART_EXPORT Dart_Handle Dart_TypeDynamic()
static void MyMessageNotifyCallback(Dart_Isolate dest_isolate)
DART_EXPORT Dart_Handle Dart_NewUnhandledExceptionError(Dart_Handle exception)
static intptr_t kNativeArgumentNativeField1Value
static void NativeFoo1(Dart_NativeArguments args)
static void StaticNativeFoo1(Dart_NativeArguments args)
DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value)
DART_EXPORT bool Dart_IsUnhandledExceptionError(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_BooleanValue(Dart_Handle boolean_obj, bool *value)
static Dart_NativeFunction NotifyIdleLong_native_lookup(Dart_Handle name, int argument_count, bool *auto_setup_scope)
static intptr_t EchoInt(double x)
DART_EXPORT Dart_Handle Dart_NewExternalTypedDataWithFinalizer(Dart_TypedData_Type type, void *data, intptr_t length, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
static Dart_NativeFunction ExternalByteDataNativeResolver(Dart_Handle name, int arg_count, bool *auto_setup_scope)
static void NotifyDestroyedNative(Dart_NativeArguments args)
static void NotifyIdleLongNative(Dart_NativeArguments args)
DART_EXPORT Dart_Handle Dart_NewStringFromUTF8(const uint8_t *utf8_array, intptr_t length)
DART_EXPORT void Dart_PropagateError(Dart_Handle handle)
static void NewNativePort_send123(Dart_Port dest_port_id, Dart_CObject *message)
static Dart_WeakPersistentHandle weak_persistent_handle2
constexpr uint64_t kMaxUint64
static Dart_NativeFunction MyNativeClosureResolver(Dart_Handle name, int arg_count, bool *auto_setup_scope)
static void ReportTimelineEvents()
static void HandleResponse(Dart_Port dest_port_id, Dart_CObject *message)
DART_EXPORT void * Dart_IsolateGroupData(Dart_Isolate isolate)
DART_EXPORT Dart_Handle Dart_GetNonNullableType(Dart_Handle library, Dart_Handle class_name, intptr_t number_of_type_arguments, Dart_Handle *type_arguments)
DART_EXPORT Dart_FinalizableHandle Dart_NewFinalizableHandle(Dart_Handle object, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
DART_EXPORT const char * Dart_GetError(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_NewTypedData(Dart_TypedData_Type type, intptr_t length)
DART_EXPORT Dart_Handle Dart_HandleFromWeakPersistent(Dart_WeakPersistentHandle object)
DART_EXPORT Dart_IsolateGroup Dart_CurrentIsolateGroup()
void TestNativeFieldsAccess_init(Dart_NativeArguments args)
DART_EXPORT uint8_t * Dart_ScopeAllocate(intptr_t size)
DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, Dart_Handle retval)
static void NewNativePort_Transferrable2(Dart_Port dest_port_id, Dart_CObject *message)
DART_EXPORT Dart_Handle Dart_GetStaticMethodClosure(Dart_Handle library, Dart_Handle cls_type, Dart_Handle function_name)
DART_EXPORT void Dart_RecordTimelineEvent(const char *label, int64_t timestamp0, int64_t timestamp1_or_id, intptr_t flow_id_count, const int64_t *flow_ids, Dart_Timeline_Event_Type type, intptr_t argument_count, const char **argument_names, const char **argument_values)
const intptr_t kDefaultNewGenSemiMaxSize
DART_EXPORT void Dart_NotifyDestroyed()
static intptr_t heap_samples
static void RunLoopTest(bool throw_exception)
static void IsolateShutdownRunDartCodeTestCallback(void *isolate_group_data, void *isolate_data)
DART_EXPORT char * Dart_Initialize(Dart_InitializeParams *params)
static int64_t add_result
DART_EXPORT Dart_Handle Dart_GetField(Dart_Handle container, Dart_Handle name)
void JustPropagateErrorNative(Dart_NativeArguments args)
static constexpr intptr_t kSendLength
DART_EXPORT Dart_Handle Dart_IsNullableType(Dart_Handle type, bool *result)
DART_EXPORT Dart_Handle Dart_GetCurrentUserTag()
static void * FfiNativeResolver(const char *name, uintptr_t args_n)
DART_EXPORT Dart_Handle Dart_MapGetAt(Dart_Handle map, Dart_Handle key)
DART_EXPORT Dart_Handle Dart_FunctionIsStatic(Dart_Handle function, bool *is_static)
DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString(const char *str)
DART_EXPORT void Dart_SetHeapSamplingPeriod(intptr_t bytes)
DART_EXPORT int64_t Dart_TimelineGetTicks()
static void StaticNativeFoo2(Dart_NativeArguments args)
DART_EXPORT bool Dart_IsFuture(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_ToString(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure)
static Dart_NativeFunction native_lookup(Dart_Handle name, int argument_count, bool *auto_setup_scope)
static void UnreachableMessageHandler(Dart_Port dest_port_id, Dart_CObject *message)
void TestNativeFieldsAccess_invalidAccess(Dart_NativeArguments args)
DART_EXPORT Dart_Handle Dart_TypedDataAcquireData(Dart_Handle object, Dart_TypedData_Type *type, void **data, intptr_t *len)
DART_EXPORT Dart_Handle Dart_GetNullableType(Dart_Handle library, Dart_Handle class_name, intptr_t number_of_type_arguments, Dart_Handle *type_arguments)
static void StaticNativeFoo3(Dart_NativeArguments args)
DART_EXPORT Dart_Isolate Dart_CurrentIsolate()
static void OptExternalByteDataNativeFunction(Dart_NativeArguments args)
DART_EXPORT Dart_Handle Dart_NewListOfTypeFilled(Dart_Handle element_type, Dart_Handle fill_object, intptr_t length)
static Dart_FinalizableHandle finalizable_handle3
DART_EXPORT Dart_Handle Dart_InvokeConstructor(Dart_Handle object, Dart_Handle name, int number_of_arguments, Dart_Handle *arguments)
DART_EXPORT Dart_Handle Dart_ListSetAt(Dart_Handle list, intptr_t index, Dart_Handle value)
DART_EXPORT char * Dart_WriteHeapSnapshot(Dart_HeapSnapshotWriteChunkCallback write, void *context)
static Dart_Handle AsHandle(Dart_PersistentHandle weak)
DART_EXPORT Dart_Handle Dart_IntegerToHexCString(Dart_Handle integer, const char **value)
static constexpr intptr_t kExtLength
DART_EXPORT bool Dart_SetEnabledTimelineCategory(const char *categories)
DART_EXPORT Dart_Handle Dart_FunctionName(Dart_Handle function)
DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate)
struct _Dart_ActivationFrame * Dart_ActivationFrame
void FUNCTION_NAME() SecretKeeper_KeepSecret(Dart_NativeArguments native_args)
static void MyNativeFunction2(Dart_NativeArguments args)
DART_EXPORT Dart_Handle Dart_NewBoolean(bool value)
DART_EXPORT char * Dart_Cleanup()
static Dart_NativeFunction NotifyIdleShort_native_lookup(Dart_Handle name, int argument_count, bool *auto_setup_scope)
DART_EXPORT void Dart_DeletePersistentHandle(Dart_PersistentHandle object)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
static Monitor * loop_test_lock
static constexpr int kTestNumNativeFields
DART_EXPORT Dart_Handle Dart_SetNativeInstanceField(Dart_Handle obj, int index, intptr_t value)
DART_EXPORT void Dart_SetIntegerReturnValue(Dart_NativeArguments args, int64_t retval)
DART_EXPORT void Dart_DeleteWeakPersistentHandle(Dart_WeakPersistentHandle object)
static Dart_NativeFunction MyNativeResolver2(Dart_Handle name, int arg_count, bool *auto_setup_scope)
DART_EXPORT Dart_Handle Dart_EmptyString()
static void NativeArgumentCreate(Dart_NativeArguments args)
static void NopCallback(void *isolate_callback_data, void *peer)
static Dart_NativeFunction MyStaticNativeClosureResolver(Dart_Handle name, int arg_count, bool *auto_setup_scope)
DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id)
DART_EXPORT Dart_Handle Dart_ObjectIsType(Dart_Handle object, Dart_Handle type, bool *value)
DART_EXPORT Dart_Handle Dart_CopyUTF8EncodingOfString(Dart_Handle str, uint8_t *utf8_array, intptr_t length)
DART_EXPORT Dart_Handle Dart_ErrorGetStackTrace(Dart_Handle handle)
static void FinalizeTypedData(void *isolate_callback_data, void *peer)
DART_EXPORT Dart_Handle Dart_TypeToNullableType(Dart_Handle type)
DART_EXPORT Dart_Handle Dart_GetNativeFieldsOfArgument(Dart_NativeArguments args, int arg_index, int num_fields, intptr_t *field_values)
Dart_Handle Dart_GetActivationFrame(Dart_StackTrace trace, int frame_index, Dart_ActivationFrame *frame)
static bool found_allocation
DART_EXPORT Dart_PerformanceMode Dart_SetPerformanceMode(Dart_PerformanceMode mode)
DART_EXPORT Dart_Handle Dart_ListSetAsBytes(Dart_Handle list, intptr_t offset, const uint8_t *native_array, intptr_t length)
static void TestTypedDataDirectAccess()
static Dart_Handle AllocateOldString(const char *c_str)
static Dart_NativeFunction ByteDataNativeResolver(Dart_Handle name, int arg_count, bool *auto_setup_scope)
static void TestDirectAccess(Dart_Handle lib, Dart_Handle array, Dart_TypedData_Type expected_type, bool is_external)
static Dart_NativeFunction CurrentStackTraceNativeLookup(Dart_Handle name, int argument_count, bool *auto_setup_scope)
static Dart_NativeFunction TestNativeFieldsAccess_lookup(Dart_Handle name, int argument_count, bool *auto_scope)
DART_EXPORT Dart_Handle Dart_NewExternalTypedData(Dart_TypedData_Type type, void *data, intptr_t length)
static void HeapSamplingDelete(void *data)
DART_EXPORT Dart_Handle Dart_TypeToNonNullableType(Dart_Handle type)
DART_EXPORT Dart_Handle Dart_AllocateWithNativeFields(Dart_Handle type, intptr_t num_native_fields, const intptr_t *native_fields)
DART_EXPORT Dart_Handle Dart_IntegerToUint64(Dart_Handle integer, uint64_t *value)
DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfTypedData(Dart_Handle object)
DART_EXPORT bool Dart_InvokeVMServiceMethod(uint8_t *request_json, intptr_t request_json_length, uint8_t **response_json, intptr_t *response_json_length, char **error)
DART_EXPORT Dart_Handle Dart_FunctionOwner(Dart_Handle function)
DART_EXPORT Dart_Handle Dart_StringGetProperties(Dart_Handle object, intptr_t *char_size, intptr_t *str_len, void **peer)
DART_EXPORT Dart_Handle Dart_NewIntegerFromUint64(uint64_t value)
DART_EXPORT bool Dart_IsServiceIsolate(Dart_Isolate isolate)
static void WeakPersistentHandlePeerCleanupEnsuresIGFinalizer(void *isolate_callback_data, void *peer)
static void NewNativePort_ExternalTypedData(Dart_Port dest_port_id, Dart_CObject *message)
DART_EXPORT bool Dart_IsMap(Dart_Handle object)
static void NewNativePort_sendInteger321(Dart_Port dest_port_id, Dart_CObject *message)
DART_EXPORT Dart_Handle Dart_SetNativeResolver(Dart_Handle library, Dart_NativeEntryResolver resolver, Dart_NativeEntrySymbol symbol)
static constexpr intptr_t kNativeField1Value
DART_EXPORT Dart_Handle Dart_DoubleValue(Dart_Handle double_obj, double *value)
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
static Dart_PersistentHandle persistent_handle1
static void * finalizable_old_ref_peer
DART_EXPORT void Dart_ExitIsolate()
static bool loop_test_exit
DART_EXPORT bool Dart_IsFunction(Dart_Handle handle)
DART_EXPORT char * Dart_IsolateMakeRunnable(Dart_Isolate isolate)
static void CreateNativePorts(uword param)
static void NewNativePort_nativeReceiveNull(Dart_Port dest_port_id, Dart_CObject *message)
static Dart_FinalizableHandle finalizable_old_ref
static Dart_NativeFunction NotifyDestroyed_native_lookup(Dart_Handle name, int argument_count, bool *auto_setup_scope)
DART_EXPORT Dart_Handle Dart_InstanceGetType(Dart_Handle instance)
DART_EXPORT bool Dart_CloseNativePort(Dart_Port native_port_id)
static void NativeFoo2(Dart_NativeArguments args)
DART_EXPORT Dart_Handle Dart_NewByteBuffer(Dart_Handle typed_data)
DART_EXPORT Dart_Handle Dart_SetField(Dart_Handle container, Dart_Handle name, Dart_Handle value)
TEST_CASE(DirectoryCurrent)
DART_EXPORT Dart_Handle Dart_StringLength(Dart_Handle str, intptr_t *len)
static void TestByteDataDirectAccess()
Dart_Handle NewString(const char *str)
static void * finalizable_new_ref_peer
DART_EXPORT bool Dart_IsTearOff(Dart_Handle object)
static Dart_Isolate RunLoopTestCallback(const char *script_name, const char *main, const char *package_root, const char *package_config, Dart_IsolateFlags *flags, void *data, char **error)
static void NativeArgumentCounter(Dart_NativeArguments args)
DART_EXPORT Dart_Handle Dart_ListGetAsBytes(Dart_Handle list, intptr_t offset, uint8_t *native_array, intptr_t length)
void HandleInterrupts(Thread *thread)
static void SlowFinalizer(void *isolate_callback_data, void *peer)
DART_EXPORT Dart_Handle Dart_RunLoop()
DART_EXPORT void * Dart_CurrentIsolateGroupData()
DART_EXPORT Dart_Handle Dart_NewListOfType(Dart_Handle element_type, intptr_t length)
static void CheckFloat32x4Data(Dart_Handle obj)
DART_EXPORT bool Dart_IsType(Dart_Handle handle)
static Dart_WeakPersistentHandle weak_persistent_handle3
DART_EXPORT Dart_Handle Dart_MapKeys(Dart_Handle map)
static void TestTypedDataDirectAccess1()
DART_EXPORT Dart_Handle Dart_InvokeClosure(Dart_Handle closure, int number_of_arguments, Dart_Handle *arguments)
Dart_Handle Dart_GetStackTraceFromError(Dart_Handle handle, Dart_StackTrace *trace)
DART_EXPORT char * Dart_SetVMFlags(int argc, const char **argv)
DART_EXPORT void Dart_NotifyIdle(int64_t deadline)
void InitHeapSampling(Thread *thread, const char *expected_cls)
static int8_t opt_data[kOptExtLength]
static void * NopResolver(const char *name, uintptr_t args_n)
DART_EXPORT void Dart_DeleteFinalizableHandle(Dart_FinalizableHandle object, Dart_Handle strong_ref_to_object)
DART_EXPORT Dart_Handle Dart_SetLibraryTagHandler(Dart_LibraryTagHandler handler)
static const char * expected_allocation_cls
static Dart_Handle LoadScript(const char *url_str, const char *source)
DART_EXPORT Dart_Handle Dart_TypeVoid()
DART_EXPORT Dart_Handle Dart_MapContainsKey(Dart_Handle map, Dart_Handle key)
DART_EXPORT Dart_Handle Dart_TypedDataReleaseData(Dart_Handle object)
DART_EXPORT void Dart_ExitScope()
DART_EXPORT int64_t Dart_TimelineGetTicksFrequency()
static void UnreachableFinalizer(void *isolate_callback_data, void *peer)
static intptr_t kNativeArgumentNativeField2Value
DART_EXPORT void Dart_RegisterHeapSamplingCallback(Dart_HeapSamplingCreateCallback create_callback, Dart_HeapSamplingDeleteCallback delete_callback)
DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfExternalTypedData(Dart_Handle object)
static void FinalizableHandleCallback(void *isolate_callback_data, void *peer)
DART_EXPORT Dart_Handle Dart_IntegerFitsIntoInt64(Dart_Handle integer, bool *fits)
static void WeakPersistentHandlePeerFinalizer(void *isolate_callback_data, void *peer)
DART_EXPORT Dart_Handle Dart_NewApiError(const char *error)
DART_EXPORT Dart_Handle Dart_ListGetRange(Dart_Handle list, intptr_t offset, intptr_t length, Dart_Handle *result)
DART_EXPORT Dart_Handle Dart_ListLength(Dart_Handle list, intptr_t *len)
DART_EXPORT void Dart_SetMessageNotifyCallback(Dart_MessageNotifyCallback message_notify_callback)
DART_EXPORT Dart_Handle Dart_NewList(intptr_t length)
void ExceptionNative(Dart_NativeArguments args)
static Dart_Handle PrivateLibName(Dart_Handle lib, const char *str)
static Dart_NativeFunction NotifyLowMemory_native_lookup(Dart_Handle name, int argument_count, bool *auto_setup_scope)
constexpr intptr_t kWordSize
static void * cleanup_isolate_group_data
DART_EXPORT void Dart_KillIsolate(Dart_Isolate handle)
DART_EXPORT Dart_Handle Dart_NewCompilationError(const char *error)
DART_EXPORT Dart_Handle Dart_GetNativeDoubleArgument(Dart_NativeArguments args, int index, double *value)
DART_EXPORT Dart_Handle Dart_ErrorGetException(Dart_Handle handle)
static void TestUnmodifiableTypedDataViewDirectAccess()
DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url)
static constexpr intptr_t kObjectAlignment
DART_EXPORT bool Dart_IsList(Dart_Handle object)
static Dart_NativeFunction SecretKeeperNativeResolver(Dart_Handle name, int argument_count, bool *auto_setup_scope)
DART_EXPORT bool Dart_IsApiError(Dart_Handle object)
static void NativeFoo3(Dart_NativeArguments args)
DART_EXPORT void * Dart_CurrentIsolateData()
static void TestNativeFields(Dart_Handle retobj)
DART_EXPORT Dart_Handle Dart_ThrowException(Dart_Handle exception)
static void ByteDataNativeFunction(Dart_NativeArguments args)
DART_EXPORT Dart_Handle Dart_GetNativeIntegerArgument(Dart_NativeArguments args, int index, int64_t *value)
static void CollectAllGarbage(Thread *thread, JSONStream *js)
DART_EXPORT int Dart_GetNativeArgumentCount(Dart_NativeArguments args)
struct _Dart_StackTrace * Dart_StackTrace
DART_EXPORT Dart_Handle Dart_LoadScriptFromKernel(const uint8_t *buffer, intptr_t buffer_size)
DART_EXPORT bool Dart_IsInteger(Dart_Handle object)
static intptr_t ReturnPtrAsInt(void *ptr)
static constexpr intptr_t kOptExtLength
DART_EXPORT int64_t Dart_TimelineGetMicros()
DART_EXPORT Dart_Handle Dart_ObjectEquals(Dart_Handle obj1, Dart_Handle obj2, bool *value)
DART_EXPORT bool Dart_IsNull(Dart_Handle object)
static void NewNativePort_send321(Dart_Port dest_port_id, Dart_CObject *message)
DART_EXPORT Dart_Handle Dart_LibraryUrl(Dart_Handle library)
DART_EXPORT Dart_Port Dart_NewNativePort(const char *name, Dart_NativeMessageHandler handler, bool handle_concurrently)
DART_EXPORT bool Dart_IsTypedData(Dart_Handle handle)
DART_EXPORT bool Dart_PostCObject(Dart_Port port_id, Dart_CObject *message)
DART_EXPORT Dart_Handle Dart_Null()
void HeapSamplingReport(void *context, void *data)
static void SetPerformanceModeDefault(Dart_NativeArguments args)
static bool use_throw_exception
static Dart_NativeFunction OptExternalByteDataNativeResolver(Dart_Handle name, int arg_count, bool *auto_setup_scope)
DART_EXPORT void Dart_SetStickyError(Dart_Handle error)
DART_EXPORT bool Dart_IsString(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_New(Dart_Handle type, Dart_Handle constructor_name, int number_of_arguments, Dart_Handle *arguments)
const char *const function_name
static int8_t data[kExtLength]
static void TestTypedDataViewDirectAccess()
static Dart_NativeFunction gnac_lookup(Dart_Handle name, int argument_count, bool *auto_setup_scope)
DART_EXPORT Dart_Handle Dart_SetRootLibrary(Dart_Handle library)
DART_EXPORT Dart_Handle Dart_GetNativeBooleanArgument(Dart_NativeArguments args, int index, bool *value)
static void TestFieldNotFound(Dart_Handle container, Dart_Handle name)
DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle object, const char **cstr)
DART_EXPORT Dart_Handle Dart_HandleFromPersistent(Dart_PersistentHandle object)
DART_EXPORT Dart_Handle Dart_GetType(Dart_Handle library, Dart_Handle class_name, intptr_t number_of_type_arguments, Dart_Handle *type_arguments)
DART_EXPORT void Dart_ShutdownIsolate()
DART_EXPORT bool Dart_IsClosure(Dart_Handle object)
static void DontDeleteWeakHandleOnFinalization(void *isolate_callback_data, void *peer)
static void * cleanup_group_callback_data
DART_EXPORT Dart_Handle Dart_NewUnmodifiableExternalTypedDataWithFinalizer(Dart_TypedData_Type type, const void *data, intptr_t length, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
DART_EXPORT Dart_Handle Dart_GetDataFromByteBuffer(Dart_Handle object)
void ByteDataFinalizer(void *isolate_data, void *peer)
DART_EXPORT bool Dart_PostInteger(Dart_Port port_id, int64_t message)
DART_EXPORT Dart_Handle Dart_NewStringFromCString(const char *str)
static void ExternalTypedDataFinalizer(void *isolate_callback_data, void *peer)
DART_EXPORT Dart_PersistentHandle Dart_NewPersistentHandle(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_GetNativeArguments(Dart_NativeArguments args, int num_arguments, const Dart_NativeArgument_Descriptor *argument_descriptors, Dart_NativeArgument_Value *arg_values)
static Dart_NativeFunction JustPropagateError_lookup(Dart_Handle name, int argument_count, bool *auto_setup_scope)
DART_EXPORT bool Dart_IsByteBuffer(Dart_Handle handle)
static void InvokeServiceMessages(uword param)
void VerifyStackOverflowStackTraceInfo(const char *script, const char *top_frame_func_name, const char *entry_func_name, int expected_line_number, int expected_column_number)
const intptr_t kMaxAddrSpaceMB
DART_EXPORT bool Dart_IdentityEquals(Dart_Handle obj1, Dart_Handle obj2)
static void * shutdown_isolate_data
DART_EXPORT bool Dart_IsFatalError(Dart_Handle object)
static Dart_WeakPersistentHandle weak2
DART_EXPORT Dart_Handle Dart_IntegerToInt64(Dart_Handle integer, int64_t *value)
static void IsolateCleanupTestCallback(void *group_data, void *isolate_data)
DART_EXPORT Dart_Handle Dart_StringUTF8Length(Dart_Handle str, intptr_t *len)
static bool loop_reset_count
static void ImplicitReferencesCallback(void *isolate_callback_data, void *peer)
static Dart_FinalizableHandle finalizable_new_ref
DART_EXPORT void Dart_EnableHeapSampling()
DECLARE_FLAG(bool, show_invisible_frames)
static constexpr intptr_t kNativeField2Value
VM_UNIT_TEST_CASE(DirectoryCurrentNoScope)
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
char * strdup(const char *str1)
std::function< void()> closure
constexpr bool contains(std::string_view str, std::string_view needle)
SI auto map(std::index_sequence< I... >, Fn &&fn, const Args &... args) -> skvx::Vec< sizeof...(I), decltype(fn(args[0]...))>
Dart_OnNewCodeCallback on_new_code
union _Dart_CObject::@86 value
struct _Dart_CObject::@86::@90 as_typed_data
struct _Dart_CObject ** values
struct _Dart_NativeArgument_Value::@84 as_native_fields
#define ZONE_STR(FMT,...)
#define EXPECT_ERROR(handle, substring)
#define RESOLVED_USER_TEST_URI
#define EXPECT_VALID(handle)
#define ARRAY_SIZE(array)