Commit 28de5bf8 authored by chunyang.dai's avatar chunyang.dai Committed by Commit bot

X87: [ic] Introduce BOOLEAN state for CompareIC.

port 10c5f2e8

original commit message:

    Slow path for relational comparison of boolean primitive values
    now goes through the runtime, which made the slow path even
    slower than it already was. So in order to repair the regression,
    we just track boolean feedback for comparisons and use that
    to generate decent code in Crankshaft (not the best possible
    code, but good enough for Crankshaft; TurboFan will be able
    to do better on that).

BUG=

Review URL: https://codereview.chromium.org/1367523005

Cr-Commit-Position: refs/heads/master@{#30903}
parent 8fe3ac07
......@@ -3110,6 +3110,37 @@ void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) {
}
void CompareICStub::GenerateBooleans(MacroAssembler* masm) {
DCHECK_EQ(CompareICState::BOOLEAN, state());
Label miss;
Label::Distance const miss_distance =
masm->emit_debug_code() ? Label::kFar : Label::kNear;
__ JumpIfSmi(edx, &miss, miss_distance);
__ mov(ecx, FieldOperand(edx, HeapObject::kMapOffset));
__ JumpIfSmi(eax, &miss, miss_distance);
__ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset));
__ JumpIfNotRoot(ecx, Heap::kBooleanMapRootIndex, &miss, miss_distance);
__ JumpIfNotRoot(ebx, Heap::kBooleanMapRootIndex, &miss, miss_distance);
if (op() != Token::EQ_STRICT && is_strong(strength())) {
__ TailCallRuntime(Runtime::kThrowStrongModeImplicitConversion, 0, 1);
} else {
if (!Token::IsEqualityOp(op())) {
__ mov(eax, FieldOperand(eax, Oddball::kToNumberOffset));
__ AssertSmi(eax);
__ mov(edx, FieldOperand(edx, Oddball::kToNumberOffset));
__ AssertSmi(edx);
__ xchg(eax, edx);
}
__ sub(eax, edx);
__ Ret();
}
__ bind(&miss);
GenerateMiss(masm);
}
void CompareICStub::GenerateSmis(MacroAssembler* masm) {
DCHECK(state() == CompareICState::SMI);
Label miss;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment