487 {
488 ASSERT(!FLAG_precompiled_mode);
490 if (optimized() && !
function.IsOptimizable()) {
492 }
493 Zone*
const zone = thread()->
zone();
495 EnterCompilerScope cs(thread());
496
497
498
499
500
501
502 volatile bool done =
false;
503
504 volatile intptr_t far_branch_level = 0;
505
506
507
508 SpeculativeInliningPolicy speculative_policy(false);
509
513 LongJumpScope jump;
514 if (setjmp(*jump.Set()) == 0) {
515 FlowGraph* flow_graph = nullptr;
516 ZoneGrowableArray<const ICData*>* ic_data_array = nullptr;
517
518 CompilerState compiler_state(thread(), false, optimized(),
520 compiler_state.set_function(
function);
521
522 {
523
524
525 ic_data_array = new (zone) ZoneGrowableArray<const ICData*>();
526
527
528
530 function.RestoreICDataMap(ic_data_array, clone_ic_data);
531
532 if (optimized()) {
535 }
536
537 if (FLAG_print_ic_data_map) {
538 for (intptr_t
i = 0;
i < ic_data_array->length();
i++) {
539 if ((*ic_data_array)[
i] !=
nullptr) {
542 }
543 }
544 }
545
547 flow_graph = pipeline->BuildFlowGraph(
548 zone, parsed_function(), ic_data_array, osr_id(), optimized());
549 }
550
551 const bool print_flow_graph =
552 (FLAG_print_flow_graph ||
553 (optimized() && FLAG_print_flow_graph_optimized)) &&
555
556 if (print_flow_graph && !optimized()) {
558 }
559
560 if (flow_graph->should_reorder_blocks()) {
562 "BlockScheduler::AssignEdgeWeights");
564 }
565
566 CompilerPassState pass_state(thread(), flow_graph, &speculative_policy);
567
568 if (optimized()) {
570
571 JitCallSpecializer call_specializer(flow_graph, &speculative_policy);
572 pass_state.call_specializer = &call_specializer;
573
575 }
576
577 ASSERT(pass_state.inline_id_to_function.length() ==
578 pass_state.caller_inline_id.length());
579 compiler::ObjectPoolBuilder object_pool_builder;
580 compiler::Assembler assembler(&object_pool_builder, far_branch_level);
581 FlowGraphCompiler graph_compiler(
582 &assembler, flow_graph, *parsed_function(), optimized(),
583 &speculative_policy, pass_state.inline_id_to_function,
584 pass_state.inline_id_to_token_pos, pass_state.caller_inline_id,
585 ic_data_array);
586 pass_state.graph_compiler = &graph_compiler;
588
589 {
591
592 auto install_code_fun = [&]() {
594 FinalizeCompilation(&assembler, &graph_compiler, flow_graph);
595#if !defined(PRODUCT)
596
597
598
599
600
601
606 }
607 }
608#endif
609 };
610
611
612
613
614
615
616 SafepointWriteRwLocker ml(thread(),
617 thread()->isolate_group()->program_lock());
618
619
620
621
622
623
624
625
626
627
628
629
630
632 install_code_fun, true);
633 }
635
637
640 } else if (FLAG_disassemble_optimized && optimized() &&
643 }
644 }
645
647 } else {
648
650
651 if (
error.ptr() == Object::branch_offset_error().ptr()) {
652
653
656 far_branch_level++;
657 }
else if (
error.ptr() == Object::speculative_inlining_error().ptr()) {
658
660 } else {
661
662
663 if (FLAG_trace_bailout) {
665 }
668
669
670
671 } else {
672
674 }
676 }
677 }
678 }
680}
static void done(const char *config, const char *src, const char *srcOptions, const char *name)
#define RELEASE_ASSERT(cond)
static void AssignEdgeWeights(FlowGraph *flow_graph)
static void NotifyCodeObservers(const Code &code, bool optimized)
static void GenerateCode(CompilerPassState *state)
static DART_WARN_UNUSED_RESULT FlowGraph * RunPipeline(PipelineMode mode, CompilerPassState *state, bool compute_ssa=true)
static bool ShouldTrace()
static bool IsBackgroundCompilation()
static void DisassembleCode(const Function &function, const Code &code, bool optimized)
static void PrintGraph(const char *phase, FlowGraph *flow_graph)
static bool ShouldPrint(const Function &function, uint8_t **compiler_pass_filter=nullptr)
static void PrintICData(const ICData &ic_data, intptr_t num_checks_to_print=kPrintAll)
void NotifyCompilation(const Function &func)
GroupDebugger * debugger() const
void RunWithStoppedMutators(T single_current_mutator, S otherwise, bool use_force_growth_in_otherwise=false)
static Object & ZoneHandle()
const Function & function() const
void set_sticky_error(const Error &value)
IsolateGroup * isolate_group() const
#define THR_Print(format,...)
const uint8_t uint32_t uint32_t GError ** error
Dart_NativeFunction function
#define HANDLESCOPE(thread)
#define TIMELINE_DURATION(thread, stream, name)