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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 10967041: Improve ShouldSpecializeForDouble to handle ICs with multiple checks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: use helpers Created 8 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index 05707fe79a51e35209d3060aecdad3cb6a7c65bb..2fe0a6aba45e30c6a8734cf43a18adba9fe118ba 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -266,22 +266,16 @@ static bool HasOneDouble(const ICData& ic_data) {
static bool ShouldSpecializeForDouble(const ICData& ic_data) {
- if (ic_data.NumberOfChecks() != 1) return false;
- if (ic_data.num_args_tested() != 2) return false;
-
- Function& target = Function::Handle();
- GrowableArray<intptr_t> class_ids;
- ic_data.GetCheckAt(0, &class_ids, &target);
- ASSERT(class_ids.length() == 2);
-
- const bool seen_double =
- (class_ids[0] == kDoubleCid) || (class_ids[1] == kDoubleCid);
-
- const bool seen_only_smi_or_double =
- ((class_ids[0] == kDoubleCid) || (class_ids[0] == kSmiCid)) &&
- ((class_ids[1] == kDoubleCid) || (class_ids[1] == kSmiCid));
+ // Unboxed double operation can't handle case of two smis.
+ if (ICDataHasReceiverArgumentClassIds(ic_data, kSmiCid, kSmiCid)) {
+ return false;
+ }
- return seen_double && seen_only_smi_or_double;
+ // Check that it have seen only smis and doubles.
+ GrowableArray<intptr_t> class_ids(2);
+ class_ids.Add(kSmiCid);
+ class_ids.Add(kDoubleCid);
+ return ICDataHasOnlyReceiverArgumentClassIds(ic_data, class_ids, class_ids);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698