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 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 | 1351 |
1352 bool Intrinsifier::String_getLength(Assembler* assembler) { | 1352 bool Intrinsifier::String_getLength(Assembler* assembler) { |
1353 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object. | 1353 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object. |
1354 __ movq(RAX, FieldAddress(RAX, String::length_offset())); | 1354 __ movq(RAX, FieldAddress(RAX, String::length_offset())); |
1355 __ ret(); | 1355 __ ret(); |
1356 return true; | 1356 return true; |
1357 } | 1357 } |
1358 | 1358 |
1359 | 1359 |
1360 // TODO(srdjan): Implement for two and four byte strings as well. | 1360 // TODO(srdjan): Implement for two and four byte strings as well. |
1361 bool Intrinsifier::String_charCodeAt(Assembler* assembler) { | 1361 bool Intrinsifier::String_codeUnitAt(Assembler* assembler) { |
1362 Label fall_through; | 1362 Label fall_through; |
1363 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Index. | 1363 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Index. |
1364 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // String. | 1364 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // String. |
1365 __ testq(RCX, Immediate(kSmiTagMask)); | 1365 __ testq(RCX, Immediate(kSmiTagMask)); |
1366 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. | 1366 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. |
1367 // Range check. | 1367 // Range check. |
1368 __ cmpq(RCX, FieldAddress(RAX, String::length_offset())); | 1368 __ cmpq(RCX, FieldAddress(RAX, String::length_offset())); |
1369 // Runtime throws exception. | 1369 // Runtime throws exception. |
1370 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); | 1370 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); |
1371 __ CompareClassId(RAX, kOneByteStringCid); | 1371 __ CompareClassId(RAX, kOneByteStringCid); |
(...skipping 20 matching lines...) Expand all Loading... |
1392 __ LoadObject(RAX, Bool::True()); | 1392 __ LoadObject(RAX, Bool::True()); |
1393 __ ret(); | 1393 __ ret(); |
1394 return true; | 1394 return true; |
1395 } | 1395 } |
1396 | 1396 |
1397 #undef __ | 1397 #undef __ |
1398 | 1398 |
1399 } // namespace dart | 1399 } // namespace dart |
1400 | 1400 |
1401 #endif // defined TARGET_ARCH_X64 | 1401 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |