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

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

Issue 509153003: New bigint implementation in the vm. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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
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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 942 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 __ andq(RAX, Immediate(~kSmiTagMask)); // Remove inverted smi-tag. 953 __ andq(RAX, Immediate(~kSmiTagMask)); // Remove inverted smi-tag.
954 __ ret(); 954 __ ret();
955 } 955 }
956 956
957 957
958 void Intrinsifier::Smi_bitLength(Assembler* assembler) { 958 void Intrinsifier::Smi_bitLength(Assembler* assembler) {
959 // TODO(sra): Implement using bsrq. 959 // TODO(sra): Implement using bsrq.
960 } 960 }
961 961
962 962
963 void Intrinsifier::Bigint_getNeg(Assembler* assembler) {
964 __ movq(RAX, Address(RSP, + 1 * kWordSize));
965 __ movq(RAX, FieldAddress(RAX, Bigint::neg_offset()));
966 __ ret();
967 }
968
969
970 void Intrinsifier::Bigint_setNeg(Assembler* assembler) {
971 __ movq(RAX, Address(RSP, + 1 * kWordSize));
972 __ movq(RCX, Address(RSP, + 2 * kWordSize));
973 __ StoreIntoObject(RCX, FieldAddress(RCX, Bigint::neg_offset()), RAX, false);
974 __ ret();
975 }
976
977
978 void Intrinsifier::Bigint_getUsed(Assembler* assembler) {
979 __ movq(RAX, Address(RSP, + 1 * kWordSize));
980 __ movq(RAX, FieldAddress(RAX, Bigint::used_offset()));
981 __ ret();
982 }
983
984
985 void Intrinsifier::Bigint_setUsed(Assembler* assembler) {
986 __ movq(RAX, Address(RSP, + 1 * kWordSize));
987 __ movq(RCX, Address(RSP, + 2 * kWordSize));
988 __ StoreIntoObject(RCX, FieldAddress(RCX, Bigint::used_offset()), RAX);
989 __ ret();
990 }
991
992
993 void Intrinsifier::Bigint_getDigits(Assembler* assembler) {
994 __ movq(RAX, Address(RSP, + 1 * kWordSize));
995 __ movq(RAX, FieldAddress(RAX, Bigint::digits_offset()));
996 __ ret();
997 }
998
999
1000 void Intrinsifier::Bigint_setDigits(Assembler* assembler) {
1001 __ movq(RAX, Address(RSP, + 1 * kWordSize));
1002 __ movq(RCX, Address(RSP, + 2 * kWordSize));
1003 __ StoreIntoObject(RCX,
1004 FieldAddress(RCX, Bigint::digits_offset()), RAX, false);
1005 __ ret();
1006 }
1007
1008
963 // Check if the last argument is a double, jump to label 'is_smi' if smi 1009 // Check if the last argument is a double, jump to label 'is_smi' if smi
964 // (easy to convert to double), otherwise jump to label 'not_double_smi', 1010 // (easy to convert to double), otherwise jump to label 'not_double_smi',
965 // Returns the last argument in RAX. 1011 // Returns the last argument in RAX.
966 static void TestLastArgumentIsDouble(Assembler* assembler, 1012 static void TestLastArgumentIsDouble(Assembler* assembler,
967 Label* is_smi, 1013 Label* is_smi,
968 Label* not_double_smi) { 1014 Label* not_double_smi) {
969 __ movq(RAX, Address(RSP, + 1 * kWordSize)); 1015 __ movq(RAX, Address(RSP, + 1 * kWordSize));
970 __ testq(RAX, Immediate(kSmiTagMask)); 1016 __ testq(RAX, Immediate(kSmiTagMask));
971 __ j(ZERO, is_smi, Assembler::kNearJump); // Jump if Smi. 1017 __ j(ZERO, is_smi, Assembler::kNearJump); // Jump if Smi.
972 __ CompareClassId(RAX, kDoubleCid); 1018 __ CompareClassId(RAX, kDoubleCid);
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1694 // Set return value to Isolate::current_tag_. 1740 // Set return value to Isolate::current_tag_.
1695 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); 1741 __ movq(RAX, Address(RBX, Isolate::current_tag_offset()));
1696 __ ret(); 1742 __ ret();
1697 } 1743 }
1698 1744
1699 #undef __ 1745 #undef __
1700 1746
1701 } // namespace dart 1747 } // namespace dart
1702 1748
1703 #endif // defined TARGET_ARCH_X64 1749 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698