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

Unified Diff: runtime/vm/compiler.cc

Issue 904763003: Redesign inlining interval computation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/disassembler.cc » ('j') | runtime/vm/flow_graph_inliner.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/compiler.cc
===================================================================
--- runtime/vm/compiler.cc (revision 43603)
+++ runtime/vm/compiler.cc (working copy)
@@ -33,6 +33,7 @@
#include "vm/regexp_parser.h"
#include "vm/regexp_assembler.h"
#include "vm/scanner.h"
+#include "vm/service.h"
Cutch 2015/02/09 20:48:23 Is this needed?
srdjan 2015/02/09 23:05:03 Removed
#include "vm/symbols.h"
#include "vm/tags.h"
#include "vm/timer.h"
@@ -65,8 +66,9 @@
"Enable compiler verification assertions");
DECLARE_FLAG(bool, trace_failed_optimization_attempts);
+DECLARE_FLAG(bool, trace_inlining_intervals);
+DECLARE_FLAG(bool, trace_irregexp);
DECLARE_FLAG(bool, trace_patching);
-DECLARE_FLAG(bool, trace_irregexp);
// TODO(zerny): Factor out unoptimizing/optimizing pipelines and remove
// separate helpers functions & `optimizing` args.
@@ -461,7 +463,11 @@
// Maps inline_id_to_function[inline_id] -> function. Top scope
// function has inline_id 0. The map is populated by the inliner.
GrowableArray<const Function*> inline_id_to_function;
+ // For a given inlining-id(index) specifies the caller's inlining-id.
+ GrowableArray<intptr_t> caller_inline_id;
inline_id_to_function.Add(&function);
+ // Top scope function has no caller (-1).
+ caller_inline_id.Add(-1);
// Collect all instance fields that are loaded in the graph and
// have non-generic type feedback attached to them that can
// potentially affect optimizations.
@@ -479,7 +485,7 @@
optimizer.TryOptimizePatterns();
DEBUG_ASSERT(flow_graph->VerifyUseLists());
- FlowGraphInliner::SetInliningId(*flow_graph, 0);
+ FlowGraphInliner::SetInliningId(flow_graph, 0);
// Inlining (mutates the flow graph)
if (FLAG_use_inlining) {
@@ -493,7 +499,9 @@
optimizer.ApplyClassIds();
DEBUG_ASSERT(flow_graph->VerifyUseLists());
- FlowGraphInliner inliner(flow_graph, &inline_id_to_function);
+ FlowGraphInliner inliner(flow_graph,
+ &inline_id_to_function,
+ &caller_inline_id);
inliner.Inline();
// Use lists are maintained and validated by the inliner.
DEBUG_ASSERT(flow_graph->VerifyUseLists());
@@ -686,10 +694,12 @@
}
}
+ ASSERT(inline_id_to_function.length() == caller_inline_id.length());
Assembler assembler(use_far_branches);
FlowGraphCompiler graph_compiler(&assembler, flow_graph,
*parsed_function, optimized,
- inline_id_to_function);
+ inline_id_to_function,
+ caller_inline_id);
{
TimerScope timer(FLAG_compiler_stats,
&CompilerStats::graphcompiler_timer,
@@ -705,6 +715,8 @@
Code::FinalizeCode(function, &assembler, optimized));
code.set_is_optimized(optimized);
code.set_inlined_intervals(graph_compiler.inlined_code_intervals());
+ code.set_inlined_id_to_function(
+ Array::Handle(graph_compiler.InliningIdToFunction()));
graph_compiler.FinalizePcDescriptors(code);
graph_compiler.FinalizeDeoptInfo(code);
graph_compiler.FinalizeStackmaps(code);
@@ -937,6 +949,9 @@
}
OS::Print("}\n");
}
+ if (optimized && FLAG_trace_inlining_intervals) {
+ code.DumpInlinedIntervals();
+ }
}
@@ -1010,7 +1025,6 @@
DisassembleCode(function, true);
OS::Print("*** END CODE\n");
}
-
return Error::null();
} else {
Error& error = Error::Handle();
« no previous file with comments | « no previous file | runtime/vm/disassembler.cc » ('j') | runtime/vm/flow_graph_inliner.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698