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/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 5412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5423 const Integer& left_int = Integer::Cast(left); | 5423 const Integer& left_int = Integer::Cast(left); |
5424 const Integer& right_int = Integer::Cast(right); | 5424 const Integer& right_int = Integer::Cast(right); |
5425 switch (op_kind) { | 5425 switch (op_kind) { |
5426 case Token::kADD: | 5426 case Token::kADD: |
5427 case Token::kSUB: | 5427 case Token::kSUB: |
5428 case Token::kMUL: | 5428 case Token::kMUL: |
5429 case Token::kTRUNCDIV: | 5429 case Token::kTRUNCDIV: |
5430 case Token::kMOD: { | 5430 case Token::kMOD: { |
5431 Instance& result = Integer::ZoneHandle( | 5431 Instance& result = Integer::ZoneHandle( |
5432 left_int.ArithmeticOp(op_kind, right_int)); | 5432 left_int.ArithmeticOp(op_kind, right_int)); |
5433 result = result.Canonicalize(); | 5433 result = result.CheckAndCanonicalize(NULL); |
| 5434 ASSERT(!result.IsNull()); |
5434 SetValue(instr, result); | 5435 SetValue(instr, result); |
5435 break; | 5436 break; |
5436 } | 5437 } |
5437 case Token::kSHL: | 5438 case Token::kSHL: |
5438 case Token::kSHR: | 5439 case Token::kSHR: |
5439 if (left.IsSmi() && right.IsSmi()) { | 5440 if (left.IsSmi() && right.IsSmi()) { |
5440 Instance& result = Integer::ZoneHandle( | 5441 Instance& result = Integer::ZoneHandle( |
5441 Smi::Cast(left_int).ShiftOp(op_kind, Smi::Cast(right_int))); | 5442 Smi::Cast(left_int).ShiftOp(op_kind, Smi::Cast(right_int))); |
5442 result = result.Canonicalize(); | 5443 result = result.CheckAndCanonicalize(NULL); |
| 5444 ASSERT(!result.IsNull()); |
5443 SetValue(instr, result); | 5445 SetValue(instr, result); |
5444 } else { | 5446 } else { |
5445 SetValue(instr, non_constant_); | 5447 SetValue(instr, non_constant_); |
5446 } | 5448 } |
5447 break; | 5449 break; |
5448 case Token::kBIT_AND: | 5450 case Token::kBIT_AND: |
5449 case Token::kBIT_OR: | 5451 case Token::kBIT_OR: |
5450 case Token::kBIT_XOR: { | 5452 case Token::kBIT_XOR: { |
5451 Instance& result = Integer::ZoneHandle( | 5453 Instance& result = Integer::ZoneHandle( |
5452 left_int.BitOp(op_kind, right_int)); | 5454 left_int.BitOp(op_kind, right_int)); |
5453 result = result.Canonicalize(); | 5455 result = result.CheckAndCanonicalize(NULL); |
| 5456 ASSERT(!result.IsNull()); |
5454 SetValue(instr, result); | 5457 SetValue(instr, result); |
5455 break; | 5458 break; |
5456 } | 5459 } |
5457 case Token::kDIV: | 5460 case Token::kDIV: |
5458 SetValue(instr, non_constant_); | 5461 SetValue(instr, non_constant_); |
5459 break; | 5462 break; |
5460 default: | 5463 default: |
5461 UNREACHABLE(); | 5464 UNREACHABLE(); |
5462 } | 5465 } |
5463 } else { | 5466 } else { |
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6586 | 6589 |
6587 // Insert materializations at environment uses. | 6590 // Insert materializations at environment uses. |
6588 const Class& cls = Class::Handle(alloc->constructor().Owner()); | 6591 const Class& cls = Class::Handle(alloc->constructor().Owner()); |
6589 for (intptr_t i = 0; i < exits.length(); i++) { | 6592 for (intptr_t i = 0; i < exits.length(); i++) { |
6590 CreateMaterializationAt(exits[i], alloc, cls, *fields); | 6593 CreateMaterializationAt(exits[i], alloc, cls, *fields); |
6591 } | 6594 } |
6592 } | 6595 } |
6593 | 6596 |
6594 | 6597 |
6595 } // namespace dart | 6598 } // namespace dart |
OLD | NEW |