10#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_MACOS) || \
11 defined(DART_HOST_OS_ANDROID) || defined(DART_HOST_OS_FUCHSIA)
18 x = ((
x >> 32) & 0x00000000ffffffff) | (
x << 32);
19 x = ((
x >> 16) & 0x0000ffff0000ffff) | ((
x & 0x0000ffff0000ffff) << 16);
20 x = ((
x >> 8) & 0x00ff00ff00ff00ff) | ((
x & 0x00ff00ff00ff00ff) << 8);
21 x = ((
x >> 4) & 0x0f0f0f0f0f0f0f0f) | ((
x & 0x0f0f0f0f0f0f0f0f) << 4);
22 x = ((
x >> 2) & 0x3333333333333333) | ((
x & 0x3333333333333333) << 2);
23 x = ((
x >> 1) & 0x5555555555555555) | ((
x & 0x5555555555555555) << 1);
28 x = ((
x >> 16) & 0x0000ffff) | ((
x & 0x0000ffff) << 16);
29 x = ((
x >> 8) & 0x00ff00ff) | ((
x & 0x00ff00ff) << 8);
30 x = ((
x >> 4) & 0x0f0f0f0f) | ((
x & 0x0f0f0f0f) << 4);
31 x = ((
x >> 2) & 0x33333333) | ((
x & 0x33333333) << 2);
32 x = ((
x >> 1) & 0x55555555) | ((
x & 0x55555555) << 1);
42 ASSERT(divisor <= -2 || divisor >= 2);
61 const uint64_t exp = 1LL << 63;
64 uint64_t abs_d = (divisor >= 0) ? divisor : -
static_cast<uint64_t
>(divisor);
65 uint64_t sign_bit =
static_cast<uint64_t
>(divisor) >> 63;
66 uint64_t tmp = exp + sign_bit;
67 uint64_t abs_nc = tmp - 1 - (tmp % abs_d);
68 uint64_t quotient1 = exp / abs_nc;
69 uint64_t remainder1 = exp % abs_nc;
70 uint64_t quotient2 = exp / abs_d;
71 uint64_t remainder2 = exp % abs_d;
79 quotient1 = 2 * quotient1;
80 remainder1 = 2 * remainder1;
81 if (remainder1 >= abs_nc) {
83 remainder1 = remainder1 - abs_nc;
85 quotient2 = 2 * quotient2;
86 remainder2 = 2 * remainder2;
87 if (remainder2 >= abs_d) {
89 remainder2 = remainder2 - abs_d;
91 delta = abs_d - remainder2;
92 }
while (quotient1 <
delta || (quotient1 ==
delta && remainder1 == 0));
94 *
magic = (divisor > 0) ? (quotient2 + 1) : (-quotient2 - 1);
105#define MIX(hash, part) \
107 (part) *= kStringHashM; \
108 (part) ^= (part) >> kStringHashR; \
109 (part) *= kStringHashM; \
110 (hash) *= kStringHashM; \
118 auto cursor =
reinterpret_cast<const uint8_t*
>(
data);
121 const intptr_t misalignment =
122 reinterpret_cast<intptr_t
>(cursor) %
kInt32Size;
123 if (misalignment > 0) {
126 uint32_t data_window = 0;
133 const intptr_t pre_alignment_length =
kInt32Size - misalignment;
134 switch (pre_alignment_length) {
136 data_window |= cursor[2] << 16;
139 data_window |= cursor[1] << 8;
142 data_window |= cursor[0];
144 cursor += pre_alignment_length;
145 size -= pre_alignment_length;
149 uint32_t aligned_part = *
reinterpret_cast<const uint32_t*
>(cursor);
150 data_window |= (aligned_part << sl);
152 data_window = aligned_part >> sr;
155 if (
size >= misalignment) {
158 switch (misalignment) {
160 data_window |= cursor[2] << (16 + sl);
163 data_window |= cursor[1] << (8 + sl);
166 data_window |= cursor[0] << sl;
169 cursor += misalignment;
170 size -= misalignment;
175 data_window |= cursor[1] << (8 + sl);
178 data_window |= cursor[0] << sl;
188 uint32_t part = *
reinterpret_cast<const uint32_t*
>(cursor);
197 hash ^= cursor[2] << 16;
200 hash ^= cursor[1] << 8;
222 a = (
a + 0x7ed55d16) + (
a << 12);
223 a = (
a ^ 0xc761c23c) ^ (
a >> 19);
224 a = (
a + 0x165667b1) + (
a << 5);
225 a = (
a + 0xd3a2646c) ^ (
a << 9);
226 a = (
a + 0xfd7046c5) + (
a << 3);
227 a = (
a ^ 0xb55a4f09) ^ (
a >> 16);
228 return static_cast<uint32_t
>(
a);
241 va_list measure_args;
242 va_copy(measure_args,
args);
251 va_copy(print_args,
args);
258 if (
error ==
nullptr)
return;
260#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_MACOS) || \
261 defined(DART_HOST_OS_ANDROID) || defined(DART_HOST_OS_FUCHSIA)
262 const char* status = dlerror();
263 *
error = status !=
nullptr ?
strdup(status) :
nullptr;
264#elif defined(DART_HOST_OS_WINDOWS)
267 char* description =
nullptr;
268 int length = FormatMessageA(
269 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
270 FORMAT_MESSAGE_IGNORE_INSERTS,
271 nullptr, status, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
272 reinterpret_cast<char*
>(&description), 0,
nullptr);
280 LocalFree(description);
290 void* handle =
nullptr;
292#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_MACOS) || \
293 defined(DART_HOST_OS_ANDROID) || defined(DART_HOST_OS_FUCHSIA)
294 handle = dlopen(library_path, RTLD_LAZY);
295#elif defined(DART_HOST_OS_WINDOWS)
298 if (library_path ==
nullptr) {
299 handle = GetModuleHandle(
nullptr);
302 const int name_len = MultiByteToWideChar(
303 CP_UTF8, 0, library_path, -1,
nullptr, 0);
305 std::unique_ptr<wchar_t[]>
name(
new wchar_t[name_len]);
306 const int written_len =
307 MultiByteToWideChar(CP_UTF8, 0, library_path,
308 -1,
name.get(), name_len);
310 handle = LoadLibraryW(
name.get());
315 if (handle ==
nullptr) {
327#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_MACOS) || \
328 defined(DART_HOST_OS_ANDROID) || defined(DART_HOST_OS_FUCHSIA)
330 result = dlsym(library_handle, symbol);
335#elif defined(DART_HOST_OS_WINDOWS)
337 result =
reinterpret_cast<void*
>(
338 GetProcAddress(
reinterpret_cast<HMODULE>(library_handle), symbol));
351#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_MACOS) || \
352 defined(DART_HOST_OS_ANDROID) || defined(DART_HOST_OS_FUCHSIA)
353 ok = dlclose(library_handle) == 0;
354#elif defined(DART_HOST_OS_WINDOWS)
357 ok = FreeLibrary(
reinterpret_cast<HMODULE>(library_handle));
static bool ok(int result)
static uint32_t hash(const SkShaderBase::GradientInfo &v)
#define RELEASE_ASSERT(cond)
static void CalculateMagicAndShiftForDivRem(int64_t divisor, int64_t *magic, int64_t *shift)
static void * LoadDynamicLibrary(const char *library_path, char **error=nullptr)
static char * StrDup(const char *s)
static char static char * VSCreate(const char *format, va_list args)
static int static int VSNPrint(char *str, size_t size, const char *format, va_list args)
static uint32_t WordHash(intptr_t key)
static uint32_t StringHash(const void *data, int length)
static void UnloadDynamicLibrary(void *library_handle, char **error=nullptr)
static char * SCreate(const char *format,...) PRINTF_ATTRIBUTE(1
static void * ResolveSymbolInDynamicLibrary(void *library_handle, const char *symbol, char **error=nullptr)
static uint32_t ReverseBits32(uint32_t x)
static uint64_t ReverseBits64(uint64_t x)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
const uint8_t uint32_t uint32_t GError ** error
uint32_t uint32_t * format
static void GetLastErrorAsString(char **error)
void * malloc(size_t size)
constexpr intptr_t kBitsPerByte
constexpr intptr_t kInt32Size
static constexpr uint32_t kStringHashM
constexpr intptr_t kBitsPerInt32
static int8_t data[kExtLength]
static constexpr int kStringHashR
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)
WINBASEAPI VOID WINAPI SetLastError(_In_ DWORD dwErrCode)
WINBASEAPI _Check_return_ _Post_equals_last_error_ DWORD WINAPI GetLastError(VOID)