23 const char* kScript = R
"(
30 @pragma("vm:never-inline")
52 Invoke(root_library,
"main");
69 kMatchAndMoveBranchTrue,
71 {kMatchAndMoveStoreField, &store1},
73 {kMatchAndMoveStoreField, &store2},
76 EXPECT(store1->ShouldEmitStoreBarrier() ==
false);
88 const char* kScript = R
"(
93 @pragma("vm:never-inline")
106 main() { foo(0); foo(10); }
109 const auto& root_library = Library::Handle(
LoadTestScript(kScript));
111 Invoke(root_library,
"main");
125 kMatchAndMoveBranchFalse,
129 {kMatchAndMoveStoreField, &store},
148 @pragma("vm:never-inline")
154 List<C?> array = List<C?>.filled(%d, null);
173 const auto& root_library = Library::Handle(
176 Invoke(root_library,
"main");
192 {kMatchAndMoveStoreIndexed, &store_into_array_before_loop},
198 {kMatchAndMoveStoreField, &store_into_c},
204 {kMatchAndMoveStoreIndexed, &store_into_array_after_loop},
207 EXPECT(store_into_c->ShouldEmitStoreBarrier() ==
false);
208 EXPECT(store_into_array_before_loop->ShouldEmitStoreBarrier() ==
false);
209 EXPECT(store_into_array_after_loop->ShouldEmitStoreBarrier() ==
210 (
length > Array::kMaxLengthForWriteBarrierElimination));
222 const char* kScript = R
"(
224 final root = List<dynamic>.filled(128, null);
225 List<dynamic> last = root;
226 for (int i = 0; i < 10 * 1024; ++i) {
227 final nc = List<dynamic>.filled(128, null);
236 const auto& root_library = Library::Handle(
LoadTestScript(kScript));
238 Invoke(root_library,
"main");
252 kMatchAndMoveCreateArray,
254 kMatchAndMoveBranchTrue,
255 kMatchAndMoveCreateArray,
256 {kMatchAndMoveStoreIndexed, &store_into_phi},
260 EXPECT(store_into_phi->array()->definition()->IsPhi());
261 EXPECT(store_into_phi->ShouldEmitStoreBarrier());
267 const char* kScript = R
"(
269 late var x = new B();
281 foo(A a) => C(a, a.x);
286 const auto& root_library = Library::Handle(
LoadTestScript(kScript));
288 Invoke(root_library,
"main");
303 kMatchAndMoveAllocateObject,
304 kMatchAndMoveLoadField,
305 {kMatchAndMoveStoreField, &store1},
306 {kMatchAndMoveStoreField, &store2},
310 EXPECT(!store1->ShouldEmitStoreBarrier());
317 const char* kScript = R
"(
330 late var x = new B();
337 const auto& root_library = Library::Handle(
LoadTestScript(kScript));
339 Invoke(root_library,
"main");
354 kMatchAndMoveAllocateObject,
355 kMatchAndMoveLoadStaticField,
356 {kMatchAndMoveStoreField, &store1},
357 {kMatchAndMoveStoreField, &store2},
361 EXPECT(!store1->ShouldEmitStoreBarrier());
#define RELEASE_ASSERT(cond)
GraphEntryInstr * graph_entry() const
FunctionEntryInstr * normal_entry() const
bool TryMatch(std::initializer_list< MatchCode > match_codes, MatchOpCode insert_before=kInvalidMatchOpCode)
FlowGraph * RunPasses(std::initializer_list< CompilerPass::Id > passes)
Dart_NativeFunction function
SI void store2(uint16_t *ptr, U16 r, U16 g)
LibraryPtr LoadTestScript(const char *script, Dart_NativeEntryResolver resolver, const char *lib_uri)
@ kMatchAndMoveBranchFalse
@ kMatchAndMoveBranchTrue
ObjectPtr Invoke(const Library &lib, const char *name)
FunctionPtr GetFunction(const Library &lib, const char *name)
static void TestWBEForArrays(int length)
ISOLATE_UNIT_TEST_CASE(StackAllocatedDestruction)
DECLARE_FLAG(bool, show_invisible_frames)
#define ISOLATE_UNIT_TEST_CASE(name)
#define RESOLVED_USER_TEST_URI