73 |
uint16 extra; /* number of arg slots for local GC roots */ |
uint16 extra; /* number of arg slots for local GC roots */ |
74 |
uint16 spare; /* reserved for future use */ |
uint16 spare; /* reserved for future use */ |
75 |
JSNative native; /* native method pointer or null */ |
JSNative native; /* native method pointer or null */ |
76 |
JSClass *clasp; /* if non-null, constructor for this class */ |
union { |
77 |
|
JSClass *clasp; /* class of objects constructed |
78 |
|
by this function */ |
79 |
|
JSTraceableNative *trcinfo; /* tracer metadata; can be first |
80 |
|
element of array */ |
81 |
|
} u; |
82 |
} n; |
} n; |
83 |
struct { |
struct { |
84 |
uint16 nvars; /* number of local variables */ |
uint16 nvars; /* number of local variables */ |
91 |
JSAtom *atom; /* name for diagnostics and decompiling */ |
JSAtom *atom; /* name for diagnostics and decompiling */ |
92 |
}; |
}; |
93 |
|
|
94 |
|
#define JSFUN_TRACEABLE 0x2000 /* can trace across calls to this native |
95 |
|
function; use FUN_TRCINFO if set, |
96 |
|
FUN_CLASP if unset */ |
97 |
#define JSFUN_EXPR_CLOSURE 0x4000 /* expression closure: function(x)x*x */ |
#define JSFUN_EXPR_CLOSURE 0x4000 /* expression closure: function(x)x*x */ |
98 |
#define JSFUN_INTERPRETED 0x8000 /* use u.i if set, u.n if unset */ |
#define JSFUN_INTERPRETED 0x8000 /* use u.i if set, u.n if unset */ |
99 |
|
|
110 |
#define FUN_MINARGS(fun) (((fun)->flags & JSFUN_FAST_NATIVE) \ |
#define FUN_MINARGS(fun) (((fun)->flags & JSFUN_FAST_NATIVE) \ |
111 |
? 0 \ |
? 0 \ |
112 |
: (fun)->nargs) |
: (fun)->nargs) |
113 |
|
#define FUN_CLASP(fun) (JS_ASSERT(!FUN_INTERPRETED(fun)), \ |
114 |
|
JS_ASSERT(!((fun)->flags & JSFUN_TRACEABLE)), \ |
115 |
|
fun->u.n.u.clasp) |
116 |
|
#define FUN_TRCINFO(fun) (JS_ASSERT(!FUN_INTERPRETED(fun)), \ |
117 |
|
JS_ASSERT((fun)->flags & JSFUN_TRACEABLE), \ |
118 |
|
fun->u.n.u.trcinfo) |
119 |
|
|
120 |
|
/* |
121 |
|
* Traceable native. This expands to a JSFunctionSpec initializer (like JS_FN |
122 |
|
* in jsapi.h). fastcall is a JSFastNative; trcinfo is a JSTraceableNative *. |
123 |
|
*/ |
124 |
|
#ifdef JS_TRACER |
125 |
|
/* MSVC demands the intermediate (void *) cast here. */ |
126 |
|
# define JS_TN(name,fastcall,nargs,flags,trcinfo) \ |
127 |
|
{name, (JSNative)(void *)(trcinfo), nargs, \ |
128 |
|
(flags) | JSFUN_FAST_NATIVE | JSFUN_STUB_GSOPS | JSFUN_TRACEABLE, 0} |
129 |
|
#else |
130 |
|
# define JS_TN(name,fastcall,nargs,flags,trcinfo) \ |
131 |
|
JS_FN(name, fastcall, nargs, flags) |
132 |
|
#endif |
133 |
|
|
134 |
extern JSClass js_ArgumentsClass; |
extern JSClass js_ArgumentsClass; |
135 |
extern JS_FRIEND_DATA(JSClass) js_CallClass; |
extern JS_FRIEND_DATA(JSClass) js_CallClass; |
284 |
extern void |
extern void |
285 |
js_FreezeLocalNames(JSContext *cx, JSFunction *fun); |
js_FreezeLocalNames(JSContext *cx, JSFunction *fun); |
286 |
|
|
287 |
|
extern JSBool |
288 |
|
js_fun_apply(JSContext *cx, uintN argc, jsval *vp); |
289 |
|
|
290 |
|
extern JSBool |
291 |
|
js_fun_call(JSContext *cx, uintN argc, jsval *vp); |
292 |
|
|
293 |
|
|
294 |
JS_END_EXTERN_C |
JS_END_EXTERN_C |
295 |
|
|
296 |
#endif /* jsfun_h___ */ |
#endif /* jsfun_h___ */ |