Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: runtime/vm/intrinsifier_arm.cc

Issue 1124173002: Implement Smi_bitLength intrinsic on mips, arm, and arm64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/disassembler_arm64.cc ('k') | runtime/vm/intrinsifier_arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 786
787 void Intrinsifier::Smi_bitNegate(Assembler* assembler) { 787 void Intrinsifier::Smi_bitNegate(Assembler* assembler) {
788 __ ldr(R0, Address(SP, 0 * kWordSize)); 788 __ ldr(R0, Address(SP, 0 * kWordSize));
789 __ mvn(R0, Operand(R0)); 789 __ mvn(R0, Operand(R0));
790 __ bic(R0, R0, Operand(kSmiTagMask)); // Remove inverted smi-tag. 790 __ bic(R0, R0, Operand(kSmiTagMask)); // Remove inverted smi-tag.
791 __ Ret(); 791 __ Ret();
792 } 792 }
793 793
794 794
795 void Intrinsifier::Smi_bitLength(Assembler* assembler) { 795 void Intrinsifier::Smi_bitLength(Assembler* assembler) {
796 // TODO(sra): Implement as word-length - CLZ. 796 __ ldr(R0, Address(SP, 0 * kWordSize));
797 __ SmiUntag(R0);
798 // XOR with sign bit to complement bits if value is negative.
799 __ eor(R0, R0, Operand(R0, ASR, 31));
800 __ clz(R0, R0);
801 __ rsb(R0, R0, Operand(32));
802 __ SmiTag(R0);
803 __ Ret();
797 } 804 }
798 805
799 806
800 void Intrinsifier::Bigint_lsh(Assembler* assembler) { 807 void Intrinsifier::Bigint_lsh(Assembler* assembler) {
801 // static void _lsh(Uint32List x_digits, int x_used, int n, 808 // static void _lsh(Uint32List x_digits, int x_used, int n,
802 // Uint32List r_digits) 809 // Uint32List r_digits)
803 810
804 // R2 = x_used, R3 = x_digits, x_used > 0, x_used is Smi. 811 // R2 = x_used, R3 = x_digits, x_used > 0, x_used is Smi.
805 __ ldrd(R2, SP, 2 * kWordSize); 812 __ ldrd(R2, SP, 2 * kWordSize);
806 // R4 = r_digits, R5 = n, n is Smi, n % _DIGIT_BITS != 0. 813 // R4 = r_digits, R5 = n, n is Smi, n % _DIGIT_BITS != 0.
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after
2021 Isolate* isolate = Isolate::Current(); 2028 Isolate* isolate = Isolate::Current();
2022 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); 2029 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate));
2023 // Set return value to Isolate::current_tag_. 2030 // Set return value to Isolate::current_tag_.
2024 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); 2031 __ ldr(R0, Address(R1, Isolate::current_tag_offset()));
2025 __ Ret(); 2032 __ Ret();
2026 } 2033 }
2027 2034
2028 } // namespace dart 2035 } // namespace dart
2029 2036
2030 #endif // defined TARGET_ARCH_ARM 2037 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/disassembler_arm64.cc ('k') | runtime/vm/intrinsifier_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698