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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 12540002: Implement a branch optimization pass. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated review comments. Created 7 years, 9 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/intermediate_language.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index 177ba92198e491affb6f187b8f59b3f729787e62..b8423951c07f6b68378be728f2426b6d7492f38d 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -497,6 +497,15 @@ void Value::RemoveFromUseList() {
}
+bool Definition::HasOnlyUse(Value* use) const {
+ if (((input_use_list() == use) && (env_use_list() == NULL)) ||
+ ((input_use_list() == NULL) && (env_use_list() == use))) {
+ return (use->next_use() == NULL);
+ }
+ return false;
+}
+
+
void Definition::ReplaceUsesWith(Definition* other) {
ASSERT(other != NULL);
ASSERT(this != other);
@@ -1163,6 +1172,11 @@ bool LoadFieldInstr::IsFixedLengthArrayCid(intptr_t cid) {
}
+Definition* ConstantInstr::Canonicalize(FlowGraphOptimizer* optimizer) {
+ return HasUses() ? this : NULL;
+}
+
+
Definition* LoadFieldInstr::Canonicalize(FlowGraphOptimizer* optimizer) {
if (!IsImmutableLengthLoad()) return this;
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698