| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 bool FlowGraphOptimizer::TryReplaceWithUnaryOp(InstanceCallInstr* call, | 807 bool FlowGraphOptimizer::TryReplaceWithUnaryOp(InstanceCallInstr* call, |
| 808 Token::Kind op_kind) { | 808 Token::Kind op_kind) { |
| 809 ASSERT(call->ArgumentCount() == 1); | 809 ASSERT(call->ArgumentCount() == 1); |
| 810 Definition* unary_op = NULL; | 810 Definition* unary_op = NULL; |
| 811 if (HasOnlyOneSmi(*call->ic_data())) { | 811 if (HasOnlyOneSmi(*call->ic_data())) { |
| 812 Value* value = call->ArgumentAt(0)->value(); | 812 Value* value = call->ArgumentAt(0)->value(); |
| 813 InsertBefore(call, | 813 InsertBefore(call, |
| 814 new CheckSmiInstr(value->Copy(), call->deopt_id()), | 814 new CheckSmiInstr(value->Copy(), call->deopt_id()), |
| 815 call->env(), | 815 call->env(), |
| 816 Definition::kEffect); | 816 Definition::kEffect); |
| 817 unary_op = new UnarySmiOpInstr(op_kind, | 817 unary_op = new UnarySmiOpInstr(op_kind, call, value); |
| 818 (op_kind == Token::kNEGATE) ? call : NULL, | |
| 819 value); | |
| 820 } else if ((op_kind == Token::kBIT_NOT) && | 818 } else if ((op_kind == Token::kBIT_NOT) && |
| 821 HasOnlySmiOrMint(*call->ic_data()) && | 819 HasOnlySmiOrMint(*call->ic_data()) && |
| 822 FlowGraphCompiler::SupportsUnboxedMints()) { | 820 FlowGraphCompiler::SupportsUnboxedMints()) { |
| 823 Value* value = call->ArgumentAt(0)->value(); | 821 Value* value = call->ArgumentAt(0)->value(); |
| 824 unary_op = new UnaryMintOpInstr(op_kind, value, call); | 822 unary_op = new UnaryMintOpInstr(op_kind, value, call); |
| 825 } else if (HasOnlyOneDouble(*call->ic_data()) && | 823 } else if (HasOnlyOneDouble(*call->ic_data()) && |
| 826 (op_kind == Token::kNEGATE)) { | 824 (op_kind == Token::kNEGATE)) { |
| 827 Value* value = call->ArgumentAt(0)->value(); | 825 Value* value = call->ArgumentAt(0)->value(); |
| 828 AddCheckClass(call, value->Copy()); | 826 AddCheckClass(call, value->Copy()); |
| 829 ConstantInstr* minus_one = | 827 ConstantInstr* minus_one = |
| (...skipping 2644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3474 | 3472 |
| 3475 if (FLAG_trace_constant_propagation) { | 3473 if (FLAG_trace_constant_propagation) { |
| 3476 OS::Print("\n==== After constant propagation ====\n"); | 3474 OS::Print("\n==== After constant propagation ====\n"); |
| 3477 FlowGraphPrinter printer(*graph_); | 3475 FlowGraphPrinter printer(*graph_); |
| 3478 printer.PrintBlocks(); | 3476 printer.PrintBlocks(); |
| 3479 } | 3477 } |
| 3480 } | 3478 } |
| 3481 | 3479 |
| 3482 | 3480 |
| 3483 } // namespace dart | 3481 } // namespace dart |
| OLD | NEW |