Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: runtime/vm/compiler.cc

Issue 790213004: Add inlining ranges/intervals to code objects so that we can map a pc to the inlined stack. The map… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/disassembler.h » ('j') | runtime/vm/flow_graph_compiler.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/compiler.h" 5 #include "vm/compiler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 8
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/block_scheduler.h" 10 #include "vm/block_scheduler.h"
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 &CompilerStats::ssa_timer, 449 &CompilerStats::ssa_timer,
450 isolate); 450 isolate);
451 // Transform to SSA (virtual register 0 and no inlining arguments). 451 // Transform to SSA (virtual register 0 and no inlining arguments).
452 flow_graph->ComputeSSA(0, NULL); 452 flow_graph->ComputeSSA(0, NULL);
453 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 453 DEBUG_ASSERT(flow_graph->VerifyUseLists());
454 if (print_flow_graph) { 454 if (print_flow_graph) {
455 FlowGraphPrinter::PrintGraph("After SSA", flow_graph); 455 FlowGraphPrinter::PrintGraph("After SSA", flow_graph);
456 } 456 }
457 } 457 }
458 458
459 // Maps inline_id_to_function[inline_id] -> function. Top scope
460 // function has inline_id 0. The map is populated by the inliner.
461 GrowableArray<const Function*> inline_id_to_function;
462 inline_id_to_function.Add(&function);
459 // Collect all instance fields that are loaded in the graph and 463 // Collect all instance fields that are loaded in the graph and
460 // have non-generic type feedback attached to them that can 464 // have non-generic type feedback attached to them that can
461 // potentially affect optimizations. 465 // potentially affect optimizations.
462 if (optimized) { 466 if (optimized) {
463 TimerScope timer(FLAG_compiler_stats, 467 TimerScope timer(FLAG_compiler_stats,
464 &CompilerStats::graphoptimizer_timer, 468 &CompilerStats::graphoptimizer_timer,
465 isolate); 469 isolate);
466 470
467 FlowGraphOptimizer optimizer(flow_graph); 471 FlowGraphOptimizer optimizer(flow_graph);
468 optimizer.ApplyICData(); 472 optimizer.ApplyICData();
469 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 473 DEBUG_ASSERT(flow_graph->VerifyUseLists());
470 474
471 // Optimize (a << b) & c patterns, merge operations. 475 // Optimize (a << b) & c patterns, merge operations.
472 // Run early in order to have more opportunity to optimize left shifts. 476 // Run early in order to have more opportunity to optimize left shifts.
473 optimizer.TryOptimizePatterns(); 477 optimizer.TryOptimizePatterns();
474 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 478 DEBUG_ASSERT(flow_graph->VerifyUseLists());
475 479
480 FlowGraphInliner::SetInliningId(*flow_graph, 0);
481
476 // Inlining (mutates the flow graph) 482 // Inlining (mutates the flow graph)
477 if (FLAG_use_inlining) { 483 if (FLAG_use_inlining) {
478 TimerScope timer(FLAG_compiler_stats, 484 TimerScope timer(FLAG_compiler_stats,
479 &CompilerStats::graphinliner_timer); 485 &CompilerStats::graphinliner_timer);
480 // Propagate types to create more inlining opportunities. 486 // Propagate types to create more inlining opportunities.
481 FlowGraphTypePropagator::Propagate(flow_graph); 487 FlowGraphTypePropagator::Propagate(flow_graph);
482 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 488 DEBUG_ASSERT(flow_graph->VerifyUseLists());
483 489
484 // Use propagated class-ids to create more inlining opportunities. 490 // Use propagated class-ids to create more inlining opportunities.
485 optimizer.ApplyClassIds(); 491 optimizer.ApplyClassIds();
486 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 492 DEBUG_ASSERT(flow_graph->VerifyUseLists());
487 493
488 FlowGraphInliner inliner(flow_graph); 494 FlowGraphInliner inliner(flow_graph, &inline_id_to_function);
489 inliner.Inline(); 495 inliner.Inline();
490 // Use lists are maintained and validated by the inliner. 496 // Use lists are maintained and validated by the inliner.
491 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 497 DEBUG_ASSERT(flow_graph->VerifyUseLists());
492 } 498 }
493 499
494 // Propagate types and eliminate more type tests. 500 // Propagate types and eliminate more type tests.
495 FlowGraphTypePropagator::Propagate(flow_graph); 501 FlowGraphTypePropagator::Propagate(flow_graph);
496 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 502 DEBUG_ASSERT(flow_graph->VerifyUseLists());
497 503
498 // Use propagated class-ids to optimize further. 504 // Use propagated class-ids to optimize further.
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 FlowGraphAllocator allocator(*flow_graph); 678 FlowGraphAllocator allocator(*flow_graph);
673 allocator.AllocateRegisters(); 679 allocator.AllocateRegisters();
674 if (reorder_blocks) block_scheduler.ReorderBlocks(); 680 if (reorder_blocks) block_scheduler.ReorderBlocks();
675 681
676 if (print_flow_graph) { 682 if (print_flow_graph) {
677 FlowGraphPrinter::PrintGraph("After Optimizations", flow_graph); 683 FlowGraphPrinter::PrintGraph("After Optimizations", flow_graph);
678 } 684 }
679 } 685 }
680 686
681 Assembler assembler(use_far_branches); 687 Assembler assembler(use_far_branches);
682 FlowGraphCompiler graph_compiler(&assembler, flow_graph, optimized); 688 FlowGraphCompiler graph_compiler(
689 &assembler, flow_graph, optimized, inline_id_to_function);
683 { 690 {
684 TimerScope timer(FLAG_compiler_stats, 691 TimerScope timer(FLAG_compiler_stats,
685 &CompilerStats::graphcompiler_timer, 692 &CompilerStats::graphcompiler_timer,
686 isolate); 693 isolate);
687 graph_compiler.CompileGraph(); 694 graph_compiler.CompileGraph();
688 pipeline->FinalizeCompilation(); 695 pipeline->FinalizeCompilation();
689 } 696 }
690 { 697 {
691 TimerScope timer(FLAG_compiler_stats, 698 TimerScope timer(FLAG_compiler_stats,
692 &CompilerStats::codefinalizer_timer, 699 &CompilerStats::codefinalizer_timer,
693 isolate); 700 isolate);
694 const Code& code = Code::Handle( 701 const Code& code = Code::Handle(
695 Code::FinalizeCode(function, &assembler, optimized)); 702 Code::FinalizeCode(function, &assembler, optimized));
696 code.set_is_optimized(optimized); 703 code.set_is_optimized(optimized);
704 code.set_inlined_intervals(graph_compiler.inlined_code_intervals());
697 graph_compiler.FinalizePcDescriptors(code); 705 graph_compiler.FinalizePcDescriptors(code);
698 graph_compiler.FinalizeDeoptInfo(code); 706 graph_compiler.FinalizeDeoptInfo(code);
699 graph_compiler.FinalizeStackmaps(code); 707 graph_compiler.FinalizeStackmaps(code);
700 graph_compiler.FinalizeVarDescriptors(code); 708 graph_compiler.FinalizeVarDescriptors(code);
701 graph_compiler.FinalizeExceptionHandlers(code); 709 graph_compiler.FinalizeExceptionHandlers(code);
702 graph_compiler.FinalizeStaticCallTargetsTable(code); 710 graph_compiler.FinalizeStaticCallTargetsTable(code);
703 711
704 if (optimized) { 712 if (optimized) {
705 if (osr_id == Isolate::kNoDeoptId) { 713 if (osr_id == Isolate::kNoDeoptId) {
706 CodePatcher::PatchEntry(Code::Handle(function.CurrentCode())); 714 CodePatcher::PatchEntry(Code::Handle(function.CurrentCode()));
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 const Object& result = 1189 const Object& result =
1182 PassiveObject::Handle(isolate->object_store()->sticky_error()); 1190 PassiveObject::Handle(isolate->object_store()->sticky_error());
1183 isolate->object_store()->clear_sticky_error(); 1191 isolate->object_store()->clear_sticky_error();
1184 return result.raw(); 1192 return result.raw();
1185 } 1193 }
1186 UNREACHABLE(); 1194 UNREACHABLE();
1187 return Object::null(); 1195 return Object::null();
1188 } 1196 }
1189 1197
1190 } // namespace dart 1198 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/disassembler.h » ('j') | runtime/vm/flow_graph_compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698