mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
Bug 1341261 - Use CompareIR for string equality. r=jandem
This commit is contained in:
parent
6a9b9472e7
commit
ebe8d92b75
@ -1,4 +1,5 @@
|
||||
SIMD/nursery-overflow.js
|
||||
asm.js/testBug1117235.js
|
||||
asm.js/testParallelCompile.js
|
||||
auto-regress/bug653395.js
|
||||
auto-regress/bug654392.js
|
||||
|
@ -3704,6 +3704,23 @@ CompareIRGenerator::CompareIRGenerator(JSContext* cx, HandleScript script, jsbyt
|
||||
op_(op), lhsVal_(lhsVal), rhsVal_(rhsVal)
|
||||
{ }
|
||||
|
||||
bool
|
||||
CompareIRGenerator::tryAttachString(ValOperandId lhsId, ValOperandId rhsId)
|
||||
{
|
||||
MOZ_ASSERT(IsEqualityOp(op_));
|
||||
|
||||
if (!lhsVal_.isString() || !rhsVal_.isString())
|
||||
return false;
|
||||
|
||||
StringOperandId lhsStrId = writer.guardIsString(lhsId);
|
||||
StringOperandId rhsStrId = writer.guardIsString(rhsId);
|
||||
writer.compareStringResult(op_, lhsStrId, rhsStrId);
|
||||
writer.returnFromIC();
|
||||
|
||||
trackAttached("String");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CompareIRGenerator::tryAttachStub()
|
||||
{
|
||||
@ -3717,6 +3734,14 @@ CompareIRGenerator::tryAttachStub()
|
||||
ValOperandId lhsId(writer.setInputOperandId(0));
|
||||
ValOperandId rhsId(writer.setInputOperandId(1));
|
||||
|
||||
if (IsEqualityOp(op_)) {
|
||||
if (tryAttachString(lhsId, rhsId))
|
||||
return true;
|
||||
|
||||
trackNotAttached();
|
||||
return false;
|
||||
}
|
||||
|
||||
trackNotAttached();
|
||||
return false;
|
||||
}
|
||||
|
@ -257,6 +257,9 @@ extern const char* CacheKindNames[];
|
||||
_(LoadTypeOfObjectResult) \
|
||||
\
|
||||
_(CallStringSplitResult) \
|
||||
\
|
||||
_(CompareStringResult) \
|
||||
\
|
||||
_(CallPrintString) \
|
||||
_(Breakpoint) \
|
||||
\
|
||||
@ -955,6 +958,12 @@ class MOZ_RAII CacheIRWriter : public JS::CustomAutoRooter
|
||||
addStubField(uintptr_t(group), StubField::Type::ObjectGroup);
|
||||
}
|
||||
|
||||
void compareStringResult(uint32_t op, StringOperandId lhs, StringOperandId rhs) {
|
||||
writeOpWithOperandId(CacheOp::CompareStringResult, lhs);
|
||||
writeOperandId(rhs);
|
||||
buffer_.writeByte(uint32_t(op));
|
||||
}
|
||||
|
||||
void callPrintString(const char* str) {
|
||||
writeOp(CacheOp::CallPrintString);
|
||||
writePointer(const_cast<char*>(str));
|
||||
@ -1012,6 +1021,7 @@ class MOZ_RAII CacheIRReader
|
||||
Scalar::Type scalarType() { return Scalar::Type(buffer_.readByte()); }
|
||||
uint32_t typeDescrKey() { return buffer_.readByte(); }
|
||||
JSWhyMagic whyMagic() { return JSWhyMagic(buffer_.readByte()); }
|
||||
JSOp jsop() { return JSOp(buffer_.readByte()); }
|
||||
int32_t int32Immediate() { return buffer_.readSigned(); }
|
||||
uint32_t uint32Immediate() { return buffer_.readUnsigned(); }
|
||||
void* pointer() { return buffer_.readRawPointer(); }
|
||||
@ -1421,6 +1431,8 @@ class MOZ_RAII CompareIRGenerator : public IRGenerator
|
||||
HandleValue lhsVal_;
|
||||
HandleValue rhsVal_;
|
||||
|
||||
bool tryAttachString(ValOperandId lhsId, ValOperandId rhsId);
|
||||
|
||||
void trackAttached(const char* name);
|
||||
void trackNotAttached();
|
||||
|
||||
|
@ -2226,6 +2226,26 @@ CacheIRCompiler::emitLoadTypeOfObjectResult()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CacheIRCompiler::emitCompareStringResult()
|
||||
{
|
||||
AutoOutputRegister output(*this);
|
||||
|
||||
Register left = allocator.useRegister(masm, reader.stringOperandId());
|
||||
Register right = allocator.useRegister(masm, reader.stringOperandId());
|
||||
JSOp op = reader.jsop();
|
||||
|
||||
AutoScratchRegisterMaybeOutput scratch(allocator, masm, output);
|
||||
|
||||
FailurePath* failure;
|
||||
if (!addFailurePath(&failure))
|
||||
return false;
|
||||
|
||||
masm.compareStrings(op, left, right, scratch, failure->label());
|
||||
masm.tagValue(JSVAL_TYPE_BOOLEAN, scratch, output.valueReg());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CacheIRCompiler::emitCallPrintString()
|
||||
{
|
||||
|
@ -55,6 +55,7 @@ namespace jit {
|
||||
_(LoadTypedElementResult) \
|
||||
_(LoadObjectResult) \
|
||||
_(LoadTypeOfObjectResult) \
|
||||
_(CompareStringResult) \
|
||||
_(CallPrintString) \
|
||||
_(Breakpoint) \
|
||||
_(MegamorphicLoadSlotByValueResult) \
|
||||
|
Loading…
Reference in New Issue
Block a user