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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/constant_propagator.h" | 8 #include "vm/constant_propagator.h" |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1676 // Fall through. | 1676 // Fall through. |
1677 case Token::kADD: | 1677 case Token::kADD: |
1678 case Token::kSUB: | 1678 case Token::kSUB: |
1679 case Token::kMUL: { | 1679 case Token::kMUL: { |
1680 result = left.ArithmeticOp(op_kind(), right, Heap::kOld); | 1680 result = left.ArithmeticOp(op_kind(), right, Heap::kOld); |
1681 break; | 1681 break; |
1682 } | 1682 } |
1683 case Token::kSHL: | 1683 case Token::kSHL: |
1684 case Token::kSHR: | 1684 case Token::kSHR: |
1685 if (left.IsSmi() && right.IsSmi() && (Smi::Cast(right).Value() >= 0)) { | 1685 if (left.IsSmi() && right.IsSmi() && (Smi::Cast(right).Value() >= 0)) { |
1686 result = Smi::Cast(left).ShiftOp(op_kind(), Smi::Cast(right)); | 1686 result = Smi::Cast(left).ShiftOp(op_kind(), |
| 1687 Smi::Cast(right), |
| 1688 Heap::kOld); |
1687 } | 1689 } |
1688 break; | 1690 break; |
1689 case Token::kBIT_AND: | 1691 case Token::kBIT_AND: |
1690 case Token::kBIT_OR: | 1692 case Token::kBIT_OR: |
1691 case Token::kBIT_XOR: { | 1693 case Token::kBIT_XOR: { |
1692 result = left.BitOp(op_kind(), right); | 1694 result = left.BitOp(op_kind(), right, Heap::kOld); |
1693 break; | 1695 break; |
1694 } | 1696 } |
1695 case Token::kDIV: | 1697 case Token::kDIV: |
1696 break; | 1698 break; |
1697 default: | 1699 default: |
1698 UNREACHABLE(); | 1700 UNREACHABLE(); |
1699 } | 1701 } |
1700 | 1702 |
1701 if (!result.IsNull()) { | 1703 if (!result.IsNull()) { |
1702 if (is_truncating()) { | 1704 if (is_truncating()) { |
(...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3452 ASSERT(store_index < length); | 3454 ASSERT(store_index < length); |
3453 ASSERT(store != NULL); | 3455 ASSERT(store != NULL); |
3454 if (store->value()->definition()->IsConstant()) { | 3456 if (store->value()->definition()->IsConstant()) { |
3455 ASSERT(store->index()->BindsToConstant()); | 3457 ASSERT(store->index()->BindsToConstant()); |
3456 const Object& obj = store->value()->definition()->AsConstant()->value(); | 3458 const Object& obj = store->value()->definition()->AsConstant()->value(); |
3457 // TODO(srdjan): Verify if any other types should be converted as well. | 3459 // TODO(srdjan): Verify if any other types should be converted as well. |
3458 if (obj.IsString()) { | 3460 if (obj.IsString()) { |
3459 pieces.SetAt(store_index, String::Cast(obj)); | 3461 pieces.SetAt(store_index, String::Cast(obj)); |
3460 } else if (obj.IsSmi()) { | 3462 } else if (obj.IsSmi()) { |
3461 const char* cstr = obj.ToCString(); | 3463 const char* cstr = obj.ToCString(); |
3462 pieces.SetAt(store_index, String::Handle(zone, String::New(cstr))); | 3464 pieces.SetAt(store_index, String::Handle(zone, Symbols::New(cstr))); |
3463 } else if (obj.IsBool()) { | 3465 } else if (obj.IsBool()) { |
3464 pieces.SetAt(store_index, | 3466 pieces.SetAt(store_index, |
3465 Bool::Cast(obj).value() ? Symbols::True() : Symbols::False()); | 3467 Bool::Cast(obj).value() ? Symbols::True() : Symbols::False()); |
3466 } else if (obj.IsNull()) { | 3468 } else if (obj.IsNull()) { |
3467 pieces.SetAt(store_index, Symbols::Null()); | 3469 pieces.SetAt(store_index, Symbols::Null()); |
3468 } else { | 3470 } else { |
3469 return this; | 3471 return this; |
3470 } | 3472 } |
3471 } else { | 3473 } else { |
3472 return this; | 3474 return this; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3637 case Token::kTRUNCDIV: return 0; | 3639 case Token::kTRUNCDIV: return 0; |
3638 case Token::kMOD: return 1; | 3640 case Token::kMOD: return 1; |
3639 default: UNIMPLEMENTED(); return -1; | 3641 default: UNIMPLEMENTED(); return -1; |
3640 } | 3642 } |
3641 } | 3643 } |
3642 | 3644 |
3643 | 3645 |
3644 #undef __ | 3646 #undef __ |
3645 | 3647 |
3646 } // namespace dart | 3648 } // namespace dart |
OLD | NEW |