Beispiel #1
0
void cgConjureUse(IRLS& env, const IRInstruction* inst) {
  auto const src = srcLoc(env, inst, 0);
  auto& v = vmain(env);
  if (src.hasReg(0)) {
    v << conjureuse{src.reg(0)};
  }
  if (src.hasReg(1)) {
    v << conjureuse{src.reg(1)};
  }
}
Beispiel #2
0
void cgConjure(IRLS& env, const IRInstruction* inst) {
  auto const dst = dstLoc(env, inst, 0);
  auto& v = vmain(env);
  if (dst.hasReg(0)) {
    v << conjure{dst.reg(0)};
  }
  if (dst.hasReg(1)) {
    v << conjure{dst.reg(1)};
  }
}
Beispiel #3
0
void cgLdInitPropAddr(IRLS& env, const IRInstruction* inst) {
  auto const dstLoc = irlower::dstLoc(env, inst, 0);
  auto const obj = srcLoc(env, inst, 0).reg();
  auto& v = vmain(env);

  auto const propPtr = obj[inst->extra<LdInitPropAddr>()->offsetBytes];

  if (dstLoc.hasReg(tv_lval::val_idx)) {
    v << lea{propPtr, dstLoc.reg(tv_lval::val_idx)};
  }
  if (wide_tv_val && dstLoc.hasReg(tv_lval::type_idx)) {
    static_assert(TVOFF(m_data) == 0, "");
    v << lea{propPtr + TVOFF(m_type), dstLoc.reg(tv_lval::type_idx)};
  }

  auto const sf = v.makeReg();
  emitCmpTVType(v, sf, KindOfUninit, propPtr + TVOFF(m_type));
  v << jcc{CC_Z, sf, {label(env, inst->next()), label(env, inst->taken())}};
}
Beispiel #4
0
void cgLdTVAux(IRLS& env, const IRInstruction* inst) {
  auto const dst = dstLoc(env, inst, 0).reg();

  auto const tv = srcLoc(env, inst, 0);
  assertx(tv.hasReg(1));
  auto const type = tv.reg(1);

  auto& v = vmain(env);
  v << shrqi{32, type, dst, v.makeReg()};

  if (RuntimeOption::EvalHHIRGenerateAsserts) {
    auto const extra = inst->extra<LdTVAux>();
    auto const mask = -extra->valid - 1;

    if (mask) {
      auto const sf = v.makeReg();
      v << testqi{mask, dst, sf};
      ifThen(v, CC_NZ, sf, [](Vout& v) {
        v << trap{TRAP_REASON};
      });
    }
  }
}