Revision: 17574
Author: [email protected]
Date: Thu Nov 7 21:59:45 2013 UTC
Log: MIPS: Add new HSeqStringGetChar instruction.
Port r17565 (dce7927c)
Original commit message:
This instruction is required for copying characters from sequential
strings in the hydrogenized StringAddStub.
BUG=
[email protected]
Review URL: https://codereview.chromium.org/65483002
http://code.google.com/p/v8/source/detail?r=17574
Modified:
/branches/bleeding_edge/src/mips/lithium-codegen-mips.cc
/branches/bleeding_edge/src/mips/lithium-mips.cc
/branches/bleeding_edge/src/mips/lithium-mips.h
=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Wed Nov 6
23:52:37 2013 UTC
+++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Thu Nov 7
21:59:45 2013 UTC
@@ -1754,6 +1754,34 @@
}
return FieldMemOperand(scratch, SeqString::kHeaderSize);
}
+
+
+void LCodeGen::DoSeqStringGetChar(LSeqStringGetChar* instr) {
+ String::Encoding encoding = instr->hydrogen()->encoding();
+ Register string = ToRegister(instr->string());
+ Register result = ToRegister(instr->result());
+
+ if (FLAG_debug_code) {
+ Register scratch = scratch0();
+ __ lw(scratch, FieldMemOperand(string, HeapObject::kMapOffset));
+ __ lbu(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset));
+
+ __ And(scratch, scratch,
+ Operand(kStringRepresentationMask | kStringEncodingMask));
+ static const uint32_t one_byte_seq_type = kSeqStringTag |
kOneByteStringTag;
+ static const uint32_t two_byte_seq_type = kSeqStringTag |
kTwoByteStringTag;
+ __ Subu(at, scratch, Operand(encoding == String::ONE_BYTE_ENCODING
+ ? one_byte_seq_type : two_byte_seq_type));
+ __ Check(eq, kUnexpectedStringType, at, Operand(zero_reg));
+ }
+
+ MemOperand operand = BuildSeqStringOperand(string, instr->index(),
encoding);
+ if (encoding == String::ONE_BYTE_ENCODING) {
+ __ lbu(result, operand);
+ } else {
+ __ lhu(result, operand);
+ }
+}
void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.cc Wed Nov 6 23:52:37
2013 UTC
+++ /branches/bleeding_edge/src/mips/lithium-mips.cc Thu Nov 7 21:59:45
2013 UTC
@@ -1802,6 +1802,13 @@
new(zone()) LDateField(object, FixedTemp(a1), instr->index());
return MarkAsCall(DefineFixed(result, v0), instr,
CAN_DEOPTIMIZE_EAGERLY);
}
+
+
+LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) {
+ LOperand* string = UseRegisterAtStart(instr->string());
+ LOperand* index = UseRegisterOrConstantAtStart(instr->index());
+ return DefineAsRegister(new(zone()) LSeqStringGetChar(string, index));
+}
LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) {
=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.h Wed Nov 6 23:52:37
2013 UTC
+++ /branches/bleeding_edge/src/mips/lithium-mips.h Thu Nov 7 21:59:45
2013 UTC
@@ -155,6 +155,7 @@
V(Random) \
V(RegExpLiteral) \
V(Return) \
+ V(SeqStringGetChar) \
V(SeqStringSetChar) \
V(ShiftI) \
V(SmiTag) \
@@ -1340,6 +1341,21 @@
};
+class LSeqStringGetChar V8_FINAL : public LTemplateInstruction<1, 2, 0> {
+ public:
+ LSeqStringGetChar(LOperand* string, LOperand* index) {
+ inputs_[0] = string;
+ inputs_[1] = index;
+ }
+
+ LOperand* string() const { return inputs_[0]; }
+ LOperand* index() const { return inputs_[1]; }
+
+ DECLARE_CONCRETE_INSTRUCTION(SeqStringGetChar, "seq-string-get-char")
+ DECLARE_HYDROGEN_ACCESSOR(SeqStringGetChar)
+};
+
+
class LSeqStringSetChar V8_FINAL : public LTemplateInstruction<1, 3, 0> {
public:
LSeqStringSetChar(LOperand* string,
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.