| 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 2462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2473 __ andi(TMP1, value, Immediate(kSmiTagMask)); | 2473 __ andi(TMP1, value, Immediate(kSmiTagMask)); |
| 2474 __ bne(TMP1, ZR, deopt); | 2474 __ bne(TMP1, ZR, deopt); |
| 2475 } | 2475 } |
| 2476 | 2476 |
| 2477 | 2477 |
| 2478 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary() const { | 2478 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary() const { |
| 2479 const intptr_t kNumInputs = 2; | 2479 const intptr_t kNumInputs = 2; |
| 2480 const intptr_t kNumTemps = 0; | 2480 const intptr_t kNumTemps = 0; |
| 2481 LocationSummary* locs = | 2481 LocationSummary* locs = |
| 2482 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 2482 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2483 locs->set_in(0, Location::RegisterOrSmiConstant(length())); | 2483 locs->set_in(locLength, Location::RegisterOrSmiConstant(length())); |
| 2484 locs->set_in(1, Location::RegisterOrSmiConstant(index())); | 2484 locs->set_in(locIndex, Location::RegisterOrSmiConstant(index())); |
| 2485 return locs; | 2485 return locs; |
| 2486 } | 2486 } |
| 2487 | 2487 |
| 2488 | 2488 |
| 2489 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2489 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2490 Label* deopt = compiler->AddDeoptStub(deopt_id(), | 2490 Label* deopt = compiler->AddDeoptStub(deopt_id(), |
| 2491 kDeoptCheckArrayBound); | 2491 kDeoptCheckArrayBound); |
| 2492 if (locs()->in(0).IsConstant() && locs()->in(1).IsConstant()) { | 2492 if (locs()->in(locLength).IsConstant() && locs()->in(locIndex).IsConstant()) { |
| 2493 ASSERT((Smi::Cast(locs()->in(locLength).constant()).Value() <= |
| 2494 Smi::Cast(locs()->in(locIndex).constant()).Value()) || |
| 2495 (Smi::Cast(locs()->in(locIndex).constant()).Value() < 0)); |
| 2493 // Unconditionally deoptimize for constant bounds checks because they | 2496 // Unconditionally deoptimize for constant bounds checks because they |
| 2494 // only occur only when index is out-of-bounds. | 2497 // only occur only when index is out-of-bounds. |
| 2495 __ b(deopt); | 2498 __ b(deopt); |
| 2496 return; | 2499 return; |
| 2497 } | 2500 } |
| 2498 | 2501 |
| 2499 if (locs()->in(1).IsConstant()) { | 2502 if (locs()->in(locIndex).IsConstant()) { |
| 2500 Register length = locs()->in(0).reg(); | 2503 Register length = locs()->in(locLength).reg(); |
| 2501 const Object& constant = locs()->in(1).constant(); | 2504 const Object& constant = locs()->in(locIndex).constant(); |
| 2502 ASSERT(constant.IsSmi()); | 2505 ASSERT(constant.IsSmi()); |
| 2503 __ BranchUnsignedLessEqual( | 2506 __ BranchUnsignedLessEqual( |
| 2504 length, reinterpret_cast<int32_t>(constant.raw()), deopt); | 2507 length, reinterpret_cast<int32_t>(constant.raw()), deopt); |
| 2505 } else if (locs()->in(0).IsConstant()) { | 2508 } else if (locs()->in(locLength).IsConstant()) { |
| 2506 ASSERT(locs()->in(0).constant().IsSmi()); | 2509 ASSERT(locs()->in(locLength).constant().IsSmi()); |
| 2507 const Smi& smi_const = Smi::Cast(locs()->in(0).constant()); | 2510 const Smi& smi_const = Smi::Cast(locs()->in(locLength).constant()); |
| 2508 Register index = locs()->in(1).reg(); | 2511 Register index = locs()->in(locIndex).reg(); |
| 2509 __ BranchUnsignedGreaterEqual( | 2512 __ BranchUnsignedGreaterEqual( |
| 2510 index, reinterpret_cast<int32_t>(smi_const.raw()), deopt); | 2513 index, reinterpret_cast<int32_t>(smi_const.raw()), deopt); |
| 2511 } else { | 2514 } else { |
| 2512 Register length = locs()->in(0).reg(); | 2515 Register length = locs()->in(locLength).reg(); |
| 2513 Register index = locs()->in(1).reg(); | 2516 Register index = locs()->in(locIndex).reg(); |
| 2514 __ BranchUnsignedGreaterEqual(index, length, deopt); | 2517 __ BranchUnsignedGreaterEqual(index, length, deopt); |
| 2515 } | 2518 } |
| 2516 } | 2519 } |
| 2517 | 2520 |
| 2518 | 2521 |
| 2519 LocationSummary* UnboxIntegerInstr::MakeLocationSummary() const { | 2522 LocationSummary* UnboxIntegerInstr::MakeLocationSummary() const { |
| 2520 UNIMPLEMENTED(); | 2523 UNIMPLEMENTED(); |
| 2521 return NULL; | 2524 return NULL; |
| 2522 } | 2525 } |
| 2523 | 2526 |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2892 compiler->GenerateCall(token_pos(), | 2895 compiler->GenerateCall(token_pos(), |
| 2893 &label, | 2896 &label, |
| 2894 PcDescriptors::kOther, | 2897 PcDescriptors::kOther, |
| 2895 locs()); | 2898 locs()); |
| 2896 __ Drop(2); // Discard type arguments and receiver. | 2899 __ Drop(2); // Discard type arguments and receiver. |
| 2897 } | 2900 } |
| 2898 | 2901 |
| 2899 } // namespace dart | 2902 } // namespace dart |
| 2900 | 2903 |
| 2901 #endif // defined TARGET_ARCH_MIPS | 2904 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |