1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * vim: set ts=4 sw=4 et tw=99:
4 * ***** BEGIN LICENSE BLOCK *****
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
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/
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
17 * The Original Code is Mozilla SpiderMonkey JavaScript 1.9 code, released
20 * The Initial Developer of the Original Code is
21 * Brendan Eich <brendan@mozilla.org>
24 * David Anderson <danderson@mozilla.com>
25 * David Mandelin <dmandelin@mozilla.com>
27 * Alternatively, the contents of this file may be used under the terms of
28 * either of the GNU General Public License Version 2 or later (the "GPL"),
29 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 * in which case the provisions of the GPL or the LGPL are applicable instead
31 * of those above. If you wish to allow use of your version of this file only
32 * under the terms of either the GPL or the LGPL, and not to allow others to
33 * use your version of this file under the terms of the MPL, indicate your
34 * decision by deleting the provisions above and replace them with the notice
35 * and other provisions required by the GPL or the LGPL. If you do not delete
36 * the provisions above, a recipient may use your version of this file under
37 * the terms of any one of the MPL, the GPL or the LGPL.
39 * ***** END LICENSE BLOCK ***** */
44 #include "MethodJIT.h"
50 typedef enum JSTrapType
{
56 void JS_FASTCALL
This(VMFrame
&f
);
57 JSObject
* JS_FASTCALL
NewInitArray(VMFrame
&f
, uint32 count
);
58 JSObject
* JS_FASTCALL
NewInitObject(VMFrame
&f
, JSObject
*base
);
59 void JS_FASTCALL
Trap(VMFrame
&f
, uint32 trapTypes
);
60 void JS_FASTCALL
Debugger(VMFrame
&f
, jsbytecode
*pc
);
61 void JS_FASTCALL
Interrupt(VMFrame
&f
, jsbytecode
*pc
);
62 void JS_FASTCALL
InitElem(VMFrame
&f
, uint32 last
);
63 void JS_FASTCALL
InitProp(VMFrame
&f
, JSAtom
*atom
);
64 void JS_FASTCALL
InitMethod(VMFrame
&f
, JSAtom
*atom
);
66 void JS_FASTCALL
HitStackQuota(VMFrame
&f
);
67 void * JS_FASTCALL
FixupArity(VMFrame
&f
, uint32 argc
);
68 void * JS_FASTCALL
CompileFunction(VMFrame
&f
, uint32 argc
);
69 void JS_FASTCALL
SlowNew(VMFrame
&f
, uint32 argc
);
70 void JS_FASTCALL
SlowCall(VMFrame
&f
, uint32 argc
);
71 void * JS_FASTCALL
UncachedNew(VMFrame
&f
, uint32 argc
);
72 void * JS_FASTCALL
UncachedCall(VMFrame
&f
, uint32 argc
);
73 void JS_FASTCALL
Eval(VMFrame
&f
, uint32 argc
);
74 void JS_FASTCALL
EnterScript(VMFrame
&f
);
75 void JS_FASTCALL
LeaveScript(VMFrame
&f
);
78 * Result struct for UncachedXHelper.
80 * These functions can have one of two results:
82 * (1) The function was executed in the interpreter. Then all fields
83 * are NULL except unjittable.
85 * (2) The function was not executed, and the function has been compiled
86 * to JM native code. Then all fields are non-NULL.
88 struct UncachedCallResult
{
89 JSObject
*callee
; // callee object
90 JSFunction
*fun
; // callee function
91 void *codeAddr
; // code address of compiled callee function
92 bool unjittable
; // did we try to JIT and fail?
103 * Helper functions for stubs and IC functions for calling functions.
104 * These functions either execute the function, return a native code
105 * pointer that can be used to call the function, or throw.
107 void UncachedCallHelper(VMFrame
&f
, uint32 argc
, UncachedCallResult
*ucr
);
108 void UncachedNewHelper(VMFrame
&f
, uint32 argc
, UncachedCallResult
*ucr
);
110 void JS_FASTCALL
CreateThis(VMFrame
&f
, JSObject
*proto
);
111 void JS_FASTCALL
Throw(VMFrame
&f
);
112 void JS_FASTCALL
PutStrictEvalCallObject(VMFrame
&f
);
113 void JS_FASTCALL
PutActivationObjects(VMFrame
&f
);
114 void JS_FASTCALL
GetCallObject(VMFrame
&f
);
116 void * JS_FASTCALL
InvokeTracer(VMFrame
&f
, ic::TraceICInfo
*tic
);
118 void * JS_FASTCALL
InvokeTracer(VMFrame
&f
);
121 void * JS_FASTCALL
LookupSwitch(VMFrame
&f
, jsbytecode
*pc
);
122 void * JS_FASTCALL
TableSwitch(VMFrame
&f
, jsbytecode
*origPc
);
124 void JS_FASTCALL
BindName(VMFrame
&f
);
125 void JS_FASTCALL
BindNameNoCache(VMFrame
&f
, JSAtom
*atom
);
126 JSObject
* JS_FASTCALL
BindGlobalName(VMFrame
&f
);
127 template<JSBool strict
> void JS_FASTCALL
SetName(VMFrame
&f
, JSAtom
*atom
);
128 template<JSBool strict
> void JS_FASTCALL
SetPropNoCache(VMFrame
&f
, JSAtom
*atom
);
129 template<JSBool strict
> void JS_FASTCALL
SetGlobalName(VMFrame
&f
, JSAtom
*atom
);
130 template<JSBool strict
> void JS_FASTCALL
SetGlobalNameNoCache(VMFrame
&f
, JSAtom
*atom
);
131 void JS_FASTCALL
Name(VMFrame
&f
);
132 void JS_FASTCALL
GetProp(VMFrame
&f
);
133 void JS_FASTCALL
GetPropNoCache(VMFrame
&f
, JSAtom
*atom
);
134 void JS_FASTCALL
GetElem(VMFrame
&f
);
135 void JS_FASTCALL
CallElem(VMFrame
&f
);
136 template<JSBool strict
> void JS_FASTCALL
SetElem(VMFrame
&f
);
137 void JS_FASTCALL
Length(VMFrame
&f
);
138 void JS_FASTCALL
CallName(VMFrame
&f
);
139 void JS_FASTCALL
GetUpvar(VMFrame
&f
, uint32 index
);
140 void JS_FASTCALL
GetGlobalName(VMFrame
&f
);
142 template<JSBool strict
> void JS_FASTCALL
NameInc(VMFrame
&f
, JSAtom
*atom
);
143 template<JSBool strict
> void JS_FASTCALL
NameDec(VMFrame
&f
, JSAtom
*atom
);
144 template<JSBool strict
> void JS_FASTCALL
IncName(VMFrame
&f
, JSAtom
*atom
);
145 template<JSBool strict
> void JS_FASTCALL
DecName(VMFrame
&f
, JSAtom
*atom
);
146 template<JSBool strict
> void JS_FASTCALL
GlobalNameInc(VMFrame
&f
, JSAtom
*atom
);
147 template<JSBool strict
> void JS_FASTCALL
GlobalNameDec(VMFrame
&f
, JSAtom
*atom
);
148 template<JSBool strict
> void JS_FASTCALL
IncGlobalName(VMFrame
&f
, JSAtom
*atom
);
149 template<JSBool strict
> void JS_FASTCALL
DecGlobalName(VMFrame
&f
, JSAtom
*atom
);
150 template<JSBool strict
> void JS_FASTCALL
PropInc(VMFrame
&f
, JSAtom
*atom
);
151 template<JSBool strict
> void JS_FASTCALL
PropDec(VMFrame
&f
, JSAtom
*atom
);
152 template<JSBool strict
> void JS_FASTCALL
IncProp(VMFrame
&f
, JSAtom
*atom
);
153 template<JSBool strict
> void JS_FASTCALL
DecProp(VMFrame
&f
, JSAtom
*atom
);
154 template<JSBool strict
> void JS_FASTCALL
ElemInc(VMFrame
&f
);
155 template<JSBool strict
> void JS_FASTCALL
ElemDec(VMFrame
&f
);
156 template<JSBool strict
> void JS_FASTCALL
IncElem(VMFrame
&f
);
157 template<JSBool strict
> void JS_FASTCALL
DecElem(VMFrame
&f
);
158 void JS_FASTCALL
CallProp(VMFrame
&f
, JSAtom
*atom
);
159 template <JSBool strict
> void JS_FASTCALL
DelProp(VMFrame
&f
, JSAtom
*atom
);
160 template <JSBool strict
> void JS_FASTCALL
DelElem(VMFrame
&f
);
161 void JS_FASTCALL
DelName(VMFrame
&f
, JSAtom
*atom
);
162 JSBool JS_FASTCALL
In(VMFrame
&f
);
164 void JS_FASTCALL
DefVarOrConst(VMFrame
&f
, JSAtom
*atom
);
165 void JS_FASTCALL
SetConst(VMFrame
&f
, JSAtom
*atom
);
166 template<JSBool strict
> void JS_FASTCALL
DefFun(VMFrame
&f
, JSFunction
*fun
);
167 JSObject
* JS_FASTCALL
DefLocalFun(VMFrame
&f
, JSFunction
*fun
);
168 JSObject
* JS_FASTCALL
DefLocalFun_FC(VMFrame
&f
, JSFunction
*fun
);
169 JSObject
* JS_FASTCALL
RegExp(VMFrame
&f
, JSObject
*regex
);
170 JSObject
* JS_FASTCALL
Lambda(VMFrame
&f
, JSFunction
*fun
);
171 JSObject
* JS_FASTCALL
LambdaForInit(VMFrame
&f
, JSFunction
*fun
);
172 JSObject
* JS_FASTCALL
LambdaForSet(VMFrame
&f
, JSFunction
*fun
);
173 JSObject
* JS_FASTCALL
LambdaJoinableForCall(VMFrame
&f
, JSFunction
*fun
);
174 JSObject
* JS_FASTCALL
LambdaJoinableForNull(VMFrame
&f
, JSFunction
*fun
);
175 JSObject
* JS_FASTCALL
FlatLambda(VMFrame
&f
, JSFunction
*fun
);
176 void JS_FASTCALL
Arguments(VMFrame
&f
);
177 void JS_FASTCALL
ArgSub(VMFrame
&f
, uint32 n
);
178 void JS_FASTCALL
EnterBlock(VMFrame
&f
, JSObject
*obj
);
179 void JS_FASTCALL
LeaveBlock(VMFrame
&f
, JSObject
*blockChain
);
181 JSBool JS_FASTCALL
LessThan(VMFrame
&f
);
182 JSBool JS_FASTCALL
LessEqual(VMFrame
&f
);
183 JSBool JS_FASTCALL
GreaterThan(VMFrame
&f
);
184 JSBool JS_FASTCALL
GreaterEqual(VMFrame
&f
);
185 JSBool JS_FASTCALL
Equal(VMFrame
&f
);
186 JSBool JS_FASTCALL
NotEqual(VMFrame
&f
);
188 void JS_FASTCALL
BitOr(VMFrame
&f
);
189 void JS_FASTCALL
BitXor(VMFrame
&f
);
190 void JS_FASTCALL
BitAnd(VMFrame
&f
);
191 void JS_FASTCALL
BitNot(VMFrame
&f
);
192 void JS_FASTCALL
Lsh(VMFrame
&f
);
193 void JS_FASTCALL
Rsh(VMFrame
&f
);
194 void JS_FASTCALL
Ursh(VMFrame
&f
);
195 void JS_FASTCALL
Add(VMFrame
&f
);
196 void JS_FASTCALL
Sub(VMFrame
&f
);
197 void JS_FASTCALL
Mul(VMFrame
&f
);
198 void JS_FASTCALL
Div(VMFrame
&f
);
199 void JS_FASTCALL
Mod(VMFrame
&f
);
200 void JS_FASTCALL
Neg(VMFrame
&f
);
201 void JS_FASTCALL
Pos(VMFrame
&f
);
202 void JS_FASTCALL
Not(VMFrame
&f
);
203 void JS_FASTCALL
StrictEq(VMFrame
&f
);
204 void JS_FASTCALL
StrictNe(VMFrame
&f
);
206 void JS_FASTCALL
Iter(VMFrame
&f
, uint32 flags
);
207 void JS_FASTCALL
IterNext(VMFrame
&f
);
208 JSBool JS_FASTCALL
IterMore(VMFrame
&f
);
209 void JS_FASTCALL
EndIter(VMFrame
&f
);
211 JSBool JS_FASTCALL
ValueToBoolean(VMFrame
&f
);
212 JSString
* JS_FASTCALL
TypeOf(VMFrame
&f
);
213 JSBool JS_FASTCALL
InstanceOf(VMFrame
&f
);
214 void JS_FASTCALL
FastInstanceOf(VMFrame
&f
);
215 void JS_FASTCALL
ArgCnt(VMFrame
&f
);
216 void JS_FASTCALL
Unbrand(VMFrame
&f
);
218 template <bool strict
> int32 JS_FASTCALL
ConvertToTypedInt(JSContext
*cx
, Value
*vp
);
219 void JS_FASTCALL
ConvertToTypedFloat(JSContext
*cx
, Value
*vp
);
221 void JS_FASTCALL
Exception(VMFrame
&f
);
223 } /* namespace stubs */
226 * If COND is true, return A; otherwise, return B. This allows us to choose between
227 * function template instantiations without running afoul of C++'s overload resolution
228 * rules. (Try simplifying, and you'll either see the problem --- or have found a
231 template<typename FuncPtr
>
232 inline FuncPtr
FunctionTemplateConditional(bool cond
, FuncPtr a
, FuncPtr b
) {
236 }} /* namespace stubs,mjit,js */
239 js_InternalThrow(js::VMFrame
&f
);
241 #endif /* jslogic_h__ */