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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 62133002: Cleanup of branch code generation (no change in functionality). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: rebased Created 7 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
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.cc
===================================================================
--- runtime/vm/intermediate_language.cc (revision 30039)
+++ runtime/vm/intermediate_language.cc (working copy)
@@ -487,7 +487,7 @@
Instruction* Instruction::RemoveFromGraph(bool return_previous) {
ASSERT(!IsBlockEntry());
- ASSERT(!IsControl());
+ ASSERT(!IsBranch());
ASSERT(!IsThrow());
ASSERT(!IsReturn());
ASSERT(!IsReThrow());
@@ -1089,12 +1089,12 @@
}
-intptr_t ControlInstruction::SuccessorCount() const {
+intptr_t BranchInstr::SuccessorCount() const {
return 2;
}
-BlockEntryInstr* ControlInstruction::SuccessorAt(intptr_t index) const {
+BlockEntryInstr* BranchInstr::SuccessorAt(intptr_t index) const {
if (index == 0) return true_successor_;
if (index == 1) return false_successor_;
UNREACHABLE();
@@ -2480,6 +2480,29 @@
}
+static bool BindsToSmiConstant(Value* value) {
+ return value->BindsToConstant() && value->BoundConstant().IsSmi();
+}
+
+
+bool IfThenElseInstr::Supports(ComparisonInstr* comparison,
+ Value* v1,
+ Value* v2) {
+ if (!(comparison->IsStrictCompare() &&
+ !comparison->AsStrictCompare()->needs_number_check()) &&
+ !(comparison->IsEqualityCompare() &&
+ (comparison->AsEqualityCompare()->operation_cid() == kSmiCid))) {
+ return false;
+ }
+
+ if (!BindsToSmiConstant(v1) || !BindsToSmiConstant(v2)) {
+ return false;
+ }
+
+ return true;
+}
+
+
void PhiInstr::InferRange() {
RangeBoundary new_min;
RangeBoundary new_max;
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698