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

Side by Side Diff: runtime/vm/intrinsifier_ia32.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_arm.cc ('k') | runtime/vm/intrinsifier_mips.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 // 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 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 // Clear hash. 1661 // Clear hash.
1662 __ movl(FieldAddress(EAX, String::hash_offset()), Immediate(0)); 1662 __ movl(FieldAddress(EAX, String::hash_offset()), Immediate(0));
1663 __ jmp(ok, Assembler::kNearJump); 1663 __ jmp(ok, Assembler::kNearJump);
1664 1664
1665 __ Bind(&pop_and_fail); 1665 __ Bind(&pop_and_fail);
1666 __ popl(EDI); 1666 __ popl(EDI);
1667 __ jmp(failure); 1667 __ jmp(failure);
1668 } 1668 }
1669 1669
1670 1670
1671 // Arg0: Onebyte String 1671 // Arg0: OneByteString (receiver)
1672 // Arg1: Start index as Smi. 1672 // Arg1: Start index as Smi.
1673 // Arg2: End index as Smi. 1673 // Arg2: End index as Smi.
1674 // The indexes must be valid. 1674 // The indexes must be valid.
1675 void Intrinsifier::OneByteString_substringUnchecked(Assembler* assembler) { 1675 void Intrinsifier::OneByteString_substringUnchecked(Assembler* assembler) {
1676 const intptr_t kStringOffset = 3 * kWordSize; 1676 const intptr_t kStringOffset = 3 * kWordSize;
1677 const intptr_t kStartIndexOffset = 2 * kWordSize; 1677 const intptr_t kStartIndexOffset = 2 * kWordSize;
1678 const intptr_t kEndIndexOffset = 1 * kWordSize; 1678 const intptr_t kEndIndexOffset = 1 * kWordSize;
1679 Label fall_through, ok; 1679 Label fall_through, ok;
1680 __ movl(EAX, Address(ESP, + kStartIndexOffset));
1680 __ movl(EDI, Address(ESP, + kEndIndexOffset)); 1681 __ movl(EDI, Address(ESP, + kEndIndexOffset));
1682 __ orl(EAX, EDI);
1683 __ testl(EAX, Immediate(kSmiTagMask));
1684 __ j(NOT_ZERO, &fall_through); // 'start', 'end' not Smi.
1685
1681 __ subl(EDI, Address(ESP, + kStartIndexOffset)); 1686 __ subl(EDI, Address(ESP, + kStartIndexOffset));
1682 TryAllocateOnebyteString(assembler, &ok, &fall_through, EDI); 1687 TryAllocateOnebyteString(assembler, &ok, &fall_through, EDI);
1683 __ Bind(&ok); 1688 __ Bind(&ok);
1684 // EAX: new string as tagged pointer. 1689 // EAX: new string as tagged pointer.
1685 // Copy string. 1690 // Copy string.
1686 __ movl(EDI, Address(ESP, + kStringOffset)); 1691 __ movl(EDI, Address(ESP, + kStringOffset));
1687 __ movl(EBX, Address(ESP, + kStartIndexOffset)); 1692 __ movl(EBX, Address(ESP, + kStartIndexOffset));
1688 __ SmiUntag(EBX); 1693 __ SmiUntag(EBX);
1689 __ leal(EDI, FieldAddress(EDI, EBX, TIMES_1, OneByteString::data_offset())); 1694 __ leal(EDI, FieldAddress(EDI, EBX, TIMES_1, OneByteString::data_offset()));
1690 // EDI: Start address to copy from (untagged). 1695 // EDI: Start address to copy from (untagged).
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1799 1804
1800 1805
1801 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { 1806 void Intrinsifier::TwoByteString_equality(Assembler* assembler) {
1802 StringEquality(assembler, kTwoByteStringCid); 1807 StringEquality(assembler, kTwoByteStringCid);
1803 } 1808 }
1804 1809
1805 #undef __ 1810 #undef __
1806 } // namespace dart 1811 } // namespace dart
1807 1812
1808 #endif // defined TARGET_ARCH_IA32 1813 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_arm.cc ('k') | runtime/vm/intrinsifier_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698