/[jscoverage]/trunk/js/jsbuiltins.h
ViewVC logotype

Annotation of /trunk/js/jsbuiltins.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 507 - (hide annotations)
Sun Jan 10 07:23:34 2010 UTC (9 years, 6 months ago) by siliconforks
File MIME type: text/plain
File size: 29346 byte(s)
Update SpiderMonkey from Firefox 3.6rc1.

1 siliconforks 399 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2     * vim: set ts=8 sw=4 et tw=99:
3     *
4     * ***** BEGIN LICENSE BLOCK *****
5     * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6     *
7     * The contents of this file are subject to the Mozilla Public License Version
8     * 1.1 (the "License"); you may not use this file except in compliance with
9     * the License. You may obtain a copy of the License at
10     * http://www.mozilla.org/MPL/
11     *
12     * Software distributed under the License is distributed on an "AS IS" basis,
13     * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14     * for the specific language governing rights and limitations under the
15     * License.
16     *
17     * The Original Code is Mozilla SpiderMonkey JavaScript 1.9 code, released
18     * May 28, 2008.
19     *
20     * The Initial Developer of the Original Code is
21     * Mozilla Corporation.
22     *
23     * Contributor(s):
24     * Jason Orendorff <jorendorff@mozilla.com>
25     *
26     * Alternatively, the contents of this file may be used under the terms of
27     * either of the GNU General Public License Version 2 or later (the "GPL"),
28     * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29     * in which case the provisions of the GPL or the LGPL are applicable instead
30     * of those above. If you wish to allow use of your version of this file only
31     * under the terms of either the GPL or the LGPL, and not to allow others to
32     * use your version of this file under the terms of the MPL, indicate your
33     * decision by deleting the provisions above and replace them with the notice
34     * and other provisions required by the GPL or the LGPL. If you do not delete
35     * the provisions above, a recipient may use your version of this file under
36     * the terms of any one of the MPL, the GPL or the LGPL.
37     *
38     * ***** END LICENSE BLOCK ***** */
39    
40     #ifndef jsbuiltins_h___
41     #define jsbuiltins_h___
42    
43     #ifdef JS_TRACER
44    
45     #include "nanojit/nanojit.h"
46    
47 siliconforks 507 #ifdef THIS
48     #undef THIS
49     #endif
50    
51 siliconforks 460 enum JSTNErrType { INFALLIBLE, FAIL_STATUS, FAIL_NULL, FAIL_NEG, FAIL_VOID, FAIL_COOKIE };
52     enum { JSTN_ERRTYPE_MASK = 0x07, JSTN_UNBOX_AFTER = 0x08, JSTN_MORE = 0x10,
53     JSTN_CONSTRUCTOR = 0x20 };
54 siliconforks 399
55     #define JSTN_ERRTYPE(jstn) ((jstn)->flags & JSTN_ERRTYPE_MASK)
56    
57     /*
58 siliconforks 507 * Type describing a type specialization of a JSFastNative.
59     *
60 siliconforks 399 * |prefix| and |argtypes| declare what arguments should be passed to the
61     * native function. |prefix| can contain the following characters:
62     *
63     * 'C': a JSContext* argument
64     * 'T': |this| as a JSObject* argument (bails if |this| is not an object)
65     * 'S': |this| as a JSString* argument (bails if |this| is not a string)
66     * 'R': a JSRuntime* argument
67     * 'P': the pc as a jsbytecode*
68     * 'D': |this| as a number (jsdouble)
69     * 'f': the function being called, as a JSObject*
70     * 'p': the .prototype of the function, as a JSObject*
71     *
72     * The corresponding things will get passed as arguments to the builtin in
73     * reverse order (so TC means JSContext* as the first arg, and the
74     * JSObject* for |this| as the second arg).
75     *
76     * |argtypes| can contain the following characters:
77     * 'd': a number (double) argument
78     * 'i': an integer argument
79     * 's': a JSString* argument
80     * 'o': a JSObject* argument
81     * 'r': a JSObject* argument that is of class js_RegExpClass
82     * 'f': a JSObject* argument that is of class js_FunctionClass
83     * 'v': a jsval argument (boxing whatever value is actually being passed in)
84     */
85 siliconforks 507 struct JSSpecializedNative {
86 siliconforks 399 const nanojit::CallInfo *builtin;
87     const char *prefix;
88     const char *argtypes;
89 siliconforks 507 uintN flags; /* JSTNErrType | JSTN_UNBOX_AFTER | JSTN_MORE |
90 siliconforks 460 JSTN_CONSTRUCTOR */
91 siliconforks 399 };
92    
93     /*
94 siliconforks 507 * Type holding extra trace-specific information about a fast native.
95     *
96     * 'specializations' points to a static array of available specializations
97     * terminated by the lack of having the JSTN_MORE flag set.
98     */
99     struct JSNativeTraceInfo {
100     JSFastNative native;
101     JSSpecializedNative *specializations;
102     };
103    
104     /*
105 siliconforks 399 * We use a magic boxed pointer value to represent error conditions that
106     * trigger a side exit. The address is so low that it should never be actually
107     * in use. If it is, a performance regression occurs, not an actual runtime
108     * error.
109     */
110 siliconforks 460 #define JSVAL_ERROR_COOKIE OBJECT_TO_JSVAL((JSObject*)0x10)
111 siliconforks 399
112     /* Macros used by JS_DEFINE_CALLINFOn. */
113     #ifdef DEBUG
114     #define _JS_CI_NAME(op) ,#op
115     #else
116     #define _JS_CI_NAME(op)
117     #endif
118    
119 siliconforks 507 #define _JS_I32_ARGSIZE nanojit::ARGSIZE_I
120     #define _JS_I32_RETSIZE nanojit::ARGSIZE_I
121     #define _JS_F64_ARGSIZE nanojit::ARGSIZE_F
122     #define _JS_F64_RETSIZE nanojit::ARGSIZE_F
123     #define _JS_PTR_ARGSIZE nanojit::ARGSIZE_P
124     #define _JS_PTR_RETSIZE nanojit::ARGSIZE_P
125 siliconforks 399
126 siliconforks 507 class ClosureVarInfo;
127    
128 siliconforks 399 /*
129 siliconforks 507 * Supported types for builtin functions.
130 siliconforks 399 *
131     * Types with -- for the two string fields are not permitted as argument types
132     * in JS_DEFINE_TRCINFO.
133     *
134 siliconforks 460 * There are three kinds of traceable-native error handling.
135 siliconforks 399 *
136 siliconforks 460 * - If a traceable native's return type ends with _FAIL, it always runs to
137     * completion. It can either succeed or fail with an error or exception;
138     * on success, it may or may not stay on trace. There may be side effects
139     * in any case. If the call succeeds but bails off trace, we resume in the
140     * interpreter at the next opcode.
141     *
142     * _FAIL builtins indicate failure or bailing off trace by setting bits in
143     * cx->interpState->builtinStatus.
144     *
145     * - If a traceable native's return type contains _RETRY, it can either
146     * succeed, fail with a JS exception, or tell the caller to bail off trace
147     * and retry the call from the interpreter. The last case happens if the
148     * builtin discovers that it can't do its job without examining the JS
149     * stack, reentering the interpreter, accessing properties of the global
150     * object, etc.
151     *
152     * The builtin must detect the need to retry before committing any side
153     * effects. If a builtin can't do this, it must use a _FAIL return type
154     * instead of _RETRY.
155     *
156     * _RETRY builtins indicate failure with a special return value that
157     * depends on the return type:
158     *
159     * BOOL_RETRY: JSVAL_TO_BOOLEAN(JSVAL_VOID)
160     * INT32_RETRY: any negative value
161     * STRING_RETRY: NULL
162     * OBJECT_RETRY_NULL: NULL
163     * JSVAL_RETRY: JSVAL_ERROR_COOKIE
164     *
165     * _RETRY function calls are faster than _FAIL calls. Each _RETRY call
166     * saves two writes to cx->bailExit and a read from state->builtinStatus.
167     *
168     * - All other traceable natives are infallible (e.g. Date.now, Math.log).
169     *
170 siliconforks 399 * Special builtins known to the tracer can have their own idiosyncratic
171     * error codes.
172     *
173     * When a traceable native returns a value indicating failure, we fall off
174     * trace. If an exception is pending, it is thrown; otherwise, we assume the
175     * builtin had no side effects and retry the current bytecode in the
176     * interpreter.
177 siliconforks 507 *
178 siliconforks 399 * So a builtin must not return a value indicating failure after causing side
179     * effects (such as reporting an error), without setting an exception pending.
180     * The operation would be retried, despite the first attempt's observable
181     * effects.
182     */
183     #define _JS_CTYPE(ctype, size, pch, ach, flags) (ctype, size, pch, ach, flags)
184 siliconforks 460 #define _JS_JSVAL_CTYPE(size, pch, ach, flags) (jsval, size, pch, ach, (flags | JSTN_UNBOX_AFTER))
185 siliconforks 399
186 siliconforks 460 #define _JS_CTYPE_CONTEXT _JS_CTYPE(JSContext *, _JS_PTR,"C", "", INFALLIBLE)
187     #define _JS_CTYPE_RUNTIME _JS_CTYPE(JSRuntime *, _JS_PTR,"R", "", INFALLIBLE)
188     #define _JS_CTYPE_THIS _JS_CTYPE(JSObject *, _JS_PTR,"T", "", INFALLIBLE)
189     #define _JS_CTYPE_THIS_DOUBLE _JS_CTYPE(jsdouble, _JS_F64,"D", "", INFALLIBLE)
190     #define _JS_CTYPE_THIS_STRING _JS_CTYPE(JSString *, _JS_PTR,"S", "", INFALLIBLE)
191     #define _JS_CTYPE_CALLEE _JS_CTYPE(JSObject *, _JS_PTR,"f","", INFALLIBLE)
192     #define _JS_CTYPE_CALLEE_PROTOTYPE _JS_CTYPE(JSObject *, _JS_PTR,"p","", INFALLIBLE)
193 siliconforks 507 #define _JS_CTYPE_FUNCTION _JS_CTYPE(JSFunction *, _JS_PTR, --, --, INFALLIBLE)
194 siliconforks 460 #define _JS_CTYPE_PC _JS_CTYPE(jsbytecode *, _JS_PTR,"P", "", INFALLIBLE)
195     #define _JS_CTYPE_JSVALPTR _JS_CTYPE(jsval *, _JS_PTR,"P", "", INFALLIBLE)
196     #define _JS_CTYPE_JSVAL _JS_JSVAL_CTYPE( _JS_PTR, "","v", INFALLIBLE)
197     #define _JS_CTYPE_JSVAL_RETRY _JS_JSVAL_CTYPE( _JS_PTR, --, --, FAIL_COOKIE)
198     #define _JS_CTYPE_JSVAL_FAIL _JS_JSVAL_CTYPE( _JS_PTR, --, --, FAIL_STATUS)
199 siliconforks 507 #define _JS_CTYPE_JSID _JS_CTYPE(jsid, _JS_PTR, --, --, INFALLIBLE)
200 siliconforks 460 #define _JS_CTYPE_BOOL _JS_CTYPE(JSBool, _JS_I32, "","i", INFALLIBLE)
201     #define _JS_CTYPE_BOOL_RETRY _JS_CTYPE(JSBool, _JS_I32, --, --, FAIL_VOID)
202     #define _JS_CTYPE_BOOL_FAIL _JS_CTYPE(JSBool, _JS_I32, --, --, FAIL_STATUS)
203     #define _JS_CTYPE_INT32 _JS_CTYPE(int32, _JS_I32, "","i", INFALLIBLE)
204     #define _JS_CTYPE_INT32_RETRY _JS_CTYPE(int32, _JS_I32, --, --, FAIL_NEG)
205     #define _JS_CTYPE_INT32_FAIL _JS_CTYPE(int32, _JS_I32, --, --, FAIL_STATUS)
206     #define _JS_CTYPE_UINT32 _JS_CTYPE(uint32, _JS_I32, "","i", INFALLIBLE)
207     #define _JS_CTYPE_UINT32_RETRY _JS_CTYPE(uint32, _JS_I32, --, --, FAIL_NEG)
208     #define _JS_CTYPE_UINT32_FAIL _JS_CTYPE(uint32, _JS_I32, --, --, FAIL_STATUS)
209     #define _JS_CTYPE_DOUBLE _JS_CTYPE(jsdouble, _JS_F64, "","d", INFALLIBLE)
210     #define _JS_CTYPE_DOUBLE_FAIL _JS_CTYPE(jsdouble, _JS_F64, --, --, FAIL_STATUS)
211     #define _JS_CTYPE_STRING _JS_CTYPE(JSString *, _JS_PTR, "","s", INFALLIBLE)
212     #define _JS_CTYPE_STRING_RETRY _JS_CTYPE(JSString *, _JS_PTR, --, --, FAIL_NULL)
213     #define _JS_CTYPE_STRING_FAIL _JS_CTYPE(JSString *, _JS_PTR, --, --, FAIL_STATUS)
214 siliconforks 507 #define _JS_CTYPE_STRINGPTR _JS_CTYPE(JSString **, _JS_PTR, --, --, INFALLIBLE)
215 siliconforks 460 #define _JS_CTYPE_OBJECT _JS_CTYPE(JSObject *, _JS_PTR, "","o", INFALLIBLE)
216     #define _JS_CTYPE_OBJECT_RETRY _JS_CTYPE(JSObject *, _JS_PTR, --, --, FAIL_NULL)
217     #define _JS_CTYPE_OBJECT_FAIL _JS_CTYPE(JSObject *, _JS_PTR, --, --, FAIL_STATUS)
218     #define _JS_CTYPE_CONSTRUCTOR_RETRY _JS_CTYPE(JSObject *, _JS_PTR, --, --, FAIL_NULL | \
219     JSTN_CONSTRUCTOR)
220     #define _JS_CTYPE_REGEXP _JS_CTYPE(JSObject *, _JS_PTR, "","r", INFALLIBLE)
221     #define _JS_CTYPE_SCOPEPROP _JS_CTYPE(JSScopeProperty *, _JS_PTR, --, --, INFALLIBLE)
222     #define _JS_CTYPE_SIDEEXIT _JS_CTYPE(SideExit *, _JS_PTR, --, --, INFALLIBLE)
223     #define _JS_CTYPE_INTERPSTATE _JS_CTYPE(InterpState *, _JS_PTR, --, --, INFALLIBLE)
224     #define _JS_CTYPE_FRAGMENT _JS_CTYPE(nanojit::Fragment *, _JS_PTR, --, --, INFALLIBLE)
225     #define _JS_CTYPE_CLASS _JS_CTYPE(JSClass *, _JS_PTR, --, --, INFALLIBLE)
226     #define _JS_CTYPE_DOUBLEPTR _JS_CTYPE(double *, _JS_PTR, --, --, INFALLIBLE)
227 siliconforks 507 #define _JS_CTYPE_CHARPTR _JS_CTYPE(char *, _JS_PTR, --, --, INFALLIBLE)
228     #define _JS_CTYPE_APNPTR _JS_CTYPE(js_ArgsPrivateNative *, _JS_PTR, --, --, INFALLIBLE)
229     #define _JS_CTYPE_CVIPTR _JS_CTYPE(const ClosureVarInfo *, _JS_PTR, --, --, INFALLIBLE)
230 siliconforks 460
231 siliconforks 399 #define _JS_EXPAND(tokens) tokens
232    
233     #define _JS_CTYPE_TYPE2(t,s,p,a,f) t
234     #define _JS_CTYPE_TYPE(tyname) _JS_EXPAND(_JS_CTYPE_TYPE2 _JS_CTYPE_##tyname)
235     #define _JS_CTYPE_RETSIZE2(t,s,p,a,f) s##_RETSIZE
236     #define _JS_CTYPE_RETSIZE(tyname) _JS_EXPAND(_JS_CTYPE_RETSIZE2 _JS_CTYPE_##tyname)
237     #define _JS_CTYPE_ARGSIZE2(t,s,p,a,f) s##_ARGSIZE
238     #define _JS_CTYPE_ARGSIZE(tyname) _JS_EXPAND(_JS_CTYPE_ARGSIZE2 _JS_CTYPE_##tyname)
239     #define _JS_CTYPE_PCH2(t,s,p,a,f) p
240     #define _JS_CTYPE_PCH(tyname) _JS_EXPAND(_JS_CTYPE_PCH2 _JS_CTYPE_##tyname)
241     #define _JS_CTYPE_ACH2(t,s,p,a,f) a
242     #define _JS_CTYPE_ACH(tyname) _JS_EXPAND(_JS_CTYPE_ACH2 _JS_CTYPE_##tyname)
243     #define _JS_CTYPE_FLAGS2(t,s,p,a,f) f
244     #define _JS_CTYPE_FLAGS(tyname) _JS_EXPAND(_JS_CTYPE_FLAGS2 _JS_CTYPE_##tyname)
245    
246     #define _JS_static_TN(t) static t
247     #define _JS_static_CI static
248     #define _JS_extern_TN(t) extern t
249     #define _JS_extern_CI
250     #define _JS_FRIEND_TN(t) extern JS_FRIEND_API(t)
251     #define _JS_FRIEND_CI
252     #define _JS_TN_LINKAGE(linkage, t) _JS_##linkage##_TN(t)
253     #define _JS_CI_LINKAGE(linkage) _JS_##linkage##_CI
254    
255     #define _JS_CALLINFO(name) name##_ci
256    
257     #if defined(JS_NO_FASTCALL) && defined(NANOJIT_IA32)
258     #define _JS_DEFINE_CALLINFO(linkage, name, crtype, cargtypes, argtypes, cse, fold) \
259     _JS_TN_LINKAGE(linkage, crtype) name cargtypes; \
260     _JS_CI_LINKAGE(linkage) const nanojit::CallInfo _JS_CALLINFO(name) = \
261     { (intptr_t) &name, argtypes, cse, fold, nanojit::ABI_CDECL _JS_CI_NAME(name) };
262     #else
263     #define _JS_DEFINE_CALLINFO(linkage, name, crtype, cargtypes, argtypes, cse, fold) \
264     _JS_TN_LINKAGE(linkage, crtype) FASTCALL name cargtypes; \
265     _JS_CI_LINKAGE(linkage) const nanojit::CallInfo _JS_CALLINFO(name) = \
266     { (intptr_t) &name, argtypes, cse, fold, nanojit::ABI_FASTCALL _JS_CI_NAME(name) };
267     #endif
268    
269     /*
270 siliconforks 507 * This macro is used for builtin functions that can be called from JITted
271     * code. It declares a C function named <op> and a CallInfo struct named
272     * <op>_ci so the tracer can call it. The <N> in JS_DEFINE_CALLINFO_<N> is
273     * the number of arguments the builtin takes. Builtins with no arguments
274     * are not supported. Using a macro is clunky but ensures that the types
275     * for each C function matches those for the corresponding CallInfo struct;
276     * mismatched types can cause subtle problems.
277     *
278     * The macro arguments are:
279     *
280     * - The linkage for the function and the associated CallInfo global. It
281     * can be extern, static, or FRIEND, which specifies JS_FRIEND_API linkage
282     * for the function.
283     *
284     * - The return type. This identifier must name one of the _JS_TYPEINFO_*
285     * macros defined in jsbuiltins.h.
286     *
287     * - The builtin name.
288     *
289     * - The parameter types.
290     *
291     * - The cse flag. 1 if the builtin call can be optimized away by common
292     * subexpression elimination; otherwise 0. This should be 1 only if the
293     * function is idempotent and the return value is determined solely by the
294     * arguments.
295     *
296     * - The fold flag. Reserved. The same as cse for now.
297 siliconforks 399 */
298     #define JS_DEFINE_CALLINFO_1(linkage, rt, op, at0, cse, fold) \
299     _JS_DEFINE_CALLINFO(linkage, op, _JS_CTYPE_TYPE(rt), (_JS_CTYPE_TYPE(at0)), \
300 siliconforks 507 (_JS_CTYPE_ARGSIZE(at0) << (1*nanojit::ARGSIZE_SHIFT)) | \
301     _JS_CTYPE_RETSIZE(rt), cse, fold)
302 siliconforks 399 #define JS_DEFINE_CALLINFO_2(linkage, rt, op, at0, at1, cse, fold) \
303     _JS_DEFINE_CALLINFO(linkage, op, _JS_CTYPE_TYPE(rt), \
304     (_JS_CTYPE_TYPE(at0), _JS_CTYPE_TYPE(at1)), \
305 siliconforks 507 (_JS_CTYPE_ARGSIZE(at0) << (2*nanojit::ARGSIZE_SHIFT)) | \
306     (_JS_CTYPE_ARGSIZE(at1) << (1*nanojit::ARGSIZE_SHIFT)) | \
307 siliconforks 399 _JS_CTYPE_RETSIZE(rt), \
308     cse, fold)
309     #define JS_DEFINE_CALLINFO_3(linkage, rt, op, at0, at1, at2, cse, fold) \
310     _JS_DEFINE_CALLINFO(linkage, op, _JS_CTYPE_TYPE(rt), \
311     (_JS_CTYPE_TYPE(at0), _JS_CTYPE_TYPE(at1), _JS_CTYPE_TYPE(at2)), \
312 siliconforks 507 (_JS_CTYPE_ARGSIZE(at0) << (3*nanojit::ARGSIZE_SHIFT)) | \
313     (_JS_CTYPE_ARGSIZE(at1) << (2*nanojit::ARGSIZE_SHIFT)) | \
314     (_JS_CTYPE_ARGSIZE(at2) << (1*nanojit::ARGSIZE_SHIFT)) | \
315     _JS_CTYPE_RETSIZE(rt), \
316 siliconforks 399 cse, fold)
317     #define JS_DEFINE_CALLINFO_4(linkage, rt, op, at0, at1, at2, at3, cse, fold) \
318     _JS_DEFINE_CALLINFO(linkage, op, _JS_CTYPE_TYPE(rt), \
319     (_JS_CTYPE_TYPE(at0), _JS_CTYPE_TYPE(at1), _JS_CTYPE_TYPE(at2), \
320     _JS_CTYPE_TYPE(at3)), \
321 siliconforks 507 (_JS_CTYPE_ARGSIZE(at0) << (4*nanojit::ARGSIZE_SHIFT)) | \
322     (_JS_CTYPE_ARGSIZE(at1) << (3*nanojit::ARGSIZE_SHIFT)) | \
323     (_JS_CTYPE_ARGSIZE(at2) << (2*nanojit::ARGSIZE_SHIFT)) | \
324     (_JS_CTYPE_ARGSIZE(at3) << (1*nanojit::ARGSIZE_SHIFT)) | \
325 siliconforks 399 _JS_CTYPE_RETSIZE(rt), \
326     cse, fold)
327     #define JS_DEFINE_CALLINFO_5(linkage, rt, op, at0, at1, at2, at3, at4, cse, fold) \
328     _JS_DEFINE_CALLINFO(linkage, op, _JS_CTYPE_TYPE(rt), \
329     (_JS_CTYPE_TYPE(at0), _JS_CTYPE_TYPE(at1), _JS_CTYPE_TYPE(at2), \
330     _JS_CTYPE_TYPE(at3), _JS_CTYPE_TYPE(at4)), \
331 siliconforks 507 (_JS_CTYPE_ARGSIZE(at0) << (5*nanojit::ARGSIZE_SHIFT)) | \
332     (_JS_CTYPE_ARGSIZE(at1) << (4*nanojit::ARGSIZE_SHIFT)) | \
333     (_JS_CTYPE_ARGSIZE(at2) << (3*nanojit::ARGSIZE_SHIFT)) | \
334     (_JS_CTYPE_ARGSIZE(at3) << (2*nanojit::ARGSIZE_SHIFT)) | \
335     (_JS_CTYPE_ARGSIZE(at4) << (1*nanojit::ARGSIZE_SHIFT)) | \
336     _JS_CTYPE_RETSIZE(rt), \
337 siliconforks 399 cse, fold)
338    
339 siliconforks 460 #define JS_DEFINE_CALLINFO_6(linkage, rt, op, at0, at1, at2, at3, at4, at5, cse, fold) \
340     _JS_DEFINE_CALLINFO(linkage, op, _JS_CTYPE_TYPE(rt), \
341     (_JS_CTYPE_TYPE(at0), _JS_CTYPE_TYPE(at1), _JS_CTYPE_TYPE(at2), \
342     _JS_CTYPE_TYPE(at3), _JS_CTYPE_TYPE(at4), _JS_CTYPE_TYPE(at5)), \
343 siliconforks 507 (_JS_CTYPE_ARGSIZE(at0) << (6*nanojit::ARGSIZE_SHIFT)) | \
344     (_JS_CTYPE_ARGSIZE(at1) << (5*nanojit::ARGSIZE_SHIFT)) | \
345     (_JS_CTYPE_ARGSIZE(at2) << (4*nanojit::ARGSIZE_SHIFT)) | \
346     (_JS_CTYPE_ARGSIZE(at3) << (3*nanojit::ARGSIZE_SHIFT)) | \
347     (_JS_CTYPE_ARGSIZE(at4) << (2*nanojit::ARGSIZE_SHIFT)) | \
348     (_JS_CTYPE_ARGSIZE(at5) << (1*nanojit::ARGSIZE_SHIFT)) | \
349 siliconforks 460 _JS_CTYPE_RETSIZE(rt), cse, fold)
350    
351 siliconforks 399 #define JS_DECLARE_CALLINFO(name) extern const nanojit::CallInfo _JS_CALLINFO(name);
352    
353     #define _JS_TN_INIT_HELPER_n(n, args) _JS_TN_INIT_HELPER_##n args
354    
355     #define _JS_TN_INIT_HELPER_1(linkage, rt, op, at0, cse, fold) \
356     &_JS_CALLINFO(op), \
357     _JS_CTYPE_PCH(at0), \
358     _JS_CTYPE_ACH(at0), \
359     _JS_CTYPE_FLAGS(rt)
360    
361     #define _JS_TN_INIT_HELPER_2(linkage, rt, op, at0, at1, cse, fold) \
362     &_JS_CALLINFO(op), \
363     _JS_CTYPE_PCH(at1) _JS_CTYPE_PCH(at0), \
364 siliconforks 460 _JS_CTYPE_ACH(at1) _JS_CTYPE_ACH(at0), \
365 siliconforks 399 _JS_CTYPE_FLAGS(rt)
366    
367     #define _JS_TN_INIT_HELPER_3(linkage, rt, op, at0, at1, at2, cse, fold) \
368     &_JS_CALLINFO(op), \
369     _JS_CTYPE_PCH(at2) _JS_CTYPE_PCH(at1) _JS_CTYPE_PCH(at0), \
370 siliconforks 460 _JS_CTYPE_ACH(at2) _JS_CTYPE_ACH(at1) _JS_CTYPE_ACH(at0), \
371 siliconforks 399 _JS_CTYPE_FLAGS(rt)
372    
373     #define _JS_TN_INIT_HELPER_4(linkage, rt, op, at0, at1, at2, at3, cse, fold) \
374     &_JS_CALLINFO(op), \
375     _JS_CTYPE_PCH(at3) _JS_CTYPE_PCH(at2) _JS_CTYPE_PCH(at1) _JS_CTYPE_PCH(at0), \
376 siliconforks 460 _JS_CTYPE_ACH(at3) _JS_CTYPE_ACH(at2) _JS_CTYPE_ACH(at1) _JS_CTYPE_ACH(at0), \
377 siliconforks 399 _JS_CTYPE_FLAGS(rt)
378    
379     #define _JS_TN_INIT_HELPER_5(linkage, rt, op, at0, at1, at2, at3, at4, cse, fold) \
380     &_JS_CALLINFO(op), \
381     _JS_CTYPE_PCH(at4) _JS_CTYPE_PCH(at3) _JS_CTYPE_PCH(at2) _JS_CTYPE_PCH(at1) \
382     _JS_CTYPE_PCH(at0), \
383 siliconforks 460 _JS_CTYPE_ACH(at4) _JS_CTYPE_ACH(at3) _JS_CTYPE_ACH(at2) _JS_CTYPE_ACH(at1) \
384     _JS_CTYPE_ACH(at0), \
385 siliconforks 399 _JS_CTYPE_FLAGS(rt)
386    
387 siliconforks 460 #define _JS_TN_INIT_HELPER_6(linkage, rt, op, at0, at1, at2, at3, at4, at5, cse, fold) \
388     &_JS_CALLINFO(op), \
389     _JS_CTYPE_PCH(at5) _JS_CTYPE_PCH(at4) _JS_CTYPE_PCH(at3) _JS_CTYPE_PCH(at2) \
390     _JS_CTYPE_PCH(at1) _JS_CTYPE_PCH(at0), \
391     _JS_CTYPE_ACH(at5) _JS_CTYPE_ACH(at4) _JS_CTYPE_ACH(at3) _JS_CTYPE_ACH(at2) \
392     _JS_CTYPE_ACH(at1) _JS_CTYPE_ACH(at0), \
393     _JS_CTYPE_FLAGS(rt)
394    
395 siliconforks 399 #define JS_DEFINE_TRCINFO_1(name, tn0) \
396     _JS_DEFINE_CALLINFO_n tn0 \
397 siliconforks 507 JSSpecializedNative name##_sns[] = { \
398     { _JS_TN_INIT_HELPER_n tn0 } \
399     }; \
400     JSNativeTraceInfo name##_trcinfo = { (JSFastNative)name, name##_sns };
401 siliconforks 399
402     #define JS_DEFINE_TRCINFO_2(name, tn0, tn1) \
403     _JS_DEFINE_CALLINFO_n tn0 \
404     _JS_DEFINE_CALLINFO_n tn1 \
405 siliconforks 507 JSSpecializedNative name##_sns[] = { \
406     { _JS_TN_INIT_HELPER_n tn0 | JSTN_MORE }, \
407     { _JS_TN_INIT_HELPER_n tn1 } \
408     }; \
409     JSNativeTraceInfo name##_trcinfo = { (JSFastNative)name, name##_sns };
410 siliconforks 399
411     #define JS_DEFINE_TRCINFO_3(name, tn0, tn1, tn2) \
412     _JS_DEFINE_CALLINFO_n tn0 \
413     _JS_DEFINE_CALLINFO_n tn1 \
414     _JS_DEFINE_CALLINFO_n tn2 \
415 siliconforks 507 JSSpecializedNative name##_sns[] = { \
416     { _JS_TN_INIT_HELPER_n tn0 | JSTN_MORE }, \
417     { _JS_TN_INIT_HELPER_n tn1 | JSTN_MORE }, \
418     { _JS_TN_INIT_HELPER_n tn2 } \
419     }; \
420     JSNativeTraceInfo name##_trcinfo = { (JSFastNative)name, name##_sns };
421 siliconforks 399
422     #define JS_DEFINE_TRCINFO_4(name, tn0, tn1, tn2, tn3) \
423     _JS_DEFINE_CALLINFO_n tn0 \
424     _JS_DEFINE_CALLINFO_n tn1 \
425     _JS_DEFINE_CALLINFO_n tn2 \
426     _JS_DEFINE_CALLINFO_n tn3 \
427 siliconforks 507 JSSpecializedNative name##_sns[] = { \
428     { _JS_TN_INIT_HELPER_n tn0 | JSTN_MORE }, \
429     { _JS_TN_INIT_HELPER_n tn1 | JSTN_MORE }, \
430     { _JS_TN_INIT_HELPER_n tn2 | JSTN_MORE }, \
431     { _JS_TN_INIT_HELPER_n tn3 } \
432     }; \
433     JSNativeTraceInfo name##_trcinfo = { (JSFastNative)name, name##_sns };
434 siliconforks 399
435     #define _JS_DEFINE_CALLINFO_n(n, args) JS_DEFINE_CALLINFO_##n args
436    
437     jsdouble FASTCALL
438     js_StringToNumber(JSContext* cx, JSString* str);
439    
440     jsdouble FASTCALL
441     js_BooleanOrUndefinedToNumber(JSContext* cx, int32 unboxed);
442    
443 siliconforks 460 /* Extern version of js_SetBuiltinError. */
444     extern JS_FRIEND_API(void)
445     js_SetTraceableNativeFailed(JSContext *cx);
446    
447 siliconforks 507 extern jsdouble FASTCALL
448     js_dmod(jsdouble a, jsdouble b);
449    
450 siliconforks 399 #else
451    
452     #define JS_DEFINE_CALLINFO_1(linkage, rt, op, at0, cse, fold)
453     #define JS_DEFINE_CALLINFO_2(linkage, rt, op, at0, at1, cse, fold)
454     #define JS_DEFINE_CALLINFO_3(linkage, rt, op, at0, at1, at2, cse, fold)
455     #define JS_DEFINE_CALLINFO_4(linkage, rt, op, at0, at1, at2, at3, cse, fold)
456     #define JS_DEFINE_CALLINFO_5(linkage, rt, op, at0, at1, at2, at3, at4, cse, fold)
457 siliconforks 507 #define JS_DEFINE_CALLINFO_6(linkage, rt, op, at0, at1, at2, at3, at4, at5, cse, fold)
458 siliconforks 399 #define JS_DECLARE_CALLINFO(name)
459     #define JS_DEFINE_TRCINFO_1(name, tn0)
460     #define JS_DEFINE_TRCINFO_2(name, tn0, tn1)
461     #define JS_DEFINE_TRCINFO_3(name, tn0, tn1, tn2)
462     #define JS_DEFINE_TRCINFO_4(name, tn0, tn1, tn2, tn3)
463    
464     #endif /* !JS_TRACER */
465    
466 siliconforks 460 /* Defined in jsobj.cpp. */
467     JS_DECLARE_CALLINFO(js_Object_tn)
468     JS_DECLARE_CALLINFO(js_NewInstance)
469    
470     /* Defined in jsarray.cpp. */
471 siliconforks 399 JS_DECLARE_CALLINFO(js_Array_dense_setelem)
472 siliconforks 507 JS_DECLARE_CALLINFO(js_Array_dense_setelem_int)
473     JS_DECLARE_CALLINFO(js_Array_dense_setelem_double)
474 siliconforks 460 JS_DECLARE_CALLINFO(js_NewEmptyArray)
475 siliconforks 507 JS_DECLARE_CALLINFO(js_NewEmptyArrayWithLength)
476 siliconforks 460 JS_DECLARE_CALLINFO(js_NewUninitializedArray)
477     JS_DECLARE_CALLINFO(js_ArrayCompPush)
478 siliconforks 399
479 siliconforks 507 /* Defined in jsfun.cpp. */
480     JS_DECLARE_CALLINFO(js_AllocFlatClosure)
481     JS_DECLARE_CALLINFO(js_PutArguments)
482    
483     /* Defined in jsfun.cpp. */
484     JS_DECLARE_CALLINFO(js_SetCallVar)
485     JS_DECLARE_CALLINFO(js_SetCallArg)
486    
487 siliconforks 460 /* Defined in jsnum.cpp. */
488 siliconforks 399 JS_DECLARE_CALLINFO(js_NumberToString)
489    
490 siliconforks 460 /* Defined in jsstr.cpp. */
491     JS_DECLARE_CALLINFO(js_String_tn)
492     JS_DECLARE_CALLINFO(js_CompareStrings)
493 siliconforks 399 JS_DECLARE_CALLINFO(js_ConcatStrings)
494 siliconforks 460 JS_DECLARE_CALLINFO(js_EqualStrings)
495 siliconforks 399 JS_DECLARE_CALLINFO(js_String_getelem)
496     JS_DECLARE_CALLINFO(js_String_p_charCodeAt)
497 siliconforks 460 JS_DECLARE_CALLINFO(js_String_p_charCodeAt0)
498     JS_DECLARE_CALLINFO(js_String_p_charCodeAt0_int)
499     JS_DECLARE_CALLINFO(js_String_p_charCodeAt_int)
500 siliconforks 399
501 siliconforks 460 /* Defined in jsbuiltins.cpp. */
502 siliconforks 507 JS_DECLARE_CALLINFO(js_BoxDouble)
503     JS_DECLARE_CALLINFO(js_BoxInt32)
504     JS_DECLARE_CALLINFO(js_UnboxDouble)
505     JS_DECLARE_CALLINFO(js_UnboxInt32)
506     JS_DECLARE_CALLINFO(js_dmod)
507     JS_DECLARE_CALLINFO(js_imod)
508     JS_DECLARE_CALLINFO(js_DoubleToInt32)
509     JS_DECLARE_CALLINFO(js_DoubleToUint32)
510 siliconforks 399
511 siliconforks 507 JS_DECLARE_CALLINFO(js_StringToNumber)
512     JS_DECLARE_CALLINFO(js_StringToInt32)
513     JS_DECLARE_CALLINFO(js_CloseIterator)
514     JS_DECLARE_CALLINFO(js_CallTree)
515     JS_DECLARE_CALLINFO(js_AddProperty)
516     JS_DECLARE_CALLINFO(js_HasNamedProperty)
517     JS_DECLARE_CALLINFO(js_HasNamedPropertyInt32)
518     JS_DECLARE_CALLINFO(js_TypeOfObject)
519     JS_DECLARE_CALLINFO(js_TypeOfBoolean)
520     JS_DECLARE_CALLINFO(js_BooleanOrUndefinedToNumber)
521     JS_DECLARE_CALLINFO(js_BooleanOrUndefinedToString)
522     JS_DECLARE_CALLINFO(js_Arguments)
523     JS_DECLARE_CALLINFO(js_NewNullClosure)
524     JS_DECLARE_CALLINFO(js_ConcatN)
525    
526 siliconforks 399 #endif /* jsbuiltins_h___ */

  ViewVC Help
Powered by ViewVC 1.1.24