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 void JS_FASTCALL
This(VMFrame
&f
);
51 void JS_FASTCALL
ComputeThis(VMFrame
&f
);
52 JSObject
* JS_FASTCALL
NewInitArray(VMFrame
&f
);
53 JSObject
* JS_FASTCALL
NewInitObject(VMFrame
&f
);
54 JSObject
* JS_FASTCALL
NewArray(VMFrame
&f
, uint32 len
);
55 void JS_FASTCALL
Trap(VMFrame
&f
, jsbytecode
*pc
);
56 void JS_FASTCALL
Debugger(VMFrame
&f
, jsbytecode
*pc
);
57 void JS_FASTCALL
Interrupt(VMFrame
&f
, jsbytecode
*pc
);
58 void JS_FASTCALL
InitElem(VMFrame
&f
, uint32 last
);
59 void JS_FASTCALL
InitProp(VMFrame
&f
, JSAtom
*atom
);
60 void JS_FASTCALL
InitMethod(VMFrame
&f
, JSAtom
*atom
);
62 void JS_FASTCALL
HitStackQuota(VMFrame
&f
);
63 void * JS_FASTCALL
FixupArity(VMFrame
&f
, uint32 argc
);
64 void * JS_FASTCALL
CompileFunction(VMFrame
&f
, uint32 argc
);
65 void JS_FASTCALL
SlowNew(VMFrame
&f
, uint32 argc
);
66 void JS_FASTCALL
SlowCall(VMFrame
&f
, uint32 argc
);
67 void * JS_FASTCALL
UncachedNew(VMFrame
&f
, uint32 argc
);
68 void * JS_FASTCALL
UncachedCall(VMFrame
&f
, uint32 argc
);
71 * Result struct for UncachedXHelper.
73 * These functions can have one of two results:
75 * (1) The function was executed in the interpreter. Then all fields
78 * (2) The function was not executed, and the function has been compiled
79 * to JM native code. Then all fields are non-NULL.
81 struct UncachedCallResult
{
82 JSObject
*callee
; // callee object
83 JSFunction
*fun
; // callee function
84 void *codeAddr
; // code address of compiled callee function
94 * Helper functions for stubs and IC functions for calling functions.
95 * These functions either execute the function, return a native code
96 * pointer that can be used to call the function, or throw.
98 void UncachedCallHelper(VMFrame
&f
, uint32 argc
, UncachedCallResult
*ucr
);
99 void UncachedNewHelper(VMFrame
&f
, uint32 argc
, UncachedCallResult
*ucr
);
101 JSBool JS_FASTCALL
NewObject(VMFrame
&f
, uint32 argc
);
102 void JS_FASTCALL
Throw(VMFrame
&f
);
103 void JS_FASTCALL
PutCallObject(VMFrame
&f
);
104 void JS_FASTCALL
PutActivationObjects(VMFrame
&f
);
105 void JS_FASTCALL
GetCallObject(VMFrame
&f
);
106 void JS_FASTCALL
WrapPrimitiveThis(VMFrame
&f
);
108 void * JS_FASTCALL
InvokeTracer(VMFrame
&f
, uint32 index
);
110 void * JS_FASTCALL
InvokeTracer(VMFrame
&f
);
113 void * JS_FASTCALL
LookupSwitch(VMFrame
&f
, jsbytecode
*pc
);
114 void * JS_FASTCALL
TableSwitch(VMFrame
&f
, jsbytecode
*origPc
);
116 void JS_FASTCALL
BindName(VMFrame
&f
);
117 JSObject
* JS_FASTCALL
BindGlobalName(VMFrame
&f
);
118 template<JSBool strict
> void JS_FASTCALL
SetName(VMFrame
&f
, JSAtom
*atom
);
119 template<JSBool strict
> void JS_FASTCALL
SetGlobalName(VMFrame
&f
, JSAtom
*atom
);
120 template<JSBool strict
> void JS_FASTCALL
SetGlobalNameDumb(VMFrame
&f
, JSAtom
*atom
);
121 void JS_FASTCALL
Name(VMFrame
&f
);
122 void JS_FASTCALL
GetProp(VMFrame
&f
);
123 void JS_FASTCALL
GetElem(VMFrame
&f
);
124 void JS_FASTCALL
CallElem(VMFrame
&f
);
125 template<JSBool strict
> void JS_FASTCALL
SetElem(VMFrame
&f
);
126 void JS_FASTCALL
Length(VMFrame
&f
);
127 void JS_FASTCALL
CallName(VMFrame
&f
);
128 void JS_FASTCALL
GetUpvar(VMFrame
&f
, uint32 index
);
129 void JS_FASTCALL
GetGlobalName(VMFrame
&f
);
131 template<JSBool strict
> void JS_FASTCALL
NameInc(VMFrame
&f
, JSAtom
*atom
);
132 template<JSBool strict
> void JS_FASTCALL
NameDec(VMFrame
&f
, JSAtom
*atom
);
133 template<JSBool strict
> void JS_FASTCALL
IncName(VMFrame
&f
, JSAtom
*atom
);
134 template<JSBool strict
> void JS_FASTCALL
DecName(VMFrame
&f
, JSAtom
*atom
);
135 template<JSBool strict
> void JS_FASTCALL
GlobalNameInc(VMFrame
&f
, JSAtom
*atom
);
136 template<JSBool strict
> void JS_FASTCALL
GlobalNameDec(VMFrame
&f
, JSAtom
*atom
);
137 template<JSBool strict
> void JS_FASTCALL
IncGlobalName(VMFrame
&f
, JSAtom
*atom
);
138 template<JSBool strict
> void JS_FASTCALL
DecGlobalName(VMFrame
&f
, JSAtom
*atom
);
139 template<JSBool strict
> void JS_FASTCALL
PropInc(VMFrame
&f
, JSAtom
*atom
);
140 template<JSBool strict
> void JS_FASTCALL
PropDec(VMFrame
&f
, JSAtom
*atom
);
141 template<JSBool strict
> void JS_FASTCALL
IncProp(VMFrame
&f
, JSAtom
*atom
);
142 template<JSBool strict
> void JS_FASTCALL
DecProp(VMFrame
&f
, JSAtom
*atom
);
143 template<JSBool strict
> void JS_FASTCALL
ElemInc(VMFrame
&f
);
144 template<JSBool strict
> void JS_FASTCALL
ElemDec(VMFrame
&f
);
145 template<JSBool strict
> void JS_FASTCALL
IncElem(VMFrame
&f
);
146 template<JSBool strict
> void JS_FASTCALL
DecElem(VMFrame
&f
);
147 void JS_FASTCALL
CallProp(VMFrame
&f
, JSAtom
*atom
);
148 template <JSBool strict
> void JS_FASTCALL
DelProp(VMFrame
&f
, JSAtom
*atom
);
149 template <JSBool strict
> void JS_FASTCALL
DelElem(VMFrame
&f
);
150 void JS_FASTCALL
DelName(VMFrame
&f
, JSAtom
*atom
);
151 JSBool JS_FASTCALL
In(VMFrame
&f
);
153 void JS_FASTCALL
DefVar(VMFrame
&f
, JSAtom
*atom
);
154 template<JSBool strict
> void JS_FASTCALL
DefFun(VMFrame
&f
, JSFunction
*fun
);
155 JSObject
* JS_FASTCALL
DefLocalFun(VMFrame
&f
, JSFunction
*fun
);
156 JSObject
* JS_FASTCALL
DefLocalFun_FC(VMFrame
&f
, JSFunction
*fun
);
157 JSObject
* JS_FASTCALL
RegExp(VMFrame
&f
, JSObject
*regex
);
158 JSObject
* JS_FASTCALL
Lambda(VMFrame
&f
, JSFunction
*fun
);
159 JSObject
* JS_FASTCALL
LambdaForInit(VMFrame
&f
, JSFunction
*fun
);
160 JSObject
* JS_FASTCALL
LambdaForSet(VMFrame
&f
, JSFunction
*fun
);
161 JSObject
* JS_FASTCALL
LambdaJoinableForCall(VMFrame
&f
, JSFunction
*fun
);
162 JSObject
* JS_FASTCALL
LambdaJoinableForNull(VMFrame
&f
, JSFunction
*fun
);
163 JSObject
* JS_FASTCALL
FlatLambda(VMFrame
&f
, JSFunction
*fun
);
164 void JS_FASTCALL
Arguments(VMFrame
&f
);
165 void JS_FASTCALL
ArgSub(VMFrame
&f
, uint32 n
);
166 void JS_FASTCALL
EnterBlock(VMFrame
&f
, JSObject
*obj
);
167 void JS_FASTCALL
LeaveBlock(VMFrame
&f
, JSObject
*blockChain
);
169 void JS_FASTCALL
VpInc(VMFrame
&f
, Value
*vp
);
170 void JS_FASTCALL
VpDec(VMFrame
&f
, Value
*vp
);
171 void JS_FASTCALL
DecVp(VMFrame
&f
, Value
*vp
);
172 void JS_FASTCALL
IncVp(VMFrame
&f
, Value
*vp
);
173 void JS_FASTCALL
LocalInc(VMFrame
&f
, uint32 slot
);
174 void JS_FASTCALL
LocalDec(VMFrame
&f
, uint32 slot
);
175 void JS_FASTCALL
IncLocal(VMFrame
&f
, uint32 slot
);
176 void JS_FASTCALL
DecLocal(VMFrame
&f
, uint32 slot
);
178 JSBool JS_FASTCALL
LessThan(VMFrame
&f
);
179 JSBool JS_FASTCALL
LessEqual(VMFrame
&f
);
180 JSBool JS_FASTCALL
GreaterThan(VMFrame
&f
);
181 JSBool JS_FASTCALL
GreaterEqual(VMFrame
&f
);
182 JSBool JS_FASTCALL
Equal(VMFrame
&f
);
183 JSBool JS_FASTCALL
NotEqual(VMFrame
&f
);
185 void JS_FASTCALL
BitOr(VMFrame
&f
);
186 void JS_FASTCALL
BitXor(VMFrame
&f
);
187 void JS_FASTCALL
BitAnd(VMFrame
&f
);
188 void JS_FASTCALL
BitNot(VMFrame
&f
);
189 void JS_FASTCALL
Lsh(VMFrame
&f
);
190 void JS_FASTCALL
Rsh(VMFrame
&f
);
191 void JS_FASTCALL
Ursh(VMFrame
&f
);
192 void JS_FASTCALL
Add(VMFrame
&f
);
193 void JS_FASTCALL
Sub(VMFrame
&f
);
194 void JS_FASTCALL
Mul(VMFrame
&f
);
195 void JS_FASTCALL
Div(VMFrame
&f
);
196 void JS_FASTCALL
Mod(VMFrame
&f
);
197 void JS_FASTCALL
Neg(VMFrame
&f
);
198 void JS_FASTCALL
Pos(VMFrame
&f
);
199 void JS_FASTCALL
Not(VMFrame
&f
);
200 void JS_FASTCALL
StrictEq(VMFrame
&f
);
201 void JS_FASTCALL
StrictNe(VMFrame
&f
);
203 void JS_FASTCALL
Iter(VMFrame
&f
, uint32 flags
);
204 void JS_FASTCALL
IterNext(VMFrame
&f
);
205 JSBool JS_FASTCALL
IterMore(VMFrame
&f
);
206 void JS_FASTCALL
EndIter(VMFrame
&f
);
207 template<JSBool strict
> void JS_FASTCALL
ForName(VMFrame
&f
, JSAtom
*atom
);
209 JSBool JS_FASTCALL
ValueToBoolean(VMFrame
&f
);
210 JSString
* JS_FASTCALL
TypeOf(VMFrame
&f
);
211 JSBool JS_FASTCALL
InstanceOf(VMFrame
&f
);
212 void JS_FASTCALL
FastInstanceOf(VMFrame
&f
);
213 void JS_FASTCALL
ArgCnt(VMFrame
&f
);
214 void JS_FASTCALL
Unbrand(VMFrame
&f
);
216 } /* namespace stubs */
219 * If COND is true, return A; otherwise, return B. This allows us to choose between
220 * function template instantiations without running afoul of C++'s overload resolution
221 * rules. (Try simplifying, and you'll either see the problem --- or have found a
224 template<typename FuncPtr
>
225 inline FuncPtr
FunctionTemplateConditional(bool cond
, FuncPtr a
, FuncPtr b
) {
229 /* Return f<true> if the script is strict mode code, f<false> otherwise. */
230 #define STRICT_VARIANT(f) \
231 (FunctionTemplateConditional(script->strictModeCode, \
234 }} /* namespace stubs,mjit,js */
237 js_InternalThrow(js::VMFrame
&f
);
239 #endif /* jslogic_h__ */