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

Unified Diff: src/a64/lithium-codegen-a64.cc

Issue 141713009: A64: Port LSeqStringSetChar optimizations from r16707 and r17521. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: src/a64/lithium-codegen-a64.cc
diff --git a/src/a64/lithium-codegen-a64.cc b/src/a64/lithium-codegen-a64.cc
index 5b7a71b55311bfbd4712718514c8db82dcf9d58c..7c8830f5f0b46335ce0a47637ea12cd5a603e14a 100644
--- a/src/a64/lithium-codegen-a64.cc
+++ b/src/a64/lithium-codegen-a64.cc
@@ -4571,30 +4571,26 @@ void LCodeGen::DoSeqStringGetChar(LSeqStringGetChar* instr) {
void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
- // TODO(all): Port ARM optimizations from r16707.
-
String::Encoding encoding = instr->encoding();
Register string = ToRegister(instr->string());
- Register index = ToRegister(instr->index());
Register value = ToRegister(instr->value());
Register temp = ToRegister(instr->temp());
if (FLAG_debug_code) {
- if (encoding == String::ONE_BYTE_ENCODING) {
- __ EmitSeqStringSetCharCheck(
- string, index, kSeqStringTag | kOneByteStringTag);
- } else {
- ASSERT(encoding == String::TWO_BYTE_ENCODING);
- __ EmitSeqStringSetCharCheck(
- string, index, kSeqStringTag | kTwoByteStringTag);
- }
+ Register index = ToRegister(instr->index());
+ static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
+ static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
+ int encoding_mask =
+ instr->hydrogen()->encoding() == String::ONE_BYTE_ENCODING
+ ? one_byte_seq_type : two_byte_seq_type;
+ __ EmitSeqStringSetCharCheck(string, index, temp, encoding_mask);
}
-
- __ Add(temp, string, SeqString::kHeaderSize - kHeapObjectTag);
+ MemOperand operand =
+ BuildSeqStringOperand(string, temp, instr->index(), encoding);
if (encoding == String::ONE_BYTE_ENCODING) {
- __ Strb(value, MemOperand(temp, index));
+ __ Strb(value, operand);
} else {
- __ Strh(value, MemOperand(temp, index, LSL, 1));
+ __ Strh(value, operand);
}
}

Powered by Google App Engine
This is Rietveld 408576698