js/src/jit/shared/BaselineIC-x86-shared.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit/shared/BaselineIC-x86-shared.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,42 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + * vim: set ts=8 sts=4 et sw=4 tw=99:
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#include "jit/BaselineHelpers.h"
    1.11 +#include "jit/BaselineIC.h"
    1.12 +
    1.13 +using namespace js;
    1.14 +using namespace js::jit;
    1.15 +
    1.16 +bool
    1.17 +ICCompare_Double::Compiler::generateStubCode(MacroAssembler &masm)
    1.18 +{
    1.19 +    Label failure, notNaN;
    1.20 +    masm.ensureDouble(R0, FloatReg0, &failure);
    1.21 +    masm.ensureDouble(R1, FloatReg1, &failure);
    1.22 +
    1.23 +    Register dest = R0.scratchReg();
    1.24 +
    1.25 +    Assembler::DoubleCondition cond = JSOpToDoubleCondition(op);
    1.26 +    masm.mov(ImmWord(0), dest);
    1.27 +    masm.compareDouble(cond, FloatReg0, FloatReg1);
    1.28 +    masm.setCC(Assembler::ConditionFromDoubleCondition(cond), dest);
    1.29 +
    1.30 +    // Check for NaN, if needed.
    1.31 +    Assembler::NaNCond nanCond = Assembler::NaNCondFromDoubleCondition(cond);
    1.32 +    if (nanCond != Assembler::NaN_HandledByCond) {
    1.33 +      masm.j(Assembler::NoParity, &notNaN);
    1.34 +      masm.mov(ImmWord(nanCond == Assembler::NaN_IsTrue), dest);
    1.35 +      masm.bind(&notNaN);
    1.36 +    }
    1.37 +
    1.38 +    masm.tagValue(JSVAL_TYPE_BOOLEAN, dest, R0);
    1.39 +    EmitReturnFromIC(masm);
    1.40 +
    1.41 +    // Failure case - jump to next stub
    1.42 +    masm.bind(&failure);
    1.43 +    EmitStubGuardFailure(masm);
    1.44 +    return true;
    1.45 +}

mercurial