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

Unified Diff: runtime/vm/flow_graph_compiler.cc

Issue 14740005: Initial support for polymorphic inlining. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated review comments. Created 7 years, 7 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/flow_graph_inliner.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 2ec6ebcc76889a136cdee5fc5c08fe96a05b1f0c..cc03069de1b83fa3e11504e6c25b48ac1f249b52 100644
--- a/runtime/vm/flow_graph_compiler.cc
+++ b/runtime/vm/flow_graph_compiler.cc
@@ -1125,6 +1125,12 @@ bool FlowGraphCompiler::TypeCheckAsClassEquality(const AbstractType& type) {
}
+static int HighestCountFirst(const CidTarget* a, const CidTarget* b) {
+ // Negative if 'a' should sort before 'b'.
+ return b->count - a->count;
+}
+
+
// Returns 'sorted' array in decreasing count order.
// The expected number of elements to sort is less than 10.
void FlowGraphCompiler::SortICDataByCount(const ICData& ic_data,
@@ -1138,20 +1144,7 @@ void FlowGraphCompiler::SortICDataByCount(const ICData& ic_data,
&Function::ZoneHandle(ic_data.GetTargetAt(i)),
ic_data.GetCountAt(i)));
}
- for (int i = 0; i < len; i++) {
- intptr_t largest_ix = i;
- for (int k = i + 1; k < len; k++) {
- if ((*sorted)[largest_ix].count < (*sorted)[k].count) {
- largest_ix = k;
- }
- }
- if (i != largest_ix) {
- // Swap.
- CidTarget temp = (*sorted)[i];
- (*sorted)[i] = (*sorted)[largest_ix];
- (*sorted)[largest_ix] = temp;
- }
- }
+ sorted->Sort(HighestCountFirst);
}
} // namespace dart
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698