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

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

Issue 1961393002: VM: Optimized code for all of [External]{One|Two}ByteString::codeUnitAt. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: addressed comment Created 4 years, 7 months 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
« no previous file with comments | « runtime/vm/intrinsifier_arm64.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 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // String object. 1711 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // String object.
1712 __ movl(EAX, FieldAddress(EAX, String::hash_offset())); 1712 __ movl(EAX, FieldAddress(EAX, String::hash_offset()));
1713 __ cmpl(EAX, Immediate(0)); 1713 __ cmpl(EAX, Immediate(0));
1714 __ j(EQUAL, &fall_through, Assembler::kNearJump); 1714 __ j(EQUAL, &fall_through, Assembler::kNearJump);
1715 __ ret(); 1715 __ ret();
1716 __ Bind(&fall_through); 1716 __ Bind(&fall_through);
1717 // Hash not yet computed. 1717 // Hash not yet computed.
1718 } 1718 }
1719 1719
1720 1720
1721 void Intrinsifier::StringBaseCodeUnitAt(Assembler* assembler) {
1722 Label fall_through, try_two_byte_string;
1723 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index.
1724 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // String.
1725 __ testl(EBX, Immediate(kSmiTagMask));
1726 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index.
1727 // Range check.
1728 __ cmpl(EBX, FieldAddress(EAX, String::length_offset()));
1729 // Runtime throws exception.
1730 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump);
1731 __ CompareClassId(EAX, kOneByteStringCid, EDI);
1732 __ j(NOT_EQUAL, &try_two_byte_string, Assembler::kNearJump);
1733 __ SmiUntag(EBX);
1734 __ movzxb(EAX, FieldAddress(EAX, EBX, TIMES_1, OneByteString::data_offset()));
1735 __ SmiTag(EAX);
1736 __ ret();
1737
1738 __ Bind(&try_two_byte_string);
1739 __ CompareClassId(EAX, kTwoByteStringCid, EDI);
1740 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump);
1741 ASSERT(kSmiTagShift == 1);
1742 __ movzxw(EAX, FieldAddress(EAX, EBX, TIMES_1, TwoByteString::data_offset()));
1743 __ SmiTag(EAX);
1744 __ ret();
1745
1746 __ Bind(&fall_through);
1747 }
1748
1749
1750 // bool _substringMatches(int start, String other) 1721 // bool _substringMatches(int start, String other)
1751 void Intrinsifier::StringBaseSubstringMatches(Assembler* assembler) { 1722 void Intrinsifier::StringBaseSubstringMatches(Assembler* assembler) {
1752 // For precompilation, not implemented on IA32. 1723 // For precompilation, not implemented on IA32.
1753 } 1724 }
1754 1725
1755 1726
1756 void Intrinsifier::StringBaseCharAt(Assembler* assembler) { 1727 void Intrinsifier::StringBaseCharAt(Assembler* assembler) {
1757 Label fall_through, try_two_byte_string; 1728 Label fall_through, try_two_byte_string;
1758 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index. 1729 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index.
1759 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // String. 1730 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // String.
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
2157 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { 2128 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) {
2158 __ LoadIsolate(EAX); 2129 __ LoadIsolate(EAX);
2159 __ movl(EAX, Address(EAX, Isolate::current_tag_offset())); 2130 __ movl(EAX, Address(EAX, Isolate::current_tag_offset()));
2160 __ ret(); 2131 __ ret();
2161 } 2132 }
2162 2133
2163 #undef __ 2134 #undef __
2164 } // namespace dart 2135 } // namespace dart
2165 2136
2166 #endif // defined TARGET_ARCH_IA32 2137 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_arm64.cc ('k') | runtime/vm/intrinsifier_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698