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

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

Issue 105143011: Optimize one byte string comparisons. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_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 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 Register result = locs()->out().reg(); 735 Register result = locs()->out().reg();
736 __ movl(result, 736 __ movl(result,
737 Immediate(reinterpret_cast<uword>(Symbols::PredefinedAddress()))); 737 Immediate(reinterpret_cast<uword>(Symbols::PredefinedAddress())));
738 __ movl(result, Address(result, 738 __ movl(result, Address(result,
739 char_code, 739 char_code,
740 TIMES_HALF_WORD_SIZE, // Char code is a smi. 740 TIMES_HALF_WORD_SIZE, // Char code is a smi.
741 Symbols::kNullCharCodeSymbolOffset * kWordSize)); 741 Symbols::kNullCharCodeSymbolOffset * kWordSize));
742 } 742 }
743 743
744 744
745 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(bool opt) const {
746 const intptr_t kNumInputs = 1;
747 return LocationSummary::Make(kNumInputs,
748 Location::RequiresRegister(),
749 LocationSummary::kNoCall);
750 }
751
752
753 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
754 ASSERT(cid_ == kOneByteStringCid);
755 Register str = locs()->in(0).reg();
756 Register result = locs()->out().reg();
757 Label is_one, done;
758 __ movl(result, FieldAddress(str, String::length_offset()));
759 __ cmpl(result, Immediate(Smi::RawValue(1)));
760 __ j(EQUAL, &is_one, Assembler::kNearJump);
761 __ movl(result, Immediate(Smi::RawValue(-1)));
762 __ jmp(&done);
763 __ Bind(&is_one);
764 __ movzxb(result, FieldAddress(str, OneByteString::data_offset()));
765 __ SmiTag(result);
766 __ Bind(&done);
767 }
768
769
745 LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const { 770 LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const {
746 const intptr_t kNumInputs = 1; 771 const intptr_t kNumInputs = 1;
747 const intptr_t kNumTemps = 0; 772 const intptr_t kNumTemps = 0;
748 LocationSummary* summary = 773 LocationSummary* summary =
749 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 774 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
750 summary->set_in(0, Location::RegisterLocation(EAX)); 775 summary->set_in(0, Location::RegisterLocation(EAX));
751 summary->set_out(Location::RegisterLocation(EAX)); 776 summary->set_out(Location::RegisterLocation(EAX));
752 return summary; 777 return summary;
753 } 778 }
754 779
(...skipping 4447 matching lines...) Expand 10 before | Expand all | Expand 10 after
5202 PcDescriptors::kOther, 5227 PcDescriptors::kOther,
5203 locs()); 5228 locs());
5204 __ Drop(2); // Discard type arguments and receiver. 5229 __ Drop(2); // Discard type arguments and receiver.
5205 } 5230 }
5206 5231
5207 } // namespace dart 5232 } // namespace dart
5208 5233
5209 #undef __ 5234 #undef __
5210 5235
5211 #endif // defined TARGET_ARCH_IA32 5236 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698