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

Unified Diff: src/arm/codegen-arm.cc

Issue 11348349: Improve array to string conversion. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/arm/full-codegen-arm.cc » ('j') | src/ia32/codegen-ia32.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/codegen-arm.cc
diff --git a/src/arm/codegen-arm.cc b/src/arm/codegen-arm.cc
index af2f21623160a9aa192c142115547dd1e8d45c0b..81e23e334b42a5777d71db010a3deb1621b670ef 100644
--- a/src/arm/codegen-arm.cc
+++ b/src/arm/codegen-arm.cc
@@ -521,6 +521,48 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm,
}
+void SeqStringSetCharGenerator::Generate(MacroAssembler* masm,
+ bool one_byte_string,
+ Register string,
+ Register index,
+ Register value) {
+ if (FLAG_debug_code) {
+ __ tst(index, Operand(kSmiTagMask));
+ __ Check(eq, "Non-smi index");
+ __ tst(value, Operand(kSmiTagMask));
+ __ Check(eq, "Non-smi value");
+
+ __ ldr(ip, FieldMemOperand(string, String::kLengthOffset));
+ __ cmp(index, ip);
+ __ Check(lt, "Index is too large");
+
+ __ cmp(index, Operand(Smi::FromInt(0)));
+ __ Check(ge, "Index is negative");
+
+ __ ldr(ip, FieldMemOperand(string, HeapObject::kMapOffset));
+ __ ldrb(ip, FieldMemOperand(ip, Map::kInstanceTypeOffset));
+
+ __ and_(ip, ip, Operand(kStringRepresentationMask | kStringEncodingMask));
+ static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
+ static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
+ __ cmp(ip, Operand(one_byte_string ? one_byte_seq_type
+ : two_byte_seq_type));
+ __ Check(eq, "Unexpected string type");
+ }
+
+ __ add(ip,
+ string,
+ Operand(SeqString::kHeaderSize - kHeapObjectTag));
+ STATIC_ASSERT(kSmiTagSize == 1);
+ __ SmiUntag(value, value);
+ if (one_byte_string) {
+ __ strb(value, MemOperand(ip, index, LSR, 1));
+ } else {
+ __ strh(value, MemOperand(ip, index));
Toon Verwaest 2012/12/05 14:29:12 Please add a comment here as well to indicate that
+ }
+}
+
+
static MemOperand ExpConstant(int index, Register base) {
return MemOperand(base, index * kDoubleSize);
}
« no previous file with comments | « no previous file | src/arm/full-codegen-arm.cc » ('j') | src/ia32/codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698