16 if ((
result != 0u) && is_protected) {
41 const intptr_t kSmallObjectSize = 4 *
kWordSize;
42 const intptr_t kMediumObjectSize = 16 *
kWordSize;
43 const intptr_t kLargeObjectSize = 8 *
KB;
54 uword small_object =
Allocate(free_list, kSmallObjectSize, is_protected);
55 EXPECT_EQ(blob, small_object);
57 Free(free_list, small_object, kSmallObjectSize, is_protected);
58 small_object =
Allocate(free_list, kSmallObjectSize, is_protected);
59 EXPECT_EQ(blob, small_object);
61 uword small_object2 =
Allocate(free_list, kSmallObjectSize, is_protected);
62 EXPECT_EQ(blob + kSmallObjectSize, small_object2);
63 uword med_object =
Allocate(free_list, kMediumObjectSize, is_protected);
64 EXPECT_EQ(small_object2 + kSmallObjectSize, med_object);
66 uword large_object =
Allocate(free_list, kLargeObjectSize, is_protected);
67 EXPECT_EQ(med_object + kMediumObjectSize, large_object);
69 uword small_object3 =
Allocate(free_list, kSmallObjectSize, is_protected);
70 EXPECT_EQ(large_object + kLargeObjectSize, small_object3);
72 Free(free_list, large_object, kLargeObjectSize, is_protected);
73 uword small_object4 =
Allocate(free_list, kSmallObjectSize, is_protected);
74 EXPECT_EQ(large_object, small_object4);
77 Allocate(free_list, kLargeObjectSize - kSmallObjectSize, is_protected);
78 EXPECT_EQ(small_object4 + kSmallObjectSize, large_object);
80 uword large_object2 =
Allocate(free_list, kLargeObjectSize, is_protected);
81 EXPECT_EQ(small_object3 + kSmallObjectSize, large_object2);
86 const intptr_t kBlobSize = 1 *
MB;
88 kBlobSize,
false,
false,
"test");
99 const intptr_t kBlobSize = 1 *
MB;
101 kBlobSize,
false,
false,
"test");
112 const intptr_t kBlobSize = 1 *
MB;
113 const intptr_t kObjectSize = 2 *
kWordSize;
114 uword* objects =
new uword[kBlobSize / kObjectSize];
117 kBlobSize,
false,
false,
"test");
128 for (intptr_t
i = 0;
i < blob->
size() / kObjectSize;
i++) {
129 objects[
i] =
Allocate(free_list, kObjectSize,
true);
137 for (intptr_t
i = 0;
i < blob->
size() / kObjectSize;
i++) {
138 free_list->
Free(objects[
i], kObjectSize);
149 const intptr_t kBlobSize = 16 *
KB;
152 uword* objects =
new uword[kBlobSize / kMinSize];
153 for (intptr_t
i = 0;
i < kBlobSize / kMinSize; ++
i) {
158 kBlobSize,
false,
false,
"test");
178 Free(free_list, e2, 4 *
KB,
true);
198 std::unique_ptr<FreeList> free_list(
new FreeList());
202 true,
false,
"test"));
203 const intptr_t remainder_size =
page / 2;
205 void*
const other_code =
206 reinterpret_cast<void*
>(blob->start() + alloc_size + remainder_size);
210#if defined(HOST_ARCH_X64) || defined(HOST_ARCH_IA32)
211 const uint8_t ret[1] = {0xC3};
212#elif defined(HOST_ARCH_ARM)
213 const uint8_t ret[4] = {0x1e, 0xff, 0x2f, 0xe1};
214#elif defined(HOST_ARCH_ARM64)
215 const uint8_t ret[4] = {0xc0, 0x03, 0x5f, 0xd6};
216#elif defined(HOST_ARCH_RISCV32) || defined(HOST_ARCH_RISCV64)
217 const uint8_t ret[2] = {0x82, 0x80};
219#error "Unknown architecture."
221 memcpy(other_code, ret,
sizeof(ret));
223 free_list->Free(blob->start(), alloc_size + remainder_size);
225 Allocate(free_list.get(), alloc_size,
true);
228 reinterpret_cast<void (*)()
>(other_code)();
232 for (
const intptr_t
i : {-2, -1, 0, 1, 2}) {
uword TryAllocate(intptr_t size, bool is_protected)
void Free(uword addr, intptr_t size)
static constexpr bool IsAligned(T x, uintptr_t alignment, uintptr_t offset=0)
static void Protect(void *address, intptr_t size, Protection mode)
static intptr_t PageSize()
static VirtualMemory * Allocate(intptr_t size, bool is_executable, bool is_compressed, const char *name)
ClipOpAndAA opAA SkRegion region
static void TestFreeList(VirtualMemory *region, FreeList *free_list, bool is_protected)
static void * Allocate(uword size, Zone *zone)
static void Free(FreeList *free_list, uword address, intptr_t size, bool is_protected)
TEST_CASE(DirectoryCurrent)
constexpr intptr_t kWordSize
static constexpr intptr_t kObjectAlignment
static void TestRegress38528(intptr_t header_overlap)
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