| 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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 2242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2253 !right_range->IsWithin(0, RangeBoundary::kPlusInfinity); | 2253 !right_range->IsWithin(0, RangeBoundary::kPlusInfinity); |
| 2254 if (right_may_be_negative) { | 2254 if (right_may_be_negative) { |
| 2255 ASSERT(shift_left->CanDeoptimize()); | 2255 ASSERT(shift_left->CanDeoptimize()); |
| 2256 __ bltz(right, deopt); | 2256 __ bltz(right, deopt); |
| 2257 } | 2257 } |
| 2258 Label done, is_not_zero; | 2258 Label done, is_not_zero; |
| 2259 | 2259 |
| 2260 __ sltiu(CMPRES, | 2260 __ sltiu(CMPRES, |
| 2261 right, Immediate(reinterpret_cast<int32_t>(Smi::New(Smi::kBits)))); | 2261 right, Immediate(reinterpret_cast<int32_t>(Smi::New(Smi::kBits)))); |
| 2262 __ movz(result, ZR, CMPRES); // result = right >= kBits ? 0 : result. | 2262 __ movz(result, ZR, CMPRES); // result = right >= kBits ? 0 : result. |
| 2263 __ mov(TMP1, right); | 2263 __ sra(TMP1, right, kSmiTagSize); |
| 2264 __ SmiUntag(TMP1); | |
| 2265 __ sllv(TMP1, left, TMP1); | 2264 __ sllv(TMP1, left, TMP1); |
| 2266 // result = right < kBits ? left << right : result. | 2265 // result = right < kBits ? left << right : result. |
| 2267 __ movn(result, TMP1, CMPRES); | 2266 __ movn(result, TMP1, CMPRES); |
| 2268 } else { | 2267 } else { |
| 2269 __ sra(TMP, right, kSmiTagSize); | 2268 __ sra(TMP, right, kSmiTagSize); |
| 2270 __ sllv(result, left, TMP); | 2269 __ sllv(result, left, TMP); |
| 2271 } | 2270 } |
| 2272 } else { | 2271 } else { |
| 2273 if (right_needs_check) { | 2272 if (right_needs_check) { |
| 2274 ASSERT(shift_left->CanDeoptimize()); | 2273 ASSERT(shift_left->CanDeoptimize()); |
| 2275 __ BranchUnsignedGreaterEqual( | 2274 __ BranchUnsignedGreaterEqual( |
| 2276 right, reinterpret_cast<int32_t>(Smi::New(Smi::kBits)), deopt); | 2275 right, reinterpret_cast<int32_t>(Smi::New(Smi::kBits)), deopt); |
| 2277 } | 2276 } |
| 2278 // Left is not a constant. | 2277 // Left is not a constant. |
| 2279 // Check if count too large for handling it inlined. | 2278 // Check if count too large for handling it inlined. |
| 2280 __ sra(TMP, right, kSmiTagSize); // SmiUntag right into TMP. | 2279 __ sra(TMP, right, kSmiTagSize); // SmiUntag right into TMP. |
| 2281 // Overflow test (preserve left, right, and TMP); | 2280 // Overflow test (preserve left, right, and TMP); |
| 2282 Register temp = locs.temp(0).reg(); | 2281 Register temp = locs.temp(0).reg(); |
| 2283 __ sllv(temp, left, TMP); | 2282 __ sllv(temp, left, TMP); |
| 2284 __ srav(temp, temp, TMP); | 2283 __ srav(temp, temp, TMP); |
| 2285 __ bne(temp, left, deopt); // Overflow. | 2284 __ bne(temp, left, deopt); // Overflow. |
| 2286 // Shift for result now we know there is no overflow. | 2285 // Shift for result now we know there is no overflow. |
| 2287 __ sll(result, left, TMP); | 2286 __ sllv(result, left, TMP); |
| 2288 } | 2287 } |
| 2289 } | 2288 } |
| 2290 | 2289 |
| 2291 | 2290 |
| 2292 LocationSummary* BinarySmiOpInstr::MakeLocationSummary() const { | 2291 LocationSummary* BinarySmiOpInstr::MakeLocationSummary() const { |
| 2293 const intptr_t kNumInputs = 2; | 2292 const intptr_t kNumInputs = 2; |
| 2294 const intptr_t kNumTemps = op_kind() == Token::kADD ? 1 : 0; | 2293 const intptr_t kNumTemps = op_kind() == Token::kADD ? 1 : 0; |
| 2295 LocationSummary* summary = | 2294 LocationSummary* summary = |
| 2296 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 2295 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2297 if (op_kind() == Token::kTRUNCDIV) { | 2296 if (op_kind() == Token::kTRUNCDIV) { |
| (...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3734 compiler->GenerateCall(token_pos(), | 3733 compiler->GenerateCall(token_pos(), |
| 3735 &label, | 3734 &label, |
| 3736 PcDescriptors::kOther, | 3735 PcDescriptors::kOther, |
| 3737 locs()); | 3736 locs()); |
| 3738 __ Drop(2); // Discard type arguments and receiver. | 3737 __ Drop(2); // Discard type arguments and receiver. |
| 3739 } | 3738 } |
| 3740 | 3739 |
| 3741 } // namespace dart | 3740 } // namespace dart |
| 3742 | 3741 |
| 3743 #endif // defined TARGET_ARCH_MIPS | 3742 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |