Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 : * vim: set ts=8 sts=4 et sw=4 tw=99:
3 : * This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #include "jit/BaselineIC.h"
8 : #include "jit/SharedICHelpers.h"
9 : #include "jit/MacroAssembler-inl.h"
10 :
11 : using namespace js;
12 : using namespace js::jit;
13 :
14 : namespace js {
15 : namespace jit {
16 :
17 : // ICCompare_Int32
18 :
19 : bool
20 140 : ICCompare_Int32::Compiler::generateStubCode(MacroAssembler& masm)
21 : {
22 : // Guard that R0 is an integer and R1 is an integer.
23 280 : Label failure;
24 140 : masm.branchTestInt32(Assembler::NotEqual, R0, &failure);
25 140 : masm.branchTestInt32(Assembler::NotEqual, R1, &failure);
26 :
27 : // Directly compare the int32 payload of R0 and R1.
28 280 : ScratchRegisterScope scratch(masm);
29 140 : Assembler::Condition cond = JSOpToCondition(op, /* signed = */true);
30 140 : masm.mov(ImmWord(0), scratch);
31 140 : masm.cmp32(R0.valueReg(), R1.valueReg());
32 140 : masm.setCC(cond, scratch);
33 :
34 : // Box the result and return
35 140 : masm.boxValue(JSVAL_TYPE_BOOLEAN, scratch, R0.valueReg());
36 140 : EmitReturnFromIC(masm);
37 :
38 : // Failure case - jump to next stub
39 140 : masm.bind(&failure);
40 140 : EmitStubGuardFailure(masm);
41 :
42 280 : return true;
43 : }
44 :
45 : } // namespace jit
46 : } // namespace js
|