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

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
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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 __ LoadImmediate(R5, entry); 713 __ LoadImmediate(R5, entry);
714 __ LoadImmediate(R1, NativeArguments::ComputeArgcTag(function())); 714 __ LoadImmediate(R1, NativeArguments::ComputeArgcTag(function()));
715 compiler->GenerateCall(token_pos(), 715 compiler->GenerateCall(token_pos(),
716 stub_entry, 716 stub_entry,
717 PcDescriptors::kOther, 717 PcDescriptors::kOther,
718 locs()); 718 locs());
719 __ Pop(result); 719 __ Pop(result);
720 } 720 }
721 721
722 722
723 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(bool opt) const { 723 LocationSummary* StringCharCodeInstr::MakeLocationSummary(bool opt) const {
724 const intptr_t kNumInputs = 1; 724 const intptr_t kNumInputs = 1;
725 // TODO(fschneider): Allow immediate operands for the char code. 725 // TODO(fschneider): Allow immediate operands for the char code.
726 return LocationSummary::Make(kNumInputs, 726 return LocationSummary::Make(kNumInputs,
727 Location::RequiresRegister(), 727 Location::RequiresRegister(),
728 LocationSummary::kNoCall); 728 LocationSummary::kNoCall);
729 } 729 }
730 730
731 731
732 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 732 void StringCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
733 Register char_code = locs()->in(0).reg(); 733 if (kind() == StringCharCodeInstr::kFromCharCode) {
734 Register result = locs()->out().reg(); 734 Register char_code = locs()->in(0).reg();
735 __ LoadImmediate(result, 735 Register result = locs()->out().reg();
736 reinterpret_cast<uword>(Symbols::PredefinedAddress())); 736 __ LoadImmediate(result,
737 __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize); 737 reinterpret_cast<uword>(Symbols::PredefinedAddress()));
738 __ ldr(result, Address(result, char_code, LSL, 1)); // Char code is a smi. 738 __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize);
739 __ ldr(result, Address(result, char_code, LSL, 1)); // Char code is a smi.
740 } else {
741 ASSERT(kind() == StringCharCodeInstr::kToCharCode);
742 ASSERT(cid_ == kOneByteStringCid);
743 Register str = locs()->in(0).reg();
744 Register result = locs()->out().reg();
745 __ ldr(result, FieldAddress(str, String::length_offset()));
746 __ cmp(result, ShifterOperand(Smi::RawValue(1)));
747 __ LoadImmediate(result, Smi::RawValue(-1), NE);
748 __ ldrb(result, FieldAddress(str, OneByteString::data_offset()), EQ);
749 __ SmiTag(result);
750 }
739 } 751 }
740 752
741 753
742 LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const { 754 LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const {
743 const intptr_t kNumInputs = 1; 755 const intptr_t kNumInputs = 1;
744 const intptr_t kNumTemps = 0; 756 const intptr_t kNumTemps = 0;
745 LocationSummary* summary = 757 LocationSummary* summary =
746 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 758 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
747 summary->set_in(0, Location::RegisterLocation(R0)); 759 summary->set_in(0, Location::RegisterLocation(R0));
748 summary->set_out(Location::RegisterLocation(R0)); 760 summary->set_out(Location::RegisterLocation(R0));
(...skipping 4071 matching lines...) Expand 10 before | Expand all | Expand 10 after
4820 compiler->GenerateCall(token_pos(), 4832 compiler->GenerateCall(token_pos(),
4821 &label, 4833 &label,
4822 PcDescriptors::kOther, 4834 PcDescriptors::kOther,
4823 locs()); 4835 locs());
4824 __ Drop(2); // Discard type arguments and receiver. 4836 __ Drop(2); // Discard type arguments and receiver.
4825 } 4837 }
4826 4838
4827 } // namespace dart 4839 } // namespace dart
4828 4840
4829 #endif // defined TARGET_ARCH_ARM 4841 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698