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

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: 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..2bce3fe8fe0dae083ca945c2a74d137f2b6e469d 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -266,22 +266,29 @@ static bool HasOneDouble(const ICData& ic_data) {
static bool ShouldSpecializeForDouble(const ICData& ic_data) {
- if (ic_data.NumberOfChecks() != 1) return false;
+ 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);
+ for (intptr_t check_idx = 0;
+ check_idx < ic_data.NumberOfChecks();
+ check_idx++) {
+ Function& target = Function::Handle();
+ GrowableArray<intptr_t> class_ids;
+ ic_data.GetCheckAt(check_idx, &class_ids, &target);
+ ASSERT(class_ids.length() == 2);
- const bool seen_double =
- (class_ids[0] == kDoubleCid) || (class_ids[1] == kDoubleCid);
+ const bool seen_double =
Florian Schneider 2012/09/21 13:23:07 It would be nice to have a helper that checks for
+ (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));
+ const bool seen_only_smi_or_double =
+ ((class_ids[0] == kDoubleCid) || (class_ids[0] == kSmiCid)) &&
+ ((class_ids[1] == kDoubleCid) || (class_ids[1] == kSmiCid));
- return seen_double && seen_only_smi_or_double;
+ if (!seen_double || !seen_only_smi_or_double) {
+ return false;
+ }
+ }
+ return true;
}
« 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