summaryrefslogtreecommitdiffstats
path: root/js/src/jit/MOpcodes.h
blob: 3185d0a836bcf65ed5ffa7878e4178455fdc163e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef jit_MOpcodes_h
#define jit_MOpcodes_h

namespace js {
namespace jit {

#define MIR_OPCODE_LIST(_)                                                  \
    _(Constant)                                                             \
    _(SimdBox)                                                              \
    _(SimdUnbox)                                                            \
    _(SimdValueX4)                                                          \
    _(SimdSplat)                                                            \
    _(SimdConstant)                                                         \
    _(SimdConvert)                                                          \
    _(SimdReinterpretCast)                                                  \
    _(SimdExtractElement)                                                   \
    _(SimdInsertElement)                                                    \
    _(SimdSwizzle)                                                          \
    _(SimdGeneralShuffle)                                                   \
    _(SimdShuffle)                                                          \
    _(SimdUnaryArith)                                                       \
    _(SimdBinaryComp)                                                       \
    _(SimdBinaryArith)                                                      \
    _(SimdBinarySaturating)                                                 \
    _(SimdBinaryBitwise)                                                    \
    _(SimdShift)                                                            \
    _(SimdSelect)                                                           \
    _(SimdAllTrue)                                                          \
    _(SimdAnyTrue)                                                          \
    _(CloneLiteral)                                                         \
    _(Parameter)                                                            \
    _(Callee)                                                               \
    _(IsConstructing)                                                       \
    _(TableSwitch)                                                          \
    _(Goto)                                                                 \
    _(Test)                                                                 \
    _(GotoWithFake)                                                         \
    _(ObjectGroupDispatch)                                                  \
    _(FunctionDispatch)                                                     \
    _(Compare)                                                              \
    _(Phi)                                                                  \
    _(Beta)                                                                 \
    _(NaNToZero)                                                            \
    _(OsrValue)                                                             \
    _(OsrEnvironmentChain)                                                  \
    _(OsrReturnValue)                                                       \
    _(OsrArgumentsObject)                                                   \
    _(ReturnFromCtor)                                                       \
    _(BinarySharedStub)                                                     \
    _(UnarySharedStub)                                                      \
    _(NullarySharedStub)                                                    \
    _(CheckOverRecursed)                                                    \
    _(DefVar)                                                               \
    _(DefLexical)                                                           \
    _(DefFun)                                                               \
    _(CreateThis)                                                           \
    _(CreateThisWithProto)                                                  \
    _(CreateThisWithTemplate)                                               \
    _(CreateArgumentsObject)                                                \
    _(GetArgumentsObjectArg)                                                \
    _(SetArgumentsObjectArg)                                                \
    _(ComputeThis)                                                          \
    _(Call)                                                                 \
    _(ApplyArgs)                                                            \
    _(ApplyArray)                                                           \
    _(Bail)                                                                 \
    _(Unreachable)                                                          \
    _(EncodeSnapshot)                                                       \
    _(AssertFloat32)                                                        \
    _(AssertRecoveredOnBailout)                                             \
    _(GetDynamicName)                                                       \
    _(CallDirectEval)                                                       \
    _(BitNot)                                                               \
    _(TypeOf)                                                               \
    _(ToAsync)                                                              \
    _(ToAsyncGen)                                                           \
    _(ToAsyncIter)                                                          \
    _(ToId)                                                                 \
    _(BitAnd)                                                               \
    _(BitOr)                                                                \
    _(BitXor)                                                               \
    _(Lsh)                                                                  \
    _(Rsh)                                                                  \
    _(Ursh)                                                                 \
    _(SignExtend)                                                           \
    _(MinMax)                                                               \
    _(Abs)                                                                  \
    _(Clz)                                                                  \
    _(Ctz)                                                                  \
    _(Popcnt)                                                               \
    _(Sqrt)                                                                 \
    _(Atan2)                                                                \
    _(Hypot)                                                                \
    _(Pow)                                                                  \
    _(PowHalf)                                                              \
    _(Random)                                                               \
    _(MathFunction)                                                         \
    _(Add)                                                                  \
    _(Sub)                                                                  \
    _(Mul)                                                                  \
    _(Div)                                                                  \
    _(Mod)                                                                  \
    _(Concat)                                                               \
    _(CharCodeAt)                                                           \
    _(FromCharCode)                                                         \
    _(FromCodePoint)                                                        \
    _(SinCos)                                                               \
    _(StringSplit)                                                          \
    _(Substr)                                                               \
    _(Return)                                                               \
    _(Throw)                                                                \
    _(Box)                                                                  \
    _(Unbox)                                                                \
    _(GuardObject)                                                          \
    _(GuardString)                                                          \
    _(PolyInlineGuard)                                                      \
    _(AssertRange)                                                          \
    _(ToDouble)                                                             \
    _(ToFloat32)                                                            \
    _(ToInt32)                                                              \
    _(TruncateToInt32)                                                      \
    _(WrapInt64ToInt32)                                                     \
    _(ExtendInt32ToInt64)                                                   \
    _(Int64ToFloatingPoint)                                                 \
    _(ToString)                                                             \
    _(ToObjectOrNull)                                                       \
    _(NewArray)                                                             \
    _(NewArrayCopyOnWrite)                                                  \
    _(NewArrayDynamicLength)                                                \
    _(NewTypedArray)                                                        \
    _(NewTypedArrayDynamicLength)                                           \
    _(NewObject)                                                            \
    _(NewTypedObject)                                                       \
    _(NewNamedLambdaObject)                                                 \
    _(NewCallObject)                                                        \
    _(NewSingletonCallObject)                                               \
    _(NewStringObject)                                                      \
    _(ObjectState)                                                          \
    _(ArrayState)                                                           \
    _(InitElem)                                                             \
    _(InitElemGetterSetter)                                                 \
    _(MutateProto)                                                          \
    _(InitProp)                                                             \
    _(InitPropGetterSetter)                                                 \
    _(Start)                                                                \
    _(OsrEntry)                                                             \
    _(Nop)                                                                  \
    _(LimitedTruncate)                                                      \
    _(RegExp)                                                               \
    _(RegExpMatcher)                                                        \
    _(RegExpSearcher)                                                       \
    _(RegExpTester)                                                         \
    _(RegExpPrototypeOptimizable)                                           \
    _(RegExpInstanceOptimizable)                                            \
    _(GetFirstDollarIndex)                                                  \
    _(StringReplace)                                                        \
    _(Lambda)                                                               \
    _(LambdaArrow)                                                          \
    _(SetFunName)                                                           \
    _(KeepAliveObject)                                                      \
    _(Slots)                                                                \
    _(Elements)                                                             \
    _(ConstantElements)                                                     \
    _(ConvertElementsToDoubles)                                             \
    _(MaybeToDoubleElement)                                                 \
    _(MaybeCopyElementsForWrite)                                            \
    _(LoadSlot)                                                             \
    _(StoreSlot)                                                            \
    _(FunctionEnvironment)                                                  \
    _(FilterTypeSet)                                                        \
    _(TypeBarrier)                                                          \
    _(MonitorTypes)                                                         \
    _(PostWriteBarrier)                                                     \
    _(PostWriteElementBarrier)                                              \
    _(GetPropertyCache)                                                     \
    _(GetPropertyPolymorphic)                                               \
    _(SetPropertyPolymorphic)                                               \
    _(BindNameCache)                                                        \
    _(CallBindVar)                                                          \
    _(GuardShape)                                                           \
    _(GuardReceiverPolymorphic)                                             \
    _(GuardObjectGroup)                                                     \
    _(GuardObjectIdentity)                                                  \
    _(GuardClass)                                                           \
    _(GuardUnboxedExpando)                                                  \
    _(LoadUnboxedExpando)                                                   \
    _(ArrayLength)                                                          \
    _(SetArrayLength)                                                       \
    _(GetNextEntryForIterator)                                              \
    _(TypedArrayLength)                                                     \
    _(TypedArrayElements)                                                   \
    _(SetDisjointTypedElements)                                             \
    _(TypedObjectDescr)                                                     \
    _(TypedObjectElements)                                                  \
    _(SetTypedObjectOffset)                                                 \
    _(InitializedLength)                                                    \
    _(SetInitializedLength)                                                 \
    _(UnboxedArrayLength)                                                   \
    _(UnboxedArrayInitializedLength)                                        \
    _(IncrementUnboxedArrayInitializedLength)                               \
    _(SetUnboxedArrayInitializedLength)                                     \
    _(Not)                                                                  \
    _(BoundsCheck)                                                          \
    _(BoundsCheckLower)                                                     \
    _(InArray)                                                              \
    _(LoadElement)                                                          \
    _(LoadElementHole)                                                      \
    _(LoadUnboxedScalar)                                                    \
    _(LoadUnboxedObjectOrNull)                                              \
    _(LoadUnboxedString)                                                    \
    _(StoreElement)                                                         \
    _(StoreElementHole)                                                     \
    _(FallibleStoreElement)                                                 \
    _(StoreUnboxedScalar)                                                   \
    _(StoreUnboxedObjectOrNull)                                             \
    _(StoreUnboxedString)                                                   \
    _(ConvertUnboxedObjectToNative)                                         \
    _(ArrayPopShift)                                                        \
    _(ArrayPush)                                                            \
    _(ArraySlice)                                                           \
    _(ArrayJoin)                                                            \
    _(LoadTypedArrayElementHole)                                            \
    _(LoadTypedArrayElementStatic)                                          \
    _(StoreTypedArrayElementHole)                                           \
    _(StoreTypedArrayElementStatic)                                         \
    _(AtomicIsLockFree)                                                     \
    _(GuardSharedTypedArray)                                                \
    _(CompareExchangeTypedArrayElement)                                     \
    _(AtomicExchangeTypedArrayElement)                                      \
    _(AtomicTypedArrayElementBinop)                                         \
    _(EffectiveAddress)                                                     \
    _(ClampToUint8)                                                         \
    _(LoadFixedSlot)                                                        \
    _(LoadFixedSlotAndUnbox)                                                \
    _(StoreFixedSlot)                                                       \
    _(CallGetProperty)                                                      \
    _(GetNameCache)                                                         \
    _(CallGetIntrinsicValue)                                                \
    _(CallGetElement)                                                       \
    _(CallSetElement)                                                       \
    _(CallSetProperty)                                                      \
    _(CallInitElementArray)                                                 \
    _(DeleteProperty)                                                       \
    _(DeleteElement)                                                        \
    _(SetPropertyCache)                                                     \
    _(IteratorStart)                                                        \
    _(IteratorMore)                                                         \
    _(IsNoIter)                                                             \
    _(IteratorEnd)                                                          \
    _(StringLength)                                                         \
    _(ArgumentsLength)                                                      \
    _(GetFrameArgument)                                                     \
    _(SetFrameArgument)                                                     \
    _(RunOncePrologue)                                                      \
    _(Rest)                                                                 \
    _(Floor)                                                                \
    _(Ceil)                                                                 \
    _(Round)                                                                \
    _(In)                                                                   \
    _(InstanceOf)                                                           \
    _(CallInstanceOf)                                                       \
    _(InterruptCheck)                                                       \
    _(GetDOMProperty)                                                       \
    _(GetDOMMember)                                                         \
    _(SetDOMProperty)                                                       \
    _(IsConstructor)                                                        \
    _(IsCallable)                                                           \
    _(IsObject)                                                             \
    _(HasClass)                                                             \
    _(GuardToClass)                                                         \
    _(CopySign)                                                             \
    _(Rotate)                                                               \
    _(NewDerivedTypedObject)                                                \
    _(RecompileCheck)                                                       \
    _(UnknownValue)                                                         \
    _(LexicalCheck)                                                         \
    _(ThrowRuntimeLexicalError)                                             \
    _(GlobalNameConflictsCheck)                                             \
    _(Debugger)                                                             \
    _(NewTarget)                                                            \
    _(ArrowNewTarget)                                                       \
    _(CheckReturn)                                                          \
    _(CheckIsObj)                                                           \
    _(CheckIsCallable)                                                      \
    _(CheckObjCoercible)                                                    \
    _(DebugCheckSelfHosted)                                                 \
    _(AsmJSNeg)                                                             \
    _(AsmJSLoadHeap)                                                        \
    _(AsmJSStoreHeap)                                                       \
    _(AsmJSCompareExchangeHeap)                                             \
    _(AsmJSAtomicExchangeHeap)                                              \
    _(AsmJSAtomicBinopHeap)                                                 \
    _(WasmBoundsCheck)                                                      \
    _(WasmAddOffset)                                                        \
    _(WasmLoad)                                                             \
    _(WasmStore)                                                            \
    _(WasmTrap)                                                             \
    _(WasmTruncateToInt32)                                                  \
    _(WasmUnsignedToDouble)                                                 \
    _(WasmUnsignedToFloat32)                                                \
    _(WasmLoadGlobalVar)                                                    \
    _(WasmStoreGlobalVar)                                                   \
    _(WasmReturn)                                                           \
    _(WasmReturnVoid)                                                       \
    _(WasmParameter)                                                        \
    _(WasmStackArg)                                                         \
    _(WasmCall)                                                             \
    _(WasmSelect)                                                           \
    _(WasmReinterpret)                                                      \
    _(WasmTruncateToInt64)

// Forward declarations of MIR types.
#define FORWARD_DECLARE(op) class M##op;
 MIR_OPCODE_LIST(FORWARD_DECLARE)
#undef FORWARD_DECLARE

class MDefinitionVisitor // interface i.e. pure abstract class
{
  public:
#define VISIT_INS(op) virtual void visit##op(M##op*) = 0;
    MIR_OPCODE_LIST(VISIT_INS)
#undef VISIT_INS
};

// MDefinition visitor which raises a Not Yet Implemented error for
// non-overloaded visit functions.
class MDefinitionVisitorDefaultNYI : public MDefinitionVisitor
{
  public:
#define VISIT_INS(op) virtual void visit##op(M##op*) { MOZ_CRASH("NYI: " #op); }
    MIR_OPCODE_LIST(VISIT_INS)
#undef VISIT_INS
};

// MDefinition visitor which ignores non-overloaded visit functions.
class MDefinitionVisitorDefaultNoop : public MDefinitionVisitor
{
  public:
#define VISIT_INS(op) virtual void visit##op(M##op*) { }
    MIR_OPCODE_LIST(VISIT_INS)
#undef VISIT_INS
};

} // namespace jit
} // namespace js

#endif /* jit_MOpcodes_h */