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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 14872002: Improve load forwarding: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address Srdjan's comments Created 7 years, 8 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 db496121a2121891632312decd4853cb9286186e..bb5720977e8c5b79a29224ec5ae37aed2cb2fca1 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -1196,7 +1196,7 @@ Definition* LoadFieldInstr::Canonicalize(FlowGraphOptimizer* optimizer) {
// For fixed length arrays if the array is the result of a known constructor
// call we can replace the length load with the length argument passed to
// the constructor.
- StaticCallInstr* call = value()->definition()->AsStaticCall();
+ StaticCallInstr* call = instance()->definition()->AsStaticCall();
if ((call != NULL) &&
call->is_known_list_constructor() &&
IsFixedLengthArrayCid(call->Type()->ToCid())) {
@@ -1245,6 +1245,29 @@ Definition* AssertAssignableInstr::Canonicalize(FlowGraphOptimizer* optimizer) {
}
+Definition* BoxDoubleInstr::Canonicalize(FlowGraphOptimizer* optimizer) {
+ if (input_use_list() == NULL) {
+ // Environments can accomodate any representation. No need to box.
+ return value()->definition();
+ }
+
+ // Fold away BoxDouble(UnboxDouble(v)) if value is known to be double.
+ UnboxDoubleInstr* defn = value()->definition()->AsUnboxDouble();
+ if ((defn != NULL) && (defn->value()->Type()->ToCid() == kDoubleCid)) {
+ return defn->value()->definition();
+ }
+
+ return this;
+}
+
+
+Definition* UnboxDoubleInstr::Canonicalize(FlowGraphOptimizer* optimizer) {
+ // Fold away UnboxDouble(BoxDouble(v)).
+ BoxDoubleInstr* defn = value()->definition()->AsBoxDouble();
+ return (defn != NULL) ? defn->value()->definition() : this;
+}
+
+
Instruction* BranchInstr::Canonicalize(FlowGraphOptimizer* optimizer) {
// Only handle strict-compares.
if (comparison()->IsStrictCompare()) {
« 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