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

Side by Side Diff: runtime/vm/intermediate_language_arm.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.h ('k') | runtime/vm/intermediate_language_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/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 738 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
739 Register char_code = locs()->in(0).reg(); 739 Register char_code = locs()->in(0).reg();
740 Register result = locs()->out().reg(); 740 Register result = locs()->out().reg();
741 __ LoadImmediate(result, 741 __ LoadImmediate(result,
742 reinterpret_cast<uword>(Symbols::PredefinedAddress())); 742 reinterpret_cast<uword>(Symbols::PredefinedAddress()));
743 __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize); 743 __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize);
744 __ ldr(result, Address(result, char_code, LSL, 1)); // Char code is a smi. 744 __ ldr(result, Address(result, char_code, LSL, 1)); // Char code is a smi.
745 } 745 }
746 746
747 747
748 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(bool opt) const {
749 const intptr_t kNumInputs = 1;
750 return LocationSummary::Make(kNumInputs,
751 Location::RequiresRegister(),
752 LocationSummary::kNoCall);
753 }
754
755
756 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
757 ASSERT(cid_ == kOneByteStringCid);
758 Register str = locs()->in(0).reg();
759 Register result = locs()->out().reg();
760 __ ldr(result, FieldAddress(str, String::length_offset()));
761 __ cmp(result, ShifterOperand(Smi::RawValue(1)));
762 __ LoadImmediate(result, Smi::RawValue(-1), NE);
763 __ ldrb(result, FieldAddress(str, OneByteString::data_offset()), EQ);
764 __ SmiTag(result);
765 }
766
767
748 LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const { 768 LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const {
749 const intptr_t kNumInputs = 1; 769 const intptr_t kNumInputs = 1;
750 const intptr_t kNumTemps = 0; 770 const intptr_t kNumTemps = 0;
751 LocationSummary* summary = 771 LocationSummary* summary =
752 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 772 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
753 summary->set_in(0, Location::RegisterLocation(R0)); 773 summary->set_in(0, Location::RegisterLocation(R0));
754 summary->set_out(Location::RegisterLocation(R0)); 774 summary->set_out(Location::RegisterLocation(R0));
755 return summary; 775 return summary;
756 } 776 }
757 777
(...skipping 4068 matching lines...) Expand 10 before | Expand all | Expand 10 after
4826 compiler->GenerateCall(token_pos(), 4846 compiler->GenerateCall(token_pos(),
4827 &label, 4847 &label,
4828 PcDescriptors::kOther, 4848 PcDescriptors::kOther,
4829 locs()); 4849 locs());
4830 __ Drop(2); // Discard type arguments and receiver. 4850 __ Drop(2); // Discard type arguments and receiver.
4831 } 4851 }
4832 4852
4833 } // namespace dart 4853 } // namespace dart
4834 4854
4835 #endif // defined TARGET_ARCH_ARM 4855 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698