diff --git a/js/src/jsbuiltins.h b/js/src/jsbuiltins.h index 5dc32094dc4f..f69f81430482 100644 --- a/js/src/jsbuiltins.h +++ b/js/src/jsbuiltins.h @@ -116,12 +116,12 @@ struct JSNativeTraceInfo { #define _JS_CI_NAME(op) #endif -#define _JS_I32_ARGSIZE nanojit::ARGSIZE_I -#define _JS_I32_RETSIZE nanojit::ARGSIZE_I -#define _JS_F64_ARGSIZE nanojit::ARGSIZE_F -#define _JS_F64_RETSIZE nanojit::ARGSIZE_F -#define _JS_PTR_ARGSIZE nanojit::ARGSIZE_P -#define _JS_PTR_RETSIZE nanojit::ARGSIZE_P +#define _JS_I32_ARGTYPE nanojit::ARGTYPE_I +#define _JS_I32_RETTYPE nanojit::ARGTYPE_I +#define _JS_F64_ARGTYPE nanojit::ARGTYPE_F +#define _JS_F64_RETTYPE nanojit::ARGTYPE_F +#define _JS_PTR_ARGTYPE nanojit::ARGTYPE_P +#define _JS_PTR_RETTYPE nanojit::ARGTYPE_P struct ClosureVarInfo; @@ -233,10 +233,10 @@ struct ClosureVarInfo; #define _JS_CTYPE_TYPE2(t,s,p,a,f) t #define _JS_CTYPE_TYPE(tyname) _JS_EXPAND(_JS_CTYPE_TYPE2 _JS_CTYPE_##tyname) -#define _JS_CTYPE_RETSIZE2(t,s,p,a,f) s##_RETSIZE -#define _JS_CTYPE_RETSIZE(tyname) _JS_EXPAND(_JS_CTYPE_RETSIZE2 _JS_CTYPE_##tyname) -#define _JS_CTYPE_ARGSIZE2(t,s,p,a,f) s##_ARGSIZE -#define _JS_CTYPE_ARGSIZE(tyname) _JS_EXPAND(_JS_CTYPE_ARGSIZE2 _JS_CTYPE_##tyname) +#define _JS_CTYPE_RETTYPE2(t,s,p,a,f) s##_RETTYPE +#define _JS_CTYPE_RETTYPE(tyname) _JS_EXPAND(_JS_CTYPE_RETTYPE2 _JS_CTYPE_##tyname) +#define _JS_CTYPE_ARGTYPE2(t,s,p,a,f) s##_ARGTYPE +#define _JS_CTYPE_ARGTYPE(tyname) _JS_EXPAND(_JS_CTYPE_ARGTYPE2 _JS_CTYPE_##tyname) #define _JS_CTYPE_PCH2(t,s,p,a,f) p #define _JS_CTYPE_PCH(tyname) _JS_EXPAND(_JS_CTYPE_PCH2 _JS_CTYPE_##tyname) #define _JS_CTYPE_ACH2(t,s,p,a,f) a @@ -297,83 +297,117 @@ struct ClosureVarInfo; * - The fold flag. Reserved. The same as cse for now. */ #define JS_DEFINE_CALLINFO_1(linkage, rt, op, at0, cse, fold) \ - _JS_DEFINE_CALLINFO(linkage, op, _JS_CTYPE_TYPE(rt), (_JS_CTYPE_TYPE(at0)), \ - (_JS_CTYPE_ARGSIZE(at0) << (1*nanojit::ARGSIZE_SHIFT)) | \ - _JS_CTYPE_RETSIZE(rt), cse, fold) + _JS_DEFINE_CALLINFO(linkage, op, \ + _JS_CTYPE_TYPE(rt), \ + (_JS_CTYPE_TYPE(at0)), \ + nanojit::CallInfo::typeSig1(_JS_CTYPE_RETTYPE(rt), \ + _JS_CTYPE_ARGTYPE(at0)), \ + cse, fold) #define JS_DEFINE_CALLINFO_2(linkage, rt, op, at0, at1, cse, fold) \ - _JS_DEFINE_CALLINFO(linkage, op, _JS_CTYPE_TYPE(rt), \ - (_JS_CTYPE_TYPE(at0), _JS_CTYPE_TYPE(at1)), \ - (_JS_CTYPE_ARGSIZE(at0) << (2*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at1) << (1*nanojit::ARGSIZE_SHIFT)) | \ - _JS_CTYPE_RETSIZE(rt), \ + _JS_DEFINE_CALLINFO(linkage, op, \ + _JS_CTYPE_TYPE(rt), \ + (_JS_CTYPE_TYPE(at0), \ + _JS_CTYPE_TYPE(at1)), \ + nanojit::CallInfo::typeSig2(_JS_CTYPE_RETTYPE(rt), \ + _JS_CTYPE_ARGTYPE(at0), \ + _JS_CTYPE_ARGTYPE(at1)), \ cse, fold) #define JS_DEFINE_CALLINFO_3(linkage, rt, op, at0, at1, at2, cse, fold) \ - _JS_DEFINE_CALLINFO(linkage, op, _JS_CTYPE_TYPE(rt), \ - (_JS_CTYPE_TYPE(at0), _JS_CTYPE_TYPE(at1), _JS_CTYPE_TYPE(at2)), \ - (_JS_CTYPE_ARGSIZE(at0) << (3*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at1) << (2*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at2) << (1*nanojit::ARGSIZE_SHIFT)) | \ - _JS_CTYPE_RETSIZE(rt), \ + _JS_DEFINE_CALLINFO(linkage, op, \ + _JS_CTYPE_TYPE(rt), \ + (_JS_CTYPE_TYPE(at0), \ + _JS_CTYPE_TYPE(at1), \ + _JS_CTYPE_TYPE(at2)), \ + nanojit::CallInfo::typeSig3(_JS_CTYPE_RETTYPE(rt), \ + _JS_CTYPE_ARGTYPE(at0), \ + _JS_CTYPE_ARGTYPE(at1), \ + _JS_CTYPE_ARGTYPE(at2)), \ cse, fold) #define JS_DEFINE_CALLINFO_4(linkage, rt, op, at0, at1, at2, at3, cse, fold) \ - _JS_DEFINE_CALLINFO(linkage, op, _JS_CTYPE_TYPE(rt), \ - (_JS_CTYPE_TYPE(at0), _JS_CTYPE_TYPE(at1), _JS_CTYPE_TYPE(at2), \ + _JS_DEFINE_CALLINFO(linkage, op, \ + _JS_CTYPE_TYPE(rt), \ + (_JS_CTYPE_TYPE(at0), \ + _JS_CTYPE_TYPE(at1), \ + _JS_CTYPE_TYPE(at2), \ _JS_CTYPE_TYPE(at3)), \ - (_JS_CTYPE_ARGSIZE(at0) << (4*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at1) << (3*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at2) << (2*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at3) << (1*nanojit::ARGSIZE_SHIFT)) | \ - _JS_CTYPE_RETSIZE(rt), \ + nanojit::CallInfo::typeSig4(_JS_CTYPE_RETTYPE(rt), \ + _JS_CTYPE_ARGTYPE(at0), \ + _JS_CTYPE_ARGTYPE(at1), \ + _JS_CTYPE_ARGTYPE(at2), \ + _JS_CTYPE_ARGTYPE(at3)), \ cse, fold) #define JS_DEFINE_CALLINFO_5(linkage, rt, op, at0, at1, at2, at3, at4, cse, fold) \ - _JS_DEFINE_CALLINFO(linkage, op, _JS_CTYPE_TYPE(rt), \ - (_JS_CTYPE_TYPE(at0), _JS_CTYPE_TYPE(at1), _JS_CTYPE_TYPE(at2), \ - _JS_CTYPE_TYPE(at3), _JS_CTYPE_TYPE(at4)), \ - (_JS_CTYPE_ARGSIZE(at0) << (5*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at1) << (4*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at2) << (3*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at3) << (2*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at4) << (1*nanojit::ARGSIZE_SHIFT)) | \ - _JS_CTYPE_RETSIZE(rt), \ + _JS_DEFINE_CALLINFO(linkage, op, \ + _JS_CTYPE_TYPE(rt), \ + (_JS_CTYPE_TYPE(at0), \ + _JS_CTYPE_TYPE(at1), \ + _JS_CTYPE_TYPE(at2), \ + _JS_CTYPE_TYPE(at3), \ + _JS_CTYPE_TYPE(at4)), \ + nanojit::CallInfo::typeSig5(_JS_CTYPE_RETTYPE(rt), \ + _JS_CTYPE_ARGTYPE(at0), \ + _JS_CTYPE_ARGTYPE(at1), \ + _JS_CTYPE_ARGTYPE(at2), \ + _JS_CTYPE_ARGTYPE(at3), \ + _JS_CTYPE_ARGTYPE(at4)), \ cse, fold) #define JS_DEFINE_CALLINFO_6(linkage, rt, op, at0, at1, at2, at3, at4, at5, cse, fold) \ - _JS_DEFINE_CALLINFO(linkage, op, _JS_CTYPE_TYPE(rt), \ - (_JS_CTYPE_TYPE(at0), _JS_CTYPE_TYPE(at1), _JS_CTYPE_TYPE(at2), \ - _JS_CTYPE_TYPE(at3), _JS_CTYPE_TYPE(at4), _JS_CTYPE_TYPE(at5)), \ - (_JS_CTYPE_ARGSIZE(at0) << (6*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at1) << (5*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at2) << (4*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at3) << (3*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at4) << (2*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at5) << (1*nanojit::ARGSIZE_SHIFT)) | \ - _JS_CTYPE_RETSIZE(rt), cse, fold) + _JS_DEFINE_CALLINFO(linkage, op, \ + _JS_CTYPE_TYPE(rt), \ + (_JS_CTYPE_TYPE(at0), \ + _JS_CTYPE_TYPE(at1), \ + _JS_CTYPE_TYPE(at2), \ + _JS_CTYPE_TYPE(at3), \ + _JS_CTYPE_TYPE(at4), \ + _JS_CTYPE_TYPE(at5)), \ + nanojit::CallInfo::typeSig6(_JS_CTYPE_RETTYPE(rt), \ + _JS_CTYPE_ARGTYPE(at0), \ + _JS_CTYPE_ARGTYPE(at1), \ + _JS_CTYPE_ARGTYPE(at2), \ + _JS_CTYPE_ARGTYPE(at3), \ + _JS_CTYPE_ARGTYPE(at4), \ + _JS_CTYPE_ARGTYPE(at5)), \ + cse, fold) #define JS_DEFINE_CALLINFO_7(linkage, rt, op, at0, at1, at2, at3, at4, at5, at6, cse, fold) \ - _JS_DEFINE_CALLINFO(linkage, op, _JS_CTYPE_TYPE(rt), \ - (_JS_CTYPE_TYPE(at0), _JS_CTYPE_TYPE(at1), _JS_CTYPE_TYPE(at2), \ - _JS_CTYPE_TYPE(at3), _JS_CTYPE_TYPE(at4), _JS_CTYPE_TYPE(at5), \ + _JS_DEFINE_CALLINFO(linkage, op, \ + _JS_CTYPE_TYPE(rt), \ + (_JS_CTYPE_TYPE(at0), \ + _JS_CTYPE_TYPE(at1), \ + _JS_CTYPE_TYPE(at2), \ + _JS_CTYPE_TYPE(at3), \ + _JS_CTYPE_TYPE(at4), \ + _JS_CTYPE_TYPE(at5), \ _JS_CTYPE_TYPE(at6)), \ - (_JS_CTYPE_ARGSIZE(at0) << (7*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at1) << (6*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at2) << (5*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at3) << (4*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at4) << (3*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at5) << (2*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at6) << (1*nanojit::ARGSIZE_SHIFT)) | \ - _JS_CTYPE_RETSIZE(rt), cse, fold) + nanojit::CallInfo::typeSig7(_JS_CTYPE_RETTYPE(rt), \ + _JS_CTYPE_ARGTYPE(at0), \ + _JS_CTYPE_ARGTYPE(at1), \ + _JS_CTYPE_ARGTYPE(at2), \ + _JS_CTYPE_ARGTYPE(at3), \ + _JS_CTYPE_ARGTYPE(at4), \ + _JS_CTYPE_ARGTYPE(at5), \ + _JS_CTYPE_ARGTYPE(at6)), \ + cse, fold) #define JS_DEFINE_CALLINFO_8(linkage, rt, op, at0, at1, at2, at3, at4, at5, at6, at7, cse, fold) \ - _JS_DEFINE_CALLINFO(linkage, op, _JS_CTYPE_TYPE(rt), \ - (_JS_CTYPE_TYPE(at0), _JS_CTYPE_TYPE(at1), _JS_CTYPE_TYPE(at2), \ - _JS_CTYPE_TYPE(at3), _JS_CTYPE_TYPE(at4), _JS_CTYPE_TYPE(at5), \ - _JS_CTYPE_TYPE(at6), _JS_CTYPE_TYPE(at7)), \ - (_JS_CTYPE_ARGSIZE(at0) << (8*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at1) << (7*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at2) << (6*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at3) << (5*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at4) << (4*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at5) << (3*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at6) << (2*nanojit::ARGSIZE_SHIFT)) | \ - (_JS_CTYPE_ARGSIZE(at7) << (1*nanojit::ARGSIZE_SHIFT)) | \ - _JS_CTYPE_RETSIZE(rt), cse, fold) + _JS_DEFINE_CALLINFO(linkage, op, \ + _JS_CTYPE_TYPE(rt), \ + (_JS_CTYPE_TYPE(at0), \ + _JS_CTYPE_TYPE(at1), \ + _JS_CTYPE_TYPE(at2), \ + _JS_CTYPE_TYPE(at3), \ + _JS_CTYPE_TYPE(at4), \ + _JS_CTYPE_TYPE(at5), \ + _JS_CTYPE_TYPE(at6), \ + _JS_CTYPE_TYPE(at7)), \ + nanojit::CallInfo::typeSig8(_JS_CTYPE_RETTYPE(rt), \ + _JS_CTYPE_ARGTYPE(at0), \ + _JS_CTYPE_ARGTYPE(at1), \ + _JS_CTYPE_ARGTYPE(at2), \ + _JS_CTYPE_ARGTYPE(at3), \ + _JS_CTYPE_ARGTYPE(at4), \ + _JS_CTYPE_ARGTYPE(at5), \ + _JS_CTYPE_ARGTYPE(at6), \ + _JS_CTYPE_ARGTYPE(at7)), \ + cse, fold) #define JS_DECLARE_CALLINFO(name) extern const nanojit::CallInfo _JS_CALLINFO(name); diff --git a/js/src/jstracer.cpp b/js/src/jstracer.cpp index eeff98a6f052..2474df8a79fd 100644 --- a/js/src/jstracer.cpp +++ b/js/src/jstracer.cpp @@ -4949,7 +4949,7 @@ TraceRecorder::emitTreeCall(TreeFragment* inner, VMSideExit* exit, LIns* inner_s CallInfo* ci = new (traceAlloc()) CallInfo(); ci->_address = uintptr_t(inner->code()); JS_ASSERT(ci->_address); - ci->_argtypes = ARGSIZE_P | ARGSIZE_P << ARGSIZE_SHIFT; + ci->_typesig = CallInfo::typeSig1(ARGTYPE_P, ARGTYPE_P); ci->_cse = ci->_fold = 0; ci->_abi = ABI_FASTCALL; #ifdef DEBUG @@ -10454,11 +10454,7 @@ TraceRecorder::emitNativePropertyOp(JSScope* scope, JSScopeProperty* sprop, LIns CallInfo* ci = new (traceAlloc()) CallInfo(); ci->_address = uintptr_t(setflag ? sprop->setter : sprop->getter); - ci->_argtypes = ARGSIZE_I << (0*ARGSIZE_SHIFT) | - ARGSIZE_P << (1*ARGSIZE_SHIFT) | - ARGSIZE_P << (2*ARGSIZE_SHIFT) | - ARGSIZE_P << (3*ARGSIZE_SHIFT) | - ARGSIZE_P << (4*ARGSIZE_SHIFT); + ci->_typesig = CallInfo::typeSig4(ARGTYPE_I, ARGTYPE_P, ARGTYPE_P, ARGTYPE_P, ARGTYPE_P); ci->_cse = ci->_fold = 0; ci->_abi = ABI_CDECL; #ifdef DEBUG @@ -10805,7 +10801,7 @@ TraceRecorder::callNative(uintN argc, JSOp mode) } // Set up arguments for the JSNative or JSFastNative. - uint32 types; + uint32 typesig; if (fun->flags & JSFUN_FAST_NATIVE) { if (mode == JSOP_NEW) RETURN_STOP("untraceable fast native constructor"); @@ -10813,10 +10809,7 @@ TraceRecorder::callNative(uintN argc, JSOp mode) args[0] = invokevp_ins; args[1] = lir->insImm(argc); args[2] = cx_ins; - types = ARGSIZE_I << (0*ARGSIZE_SHIFT) | - ARGSIZE_P << (1*ARGSIZE_SHIFT) | - ARGSIZE_I << (2*ARGSIZE_SHIFT) | - ARGSIZE_P << (3*ARGSIZE_SHIFT); + typesig = CallInfo::typeSig3(ARGTYPE_I, ARGTYPE_P, ARGTYPE_I, ARGTYPE_P); } else { int32_t offset = (vplen - 1) * sizeof(jsval); native_rval_ins = lir->ins2(LIR_piadd, invokevp_ins, INS_CONSTWORD(offset)); @@ -10825,12 +10818,8 @@ TraceRecorder::callNative(uintN argc, JSOp mode) args[2] = lir->insImm(argc); args[3] = this_ins; args[4] = cx_ins; - types = ARGSIZE_I << (0*ARGSIZE_SHIFT) | - ARGSIZE_P << (1*ARGSIZE_SHIFT) | - ARGSIZE_P << (2*ARGSIZE_SHIFT) | - ARGSIZE_I << (3*ARGSIZE_SHIFT) | - ARGSIZE_P << (4*ARGSIZE_SHIFT) | - ARGSIZE_P << (5*ARGSIZE_SHIFT); + typesig = CallInfo::typeSig5(ARGTYPE_I, + ARGTYPE_P, ARGTYPE_P, ARGTYPE_I, ARGTYPE_P, ARGTYPE_P); } // Generate CallInfo and a JSSpecializedNative structure on the fly. @@ -10841,7 +10830,7 @@ TraceRecorder::callNative(uintN argc, JSOp mode) ci->_address = uintptr_t(fun->u.n.native); ci->_cse = ci->_fold = 0; ci->_abi = ABI_CDECL; - ci->_argtypes = types; + ci->_typesig = typesig; #ifdef DEBUG ci->_name = JS_GetFunctionName(fun); #endif @@ -12636,7 +12625,7 @@ TraceRecorder::record_NativeCallComplete() } else { /* Convert the result to double if the builtin returns int32. */ if (JSVAL_IS_NUMBER(v) && - (pendingSpecializedNative->builtin->_argtypes & ARGSIZE_MASK_ANY) == ARGSIZE_I) { + pendingSpecializedNative->builtin->returnType() == ARGTYPE_I) { set(&v, lir->ins1(LIR_i2f, v_ins)); } }