Chromium Code Reviews| 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 6263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6274 | 6274 |
| 6275 Label* deopt = NULL; | 6275 Label* deopt = NULL; |
| 6276 if (CanDeoptimize()) { | 6276 if (CanDeoptimize()) { |
| 6277 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptShiftMintOp); | 6277 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptShiftMintOp); |
| 6278 } | 6278 } |
| 6279 if (locs()->in(1).IsConstant()) { | 6279 if (locs()->in(1).IsConstant()) { |
| 6280 // Code for a constant shift amount. | 6280 // Code for a constant shift amount. |
| 6281 ASSERT(locs()->in(1).constant().IsSmi()); | 6281 ASSERT(locs()->in(1).constant().IsSmi()); |
| 6282 const int32_t shift = | 6282 const int32_t shift = |
| 6283 reinterpret_cast<int32_t>(locs()->in(1).constant().raw()) >> 1; | 6283 reinterpret_cast<int32_t>(locs()->in(1).constant().raw()) >> 1; |
| 6284 if ((shift < 0) || (shift > kMintShiftCountLimit)) { | |
| 6285 __ b(deopt); | |
| 6286 return; | |
| 6287 } else if (shift == 0) { | |
| 6288 // Nothing to do for zero shift amount. | |
| 6289 __ mov(out_lo, Operand(left_lo)); | |
| 6290 __ mov(out_hi, Operand(left_hi)); | |
| 6291 return; | |
| 6292 } | |
| 6293 switch (op_kind()) { | 6284 switch (op_kind()) { |
| 6294 case Token::kSHR: { | 6285 case Token::kSHR: { |
| 6295 if (shift < 32) { | 6286 if (shift < 32) { |
| 6296 __ Lsl(out_lo, left_hi, 32 - shift); | 6287 __ Lsl(out_lo, left_hi, 32 - shift); |
| 6297 __ orr(out_lo, out_lo, Operand(left_lo, LSR, shift)); | 6288 __ orr(out_lo, out_lo, Operand(left_lo, LSR, shift)); |
| 6298 __ Asr(out_hi, left_hi, shift); | 6289 __ Asr(out_hi, left_hi, shift); |
| 6299 } else { | 6290 } else { |
| 6300 if (shift == 32) { | 6291 if (shift == 32) { |
| 6301 __ mov(out_lo, Operand(left_hi)); | 6292 __ mov(out_lo, Operand(left_hi)); |
| 6302 } else { | 6293 } else { |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6514 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptShiftMintOp); | 6505 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptShiftMintOp); |
| 6515 | 6506 |
| 6516 if (locs()->in(1).IsConstant()) { | 6507 if (locs()->in(1).IsConstant()) { |
| 6517 // Shifter is constant. | 6508 // Shifter is constant. |
| 6518 | 6509 |
| 6519 const Object& constant = locs()->in(1).constant(); | 6510 const Object& constant = locs()->in(1).constant(); |
| 6520 ASSERT(constant.IsSmi()); | 6511 ASSERT(constant.IsSmi()); |
| 6521 const intptr_t shift_value = Smi::Cast(constant).Value(); | 6512 const intptr_t shift_value = Smi::Cast(constant).Value(); |
| 6522 | 6513 |
| 6523 // Check constant shift value. | 6514 // Check constant shift value. |
| 6524 if (shift_value == 0) { | 6515 if (shift_value > kShifterLimit) { |
|
Vyacheslav Egorov (Google)
2014/10/07 12:03:50
Can't this also be handled in Canonicalize just li
Cutch
2014/10/21 17:42:11
Done.
| |
| 6525 // Nothing to do. | |
| 6526 __ mov(out, Operand(left)); | |
| 6527 } else if (shift_value < 0) { | |
| 6528 // Invalid shift value. | |
| 6529 __ b(deopt); | |
| 6530 } else if (shift_value > kShifterLimit) { | |
| 6531 // Result is 0. | 6516 // Result is 0. |
| 6532 __ eor(out, out, Operand(out)); | 6517 __ eor(out, out, Operand(out)); |
| 6533 } else { | 6518 } else { |
| 6534 // Do the shift: (shift_value > 0) && (shift_value <= kShifterLimit). | 6519 // Do the shift: (shift_value > 0) && (shift_value <= kShifterLimit). |
| 6535 switch (op_kind()) { | 6520 switch (op_kind()) { |
| 6536 case Token::kSHR: | 6521 case Token::kSHR: |
| 6537 __ Lsr(out, left, shift_value); | 6522 __ Lsr(out, left, shift_value); |
| 6538 break; | 6523 break; |
| 6539 case Token::kSHL: | 6524 case Token::kSHL: |
| 6540 __ Lsl(out, left, shift_value); | 6525 __ Lsl(out, left, shift_value); |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7019 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 7004 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
| 7020 #if defined(DEBUG) | 7005 #if defined(DEBUG) |
| 7021 __ LoadImmediate(R4, kInvalidObjectPointer); | 7006 __ LoadImmediate(R4, kInvalidObjectPointer); |
| 7022 __ LoadImmediate(R5, kInvalidObjectPointer); | 7007 __ LoadImmediate(R5, kInvalidObjectPointer); |
| 7023 #endif | 7008 #endif |
| 7024 } | 7009 } |
| 7025 | 7010 |
| 7026 } // namespace dart | 7011 } // namespace dart |
| 7027 | 7012 |
| 7028 #endif // defined TARGET_ARCH_ARM | 7013 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |