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/globals.h" // Needed here to get TARGET_ARCH_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 6112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6123 ASSERT(op_kind() == Token::kSUB); | 6123 ASSERT(op_kind() == Token::kSUB); |
6124 __ subs(out_lo, left_lo, Operand(right_lo)); | 6124 __ subs(out_lo, left_lo, Operand(right_lo)); |
6125 __ sbcs(out_hi, left_hi, Operand(right_hi)); | 6125 __ sbcs(out_hi, left_hi, Operand(right_hi)); |
6126 } | 6126 } |
6127 if (can_overflow()) { | 6127 if (can_overflow()) { |
6128 // Deopt on overflow. | 6128 // Deopt on overflow. |
6129 __ b(deopt, VS); | 6129 __ b(deopt, VS); |
6130 } | 6130 } |
6131 break; | 6131 break; |
6132 } | 6132 } |
6133 default: | 6133 case Token::kMUL: { |
6134 UNREACHABLE(); | 6134 // We only support the multiplication of two positive 32-bit integers |
6135 break; | 6135 // resulting in a positive 64-bit integer fitting in a mint. |
| 6136 // We deopt in all other cases. |
| 6137 // This guarantees that the multiplication of 16-bit unsigned integers, |
| 6138 // as used in bignum arithmetic, will always succeed. |
| 6139 if (TargetCPUFeatures::arm_version() == ARMv7) { |
| 6140 __ orrs(out_hi, left_hi, Operand(right_hi)); |
| 6141 __ b(deopt, NE); |
| 6142 __ smull(out_lo, out_hi, left_lo, right_lo); |
| 6143 if (can_overflow()) { |
| 6144 __ TestImmediate(out_hi, 0xC0000000); |
| 6145 __ b(deopt, NE); |
| 6146 } |
| 6147 } else { |
| 6148 __ b(deopt); |
| 6149 } |
| 6150 break; |
| 6151 } |
| 6152 default: UNREACHABLE(); |
6136 } | 6153 } |
6137 if (FLAG_throw_on_javascript_int_overflow) { | 6154 if (FLAG_throw_on_javascript_int_overflow) { |
6138 EmitJavascriptIntOverflowCheck(compiler, deopt, out_lo, out_hi); | 6155 EmitJavascriptIntOverflowCheck(compiler, deopt, out_lo, out_hi); |
6139 } | 6156 } |
6140 } | 6157 } |
6141 | 6158 |
6142 | 6159 |
6143 LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Isolate* isolate, | 6160 LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Isolate* isolate, |
6144 bool opt) const { | 6161 bool opt) const { |
6145 const intptr_t kNumInputs = 2; | 6162 const intptr_t kNumInputs = 2; |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6816 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 6833 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
6817 #if defined(DEBUG) | 6834 #if defined(DEBUG) |
6818 __ LoadImmediate(R4, kInvalidObjectPointer); | 6835 __ LoadImmediate(R4, kInvalidObjectPointer); |
6819 __ LoadImmediate(R5, kInvalidObjectPointer); | 6836 __ LoadImmediate(R5, kInvalidObjectPointer); |
6820 #endif | 6837 #endif |
6821 } | 6838 } |
6822 | 6839 |
6823 } // namespace dart | 6840 } // namespace dart |
6824 | 6841 |
6825 #endif // defined TARGET_ARCH_ARM | 6842 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |