| 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/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
| 9 | 9 |
| 10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 | 685 |
| 686 void Intrinsifier::Smi_bitNegate(Assembler* assembler) { | 686 void Intrinsifier::Smi_bitNegate(Assembler* assembler) { |
| 687 __ ldr(R0, Address(SP, 0 * kWordSize)); | 687 __ ldr(R0, Address(SP, 0 * kWordSize)); |
| 688 __ mvn(R0, R0); | 688 __ mvn(R0, R0); |
| 689 __ andi(R0, R0, Immediate(~kSmiTagMask)); // Remove inverted smi-tag. | 689 __ andi(R0, R0, Immediate(~kSmiTagMask)); // Remove inverted smi-tag. |
| 690 __ ret(); | 690 __ ret(); |
| 691 } | 691 } |
| 692 | 692 |
| 693 | 693 |
| 694 void Intrinsifier::Smi_bitLength(Assembler* assembler) { | 694 void Intrinsifier::Smi_bitLength(Assembler* assembler) { |
| 695 // TODO(sra): Implement as word-length - CLZ. | 695 __ ldr(R0, Address(SP, 0 * kWordSize)); |
| 696 __ SmiUntag(R0); |
| 697 // XOR with sign bit to complement bits if value is negative. |
| 698 __ eor(R0, R0, Operand(R0, ASR, 63)); |
| 699 __ clz(R0, R0); |
| 700 __ LoadImmediate(R1, 64, kNoPP); |
| 701 __ sub(R0, R1, Operand(R0)); |
| 702 __ SmiTag(R0); |
| 703 __ ret(); |
| 696 } | 704 } |
| 697 | 705 |
| 698 | 706 |
| 699 void Intrinsifier::Bigint_lsh(Assembler* assembler) { | 707 void Intrinsifier::Bigint_lsh(Assembler* assembler) { |
| 700 // static void _lsh(Uint32List x_digits, int x_used, int n, | 708 // static void _lsh(Uint32List x_digits, int x_used, int n, |
| 701 // Uint32List r_digits) | 709 // Uint32List r_digits) |
| 702 | 710 |
| 703 // R2 = x_used, R3 = x_digits, x_used > 0, x_used is Smi. | 711 // R2 = x_used, R3 = x_digits, x_used > 0, x_used is Smi. |
| 704 __ ldp(R2, R3, Address(SP, 2 * kWordSize, Address::PairOffset)); | 712 __ ldp(R2, R3, Address(SP, 2 * kWordSize, Address::PairOffset)); |
| 705 __ add(R2, R2, Operand(2)); // x_used > 0, Smi. R2 = x_used + 1, round up. | 713 __ add(R2, R2, Operand(2)); // x_used > 0, Smi. R2 = x_used + 1, round up. |
| (...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2103 Isolate* isolate = Isolate::Current(); | 2111 Isolate* isolate = Isolate::Current(); |
| 2104 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); | 2112 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); |
| 2105 // Set return value to Isolate::current_tag_. | 2113 // Set return value to Isolate::current_tag_. |
| 2106 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 2114 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
| 2107 __ ret(); | 2115 __ ret(); |
| 2108 } | 2116 } |
| 2109 | 2117 |
| 2110 } // namespace dart | 2118 } // namespace dart |
| 2111 | 2119 |
| 2112 #endif // defined TARGET_ARCH_ARM64 | 2120 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |