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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 11414136: Implement proposed new identity spec. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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
Index: runtime/vm/flow_graph_optimizer.cc
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 15270)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -56,6 +56,13 @@
VisitInstanceCall(call);
}
}
+ } else if (it.Current()->IsStrictCompare()) {
+ VisitStrictCompare(it.Current()->AsStrictCompare());
+ } else if (it.Current()->IsBranch()) {
+ ComparisonInstr* compare = it.Current()->AsBranch()->comparison();
+ if (compare->IsStrictCompare()) {
+ VisitStrictCompare(compare->AsStrictCompare());
+ }
}
}
current_iterator_ = NULL;
@@ -1512,6 +1519,27 @@
}
+static bool MayBeBoxableNumber(intptr_t cid) {
+ return (cid == kDynamicCid) ||
+ (cid == kMintCid) ||
+ (cid == kBigintCid) ||
+ (cid == kDoubleCid);
+}
+
+
+// Check if number check is not needed.
+void FlowGraphOptimizer::VisitStrictCompare(StrictCompareInstr* instr) {
+ if (!instr->needs_number_check()) return;
+
+ // If one of the input is not a boxable number (Mint, Double, Bigint), no
+ // need for number checks.
+ if (!MayBeBoxableNumber(instr->left()->ResultCid()) ||
+ !MayBeBoxableNumber(instr->right()->ResultCid())) {
+ instr->set_needs_number_check(false);
+ }
+}
+
+
// SminessPropagator ensures that CheckSmis are eliminated across phis.
class SminessPropagator : public ValueObject {
public:

Powered by Google App Engine
This is Rietveld 408576698