bool CodeGeneratorX64::visitCompareBAndBranch(LCompareBAndBranch *lir) { MCompare *mir = lir->mir(); const ValueOperand lhs = ToValue(lir, LCompareBAndBranch::Lhs); const LAllocation *rhs = lir->rhs(); JS_ASSERT(mir->jsop() == JSOP_STRICTEQ || mir->jsop() == JSOP_STRICTNE); // Load boxed boolean in ScratchReg. if (rhs->isConstant()) masm.moveValue(*rhs->toConstant(), ScratchReg); else masm.boxValue(JSVAL_TYPE_BOOLEAN, ToRegister(rhs), ScratchReg); // Perform the comparison. masm.cmpq(lhs.valueReg(), ScratchReg); emitBranch(JSOpToCondition(mir->compareType(), mir->jsop()), lir->ifTrue(), lir->ifFalse()); return true; }
void CodeGeneratorMIPS64::visitCompareB(LCompareB* lir) { MCompare* mir = lir->mir(); const ValueOperand lhs = ToValue(lir, LCompareB::Lhs); const LAllocation* rhs = lir->rhs(); const Register output = ToRegister(lir->output()); MOZ_ASSERT(mir->jsop() == JSOP_STRICTEQ || mir->jsop() == JSOP_STRICTNE); Assembler::Condition cond = JSOpToCondition(mir->compareType(), mir->jsop()); // Load boxed boolean in ScratchRegister. if (rhs->isConstant()) masm.moveValue(rhs->toConstant()->toJSValue(), ScratchRegister); else masm.boxValue(JSVAL_TYPE_BOOLEAN, ToRegister(rhs), ScratchRegister); // Perform the comparison. masm.cmpPtrSet(cond, lhs.valueReg(), ScratchRegister, output); }
void MacroAssemblerX64::branchValueIsNurseryObject(Condition cond, ValueOperand value, Register temp, Label* label) { MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); const Nursery& nursery = GetJitContext()->runtime->gcNursery(); // Avoid creating a bogus ObjectValue below. if (!nursery.exists()) return; // 'Value' representing the start of the nursery tagged as a JSObject Value start = ObjectValue(*reinterpret_cast<JSObject*>(nursery.start())); ScratchRegisterScope scratch(asMasm()); movePtr(ImmWord(-ptrdiff_t(start.asRawBits())), scratch); addPtr(value.valueReg(), scratch); branchPtr(cond == Assembler::Equal ? Assembler::Below : Assembler::AboveOrEqual, scratch, Imm32(nursery.nurserySize()), label); }
void CodeGeneratorX64::visitCompareB(LCompareB* lir) { MCompare* mir = lir->mir(); const ValueOperand lhs = ToValue(lir, LCompareB::Lhs); const LAllocation* rhs = lir->rhs(); const Register output = ToRegister(lir->output()); MOZ_ASSERT(mir->jsop() == JSOP_STRICTEQ || mir->jsop() == JSOP_STRICTNE); // Load boxed boolean in ScratchReg. ScratchRegisterScope scratch(masm); if (rhs->isConstant()) masm.moveValue(*rhs->toConstant(), scratch); else masm.boxValue(JSVAL_TYPE_BOOLEAN, ToRegister(rhs), scratch); // Perform the comparison. masm.cmpPtr(lhs.valueReg(), scratch); masm.emitSet(JSOpToCondition(mir->compareType(), mir->jsop()), output); }
void MacroAssembler::branchValueIsNurseryObject(Condition cond, ValueOperand value, Register temp, Label* label) { branchValueIsNurseryObjectImpl(cond, value.valueReg(), temp, label); }