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

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

Issue 1739963002: Remember token position where a function was inlined (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months 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
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler.h » ('j') | no next file with comments »
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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 INC_STAT(thread(), total_code_size, 450 INC_STAT(thread(), total_code_size,
451 inlined_id_array.Length() * sizeof(uword)); 451 inlined_id_array.Length() * sizeof(uword));
452 code.SetInlinedIdToFunction(inlined_id_array); 452 code.SetInlinedIdToFunction(inlined_id_array);
453 453
454 const Array& caller_inlining_id_map_array = 454 const Array& caller_inlining_id_map_array =
455 Array::Handle(zone, graph_compiler->CallerInliningIdMap()); 455 Array::Handle(zone, graph_compiler->CallerInliningIdMap());
456 INC_STAT(thread(), total_code_size, 456 INC_STAT(thread(), total_code_size,
457 caller_inlining_id_map_array.Length() * sizeof(uword)); 457 caller_inlining_id_map_array.Length() * sizeof(uword));
458 code.SetInlinedCallerIdMap(caller_inlining_id_map_array); 458 code.SetInlinedCallerIdMap(caller_inlining_id_map_array);
459 459
460 const Array& inlined_id_to_token_pos =
461 Array::Handle(zone, graph_compiler->InliningIdToTokenPos());
462 INC_STAT(thread(), total_code_size,
463 inlined_id_to_token_pos.Length() * sizeof(uword));
464 code.SetInlinedIdToTokenPos(inlined_id_to_token_pos);
465
460 graph_compiler->FinalizePcDescriptors(code); 466 graph_compiler->FinalizePcDescriptors(code);
461 code.set_deopt_info_array(deopt_info_array); 467 code.set_deopt_info_array(deopt_info_array);
462 468
463 graph_compiler->FinalizeStackmaps(code); 469 graph_compiler->FinalizeStackmaps(code);
464 graph_compiler->FinalizeVarDescriptors(code); 470 graph_compiler->FinalizeVarDescriptors(code);
465 graph_compiler->FinalizeExceptionHandlers(code); 471 graph_compiler->FinalizeExceptionHandlers(code);
466 graph_compiler->FinalizeStaticCallTargetsTable(code); 472 graph_compiler->FinalizeStaticCallTargetsTable(code);
467 473
468 if (optimized()) { 474 if (optimized()) {
469 // Installs code while at safepoint. 475 // Installs code while at safepoint.
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 flow_graph->ComputeSSA(0, NULL); 669 flow_graph->ComputeSSA(0, NULL);
664 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 670 DEBUG_ASSERT(flow_graph->VerifyUseLists());
665 if (print_flow_graph) { 671 if (print_flow_graph) {
666 FlowGraphPrinter::PrintGraph("After SSA", flow_graph); 672 FlowGraphPrinter::PrintGraph("After SSA", flow_graph);
667 } 673 }
668 } 674 }
669 675
670 // Maps inline_id_to_function[inline_id] -> function. Top scope 676 // Maps inline_id_to_function[inline_id] -> function. Top scope
671 // function has inline_id 0. The map is populated by the inliner. 677 // function has inline_id 0. The map is populated by the inliner.
672 GrowableArray<const Function*> inline_id_to_function; 678 GrowableArray<const Function*> inline_id_to_function;
679 // Token position where inlining occured.
680 GrowableArray<TokenPosition> inline_id_to_token_pos;
673 // For a given inlining-id(index) specifies the caller's inlining-id. 681 // For a given inlining-id(index) specifies the caller's inlining-id.
674 GrowableArray<intptr_t> caller_inline_id; 682 GrowableArray<intptr_t> caller_inline_id;
675 // Collect all instance fields that are loaded in the graph and 683 // Collect all instance fields that are loaded in the graph and
676 // have non-generic type feedback attached to them that can 684 // have non-generic type feedback attached to them that can
677 // potentially affect optimizations. 685 // potentially affect optimizations.
678 if (optimized()) { 686 if (optimized()) {
679 NOT_IN_PRODUCT(TimelineDurationScope tds(thread(), 687 NOT_IN_PRODUCT(TimelineDurationScope tds(thread(),
680 compiler_timeline, 688 compiler_timeline,
681 "OptimizationPasses")); 689 "OptimizationPasses"));
682 inline_id_to_function.Add(&function); 690 inline_id_to_function.Add(&function);
691 inline_id_to_token_pos.Add(function.token_pos());
683 // Top scope function has no caller (-1). 692 // Top scope function has no caller (-1).
684 caller_inline_id.Add(-1); 693 caller_inline_id.Add(-1);
685 CSTAT_TIMER_SCOPE(thread(), graphoptimizer_timer); 694 CSTAT_TIMER_SCOPE(thread(), graphoptimizer_timer);
686 695
687 JitOptimizer optimizer(flow_graph); 696 JitOptimizer optimizer(flow_graph);
688 697
689 optimizer.ApplyICData(); 698 optimizer.ApplyICData();
690 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 699 DEBUG_ASSERT(flow_graph->VerifyUseLists());
691 700
692 // Optimize (a << b) & c patterns, merge operations. 701 // Optimize (a << b) & c patterns, merge operations.
(...skipping 12 matching lines...) Expand all
705 // Propagate types to create more inlining opportunities. 714 // Propagate types to create more inlining opportunities.
706 FlowGraphTypePropagator::Propagate(flow_graph); 715 FlowGraphTypePropagator::Propagate(flow_graph);
707 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 716 DEBUG_ASSERT(flow_graph->VerifyUseLists());
708 717
709 // Use propagated class-ids to create more inlining opportunities. 718 // Use propagated class-ids to create more inlining opportunities.
710 optimizer.ApplyClassIds(); 719 optimizer.ApplyClassIds();
711 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 720 DEBUG_ASSERT(flow_graph->VerifyUseLists());
712 721
713 FlowGraphInliner inliner(flow_graph, 722 FlowGraphInliner inliner(flow_graph,
714 &inline_id_to_function, 723 &inline_id_to_function,
724 &inline_id_to_token_pos,
715 &caller_inline_id, 725 &caller_inline_id,
716 use_speculative_inlining, 726 use_speculative_inlining,
717 NULL); 727 NULL);
718 inliner.Inline(); 728 inliner.Inline();
719 // Use lists are maintained and validated by the inliner. 729 // Use lists are maintained and validated by the inliner.
720 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 730 DEBUG_ASSERT(flow_graph->VerifyUseLists());
721 } 731 }
722 732
723 // Propagate types and eliminate more type tests. 733 // Propagate types and eliminate more type tests.
724 FlowGraphTypePropagator::Propagate(flow_graph); 734 FlowGraphTypePropagator::Propagate(flow_graph);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 if (print_flow_graph) { 985 if (print_flow_graph) {
976 FlowGraphPrinter::PrintGraph("After Optimizations", flow_graph); 986 FlowGraphPrinter::PrintGraph("After Optimizations", flow_graph);
977 } 987 }
978 } 988 }
979 989
980 ASSERT(inline_id_to_function.length() == caller_inline_id.length()); 990 ASSERT(inline_id_to_function.length() == caller_inline_id.length());
981 Assembler assembler(use_far_branches); 991 Assembler assembler(use_far_branches);
982 FlowGraphCompiler graph_compiler(&assembler, flow_graph, 992 FlowGraphCompiler graph_compiler(&assembler, flow_graph,
983 *parsed_function(), optimized(), 993 *parsed_function(), optimized(),
984 inline_id_to_function, 994 inline_id_to_function,
995 inline_id_to_token_pos,
985 caller_inline_id); 996 caller_inline_id);
986 { 997 {
987 CSTAT_TIMER_SCOPE(thread(), graphcompiler_timer); 998 CSTAT_TIMER_SCOPE(thread(), graphcompiler_timer);
988 NOT_IN_PRODUCT(TimelineDurationScope tds(thread(), 999 NOT_IN_PRODUCT(TimelineDurationScope tds(thread(),
989 compiler_timeline, 1000 compiler_timeline,
990 "CompileGraph")); 1001 "CompileGraph"));
991 graph_compiler.CompileGraph(); 1002 graph_compiler.CompileGraph();
992 pipeline->FinalizeCompilation(); 1003 pipeline->FinalizeCompilation();
993 } 1004 }
994 { 1005 {
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 } 1845 }
1835 1846
1836 1847
1837 void BackgroundCompiler::EnsureInit(Thread* thread) { 1848 void BackgroundCompiler::EnsureInit(Thread* thread) {
1838 UNREACHABLE(); 1849 UNREACHABLE();
1839 } 1850 }
1840 1851
1841 #endif // DART_PRECOMPILED_RUNTIME 1852 #endif // DART_PRECOMPILED_RUNTIME
1842 1853
1843 } // namespace dart 1854 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698