| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2447 __ Bind(slow_path->exit_label()); | 2447 __ Bind(slow_path->exit_label()); |
| 2448 } | 2448 } |
| 2449 | 2449 |
| 2450 | 2450 |
| 2451 static void EmitJavascriptOverflowCheck(FlowGraphCompiler* compiler, | 2451 static void EmitJavascriptOverflowCheck(FlowGraphCompiler* compiler, |
| 2452 Range* range, | 2452 Range* range, |
| 2453 Label* overflow, | 2453 Label* overflow, |
| 2454 Register result) { | 2454 Register result) { |
| 2455 if (!range->IsWithin(-0x20000000000000LL, 0x20000000000000LL)) { | 2455 if (!range->IsWithin(-0x20000000000000LL, 0x20000000000000LL)) { |
| 2456 ASSERT(overflow != NULL); | 2456 ASSERT(overflow != NULL); |
| 2457 __ CompareImmediate(result, -0x20000000000000LL, PP); | 2457 __ LoadImmediate(TMP, 0x20000000000000LL, PP); |
| 2458 __ b(overflow, LT); | 2458 __ add(TMP2, result, Operand(TMP)); |
| 2459 __ CompareImmediate(result, 0x20000000000000LL, PP); | 2459 __ cmp(TMP2, Operand(TMP, LSL, 1)); |
| 2460 __ b(overflow, GT); | 2460 __ b(overflow, HI); |
| 2461 } | 2461 } |
| 2462 } | 2462 } |
| 2463 | 2463 |
| 2464 | 2464 |
| 2465 static void EmitSmiShiftLeft(FlowGraphCompiler* compiler, | 2465 static void EmitSmiShiftLeft(FlowGraphCompiler* compiler, |
| 2466 BinarySmiOpInstr* shift_left) { | 2466 BinarySmiOpInstr* shift_left) { |
| 2467 const bool is_truncating = shift_left->is_truncating(); | 2467 const bool is_truncating = shift_left->is_truncating(); |
| 2468 const LocationSummary& locs = *shift_left->locs(); | 2468 const LocationSummary& locs = *shift_left->locs(); |
| 2469 Register left = locs.in(0).reg(); | 2469 Register left = locs.in(0).reg(); |
| 2470 Register result = locs.out(0).reg(); | 2470 Register result = locs.out(0).reg(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2562 } | 2562 } |
| 2563 } else { | 2563 } else { |
| 2564 if (right_needs_check) { | 2564 if (right_needs_check) { |
| 2565 ASSERT(shift_left->CanDeoptimize()); | 2565 ASSERT(shift_left->CanDeoptimize()); |
| 2566 __ CompareImmediate( | 2566 __ CompareImmediate( |
| 2567 right, reinterpret_cast<int64_t>(Smi::New(Smi::kBits)), PP); | 2567 right, reinterpret_cast<int64_t>(Smi::New(Smi::kBits)), PP); |
| 2568 __ b(deopt, CS); | 2568 __ b(deopt, CS); |
| 2569 } | 2569 } |
| 2570 // Left is not a constant. | 2570 // Left is not a constant. |
| 2571 // Check if count too large for handling it inlined. | 2571 // Check if count too large for handling it inlined. |
| 2572 __ Asr(TMP, right, kSmiTagSize); // SmiUntag right into IP. | 2572 __ Asr(TMP, right, kSmiTagSize); // SmiUntag right into TMP. |
| 2573 // Overflow test (preserve left, right, and IP); | 2573 // Overflow test (preserve left, right, and TMP); |
| 2574 Register temp = locs.temp(0).reg(); | 2574 Register temp = locs.temp(0).reg(); |
| 2575 __ lslv(temp, left, TMP); | 2575 __ lslv(temp, left, TMP); |
| 2576 __ asrv(TMP2, temp, TMP); | 2576 __ asrv(TMP2, temp, TMP); |
| 2577 __ CompareRegisters(left, TMP2); | 2577 __ CompareRegisters(left, TMP2); |
| 2578 __ b(deopt, NE); // Overflow. | 2578 __ b(deopt, NE); // Overflow. |
| 2579 // Shift for result now we know there is no overflow. | 2579 // Shift for result now we know there is no overflow. |
| 2580 __ lslv(result, left, TMP); | 2580 __ lslv(result, left, TMP); |
| 2581 } | 2581 } |
| 2582 if (FLAG_throw_on_javascript_int_overflow) { | 2582 if (FLAG_throw_on_javascript_int_overflow) { |
| 2583 EmitJavascriptOverflowCheck(compiler, shift_left->range(), deopt, result); | 2583 EmitJavascriptOverflowCheck(compiler, shift_left->range(), deopt, result); |
| (...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4487 compiler->GenerateCall(token_pos(), | 4487 compiler->GenerateCall(token_pos(), |
| 4488 &label, | 4488 &label, |
| 4489 PcDescriptors::kOther, | 4489 PcDescriptors::kOther, |
| 4490 locs()); | 4490 locs()); |
| 4491 __ Drop(ArgumentCount()); // Discard arguments. | 4491 __ Drop(ArgumentCount()); // Discard arguments. |
| 4492 } | 4492 } |
| 4493 | 4493 |
| 4494 } // namespace dart | 4494 } // namespace dart |
| 4495 | 4495 |
| 4496 #endif // defined TARGET_ARCH_ARM64 | 4496 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |