Skip to content

Commit 2aa5341

Browse files
lizhengxingCommit bot
authored andcommitted
X87: [runtime] Unify comparison operator runtime entries.
port 55b4df7(r34303) original commit message: Only use one set of %StrictEquals/%StrictNotEquals and %Equals/%NotEquals runtime entries for both the interpreter and the old-style CompareICStub. The long-term plan is to update the CompareICStub to also return boolean values, and even allow some more code sharing with the interpreter there. BUG= Review URL: https://codereview.chromium.org/1743123002 Cr-Commit-Position: refs/heads/master@{#34352}
1 parent 008888c commit 2aa5341

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

src/x87/code-stubs-x87.cc

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,21 +1150,26 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) {
11501150
}
11511151
__ bind(&runtime_call);
11521152

1153-
// Push arguments below the return address.
1154-
__ pop(ecx);
1155-
__ push(edx);
1156-
__ push(eax);
1157-
1158-
// Figure out which native to call and setup the arguments.
11591153
if (cc == equal) {
1160-
__ push(ecx);
1161-
__ TailCallRuntime(strict() ? Runtime::kStrictEquals : Runtime::kEquals);
1154+
{
1155+
FrameScope scope(masm, StackFrame::INTERNAL);
1156+
__ Push(edx);
1157+
__ Push(eax);
1158+
__ CallRuntime(strict() ? Runtime::kStrictEquals : Runtime::kEquals);
1159+
}
1160+
// Turn true into 0 and false into some non-zero value.
1161+
STATIC_ASSERT(EQUAL == 0);
1162+
__ sub(eax, Immediate(isolate()->factory()->true_value()));
1163+
__ Ret();
11621164
} else {
1165+
// Push arguments below the return address.
1166+
__ pop(ecx);
1167+
__ push(edx);
1168+
__ push(eax);
11631169
__ push(Immediate(Smi::FromInt(NegativeComparisonResult(cc))));
11641170

11651171
// Restore return address on the stack.
11661172
__ push(ecx);
1167-
11681173
// Call the native; it returns -1 (less), 0 (equal), or 1 (greater)
11691174
// tagged as a small integer.
11701175
__ TailCallRuntime(Runtime::kCompare);

0 commit comments

Comments
 (0)