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

Unified Diff: runtime/vm/flow_graph_compiler.cc

Issue 1268783002: Fix inlining information: (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: sync Created 5 years, 5 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 | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/il_printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler.cc
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
index 4e19dc3d9a9e39b6d3632c4e2dda88a255c66e8e..59bd3cf908fcd7074111bd1e0c6409840c437b69 100644
--- a/runtime/vm/flow_graph_compiler.cc
+++ b/runtime/vm/flow_graph_compiler.cc
@@ -425,7 +425,7 @@ struct IntervalStruct {
intptr_t inlining_id;
IntervalStruct(intptr_t s, intptr_t id) : start(s), inlining_id(id) {}
void Dump() {
- OS::Print("start: %" Px " id: %" Pd "", start, inlining_id);
+ ISL_Print("start: 0x%" Px " iid: %" Pd " ", start, inlining_id);
}
};
@@ -470,8 +470,7 @@ void FlowGraphCompiler::VisitBlocks() {
// Compose intervals.
if (instr->has_inlining_id() && is_optimizing()) {
if (prev_inlining_id != instr->inlining_id()) {
- intervals.Add(IntervalStruct(prev_offset,
- prev_inlining_id));
+ intervals.Add(IntervalStruct(prev_offset, prev_inlining_id));
prev_offset = assembler()->CodeSize();
prev_inlining_id = instr->inlining_id();
if (prev_inlining_id > max_inlining_id) {
@@ -480,8 +479,7 @@ void FlowGraphCompiler::VisitBlocks() {
}
}
if (FLAG_code_comments ||
- FLAG_disassemble ||
- FLAG_disassemble_optimized) {
+ FLAG_disassemble || FLAG_disassemble_optimized) {
if (FLAG_source_lines) {
EmitSourceLine(instr);
}
@@ -516,6 +514,7 @@ void FlowGraphCompiler::VisitBlocks() {
}
if (is_optimizing()) {
+ LogBlock lb(Isolate::Current());
intervals.Add(IntervalStruct(prev_offset, prev_inlining_id));
inlined_code_intervals_ =
Array::New(intervals.length() * Code::kInlIntNumEntries, Heap::kOld);
@@ -524,13 +523,14 @@ void FlowGraphCompiler::VisitBlocks() {
Smi& inline_id = Smi::Handle();
for (intptr_t i = 0; i < intervals.length(); i++) {
if (FLAG_trace_inlining_intervals && is_optimizing()) {
- const Function* function =
- inline_id_to_function_.At(intervals[i].inlining_id);
+ const Function& function =
+ *inline_id_to_function_.At(intervals[i].inlining_id);
intervals[i].Dump();
- OS::Print(" %s parent %" Pd "\n",
- function->ToQualifiedCString(),
- caller_inline_id_[intervals[i].inlining_id]);
+ ISL_Print(" parent iid %" Pd " %s\n",
+ caller_inline_id_[intervals[i].inlining_id],
+ function.ToQualifiedCString());
}
+
const intptr_t id = intervals[i].inlining_id;
start_h = Smi::New(intervals[i].start);
inline_id = Smi::New(id);
@@ -539,23 +539,24 @@ void FlowGraphCompiler::VisitBlocks() {
const intptr_t p = i * Code::kInlIntNumEntries;
inlined_code_intervals_.SetAt(p + Code::kInlIntStart, start_h);
inlined_code_intervals_.SetAt(p + Code::kInlIntInliningId, inline_id);
- inlined_code_intervals_.SetAt(
- p + Code::kInlIntCallerId, caller_inline_id);
}
}
set_current_block(NULL);
if (FLAG_trace_inlining_intervals && is_optimizing()) {
- OS::Print("Intervals:\n");
+ LogBlock lb(Isolate::Current());
+ ISL_Print("Intervals:\n");
+ for (intptr_t cc = 0; cc < caller_inline_id_.length(); cc++) {
+ ISL_Print(" iid: %" Pd " caller iid: %" Pd "\n",
+ cc, caller_inline_id_[cc]);
+ }
Smi& temp = Smi::Handle();
for (intptr_t i = 0; i < inlined_code_intervals_.Length();
i += Code::kInlIntNumEntries) {
temp ^= inlined_code_intervals_.At(i + Code::kInlIntStart);
ASSERT(!temp.IsNull());
- OS::Print("% " Pd " start: %" Px " ", i, temp.Value());
+ ISL_Print("% " Pd " start: 0x%" Px " ", i, temp.Value());
temp ^= inlined_code_intervals_.At(i + Code::kInlIntInliningId);
- OS::Print("inl-id: %" Pd " ", temp.Value());
- temp ^= inlined_code_intervals_.At(i + Code::kInlIntCallerId);
- OS::Print("caller-id: %" Pd " \n", temp.Value());
+ ISL_Print("iid: %" Pd " ", temp.Value());
}
}
}
@@ -1697,6 +1698,21 @@ RawArray* FlowGraphCompiler::InliningIdToFunction() const {
}
+RawArray* FlowGraphCompiler::CallerInliningIdMap() const {
+ if (caller_inline_id_.length() == 0) {
+ return Object::empty_array().raw();
+ }
+ const Array& res = Array::Handle(
+ Array::New(caller_inline_id_.length(), Heap::kOld));
+ Smi& smi = Smi::Handle();
+ for (intptr_t i = 0; i < caller_inline_id_.length(); i++) {
+ smi = Smi::New(caller_inline_id_[i]);
+ res.SetAt(i, smi);
+ }
+ return res.raw();
+}
+
+
void FlowGraphCompiler::EmitPolymorphicInstanceCall(
const ICData& ic_data,
intptr_t argument_count,
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/il_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698