| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 225 |
| 226 // Pattern recognized. | 226 // Pattern recognized. |
| 227 smi_shift_left->set_is_truncating(true); | 227 smi_shift_left->set_is_truncating(true); |
| 228 ASSERT(bit_and_instr->IsBinarySmiOp() || bit_and_instr->IsBinaryMintOp()); | 228 ASSERT(bit_and_instr->IsBinarySmiOp() || bit_and_instr->IsBinaryMintOp()); |
| 229 if (bit_and_instr->IsBinaryMintOp()) { | 229 if (bit_and_instr->IsBinaryMintOp()) { |
| 230 // Replace Mint op with Smi op. | 230 // Replace Mint op with Smi op. |
| 231 BinarySmiOpInstr* smi_op = new BinarySmiOpInstr( | 231 BinarySmiOpInstr* smi_op = new BinarySmiOpInstr( |
| 232 Token::kBIT_AND, | 232 Token::kBIT_AND, |
| 233 new Value(left_instr), | 233 new Value(left_instr), |
| 234 new Value(right_instr), | 234 new Value(right_instr), |
| 235 bit_and_instr->deopt_id()); | 235 Isolate::kNoDeoptId); // BIT_AND cannot deoptimize. |
| 236 bit_and_instr->ReplaceWith(smi_op, current_iterator()); | 236 bit_and_instr->ReplaceWith(smi_op, current_iterator()); |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 | 239 |
| 240 | 240 |
| 241 // Optimize (a << b) & c pattern: if c is a positive Smi or zero, then the | 241 // Optimize (a << b) & c pattern: if c is a positive Smi or zero, then the |
| 242 // shift can be a truncating Smi shift-left and result is always Smi. | 242 // shift can be a truncating Smi shift-left and result is always Smi. |
| 243 void FlowGraphOptimizer::TryOptimizeLeftShiftWithBitAndPattern() { | 243 void FlowGraphOptimizer::TryOptimizeLeftShiftWithBitAndPattern() { |
| 244 if (!FLAG_truncating_left_shift) return; | 244 if (!FLAG_truncating_left_shift) return; |
| 245 ASSERT(current_iterator_ == NULL); | 245 ASSERT(current_iterator_ == NULL); |
| (...skipping 6995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7241 | 7241 |
| 7242 // Insert materializations at environment uses. | 7242 // Insert materializations at environment uses. |
| 7243 const Class& cls = Class::Handle(alloc->constructor().Owner()); | 7243 const Class& cls = Class::Handle(alloc->constructor().Owner()); |
| 7244 for (intptr_t i = 0; i < exits.length(); i++) { | 7244 for (intptr_t i = 0; i < exits.length(); i++) { |
| 7245 CreateMaterializationAt(exits[i], alloc, cls, *fields); | 7245 CreateMaterializationAt(exits[i], alloc, cls, *fields); |
| 7246 } | 7246 } |
| 7247 } | 7247 } |
| 7248 | 7248 |
| 7249 | 7249 |
| 7250 } // namespace dart | 7250 } // namespace dart |
| OLD | NEW |