Commit 2aa53410 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [runtime] Unify comparison operator runtime entries.

  port 55b4df73(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}
parent 008888c8
...@@ -1150,21 +1150,26 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { ...@@ -1150,21 +1150,26 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) {
} }
__ bind(&runtime_call); __ bind(&runtime_call);
if (cc == equal) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
__ Push(edx);
__ Push(eax);
__ CallRuntime(strict() ? Runtime::kStrictEquals : Runtime::kEquals);
}
// Turn true into 0 and false into some non-zero value.
STATIC_ASSERT(EQUAL == 0);
__ sub(eax, Immediate(isolate()->factory()->true_value()));
__ Ret();
} else {
// Push arguments below the return address. // Push arguments below the return address.
__ pop(ecx); __ pop(ecx);
__ push(edx); __ push(edx);
__ push(eax); __ push(eax);
// Figure out which native to call and setup the arguments.
if (cc == equal) {
__ push(ecx);
__ TailCallRuntime(strict() ? Runtime::kStrictEquals : Runtime::kEquals);
} else {
__ push(Immediate(Smi::FromInt(NegativeComparisonResult(cc)))); __ push(Immediate(Smi::FromInt(NegativeComparisonResult(cc))));
// Restore return address on the stack. // Restore return address on the stack.
__ push(ecx); __ push(ecx);
// Call the native; it returns -1 (less), 0 (equal), or 1 (greater) // Call the native; it returns -1 (less), 0 (equal), or 1 (greater)
// tagged as a small integer. // tagged as a small integer.
__ TailCallRuntime(Runtime::kCompare); __ TailCallRuntime(Runtime::kCompare);
......
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