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

Side by Side Diff: runtime/vm/intrinsifier_arm.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 | « no previous file | runtime/vm/intrinsifier_ia32.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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after
1568 // Clear hash. 1568 // Clear hash.
1569 __ LoadImmediate(TMP, 0); 1569 __ LoadImmediate(TMP, 0);
1570 __ str(TMP, FieldAddress(R0, String::hash_offset())); 1570 __ str(TMP, FieldAddress(R0, String::hash_offset()));
1571 __ b(ok); 1571 __ b(ok);
1572 1572
1573 __ Bind(&fail); 1573 __ Bind(&fail);
1574 __ b(failure); 1574 __ b(failure);
1575 } 1575 }
1576 1576
1577 1577
1578 // Arg0: Onebyte String 1578 // Arg0: OneByteString (receiver).
1579 // Arg1: Start index as Smi. 1579 // Arg1: Start index as Smi.
1580 // Arg2: End index as Smi. 1580 // Arg2: End index as Smi.
1581 // The indexes must be valid. 1581 // The indexes must be valid.
1582 void Intrinsifier::OneByteString_substringUnchecked(Assembler* assembler) { 1582 void Intrinsifier::OneByteString_substringUnchecked(Assembler* assembler) {
1583 const intptr_t kStringOffset = 2 * kWordSize; 1583 const intptr_t kStringOffset = 2 * kWordSize;
1584 const intptr_t kStartIndexOffset = 1 * kWordSize; 1584 const intptr_t kStartIndexOffset = 1 * kWordSize;
1585 const intptr_t kEndIndexOffset = 0 * kWordSize; 1585 const intptr_t kEndIndexOffset = 0 * kWordSize;
1586 Label fall_through, ok; 1586 Label fall_through, ok;
1587 1587
1588 __ ldr(R2, Address(SP, kEndIndexOffset)); 1588 __ ldr(R2, Address(SP, kEndIndexOffset));
1589 __ ldr(TMP, Address(SP, kStartIndexOffset)); 1589 __ ldr(TMP, Address(SP, kStartIndexOffset));
1590 __ orr(R3, R2, ShifterOperand(TMP));
1591 __ tst(R3, ShifterOperand(kSmiTagMask));
1592 __ b(&fall_through, NE); // 'start', 'end' not Smi.
1593
1590 __ sub(R2, R2, ShifterOperand(TMP)); 1594 __ sub(R2, R2, ShifterOperand(TMP));
1591 TryAllocateOnebyteString(assembler, &ok, &fall_through); 1595 TryAllocateOnebyteString(assembler, &ok, &fall_through);
1592 __ Bind(&ok); 1596 __ Bind(&ok);
1593 // R0: new string as tagged pointer. 1597 // R0: new string as tagged pointer.
1594 // Copy string. 1598 // Copy string.
1595 __ ldr(R3, Address(SP, kStringOffset)); 1599 __ ldr(R3, Address(SP, kStringOffset));
1596 __ ldr(R1, Address(SP, kStartIndexOffset)); 1600 __ ldr(R1, Address(SP, kStartIndexOffset));
1597 __ SmiUntag(R1); 1601 __ SmiUntag(R1);
1598 __ add(R3, R3, ShifterOperand(R1)); 1602 __ add(R3, R3, ShifterOperand(R1));
1599 // Calculate start address and untag (- 1). 1603 // Calculate start address and untag (- 1).
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 1729
1726 1730
1727 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { 1731 void Intrinsifier::TwoByteString_equality(Assembler* assembler) {
1728 StringEquality(assembler, kTwoByteStringCid); 1732 StringEquality(assembler, kTwoByteStringCid);
1729 } 1733 }
1730 1734
1731 1735
1732 } // namespace dart 1736 } // namespace dart
1733 1737
1734 #endif // defined TARGET_ARCH_ARM 1738 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intrinsifier_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698