Bug 576175 - TM: rename js_Unbox{Double,Int32}. r=luke.

This commit is contained in:
Nicholas Nethercote 2011-05-19 17:02:46 -07:00
parent 7b38f467cb
commit a705714616
3 changed files with 21 additions and 17 deletions

View File

@ -110,50 +110,54 @@ JS_DEFINE_CALLINFO_2(extern, INT32, js_imod, INT32, INT32, 1, ACCSET_NONE)
#if JS_BITS_PER_WORD == 32
jsdouble FASTCALL
js_UnboxDouble(uint32 tag, uint32 payload)
js_UnboxNumberAsDouble(uint32 tag, uint32 payload)
{
if (tag == JSVAL_TAG_INT32)
return (double)(int32)payload;
JS_ASSERT(tag <= JSVAL_TAG_CLEAR);
jsval_layout l;
l.s.tag = (JSValueTag)tag;
l.s.payload.u32 = payload;
return l.asDouble;
}
JS_DEFINE_CALLINFO_2(extern, DOUBLE, js_UnboxDouble, UINT32, UINT32, 1, ACCSET_NONE)
JS_DEFINE_CALLINFO_2(extern, DOUBLE, js_UnboxNumberAsDouble, UINT32, UINT32, 1, ACCSET_NONE)
int32 FASTCALL
js_UnboxInt32(uint32 tag, uint32 payload)
js_UnboxNumberAsInt32(uint32 tag, uint32 payload)
{
if (tag == JSVAL_TAG_INT32)
return (int32)payload;
JS_ASSERT(tag <= JSVAL_TAG_CLEAR);
jsval_layout l;
l.s.tag = (JSValueTag)tag;
l.s.payload.u32 = payload;
return js_DoubleToECMAInt32(l.asDouble);
}
JS_DEFINE_CALLINFO_2(extern, INT32, js_UnboxInt32, UINT32, UINT32, 1, ACCSET_NONE)
JS_DEFINE_CALLINFO_2(extern, INT32, js_UnboxNumberAsInt32, UINT32, UINT32, 1, ACCSET_NONE)
#elif JS_BITS_PER_WORD == 64
jsdouble FASTCALL
js_UnboxDouble(Value v)
js_UnboxNumberAsDouble(Value v)
{
if (v.isInt32())
return (jsdouble)v.toInt32();
JS_ASSERT(v.isDouble());
return v.toDouble();
}
JS_DEFINE_CALLINFO_1(extern, DOUBLE, js_UnboxDouble, JSVAL, 1, ACCSET_NONE)
JS_DEFINE_CALLINFO_1(extern, DOUBLE, js_UnboxNumberAsDouble, JSVAL, 1, ACCSET_NONE)
int32 FASTCALL
js_UnboxInt32(Value v)
js_UnboxNumberAsInt32(Value v)
{
if (v.isInt32())
return v.toInt32();
JS_ASSERT(v.isDouble());
return js_DoubleToECMAInt32(v.toDouble());
}
JS_DEFINE_CALLINFO_1(extern, INT32, js_UnboxInt32, VALUE, 1, ACCSET_NONE)
JS_DEFINE_CALLINFO_1(extern, INT32, js_UnboxNumberAsInt32, VALUE, 1, ACCSET_NONE)
#endif

View File

@ -585,8 +585,8 @@ JS_DECLARE_CALLINFO(js_ArrayCompPush_tn)
JS_DECLARE_CALLINFO(js_EnsureDenseArrayCapacity)
/* Defined in jsbuiltins.cpp. */
JS_DECLARE_CALLINFO(js_UnboxDouble)
JS_DECLARE_CALLINFO(js_UnboxInt32)
JS_DECLARE_CALLINFO(js_UnboxNumberAsDouble)
JS_DECLARE_CALLINFO(js_UnboxNumberAsInt32)
JS_DECLARE_CALLINFO(js_dmod)
JS_DECLARE_CALLINFO(js_imod)
JS_DECLARE_CALLINFO(js_DoubleToInt32)

View File

@ -8557,16 +8557,16 @@ TraceRecorder::d2i(LIns* d, bool resultCanBeImpreciseIfFractional)
}
if (d->isCall()) {
const CallInfo* ci = d->callInfo();
if (ci == &js_UnboxDouble_ci) {
if (ci == &js_UnboxNumberAsDouble_ci) {
#if JS_BITS_PER_WORD == 32
LIns *tag_ins = d->callArgN(0);
LIns *payload_ins = d->callArgN(1);
LIns* args[] = { payload_ins, tag_ins };
return w.call(&js_UnboxInt32_ci, args);
return w.call(&js_UnboxNumberAsInt32_ci, args);
#else
LIns* val_ins = d->callArgN(0);
LIns* args[] = { val_ins };
return w.call(&js_UnboxInt32_ci, args);
return w.call(&js_UnboxNumberAsInt32_ci, args);
#endif
}
if (ci == &js_StringToNumber_ci) {
@ -9688,7 +9688,7 @@ TraceRecorder::unbox_number_as_double(Address addr, LIns *tag_ins, VMSideExit *e
guard(true, w.leui(tag_ins, w.nameImmui(JSVAL_UPPER_INCL_TAG_OF_NUMBER_SET)), exit);
LIns *val_ins = w.ldiValuePayload(addr);
LIns* args[] = { val_ins, tag_ins };
return w.call(&js_UnboxDouble_ci, args);
return w.call(&js_UnboxNumberAsDouble_ci, args);
}
inline LIns*
@ -9780,7 +9780,7 @@ TraceRecorder::box_value_into(const Value &v, LIns *v_ins, Address addr)
{
if (v.isNumber()) {
JS_ASSERT(v_ins->isD());
if (fcallinfo(v_ins) == &js_UnboxDouble_ci) {
if (fcallinfo(v_ins) == &js_UnboxNumberAsDouble_ci) {
w.stiValueTag(v_ins->callArgN(0), addr);
w.stiValuePayload(v_ins->callArgN(1), addr);
} else if (IsPromotedInt32(v_ins)) {
@ -9838,7 +9838,7 @@ TraceRecorder::unbox_number_as_double(LIns *v_ins, VMSideExit *exit)
w.ltuq(v_ins, w.nameImmq(JSVAL_UPPER_EXCL_SHIFTED_TAG_OF_NUMBER_SET)),
exit);
LIns* args[] = { v_ins };
return w.call(&js_UnboxDouble_ci, args);
return w.call(&js_UnboxNumberAsDouble_ci, args);
}
inline nanojit::LIns*
@ -9932,7 +9932,7 @@ TraceRecorder::box_value_for_native_call(const Value &v, LIns *v_ins)
{
if (v.isNumber()) {
JS_ASSERT(v_ins->isD());
if (fcallinfo(v_ins) == &js_UnboxDouble_ci)
if (fcallinfo(v_ins) == &js_UnboxNumberAsDouble_ci)
return v_ins->callArgN(0);
if (IsPromotedInt32(v_ins)) {
return w.orq(w.ui2uq(w.demoteToInt32(v_ins)),