@@ -66,8 +66,8 @@ bool MaglevInliner::IsSmallWithHeapNumberInputsOutputs(
6666 max_inlined_bytecode_size_small_with_heapnum_in_out ();
6767}
6868
69- void MaglevInliner::Run () {
70- if (graph_->inlineable_calls ().empty ()) return ;
69+ bool MaglevInliner::Run () {
70+ if (graph_->inlineable_calls ().empty ()) return true ;
7171
7272 while (!graph_->inlineable_calls ().empty ()) {
7373 MaglevCallSiteInfo* call_site = ChooseNextCallSite ();
@@ -100,10 +100,12 @@ void MaglevInliner::Run() {
100100 }
101101 }
102102
103- TRACE (" > Inlining!" );
104- MaybeReduceResult result =
103+ InliningResult result =
105104 BuildInlineFunction (call_site, is_small_with_heapnum_input_outputs);
106- if (result.IsFail ()) continue ;
105+ if (result == InliningResult::kAbort ) return false ;
106+ if (result == InliningResult::kFail ) continue ;
107+ DCHECK_EQ (result, InliningResult::kDone );
108+
107109 // If --trace-maglev-inlining-verbose, we print the graph after each
108110 // inlining step/call.
109111 if (V8_UNLIKELY (ShouldPrintMaglevGraph ())) {
@@ -136,6 +138,8 @@ void MaglevInliner::Run() {
136138 std::cout << " \n After inlining" << std::endl;
137139 PrintGraph (std::cout, graph_);
138140 }
141+
142+ return true ;
139143}
140144
141145int MaglevInliner::max_inlined_bytecode_size_cumulative () const {
@@ -166,7 +170,7 @@ MaglevCallSiteInfo* MaglevInliner::ChooseNextCallSite() {
166170 return call_site;
167171}
168172
169- MaybeReduceResult MaglevInliner::BuildInlineFunction (
173+ MaglevInliner::InliningResult MaglevInliner::BuildInlineFunction (
170174 MaglevCallSiteInfo* call_site, bool is_small) {
171175 CallKnownJSFunction* call_node = call_site->generic_call_node ;
172176 BasicBlock* call_block = call_node->owner ();
@@ -179,7 +183,7 @@ MaybeReduceResult MaglevInliner::BuildInlineFunction(
179183 if (!call_block || call_block->is_dead ()) {
180184 // The block containing the call is unreachable, and it was previously
181185 // removed. Do not try to inline the call.
182- return ReduceResult::Fail () ;
186+ return InliningResult:: kFail ;
183187 }
184188
185189 if (V8_UNLIKELY (v8_flags.trace_maglev_inlining && is_tracing_enabled ())) {
@@ -267,6 +271,10 @@ MaybeReduceResult MaglevInliner::BuildInlineFunction(
267271 call_node->new_target ().node ()->Unwrap ());
268272
269273 if (result.IsDoneWithAbort ()) {
274+ if (inner_graph_builder.should_abort_compilation ()) {
275+ return InliningResult::kAbort ;
276+ }
277+
270278 // Since the rest of the block is dead, these nodes don't belong
271279 // to any basic block anymore.
272280 for (auto node : rem_nodes_in_call_block) {
@@ -282,7 +290,7 @@ MaybeReduceResult MaglevInliner::BuildInlineFunction(
282290 // remove unreachable blocks, but only the successors of control_node in
283291 // saved_bbs.
284292 RemoveUnreachableBlocks ();
285- return result ;
293+ return InliningResult:: kDone ;
286294 }
287295
288296 DCHECK (result.IsDoneWithValue ());
@@ -326,7 +334,7 @@ MaybeReduceResult MaglevInliner::BuildInlineFunction(
326334 RemoveUnreachableBlocks ();
327335 }
328336
329- return ReduceResult::Done () ;
337+ return InliningResult:: kDone ;
330338}
331339
332340std::vector<BasicBlock*> MaglevInliner::TruncateGraphAt (BasicBlock* block) {
0 commit comments