19 const char* kScript = R
"(
20 import 'dart:_internal' show reachabilityFence;
28 void someFunction(int arg) {
33 final object = A()..a = 10;
34 someFunction(object.a!);
35 reachabilityFence(object);
42 Invoke(root_library,
"main");
47 ASSERT(flow_graph !=
nullptr);
63 {kMatchAndMoveAllocateObject, &allocate_object},
66 kMatchAndMoveStoreStaticField,
68 {kMatchAndMoveReachabilityFence, &fence},
71 EXPECT(fence->value()->definition() == allocate_object);
76 const char* kScript = R
"(
77 import 'dart:_internal' show reachabilityFence;
85 @pragma('vm:never-inline')
90 void someFunction(int arg) {
95 final object = makeSomeA();
96 for(int i = 0; i < 100000; i++) {
97 someFunction(object.a!);
98 reachabilityFence(object);
104 const auto& root_library = Library::Handle(
LoadTestScript(kScript));
106 Invoke(root_library,
"main");
111 ASSERT(flow_graph !=
nullptr);
124 {kMatchAndMoveStaticCall, &object},
126 {kMatchAndMoveLoadField, &field_load},
130 {kMatchAndMoveReachabilityFence, &fence},
134 EXPECT(field_load->instance()->definition() ==
object);
135 EXPECT(fence->value()->definition() ==
object);
140 const char* kScript = R
"(
141 import 'dart:_internal' show reachabilityFence;
149 @pragma('vm:never-inline')
154 void someFunction(int arg) {
159 final object = makeSomeA();
160 reachabilityFence(object);
161 for(int i = 0; i < 100000; i++) {
162 someFunction(object.a!);
163 reachabilityFence(object);
165 reachabilityFence(object);
166 reachabilityFence(object);
171 const auto& root_library = Library::Handle(
LoadTestScript(kScript));
173 Invoke(root_library,
"main");
178 ASSERT(flow_graph !=
nullptr);
192 {kMatchAndMoveStaticCall, &object},
193 {kMatchAndMoveReachabilityFence, &fence1},
195 {kMatchAndMoveReachabilityFence, &fence2},
197 {kMatchAndMoveReachabilityFence, &fence3},
198 {kMatchAndMoveReachabilityFence, &fence4},
202 EXPECT(fence1->value()->definition() ==
object);
203 EXPECT(fence2->value()->definition() ==
object);
204 EXPECT(fence3->value()->definition() ==
object);
205 EXPECT(fence4->value()->definition() ==
object);
#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
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)
ISOLATE_UNIT_TEST_CASE(StackAllocatedDestruction)
#define ISOLATE_UNIT_TEST_CASE(name)