michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * vim: set ts=8 sts=4 et sw=4 tw=99: michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "jit/BaselineHelpers.h" michael@0: #include "jit/BaselineIC.h" michael@0: michael@0: using namespace js; michael@0: using namespace js::jit; michael@0: michael@0: bool michael@0: ICCompare_Double::Compiler::generateStubCode(MacroAssembler &masm) michael@0: { michael@0: Label failure, notNaN; michael@0: masm.ensureDouble(R0, FloatReg0, &failure); michael@0: masm.ensureDouble(R1, FloatReg1, &failure); michael@0: michael@0: Register dest = R0.scratchReg(); michael@0: michael@0: Assembler::DoubleCondition cond = JSOpToDoubleCondition(op); michael@0: masm.mov(ImmWord(0), dest); michael@0: masm.compareDouble(cond, FloatReg0, FloatReg1); michael@0: masm.setCC(Assembler::ConditionFromDoubleCondition(cond), dest); michael@0: michael@0: // Check for NaN, if needed. michael@0: Assembler::NaNCond nanCond = Assembler::NaNCondFromDoubleCondition(cond); michael@0: if (nanCond != Assembler::NaN_HandledByCond) { michael@0: masm.j(Assembler::NoParity, ¬NaN); michael@0: masm.mov(ImmWord(nanCond == Assembler::NaN_IsTrue), dest); michael@0: masm.bind(¬NaN); michael@0: } michael@0: michael@0: masm.tagValue(JSVAL_TYPE_BOOLEAN, dest, R0); michael@0: EmitReturnFromIC(masm); michael@0: michael@0: // Failure case - jump to next stub michael@0: masm.bind(&failure); michael@0: EmitStubGuardFailure(masm); michael@0: return true; michael@0: }