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 // The intrinsic code below is executed before a method has built its frame. | 5 // The intrinsic code below is executed before a method has built its frame. |
6 // The return address is on the stack and the arguments below it. | 6 // The return address is on the stack and the arguments below it. |
7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. | 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. |
8 // Each intrinsification method returns true if the corresponding | 8 // Each intrinsification method returns true if the corresponding |
9 // Dart method was intrinsified. | 9 // Dart method was intrinsified. |
10 | 10 |
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 | 1428 |
1429 bool Intrinsifier::String_getLength(Assembler* assembler) { | 1429 bool Intrinsifier::String_getLength(Assembler* assembler) { |
1430 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // String object. | 1430 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // String object. |
1431 __ movl(EAX, FieldAddress(EAX, String::length_offset())); | 1431 __ movl(EAX, FieldAddress(EAX, String::length_offset())); |
1432 __ ret(); | 1432 __ ret(); |
1433 return true; | 1433 return true; |
1434 } | 1434 } |
1435 | 1435 |
1436 | 1436 |
1437 // TODO(srdjan): Implement for two and four byte strings as well. | 1437 // TODO(srdjan): Implement for two and four byte strings as well. |
1438 bool Intrinsifier::String_charCodeAt(Assembler* assembler) { | 1438 bool Intrinsifier::String_codeUnitAt(Assembler* assembler) { |
1439 Label fall_through; | 1439 Label fall_through; |
1440 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index. | 1440 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index. |
1441 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // String. | 1441 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // String. |
1442 __ testl(EBX, Immediate(kSmiTagMask)); | 1442 __ testl(EBX, Immediate(kSmiTagMask)); |
1443 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. | 1443 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. |
1444 // Range check. | 1444 // Range check. |
1445 __ cmpl(EBX, FieldAddress(EAX, String::length_offset())); | 1445 __ cmpl(EBX, FieldAddress(EAX, String::length_offset())); |
1446 // Runtime throws exception. | 1446 // Runtime throws exception. |
1447 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); | 1447 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); |
1448 __ CompareClassId(EAX, kOneByteStringCid, EDI); | 1448 __ CompareClassId(EAX, kOneByteStringCid, EDI); |
(...skipping 19 matching lines...) Expand all Loading... |
1468 __ Bind(&is_true); | 1468 __ Bind(&is_true); |
1469 __ LoadObject(EAX, Bool::True()); | 1469 __ LoadObject(EAX, Bool::True()); |
1470 __ ret(); | 1470 __ ret(); |
1471 return true; | 1471 return true; |
1472 } | 1472 } |
1473 | 1473 |
1474 #undef __ | 1474 #undef __ |
1475 } // namespace dart | 1475 } // namespace dart |
1476 | 1476 |
1477 #endif // defined TARGET_ARCH_IA32 | 1477 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |