Revert "Add new HSeqStringGetChar instruction."
This reverts commit r17562 for invalid usage of movw to load string characters. Will reland with fix. TBR=svenpanne@chromium.org Review URL: https://codereview.chromium.org/64333002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17563 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
e2c8e45402
commit
cc5c9e9ae8
@ -1884,13 +1884,6 @@ LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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) {
|
LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) {
|
||||||
LOperand* string = UseRegister(instr->string());
|
LOperand* string = UseRegister(instr->string());
|
||||||
LOperand* index = UseRegisterOrConstant(instr->index());
|
LOperand* index = UseRegisterOrConstant(instr->index());
|
||||||
|
@ -156,7 +156,6 @@ class LCodeGen;
|
|||||||
V(Random) \
|
V(Random) \
|
||||||
V(RegExpLiteral) \
|
V(RegExpLiteral) \
|
||||||
V(Return) \
|
V(Return) \
|
||||||
V(SeqStringGetChar) \
|
|
||||||
V(SeqStringSetChar) \
|
V(SeqStringSetChar) \
|
||||||
V(ShiftI) \
|
V(ShiftI) \
|
||||||
V(SmiTag) \
|
V(SmiTag) \
|
||||||
@ -1361,21 +1360,6 @@ class LDateField V8_FINAL : public LTemplateInstruction<1, 1, 1> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
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> {
|
class LSeqStringSetChar V8_FINAL : public LTemplateInstruction<1, 3, 0> {
|
||||||
public:
|
public:
|
||||||
LSeqStringSetChar(LOperand* string,
|
LSeqStringSetChar(LOperand* string,
|
||||||
|
@ -1948,34 +1948,6 @@ MemOperand LCodeGen::BuildSeqStringOperand(Register string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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();
|
|
||||||
__ ldr(scratch, FieldMemOperand(string, HeapObject::kMapOffset));
|
|
||||||
__ ldrb(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;
|
|
||||||
__ cmp(scratch, Operand(encoding == String::ONE_BYTE_ENCODING
|
|
||||||
? one_byte_seq_type : two_byte_seq_type));
|
|
||||||
__ Check(eq, kUnexpectedStringType);
|
|
||||||
}
|
|
||||||
|
|
||||||
MemOperand operand = BuildSeqStringOperand(string, instr->index(), encoding);
|
|
||||||
if (encoding == String::ONE_BYTE_ENCODING) {
|
|
||||||
__ ldrb(result, operand);
|
|
||||||
} else {
|
|
||||||
__ ldrh(result, operand);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
|
void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
|
||||||
String::Encoding encoding = instr->hydrogen()->encoding();
|
String::Encoding encoding = instr->hydrogen()->encoding();
|
||||||
Register string = ToRegister(instr->string());
|
Register string = ToRegister(instr->string());
|
||||||
|
@ -3991,26 +3991,6 @@ HInstruction* HShr::New(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HInstruction* HSeqStringGetChar::New(Zone* zone,
|
|
||||||
HValue* context,
|
|
||||||
String::Encoding encoding,
|
|
||||||
HValue* string,
|
|
||||||
HValue* index) {
|
|
||||||
if (FLAG_fold_constants && string->IsConstant() && index->IsConstant()) {
|
|
||||||
HConstant* c_string = HConstant::cast(string);
|
|
||||||
HConstant* c_index = HConstant::cast(index);
|
|
||||||
if (c_string->HasStringValue() && c_index->HasInteger32Value()) {
|
|
||||||
Handle<String> s = c_string->StringValue();
|
|
||||||
int32_t i = c_index->Integer32Value();
|
|
||||||
ASSERT_LE(0, i);
|
|
||||||
ASSERT_LT(i, s->length());
|
|
||||||
return H_CONSTANT_INT(s->Get(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new(zone) HSeqStringGetChar(encoding, string, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#undef H_CONSTANT_INT
|
#undef H_CONSTANT_INT
|
||||||
#undef H_CONSTANT_DOUBLE
|
#undef H_CONSTANT_DOUBLE
|
||||||
|
|
||||||
|
@ -159,7 +159,6 @@ class LChunkBuilder;
|
|||||||
V(Return) \
|
V(Return) \
|
||||||
V(Ror) \
|
V(Ror) \
|
||||||
V(Sar) \
|
V(Sar) \
|
||||||
V(SeqStringGetChar) \
|
|
||||||
V(SeqStringSetChar) \
|
V(SeqStringSetChar) \
|
||||||
V(Shl) \
|
V(Shl) \
|
||||||
V(Shr) \
|
V(Shr) \
|
||||||
@ -7024,56 +7023,6 @@ class HDateField V8_FINAL : public HUnaryOperation {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class HSeqStringGetChar V8_FINAL : public HTemplateInstruction<2> {
|
|
||||||
public:
|
|
||||||
static HInstruction* New(Zone* zone,
|
|
||||||
HValue* context,
|
|
||||||
String::Encoding encoding,
|
|
||||||
HValue* string,
|
|
||||||
HValue* index);
|
|
||||||
|
|
||||||
virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
|
|
||||||
return (index == 0) ? Representation::Tagged()
|
|
||||||
: Representation::Integer32();
|
|
||||||
}
|
|
||||||
|
|
||||||
String::Encoding encoding() const { return encoding_; }
|
|
||||||
HValue* string() const { return OperandAt(0); }
|
|
||||||
HValue* index() const { return OperandAt(1); }
|
|
||||||
|
|
||||||
DECLARE_CONCRETE_INSTRUCTION(SeqStringGetChar)
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual bool DataEquals(HValue* other) V8_OVERRIDE {
|
|
||||||
return encoding() == HSeqStringGetChar::cast(other)->encoding();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual Range* InferRange(Zone* zone) V8_OVERRIDE {
|
|
||||||
if (encoding() == String::ONE_BYTE_ENCODING) {
|
|
||||||
return new(zone) Range(0, String::kMaxOneByteCharCode);
|
|
||||||
} else {
|
|
||||||
ASSERT_EQ(String::TWO_BYTE_ENCODING, encoding());
|
|
||||||
return new(zone) Range(0, String::kMaxUtf16CodeUnit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
HSeqStringGetChar(String::Encoding encoding,
|
|
||||||
HValue* string,
|
|
||||||
HValue* index) : encoding_(encoding) {
|
|
||||||
SetOperandAt(0, string);
|
|
||||||
SetOperandAt(1, index);
|
|
||||||
set_representation(Representation::Integer32());
|
|
||||||
SetFlag(kUseGVN);
|
|
||||||
SetGVNFlag(kDependsOnStringChars);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool IsDeletable() const V8_OVERRIDE { return true; }
|
|
||||||
|
|
||||||
String::Encoding encoding_;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<3> {
|
class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<3> {
|
||||||
public:
|
public:
|
||||||
DECLARE_INSTRUCTION_FACTORY_P4(HSeqStringSetChar, String::Encoding,
|
DECLARE_INSTRUCTION_FACTORY_P4(HSeqStringSetChar, String::Encoding,
|
||||||
|
@ -2078,34 +2078,6 @@ Operand LCodeGen::BuildSeqStringOperand(Register string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoSeqStringGetChar(LSeqStringGetChar* instr) {
|
|
||||||
String::Encoding encoding = instr->hydrogen()->encoding();
|
|
||||||
Register result = ToRegister(instr->result());
|
|
||||||
Register string = ToRegister(instr->string());
|
|
||||||
|
|
||||||
if (FLAG_debug_code) {
|
|
||||||
__ push(string);
|
|
||||||
__ mov(string, FieldOperand(string, HeapObject::kMapOffset));
|
|
||||||
__ movzx_b(string, FieldOperand(string, Map::kInstanceTypeOffset));
|
|
||||||
|
|
||||||
__ and_(string, Immediate(kStringRepresentationMask | kStringEncodingMask));
|
|
||||||
static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
|
|
||||||
static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
|
|
||||||
__ cmp(string, Immediate(encoding == String::ONE_BYTE_ENCODING
|
|
||||||
? one_byte_seq_type : two_byte_seq_type));
|
|
||||||
__ Check(equal, kUnexpectedStringType);
|
|
||||||
__ pop(string);
|
|
||||||
}
|
|
||||||
|
|
||||||
Operand operand = BuildSeqStringOperand(string, instr->index(), encoding);
|
|
||||||
if (encoding == String::ONE_BYTE_ENCODING) {
|
|
||||||
__ movzx_b(result, operand);
|
|
||||||
} else {
|
|
||||||
__ mov_w(result, operand);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
|
void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
|
||||||
String::Encoding encoding = instr->hydrogen()->encoding();
|
String::Encoding encoding = instr->hydrogen()->encoding();
|
||||||
Register string = ToRegister(instr->string());
|
Register string = ToRegister(instr->string());
|
||||||
|
@ -1873,13 +1873,6 @@ LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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) {
|
LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) {
|
||||||
LOperand* string = UseRegisterAtStart(instr->string());
|
LOperand* string = UseRegisterAtStart(instr->string());
|
||||||
LOperand* index = UseRegisterOrConstantAtStart(instr->index());
|
LOperand* index = UseRegisterOrConstantAtStart(instr->index());
|
||||||
|
@ -156,7 +156,6 @@ class LCodeGen;
|
|||||||
V(PushArgument) \
|
V(PushArgument) \
|
||||||
V(RegExpLiteral) \
|
V(RegExpLiteral) \
|
||||||
V(Return) \
|
V(Return) \
|
||||||
V(SeqStringGetChar) \
|
|
||||||
V(SeqStringSetChar) \
|
V(SeqStringSetChar) \
|
||||||
V(ShiftI) \
|
V(ShiftI) \
|
||||||
V(SmiTag) \
|
V(SmiTag) \
|
||||||
@ -1338,21 +1337,6 @@ class LDateField V8_FINAL : public LTemplateInstruction<1, 1, 1> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
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> {
|
class LSeqStringSetChar V8_FINAL : public LTemplateInstruction<1, 3, 0> {
|
||||||
public:
|
public:
|
||||||
LSeqStringSetChar(LOperand* string,
|
LSeqStringSetChar(LOperand* string,
|
||||||
|
@ -1366,15 +1366,6 @@ void Assembler::movb(const Operand& dst, Immediate imm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Assembler::movw(Register dst, const Operand& src) {
|
|
||||||
EnsureSpace ensure_space(this);
|
|
||||||
emit(0x66);
|
|
||||||
emit_optional_rex_32(dst, src);
|
|
||||||
emit(0x8B);
|
|
||||||
emit_operand(dst, src);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Assembler::movw(const Operand& dst, Register src) {
|
void Assembler::movw(const Operand& dst, Register src) {
|
||||||
EnsureSpace ensure_space(this);
|
EnsureSpace ensure_space(this);
|
||||||
emit(0x66);
|
emit(0x66);
|
||||||
|
@ -698,7 +698,6 @@ class Assembler : public AssemblerBase {
|
|||||||
|
|
||||||
// Move the low 16 bits of a 64-bit register value to a 16-bit
|
// Move the low 16 bits of a 64-bit register value to a 16-bit
|
||||||
// memory location.
|
// memory location.
|
||||||
void movw(Register dst, const Operand& src);
|
|
||||||
void movw(const Operand& dst, Register src);
|
void movw(const Operand& dst, Register src);
|
||||||
void movw(const Operand& dst, Immediate imm);
|
void movw(const Operand& dst, Immediate imm);
|
||||||
|
|
||||||
|
@ -1650,34 +1650,6 @@ Operand LCodeGen::BuildSeqStringOperand(Register string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoSeqStringGetChar(LSeqStringGetChar* instr) {
|
|
||||||
String::Encoding encoding = instr->hydrogen()->encoding();
|
|
||||||
Register result = ToRegister(instr->result());
|
|
||||||
Register string = ToRegister(instr->string());
|
|
||||||
|
|
||||||
if (FLAG_debug_code) {
|
|
||||||
__ push(string);
|
|
||||||
__ movq(string, FieldOperand(string, HeapObject::kMapOffset));
|
|
||||||
__ movzxbq(string, FieldOperand(string, Map::kInstanceTypeOffset));
|
|
||||||
|
|
||||||
__ andb(string, Immediate(kStringRepresentationMask | kStringEncodingMask));
|
|
||||||
static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
|
|
||||||
static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
|
|
||||||
__ cmpq(string, Immediate(encoding == String::ONE_BYTE_ENCODING
|
|
||||||
? one_byte_seq_type : two_byte_seq_type));
|
|
||||||
__ Check(equal, kUnexpectedStringType);
|
|
||||||
__ pop(string);
|
|
||||||
}
|
|
||||||
|
|
||||||
Operand operand = BuildSeqStringOperand(string, instr->index(), encoding);
|
|
||||||
if (encoding == String::ONE_BYTE_ENCODING) {
|
|
||||||
__ movzxbl(result, operand);
|
|
||||||
} else {
|
|
||||||
__ movw(result, operand);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
|
void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
|
||||||
String::Encoding encoding = instr->hydrogen()->encoding();
|
String::Encoding encoding = instr->hydrogen()->encoding();
|
||||||
Register string = ToRegister(instr->string());
|
Register string = ToRegister(instr->string());
|
||||||
|
@ -1756,13 +1756,6 @@ LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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) {
|
LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) {
|
||||||
LOperand* string = UseRegisterAtStart(instr->string());
|
LOperand* string = UseRegisterAtStart(instr->string());
|
||||||
LOperand* index = UseRegisterOrConstantAtStart(instr->index());
|
LOperand* index = UseRegisterOrConstantAtStart(instr->index());
|
||||||
|
@ -154,7 +154,6 @@ class LCodeGen;
|
|||||||
V(Random) \
|
V(Random) \
|
||||||
V(RegExpLiteral) \
|
V(RegExpLiteral) \
|
||||||
V(Return) \
|
V(Return) \
|
||||||
V(SeqStringGetChar) \
|
|
||||||
V(SeqStringSetChar) \
|
V(SeqStringSetChar) \
|
||||||
V(ShiftI) \
|
V(ShiftI) \
|
||||||
V(SmiTag) \
|
V(SmiTag) \
|
||||||
@ -1282,21 +1281,6 @@ class LDateField V8_FINAL : public LTemplateInstruction<1, 1, 0> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
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> {
|
class LSeqStringSetChar V8_FINAL : public LTemplateInstruction<1, 3, 0> {
|
||||||
public:
|
public:
|
||||||
LSeqStringSetChar(LOperand* string,
|
LSeqStringSetChar(LOperand* string,
|
||||||
|
Loading…
Reference in New Issue
Block a user