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 2469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2480 __ b(slow_path->entry_label()); | 2480 __ b(slow_path->entry_label()); |
2481 } | 2481 } |
2482 __ Bind(slow_path->exit_label()); | 2482 __ Bind(slow_path->exit_label()); |
2483 } | 2483 } |
2484 | 2484 |
2485 | 2485 |
2486 static void EmitJavascriptOverflowCheck(FlowGraphCompiler* compiler, | 2486 static void EmitJavascriptOverflowCheck(FlowGraphCompiler* compiler, |
2487 Range* range, | 2487 Range* range, |
2488 Label* overflow, | 2488 Label* overflow, |
2489 Register result) { | 2489 Register result) { |
2490 if (!range->IsWithin(-0x20000000000000LL, 0x20000000000000LL)) { | 2490 if (!RangeUtils::IsWithin(range, -0x20000000000000LL, 0x20000000000000LL)) { |
2491 ASSERT(overflow != NULL); | 2491 ASSERT(overflow != NULL); |
2492 __ LoadImmediate(TMP, 0x20000000000000LL, PP); | 2492 __ LoadImmediate(TMP, 0x20000000000000LL, PP); |
2493 __ add(TMP2, result, Operand(TMP)); | 2493 __ add(TMP2, result, Operand(TMP)); |
2494 __ cmp(TMP2, Operand(TMP, LSL, 1)); | 2494 __ cmp(TMP2, Operand(TMP, LSL, 1)); |
2495 __ b(overflow, HI); | 2495 __ b(overflow, HI); |
2496 } | 2496 } |
2497 } | 2497 } |
2498 | 2498 |
2499 | 2499 |
2500 static void EmitSmiShiftLeft(FlowGraphCompiler* compiler, | 2500 static void EmitSmiShiftLeft(FlowGraphCompiler* compiler, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2549 if (obj.IsSmi()) { | 2549 if (obj.IsSmi()) { |
2550 const intptr_t left_int = Smi::Cast(obj).Value(); | 2550 const intptr_t left_int = Smi::Cast(obj).Value(); |
2551 if (left_int == 0) { | 2551 if (left_int == 0) { |
2552 __ CompareRegisters(right, ZR); | 2552 __ CompareRegisters(right, ZR); |
2553 __ b(deopt, MI); | 2553 __ b(deopt, MI); |
2554 __ mov(result, ZR); | 2554 __ mov(result, ZR); |
2555 return; | 2555 return; |
2556 } | 2556 } |
2557 const intptr_t max_right = kSmiBits - Utils::HighestBit(left_int); | 2557 const intptr_t max_right = kSmiBits - Utils::HighestBit(left_int); |
2558 const bool right_needs_check = | 2558 const bool right_needs_check = |
2559 (right_range == NULL) || | 2559 !RangeUtils::IsWithin(right_range, 0, max_right - 1); |
2560 !right_range->IsWithin(0, max_right - 1); | |
2561 if (right_needs_check) { | 2560 if (right_needs_check) { |
2562 __ CompareImmediate(right, | 2561 __ CompareImmediate(right, |
2563 reinterpret_cast<int64_t>(Smi::New(max_right)), PP); | 2562 reinterpret_cast<int64_t>(Smi::New(max_right)), PP); |
2564 __ b(deopt, CS); | 2563 __ b(deopt, CS); |
2565 } | 2564 } |
2566 __ SmiUntag(TMP, right); | 2565 __ SmiUntag(TMP, right); |
2567 __ lslv(result, left, TMP); | 2566 __ lslv(result, left, TMP); |
2568 } | 2567 } |
2569 if (FLAG_throw_on_javascript_int_overflow) { | 2568 if (FLAG_throw_on_javascript_int_overflow) { |
2570 EmitJavascriptOverflowCheck(compiler, shift_left->range(), deopt, result); | 2569 EmitJavascriptOverflowCheck(compiler, shift_left->range(), deopt, result); |
2571 } | 2570 } |
2572 return; | 2571 return; |
2573 } | 2572 } |
2574 | 2573 |
2575 const bool right_needs_check = | 2574 const bool right_needs_check = |
2576 (right_range == NULL) || !right_range->IsWithin(0, (Smi::kBits - 1)); | 2575 !RangeUtils::IsWithin(right_range, 0, (Smi::kBits - 1)); |
2577 if (is_truncating) { | 2576 if (is_truncating) { |
2578 if (right_needs_check) { | 2577 if (right_needs_check) { |
2579 const bool right_may_be_negative = | 2578 const bool right_may_be_negative = |
2580 (right_range == NULL) || !right_range->IsPositive(); | 2579 (right_range == NULL) || !right_range->IsPositive(); |
2581 if (right_may_be_negative) { | 2580 if (right_may_be_negative) { |
2582 ASSERT(shift_left->CanDeoptimize()); | 2581 ASSERT(shift_left->CanDeoptimize()); |
2583 __ CompareRegisters(right, ZR); | 2582 __ CompareRegisters(right, ZR); |
2584 __ b(deopt, MI); | 2583 __ b(deopt, MI); |
2585 } | 2584 } |
2586 | 2585 |
(...skipping 2835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5422 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 5421 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
5423 #if defined(DEBUG) | 5422 #if defined(DEBUG) |
5424 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); | 5423 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); |
5425 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); | 5424 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); |
5426 #endif | 5425 #endif |
5427 } | 5426 } |
5428 | 5427 |
5429 } // namespace dart | 5428 } // namespace dart |
5430 | 5429 |
5431 #endif // defined TARGET_ARCH_ARM64 | 5430 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |