mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Use lir->insImmf and emit ins_eq0 centrally in guard() (483365, r=brendan).
This commit is contained in:
parent
c5b3eb193e
commit
8fb6a7a444
@ -2232,6 +2232,10 @@ TraceRecorder::snapshot(ExitType exitType)
|
|||||||
LIns*
|
LIns*
|
||||||
TraceRecorder::guard(bool expected, LIns* cond, LIns* exit)
|
TraceRecorder::guard(bool expected, LIns* cond, LIns* exit)
|
||||||
{
|
{
|
||||||
|
if (!cond->isCond()) {
|
||||||
|
expected = !expected;
|
||||||
|
cond = lir->ins_eq0(cond);
|
||||||
|
}
|
||||||
return lir->insGuard(expected ? LIR_xf : LIR_xt, cond, exit);
|
return lir->insGuard(expected ? LIR_xf : LIR_xt, cond, exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4901,11 +4905,8 @@ TraceRecorder::alu(LOpcode v, jsdouble v0, jsdouble v1, LIns* s0, LIns* s1)
|
|||||||
* The result doesn't fit into the integer domain, so either generate
|
* The result doesn't fit into the integer domain, so either generate
|
||||||
* a floating point constant or a floating point operation.
|
* a floating point constant or a floating point operation.
|
||||||
*/
|
*/
|
||||||
if (s0->isconst() && s1->isconst()) {
|
if (s0->isconst() && s1->isconst())
|
||||||
jsdpun u;
|
return lir->insImmf(r);
|
||||||
u.d = r;
|
|
||||||
return lir->insImmq(u.u64);
|
|
||||||
}
|
|
||||||
return lir->ins2(v, s0, s1);
|
return lir->ins2(v, s0, s1);
|
||||||
}
|
}
|
||||||
return lir->ins2(v, s0, s1);
|
return lir->ins2(v, s0, s1);
|
||||||
@ -4997,11 +4998,9 @@ TraceRecorder::ifop()
|
|||||||
} else if (isNumber(v)) {
|
} else if (isNumber(v)) {
|
||||||
jsdouble d = asNumber(v);
|
jsdouble d = asNumber(v);
|
||||||
cond = !JSDOUBLE_IS_NaN(d) && d;
|
cond = !JSDOUBLE_IS_NaN(d) && d;
|
||||||
jsdpun u;
|
|
||||||
u.d = 0;
|
|
||||||
x = lir->ins2(LIR_and,
|
x = lir->ins2(LIR_and,
|
||||||
lir->ins2(LIR_feq, v_ins, v_ins),
|
lir->ins2(LIR_feq, v_ins, v_ins),
|
||||||
lir->ins_eq0(lir->ins2(LIR_feq, v_ins, lir->insImmq(u.u64))));
|
lir->ins_eq0(lir->ins2(LIR_feq, v_ins, lir->insImmq(0))));
|
||||||
} else if (JSVAL_IS_STRING(v)) {
|
} else if (JSVAL_IS_STRING(v)) {
|
||||||
cond = JSSTRING_LENGTH(JSVAL_TO_STRING(v)) != 0;
|
cond = JSSTRING_LENGTH(JSVAL_TO_STRING(v)) != 0;
|
||||||
x = lir->ins2(LIR_piand,
|
x = lir->ins2(LIR_piand,
|
||||||
@ -5014,12 +5013,7 @@ TraceRecorder::ifop()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
flipIf(cx->fp->regs->pc, cond);
|
flipIf(cx->fp->regs->pc, cond);
|
||||||
bool expected = cond;
|
guard(cond, x, BRANCH_EXIT);
|
||||||
if (!x->isCond()) {
|
|
||||||
x = lir->ins_eq0(x);
|
|
||||||
expected = !expected;
|
|
||||||
}
|
|
||||||
guard(expected, x, BRANCH_EXIT);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5096,10 +5090,8 @@ TraceRecorder::switchop()
|
|||||||
return true;
|
return true;
|
||||||
if (isNumber(v)) {
|
if (isNumber(v)) {
|
||||||
jsdouble d = asNumber(v);
|
jsdouble d = asNumber(v);
|
||||||
jsdpun u;
|
|
||||||
u.d = d;
|
|
||||||
guard(true,
|
guard(true,
|
||||||
addName(lir->ins2(LIR_feq, v_ins, lir->insImmq(u.u64)),
|
addName(lir->ins2(LIR_feq, v_ins, lir->insImmf(d)),
|
||||||
"guard(switch on numeric)"),
|
"guard(switch on numeric)"),
|
||||||
BRANCH_EXIT);
|
BRANCH_EXIT);
|
||||||
} else if (JSVAL_IS_STRING(v)) {
|
} else if (JSVAL_IS_STRING(v)) {
|
||||||
@ -5139,10 +5131,7 @@ TraceRecorder::inc(jsval& v, LIns*& v_ins, jsint incr, bool pre)
|
|||||||
if (!isNumber(v))
|
if (!isNumber(v))
|
||||||
ABORT_TRACE("can only inc numbers");
|
ABORT_TRACE("can only inc numbers");
|
||||||
|
|
||||||
jsdpun u;
|
LIns* v_after = alu(LIR_fadd, asNumber(v), incr, v_ins, lir->insImmf(incr));
|
||||||
u.d = jsdouble(incr);
|
|
||||||
|
|
||||||
LIns* v_after = alu(LIR_fadd, asNumber(v), incr, v_ins, lir->insImmq(u.u64));
|
|
||||||
|
|
||||||
const JSCodeSpec& cs = js_CodeSpec[*cx->fp->regs->pc];
|
const JSCodeSpec& cs = js_CodeSpec[*cx->fp->regs->pc];
|
||||||
JS_ASSERT(cs.ndefs == 1);
|
JS_ASSERT(cs.ndefs == 1);
|
||||||
@ -6532,9 +6521,7 @@ TraceRecorder::record_JSOP_NEG()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (JSVAL_IS_NULL(v)) {
|
if (JSVAL_IS_NULL(v)) {
|
||||||
jsdpun u;
|
set(&v, lir->insImmf(-0.0));
|
||||||
u.d = -0.0;
|
|
||||||
set(&v, lir->insImmq(u.u64));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6851,9 +6838,7 @@ success:
|
|||||||
case FAIL_NEG:
|
case FAIL_NEG:
|
||||||
{
|
{
|
||||||
res_ins = lir->ins1(LIR_i2f, res_ins);
|
res_ins = lir->ins1(LIR_i2f, res_ins);
|
||||||
jsdpun u;
|
guard(false, lir->ins2(LIR_flt, res_ins, lir->insImmq(0)), OOM_EXIT);
|
||||||
u.d = 0.0;
|
|
||||||
guard(false, lir->ins2(LIR_flt, res_ins, lir->insImmq(u.u64)), OOM_EXIT);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FAIL_VOID:
|
case FAIL_VOID:
|
||||||
@ -7932,9 +7917,7 @@ JS_REQUIRES_STACK bool
|
|||||||
TraceRecorder::record_JSOP_DOUBLE()
|
TraceRecorder::record_JSOP_DOUBLE()
|
||||||
{
|
{
|
||||||
jsval v = jsval(atoms[GET_INDEX(cx->fp->regs->pc)]);
|
jsval v = jsval(atoms[GET_INDEX(cx->fp->regs->pc)]);
|
||||||
jsdpun u;
|
stack(0, lir->insImmf(*JSVAL_TO_DOUBLE(v)));
|
||||||
u.d = *JSVAL_TO_DOUBLE(v);
|
|
||||||
stack(0, lir->insImmq(u.u64));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7950,18 +7933,14 @@ TraceRecorder::record_JSOP_STRING()
|
|||||||
JS_REQUIRES_STACK bool
|
JS_REQUIRES_STACK bool
|
||||||
TraceRecorder::record_JSOP_ZERO()
|
TraceRecorder::record_JSOP_ZERO()
|
||||||
{
|
{
|
||||||
jsdpun u;
|
stack(0, lir->insImmq(0));
|
||||||
u.d = 0.0;
|
|
||||||
stack(0, lir->insImmq(u.u64));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_REQUIRES_STACK bool
|
JS_REQUIRES_STACK bool
|
||||||
TraceRecorder::record_JSOP_ONE()
|
TraceRecorder::record_JSOP_ONE()
|
||||||
{
|
{
|
||||||
jsdpun u;
|
stack(0, lir->insImmf(1));
|
||||||
u.d = 1.0;
|
|
||||||
stack(0, lir->insImmq(u.u64));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8094,9 +8073,7 @@ TraceRecorder::record_JSOP_SETLOCAL()
|
|||||||
JS_REQUIRES_STACK bool
|
JS_REQUIRES_STACK bool
|
||||||
TraceRecorder::record_JSOP_UINT16()
|
TraceRecorder::record_JSOP_UINT16()
|
||||||
{
|
{
|
||||||
jsdpun u;
|
stack(0, lir->insImmf(GET_UINT16(cx->fp->regs->pc)));
|
||||||
u.d = (jsdouble)GET_UINT16(cx->fp->regs->pc);
|
|
||||||
stack(0, lir->insImmq(u.u64));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8589,9 +8566,7 @@ JS_REQUIRES_STACK bool
|
|||||||
TraceRecorder::record_JSOP_ARGCNT()
|
TraceRecorder::record_JSOP_ARGCNT()
|
||||||
{
|
{
|
||||||
if (!(cx->fp->fun->flags & JSFUN_HEAVYWEIGHT)) {
|
if (!(cx->fp->fun->flags & JSFUN_HEAVYWEIGHT)) {
|
||||||
jsdpun u;
|
stack(0, lir->insImmf(cx->fp->argc));
|
||||||
u.d = cx->fp->argc;
|
|
||||||
stack(0, lir->insImmq(u.u64));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
ABORT_TRACE("can't trace heavyweight JSOP_ARGCNT");
|
ABORT_TRACE("can't trace heavyweight JSOP_ARGCNT");
|
||||||
@ -9036,9 +9011,7 @@ TraceRecorder::record_JSOP_DELDESC()
|
|||||||
JS_REQUIRES_STACK bool
|
JS_REQUIRES_STACK bool
|
||||||
TraceRecorder::record_JSOP_UINT24()
|
TraceRecorder::record_JSOP_UINT24()
|
||||||
{
|
{
|
||||||
jsdpun u;
|
stack(0, lir->insImmf(GET_UINT24(cx->fp->regs->pc)));
|
||||||
u.d = (jsdouble)GET_UINT24(cx->fp->regs->pc);
|
|
||||||
stack(0, lir->insImmq(u.u64));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9419,18 +9392,14 @@ TraceRecorder::record_JSOP_NULLTHIS()
|
|||||||
JS_REQUIRES_STACK bool
|
JS_REQUIRES_STACK bool
|
||||||
TraceRecorder::record_JSOP_INT8()
|
TraceRecorder::record_JSOP_INT8()
|
||||||
{
|
{
|
||||||
jsdpun u;
|
stack(0, lir->insImmf(GET_INT8(cx->fp->regs->pc)));
|
||||||
u.d = (jsdouble)GET_INT8(cx->fp->regs->pc);
|
|
||||||
stack(0, lir->insImmq(u.u64));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_REQUIRES_STACK bool
|
JS_REQUIRES_STACK bool
|
||||||
TraceRecorder::record_JSOP_INT32()
|
TraceRecorder::record_JSOP_INT32()
|
||||||
{
|
{
|
||||||
jsdpun u;
|
stack(0, lir->insImmf(GET_INT32(cx->fp->regs->pc)));
|
||||||
u.d = (jsdouble)GET_INT32(cx->fp->regs->pc);
|
|
||||||
stack(0, lir->insImmq(u.u64));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user