| 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_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 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 __ SmiUntag(R12); | 963 __ SmiUntag(R12); |
| 964 __ movq(RAX, FieldAddress(RAX, ExternalUint8Array::data_offset())); | 964 __ movq(RAX, FieldAddress(RAX, ExternalUint8Array::data_offset())); |
| 965 __ movzxb(RAX, Address(RAX, R12, TIMES_1, 0)); | 965 __ movzxb(RAX, Address(RAX, R12, TIMES_1, 0)); |
| 966 __ SmiTag(RAX); | 966 __ SmiTag(RAX); |
| 967 __ ret(); | 967 __ ret(); |
| 968 __ Bind(&fall_through); | 968 __ Bind(&fall_through); |
| 969 return false; | 969 return false; |
| 970 } | 970 } |
| 971 | 971 |
| 972 | 972 |
| 973 bool Intrinsifier::ExternalUint8ClampedArray_getIndexed(Assembler* assembler) { |
| 974 Label fall_through; |
| 975 TestByteArrayGetIndex(assembler, &fall_through); |
| 976 // R12: index as Smi. |
| 977 // RAX: array. |
| 978 __ SmiUntag(R12); |
| 979 __ movq(RAX, FieldAddress(RAX, ExternalUint8ClampedArray::data_offset())); |
| 980 __ movzxb(RAX, Address(RAX, R12, TIMES_1, 0)); |
| 981 __ SmiTag(RAX); |
| 982 __ ret(); |
| 983 __ Bind(&fall_through); |
| 984 return false; |
| 985 } |
| 986 |
| 987 |
| 988 bool Intrinsifier::ExternalUint8ClampedArray_setIndexed(Assembler* assembler) { |
| 989 Label fall_through, store_value, load_0xff; |
| 990 TestByteArraySetIndex(assembler, &fall_through); |
| 991 // R12: index as Smi. |
| 992 // RAX: array. |
| 993 __ SmiUntag(R12); |
| 994 __ movq(RDI, Address(RSP, + 1 * kWordSize)); // Value. |
| 995 __ testq(RDI, Immediate(kSmiTagMask)); |
| 996 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); |
| 997 |
| 998 __ SmiUntag(RDI); |
| 999 __ cmpq(RDI, Immediate(0xFF)); |
| 1000 __ j(BELOW_EQUAL, &store_value, Assembler::kNearJump); |
| 1001 __ j(GREATER, &load_0xff, Assembler::kNearJump); |
| 1002 __ xorq(RDI, RDI); // Zero. |
| 1003 __ jmp(&store_value, Assembler::kNearJump); |
| 1004 __ Bind(&load_0xff); |
| 1005 __ movq(RDI, Immediate(0xFF)); |
| 1006 |
| 1007 __ Bind(&store_value); |
| 1008 __ movq(RAX, FieldAddress(RAX, ExternalUint8ClampedArray::data_offset())); |
| 1009 __ movb(Address(RAX, R12, TIMES_1, 0), RDI); |
| 1010 __ ret(); |
| 1011 __ Bind(&fall_through); |
| 1012 return false; |
| 1013 } |
| 1014 |
| 1015 |
| 973 // Tests if two top most arguments are smis, jumps to label not_smi if not. | 1016 // Tests if two top most arguments are smis, jumps to label not_smi if not. |
| 974 // Topmost argument is in RAX. | 1017 // Topmost argument is in RAX. |
| 975 static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { | 1018 static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { |
| 976 __ movq(RAX, Address(RSP, + 1 * kWordSize)); | 1019 __ movq(RAX, Address(RSP, + 1 * kWordSize)); |
| 977 __ movq(RCX, Address(RSP, + 2 * kWordSize)); | 1020 __ movq(RCX, Address(RSP, + 2 * kWordSize)); |
| 978 __ orq(RCX, RAX); | 1021 __ orq(RCX, RAX); |
| 979 __ testq(RCX, Immediate(kSmiTagMask)); | 1022 __ testq(RCX, Immediate(kSmiTagMask)); |
| 980 __ j(NOT_ZERO, not_smi, Assembler::kNearJump); | 1023 __ j(NOT_ZERO, not_smi, Assembler::kNearJump); |
| 981 } | 1024 } |
| 982 | 1025 |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1720 __ LoadObject(RAX, Bool::True()); | 1763 __ LoadObject(RAX, Bool::True()); |
| 1721 __ ret(); | 1764 __ ret(); |
| 1722 return true; | 1765 return true; |
| 1723 } | 1766 } |
| 1724 | 1767 |
| 1725 #undef __ | 1768 #undef __ |
| 1726 | 1769 |
| 1727 } // namespace dart | 1770 } // namespace dart |
| 1728 | 1771 |
| 1729 #endif // defined TARGET_ARCH_X64 | 1772 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |