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

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

Issue 54463004: Fix issue 14659: intrinsic method must check if the start, end arguments are Smi. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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/intrinsifier_mips.cc ('k') | tests/language/substring_test.dart » ('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_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 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 // Clear hash. 1572 // Clear hash.
1573 __ movq(FieldAddress(RAX, String::hash_offset()), Immediate(0)); 1573 __ movq(FieldAddress(RAX, String::hash_offset()), Immediate(0));
1574 __ jmp(ok, Assembler::kNearJump); 1574 __ jmp(ok, Assembler::kNearJump);
1575 1575
1576 __ Bind(&pop_and_fail); 1576 __ Bind(&pop_and_fail);
1577 __ popq(RDI); 1577 __ popq(RDI);
1578 __ jmp(failure); 1578 __ jmp(failure);
1579 } 1579 }
1580 1580
1581 1581
1582 // Arg0: Onebyte String 1582 // Arg0: OneByteString (receiver).
1583 // Arg1: Start index as Smi. 1583 // Arg1: Start index as Smi.
1584 // Arg2: End index as Smi. 1584 // Arg2: End index as Smi.
1585 // The indexes must be valid. 1585 // The indexes must be valid.
1586 void Intrinsifier::OneByteString_substringUnchecked(Assembler* assembler) { 1586 void Intrinsifier::OneByteString_substringUnchecked(Assembler* assembler) {
1587 const intptr_t kStringOffset = 3 * kWordSize; 1587 const intptr_t kStringOffset = 3 * kWordSize;
1588 const intptr_t kStartIndexOffset = 2 * kWordSize; 1588 const intptr_t kStartIndexOffset = 2 * kWordSize;
1589 const intptr_t kEndIndexOffset = 1 * kWordSize; 1589 const intptr_t kEndIndexOffset = 1 * kWordSize;
1590 Label fall_through, ok; 1590 Label fall_through, ok;
1591 __ movq(RSI, Address(RSP, + kEndIndexOffset));
1591 __ movq(RDI, Address(RSP, + kEndIndexOffset)); 1592 __ movq(RDI, Address(RSP, + kEndIndexOffset));
1593 __ orq(RSI, RDI);
1594 __ testq(RSI, Immediate(kSmiTagMask));
1595 __ j(NOT_ZERO, &fall_through); // 'start', 'end' not Smi.
1596
1592 __ subq(RDI, Address(RSP, + kStartIndexOffset)); 1597 __ subq(RDI, Address(RSP, + kStartIndexOffset));
1593 TryAllocateOnebyteString(assembler, &ok, &fall_through, RDI); 1598 TryAllocateOnebyteString(assembler, &ok, &fall_through, RDI);
1594 __ Bind(&ok); 1599 __ Bind(&ok);
1595 // RAX: new string as tagged pointer. 1600 // RAX: new string as tagged pointer.
1596 // Copy string. 1601 // Copy string.
1597 __ movq(RSI, Address(RSP, + kStringOffset)); 1602 __ movq(RSI, Address(RSP, + kStringOffset));
1598 __ movq(RBX, Address(RSP, + kStartIndexOffset)); 1603 __ movq(RBX, Address(RSP, + kStartIndexOffset));
1599 __ SmiUntag(RBX); 1604 __ SmiUntag(RBX);
1600 __ leaq(RSI, FieldAddress(RSI, RBX, TIMES_1, OneByteString::data_offset())); 1605 __ leaq(RSI, FieldAddress(RSI, RBX, TIMES_1, OneByteString::data_offset()));
1601 // RSI: Start address to copy from (untagged). 1606 // RSI: Start address to copy from (untagged).
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 1716
1712 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { 1717 void Intrinsifier::TwoByteString_equality(Assembler* assembler) {
1713 StringEquality(assembler, kTwoByteStringCid); 1718 StringEquality(assembler, kTwoByteStringCid);
1714 } 1719 }
1715 1720
1716 #undef __ 1721 #undef __
1717 1722
1718 } // namespace dart 1723 } // namespace dart
1719 1724
1720 #endif // defined TARGET_ARCH_X64 1725 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_mips.cc ('k') | tests/language/substring_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698