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

Side by Side Diff: runtime/vm/intrinsifier_mips.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_ia32.cc ('k') | runtime/vm/intrinsifier_x64.cc » ('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_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after
1652 // Set the length field using the saved length (T6). 1652 // Set the length field using the saved length (T6).
1653 __ StoreIntoObjectNoBarrier(V0, 1653 __ StoreIntoObjectNoBarrier(V0,
1654 FieldAddress(V0, String::length_offset()), 1654 FieldAddress(V0, String::length_offset()),
1655 T6); 1655 T6);
1656 // Clear hash. 1656 // Clear hash.
1657 __ b(ok); 1657 __ b(ok);
1658 __ delay_slot()->sw(ZR, FieldAddress(V0, String::hash_offset())); 1658 __ delay_slot()->sw(ZR, FieldAddress(V0, String::hash_offset()));
1659 } 1659 }
1660 1660
1661 1661
1662 // Arg0: Onebyte String 1662 // Arg0: OneByteString (receiver).
1663 // Arg1: Start index as Smi. 1663 // Arg1: Start index as Smi.
1664 // Arg2: End index as Smi. 1664 // Arg2: End index as Smi.
1665 // The indexes must be valid. 1665 // The indexes must be valid.
1666 void Intrinsifier::OneByteString_substringUnchecked(Assembler* assembler) { 1666 void Intrinsifier::OneByteString_substringUnchecked(Assembler* assembler) {
1667 const intptr_t kStringOffset = 2 * kWordSize; 1667 const intptr_t kStringOffset = 2 * kWordSize;
1668 const intptr_t kStartIndexOffset = 1 * kWordSize; 1668 const intptr_t kStartIndexOffset = 1 * kWordSize;
1669 const intptr_t kEndIndexOffset = 0 * kWordSize; 1669 const intptr_t kEndIndexOffset = 0 * kWordSize;
1670 Label fall_through, ok; 1670 Label fall_through, ok;
1671 1671
1672 __ lw(T2, Address(SP, kEndIndexOffset)); 1672 __ lw(T2, Address(SP, kEndIndexOffset));
1673 __ lw(TMP, Address(SP, kStartIndexOffset)); 1673 __ lw(TMP, Address(SP, kStartIndexOffset));
1674 __ or_(CMPRES, T2, TMP);
1675 __ andi(CMPRES, CMPRES, Immediate(kSmiTagMask));
1676 __ bne(CMPRES, ZR, &fall_through); // 'start', 'end' not Smi.
1677
1674 __ subu(T2, T2, TMP); 1678 __ subu(T2, T2, TMP);
1675 TryAllocateOnebyteString(assembler, &ok, &fall_through); 1679 TryAllocateOnebyteString(assembler, &ok, &fall_through);
1676 __ Bind(&ok); 1680 __ Bind(&ok);
1677 // V0: new string as tagged pointer. 1681 // V0: new string as tagged pointer.
1678 // Copy string. 1682 // Copy string.
1679 __ lw(T3, Address(SP, kStringOffset)); 1683 __ lw(T3, Address(SP, kStringOffset));
1680 __ lw(T1, Address(SP, kStartIndexOffset)); 1684 __ lw(T1, Address(SP, kStartIndexOffset));
1681 __ SmiUntag(T1); 1685 __ SmiUntag(T1);
1682 __ addu(T3, T3, T1); 1686 __ addu(T3, T3, T1);
1683 __ AddImmediate(T3, OneByteString::data_offset() - 1); 1687 __ AddImmediate(T3, OneByteString::data_offset() - 1);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1797 } 1801 }
1798 1802
1799 1803
1800 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { 1804 void Intrinsifier::TwoByteString_equality(Assembler* assembler) {
1801 StringEquality(assembler, kTwoByteStringCid); 1805 StringEquality(assembler, kTwoByteStringCid);
1802 } 1806 }
1803 1807
1804 } // namespace dart 1808 } // namespace dart
1805 1809
1806 #endif // defined TARGET_ARCH_MIPS 1810 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | runtime/vm/intrinsifier_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698