20 const char* kScriptChars =
22 " static foo() { return 42; }\n"
45 EXPECT_STREQ(
"static foo() { return 42; }", function_source.
ToCString());
56 function_source = function_moo.
GetSource();
57 EXPECT_STREQ(
"static moo() {\n // A.foo();\n }",
63 const char* kScriptChars =
65 " static foo() { return 42; }\n"
89 FLAG_background_compilation =
true;
91 auto isolate_group = thread->isolate_group();
92 isolate_group->background_compiler()->EnqueueCompilation(func);
105 const char* kScriptChars =
107 " static foo() { return 42; }\n"
131 const char* kScriptChars =
134 "unOpt() => new A(); \n"
135 "optIt() => new A(); \n"
178 const char* kScriptChars =
179 "int ten = 2 * 5; \n"
182 " var apa = 'Herr Nilsson'; \n"
183 " calc(x) => '${x*ten}'; \n"
185 "makeObj() => new A(); \n";
197 expr_text =
String::New(
"apa + ' ${calc(10)}' + dot");
210 expr_text.
ToCString(), Array::empty_array(), Array::empty_array(),
211 Array::empty_array(), Array::empty_array(), Array::empty_array(),
214 TokenPosition::kNoSource,
221 const_cast<uint8_t*
>(compilation_result.
kernel),
224 val = Instance::Cast(obj).EvaluateCompiledExpression(
225 receiver_cls, kernel_buffer, Array::empty_array(), Array::empty_array(),
226 TypeArguments::null_type_arguments());
231 EXPECT_STREQ(
"Herr Nilsson 100.", val.
ToCString());
241 String::New(
"(){ return (){ return (){ return 3 + 4; }(); }(); }()"));
245 Array::empty_array(),
246 Array::empty_array()));
251 EXPECT_EQ(7, Integer::Cast(val).AsInt64Value());
264 Array::empty_array(),
265 Array::empty_array()));
270 EXPECT_EQ(7, Integer::Cast(val).AsInt64Value());
274 intptr_t initial_class_table_size = class_table->
NumCids();
278 Array::empty_array(),
279 Array::empty_array()));
283 EXPECT_EQ(7, Integer::Cast(val).AsInt64Value());
285 intptr_t final_class_table_size = class_table->NumCids();
287 EXPECT_EQ(initial_class_table_size, final_class_table_size);
291#if !defined(DEBUG) && !defined(USING_THREAD_SANITIZER)
295 const intptr_t kNumClasses = (1 << 16) + 1;
298 for (intptr_t
i = 0;
i < kNumClasses;
i++) {
299 buffer.Printf(
"class C%" Pd " { String toString() => 'C%" Pd "'; }\n",
i,
302 buffer.Printf(
"main() {\n");
303 for (intptr_t
i = 0;
i < kNumClasses;
i++) {
304 buffer.Printf(
" new C%" Pd "().toString();\n",
i);
static ObjectPtr UnwrapHandle(Dart_Handle object)
static bool ProcessPendingClasses()
FunctionPtr LookupStaticFunction(const String &name) const
void DisableAllocationStub() const
ErrorPtr EnsureIsFinalized(Thread *thread) const
static bool TestCompileFunction(const Function &function)
static ExternalTypedDataPtr NewFinalizeWithFree(uint8_t *data, intptr_t len)
StringPtr GetSource() const
bool HasOptimizedCode() const
static IsolateGroup * Current()
ClassTable * class_table() const
static Dart_KernelCompilationResult CompileExpressionToKernel(const uint8_t *platform_kernel, intptr_t platform_kernel_size, const char *expression, const Array &definitions, const Array &definition_types, const Array &type_definitions, const Array &type_bounds, const Array &type_defaults, const char *library_url, const char *klass, const char *method, TokenPosition token_pos, char const *script_uri, bool is_static)
static LibraryPtr CoreLibrary()
ClassPtr LookupClass(const String &name) const
virtual const char * ToCString() const
static ObjectPtr RawCast(ObjectPtr obj)
static Object & ZoneHandle()
Monitor::WaitResult Wait(int64_t millis=Monitor::kNoTimeout)
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
static const char * ToCString(Thread *thread, StringPtr ptr)
static StringPtr New(Thread *thread, const char *cstr)
static Dart_Handle LoadTestScript(const char *script, Dart_NativeEntryResolver resolver, const char *lib_uri=RESOLVED_USER_TEST_URI, bool finalize=true, bool allow_compile_errors=false)
static Dart_Handle EvaluateExpression(const Library &lib, const String &expr, const Array ¶m_names, const Array ¶m_values)
@ Dart_KernelCompilationStatus_Ok
struct _Dart_Handle * Dart_Handle
const uint8_t uint32_t uint32_t GError ** error
DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, Dart_Handle name, int number_of_arguments, Dart_Handle *arguments)
ISOLATE_UNIT_TEST_CASE(StackAllocatedDestruction)
TEST_CASE(DirectoryCurrent)
Dart_Handle NewString(const char *str)
DART_EXPORT Dart_Handle Dart_NewStringFromCString(const char *str)
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
Dart_KernelCompilationStatus status
#define EXPECT_VALID(handle)