| 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()) {
|
|
|