| 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/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
| 9 | 9 |
| 10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 | 781 |
| 782 void Intrinsifier::Smi_bitNegate(Assembler* assembler) { | 782 void Intrinsifier::Smi_bitNegate(Assembler* assembler) { |
| 783 __ lw(T0, Address(SP, 0 * kWordSize)); | 783 __ lw(T0, Address(SP, 0 * kWordSize)); |
| 784 __ nor(V0, T0, ZR); | 784 __ nor(V0, T0, ZR); |
| 785 __ Ret(); | 785 __ Ret(); |
| 786 __ delay_slot()->addiu(V0, V0, Immediate(-1)); // Remove inverted smi-tag. | 786 __ delay_slot()->addiu(V0, V0, Immediate(-1)); // Remove inverted smi-tag. |
| 787 } | 787 } |
| 788 | 788 |
| 789 | 789 |
| 790 void Intrinsifier::Smi_bitLength(Assembler* assembler) { | 790 void Intrinsifier::Smi_bitLength(Assembler* assembler) { |
| 791 // TODO(sra): Implement. | 791 __ lw(V0, Address(SP, 0 * kWordSize)); |
| 792 __ SmiUntag(V0); |
| 793 // XOR with sign bit to complement bits if value is negative. |
| 794 __ sra(T0, V0, 31); |
| 795 __ xor_(V0, V0, T0); |
| 796 __ clz(V0, V0); |
| 797 __ LoadImmediate(T0, 32); |
| 798 __ subu(V0, T0, V0); |
| 799 __ Ret(); |
| 800 __ delay_slot()->SmiTag(V0); |
| 792 } | 801 } |
| 793 | 802 |
| 794 | 803 |
| 795 void Intrinsifier::Bigint_lsh(Assembler* assembler) { | 804 void Intrinsifier::Bigint_lsh(Assembler* assembler) { |
| 796 // static void _lsh(Uint32List x_digits, int x_used, int n, | 805 // static void _lsh(Uint32List x_digits, int x_used, int n, |
| 797 // Uint32List r_digits) | 806 // Uint32List r_digits) |
| 798 | 807 |
| 799 // T2 = x_used, T3 = x_digits, x_used > 0, x_used is Smi. | 808 // T2 = x_used, T3 = x_digits, x_used > 0, x_used is Smi. |
| 800 __ lw(T2, Address(SP, 2 * kWordSize)); | 809 __ lw(T2, Address(SP, 2 * kWordSize)); |
| 801 __ lw(T3, Address(SP, 3 * kWordSize)); | 810 __ lw(T3, Address(SP, 3 * kWordSize)); |
| (...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2135 Isolate* isolate = Isolate::Current(); | 2144 Isolate* isolate = Isolate::Current(); |
| 2136 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); | 2145 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); |
| 2137 // Set return value. | 2146 // Set return value. |
| 2138 __ Ret(); | 2147 __ Ret(); |
| 2139 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); | 2148 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); |
| 2140 } | 2149 } |
| 2141 | 2150 |
| 2142 } // namespace dart | 2151 } // namespace dart |
| 2143 | 2152 |
| 2144 #endif // defined TARGET_ARCH_MIPS | 2153 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |