V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
opcodes.h
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_COMPILER_OPCODES_H_
6 #define V8_COMPILER_OPCODES_H_
7 
8 #include <iosfwd>
9 
10 #include "src/globals.h"
11 
12 // Opcodes for control operators.
13 #define CONTROL_OP_LIST(V) \
14  V(Start) \
15  V(Loop) \
16  V(Branch) \
17  V(Switch) \
18  V(IfTrue) \
19  V(IfFalse) \
20  V(IfSuccess) \
21  V(IfException) \
22  V(IfValue) \
23  V(IfDefault) \
24  V(Merge) \
25  V(Deoptimize) \
26  V(DeoptimizeIf) \
27  V(DeoptimizeUnless) \
28  V(TrapIf) \
29  V(TrapUnless) \
30  V(Return) \
31  V(TailCall) \
32  V(Terminate) \
33  V(OsrNormalEntry) \
34  V(OsrLoopEntry) \
35  V(Throw) \
36  V(End)
37 
38 // Opcodes for constant operators.
39 #define CONSTANT_OP_LIST(V) \
40  V(Int32Constant) \
41  V(Int64Constant) \
42  V(Float32Constant) \
43  V(Float64Constant) \
44  V(ExternalConstant) \
45  V(NumberConstant) \
46  V(PointerConstant) \
47  V(HeapConstant) \
48  V(RelocatableInt32Constant) \
49  V(RelocatableInt64Constant)
50 
51 #define INNER_OP_LIST(V) \
52  V(Select) \
53  V(Phi) \
54  V(EffectPhi) \
55  V(InductionVariablePhi) \
56  V(Checkpoint) \
57  V(BeginRegion) \
58  V(FinishRegion) \
59  V(FrameState) \
60  V(StateValues) \
61  V(TypedStateValues) \
62  V(ArgumentsElementsState) \
63  V(ArgumentsLengthState) \
64  V(ObjectState) \
65  V(ObjectId) \
66  V(TypedObjectState) \
67  V(Call) \
68  V(CallWithCallerSavedRegisters) \
69  V(Parameter) \
70  V(OsrValue) \
71  V(LoopExit) \
72  V(LoopExitValue) \
73  V(LoopExitEffect) \
74  V(Projection) \
75  V(Retain) \
76  V(MapGuard) \
77  V(TypeGuard)
78 
79 #define COMMON_OP_LIST(V) \
80  CONSTANT_OP_LIST(V) \
81  INNER_OP_LIST(V) \
82  V(Unreachable) \
83  V(DeadValue) \
84  V(Dead)
85 
86 // Opcodes for JavaScript operators.
87 #define JS_COMPARE_BINOP_LIST(V) \
88  V(JSEqual) \
89  V(JSStrictEqual) \
90  V(JSLessThan) \
91  V(JSGreaterThan) \
92  V(JSLessThanOrEqual) \
93  V(JSGreaterThanOrEqual)
94 
95 #define JS_BITWISE_BINOP_LIST(V) \
96  V(JSBitwiseOr) \
97  V(JSBitwiseXor) \
98  V(JSBitwiseAnd) \
99  V(JSShiftLeft) \
100  V(JSShiftRight) \
101  V(JSShiftRightLogical)
102 
103 #define JS_ARITH_BINOP_LIST(V) \
104  V(JSAdd) \
105  V(JSSubtract) \
106  V(JSMultiply) \
107  V(JSDivide) \
108  V(JSModulus) \
109  V(JSExponentiate)
110 
111 #define JS_SIMPLE_BINOP_LIST(V) \
112  JS_COMPARE_BINOP_LIST(V) \
113  JS_BITWISE_BINOP_LIST(V) \
114  JS_ARITH_BINOP_LIST(V) \
115  V(JSHasInPrototypeChain) \
116  V(JSInstanceOf) \
117  V(JSOrdinaryHasInstance)
118 
119 #define JS_CONVERSION_UNOP_LIST(V) \
120  V(JSToLength) \
121  V(JSToName) \
122  V(JSToNumber) \
123  V(JSToNumberConvertBigInt) \
124  V(JSToNumeric) \
125  V(JSToObject) \
126  V(JSToString) \
127  V(JSParseInt)
128 
129 #define JS_SIMPLE_UNOP_LIST(V) \
130  JS_CONVERSION_UNOP_LIST(V) \
131  V(JSBitwiseNot) \
132  V(JSDecrement) \
133  V(JSIncrement) \
134  V(JSNegate)
135 
136 #define JS_CREATE_OP_LIST(V) \
137  V(JSCreate) \
138  V(JSCreateArguments) \
139  V(JSCreateArray) \
140  V(JSCreateArrayIterator) \
141  V(JSCreateAsyncFunctionObject) \
142  V(JSCreateBoundFunction) \
143  V(JSCreateClosure) \
144  V(JSCreateCollectionIterator) \
145  V(JSCreateGeneratorObject) \
146  V(JSCreateIterResultObject) \
147  V(JSCreateStringIterator) \
148  V(JSCreateKeyValueArray) \
149  V(JSCreateObject) \
150  V(JSCreatePromise) \
151  V(JSCreateTypedArray) \
152  V(JSCreateLiteralArray) \
153  V(JSCreateEmptyLiteralArray) \
154  V(JSCreateArrayFromIterable) \
155  V(JSCreateLiteralObject) \
156  V(JSCreateEmptyLiteralObject) \
157  V(JSCloneObject) \
158  V(JSCreateLiteralRegExp)
159 
160 #define JS_OBJECT_OP_LIST(V) \
161  JS_CREATE_OP_LIST(V) \
162  V(JSLoadProperty) \
163  V(JSLoadNamed) \
164  V(JSLoadGlobal) \
165  V(JSStoreProperty) \
166  V(JSStoreNamed) \
167  V(JSStoreNamedOwn) \
168  V(JSStoreGlobal) \
169  V(JSStoreDataPropertyInLiteral) \
170  V(JSStoreInArrayLiteral) \
171  V(JSDeleteProperty) \
172  V(JSHasProperty) \
173  V(JSGetSuperConstructor)
174 
175 #define JS_CONTEXT_OP_LIST(V) \
176  V(JSLoadContext) \
177  V(JSStoreContext) \
178  V(JSCreateFunctionContext) \
179  V(JSCreateCatchContext) \
180  V(JSCreateWithContext) \
181  V(JSCreateBlockContext)
182 
183 #define JS_CALL_OP_LIST(V) \
184  V(JSCall) \
185  V(JSCallForwardVarargs) \
186  V(JSCallWithArrayLike) \
187  V(JSCallWithSpread)
188 
189 #define JS_CONSTRUCT_OP_LIST(V) \
190  V(JSConstructForwardVarargs) \
191  V(JSConstruct) \
192  V(JSConstructWithArrayLike) \
193  V(JSConstructWithSpread)
194 
195 #define JS_OTHER_OP_LIST(V) \
196  JS_CALL_OP_LIST(V) \
197  JS_CONSTRUCT_OP_LIST(V) \
198  V(JSAsyncFunctionEnter) \
199  V(JSAsyncFunctionReject) \
200  V(JSAsyncFunctionResolve) \
201  V(JSCallRuntime) \
202  V(JSForInEnumerate) \
203  V(JSForInNext) \
204  V(JSForInPrepare) \
205  V(JSLoadMessage) \
206  V(JSStoreMessage) \
207  V(JSLoadModule) \
208  V(JSStoreModule) \
209  V(JSGeneratorStore) \
210  V(JSGeneratorRestoreContinuation) \
211  V(JSGeneratorRestoreContext) \
212  V(JSGeneratorRestoreRegister) \
213  V(JSGeneratorRestoreInputOrDebugPos) \
214  V(JSFulfillPromise) \
215  V(JSPerformPromiseThen) \
216  V(JSPromiseResolve) \
217  V(JSRejectPromise) \
218  V(JSResolvePromise) \
219  V(JSStackCheck) \
220  V(JSObjectIsArray) \
221  V(JSRegExpTest) \
222  V(JSDebugger)
223 
224 #define JS_OP_LIST(V) \
225  JS_SIMPLE_BINOP_LIST(V) \
226  JS_SIMPLE_UNOP_LIST(V) \
227  JS_OBJECT_OP_LIST(V) \
228  JS_CONTEXT_OP_LIST(V) \
229  JS_OTHER_OP_LIST(V)
230 
231 // Opcodes for VirtuaMachine-level operators.
232 #define SIMPLIFIED_CHANGE_OP_LIST(V) \
233  V(ChangeTaggedSignedToInt32) \
234  V(ChangeTaggedSignedToInt64) \
235  V(ChangeTaggedToInt32) \
236  V(ChangeTaggedToInt64) \
237  V(ChangeTaggedToUint32) \
238  V(ChangeTaggedToFloat64) \
239  V(ChangeTaggedToTaggedSigned) \
240  V(ChangeInt31ToTaggedSigned) \
241  V(ChangeInt32ToTagged) \
242  V(ChangeInt64ToTagged) \
243  V(ChangeUint32ToTagged) \
244  V(ChangeUint64ToTagged) \
245  V(ChangeFloat64ToTagged) \
246  V(ChangeFloat64ToTaggedPointer) \
247  V(ChangeTaggedToBit) \
248  V(ChangeBitToTagged) \
249  V(TruncateTaggedToWord32) \
250  V(TruncateTaggedToFloat64) \
251  V(TruncateTaggedToBit) \
252  V(TruncateTaggedPointerToBit)
253 
254 #define SIMPLIFIED_CHECKED_OP_LIST(V) \
255  V(CheckedInt32Add) \
256  V(CheckedInt32Sub) \
257  V(CheckedInt32Div) \
258  V(CheckedInt32Mod) \
259  V(CheckedUint32Div) \
260  V(CheckedUint32Mod) \
261  V(CheckedInt32Mul) \
262  V(CheckedInt32ToTaggedSigned) \
263  V(CheckedInt64ToInt32) \
264  V(CheckedInt64ToTaggedSigned) \
265  V(CheckedUint32Bounds) \
266  V(CheckedUint32ToInt32) \
267  V(CheckedUint32ToTaggedSigned) \
268  V(CheckedUint64Bounds) \
269  V(CheckedUint64ToInt32) \
270  V(CheckedUint64ToTaggedSigned) \
271  V(CheckedFloat64ToInt32) \
272  V(CheckedFloat64ToInt64) \
273  V(CheckedTaggedSignedToInt32) \
274  V(CheckedTaggedToInt32) \
275  V(CheckedTruncateTaggedToWord32) \
276  V(CheckedTaggedToFloat64) \
277  V(CheckedTaggedToInt64) \
278  V(CheckedTaggedToTaggedSigned) \
279  V(CheckedTaggedToTaggedPointer)
280 
281 #define SIMPLIFIED_COMPARE_BINOP_LIST(V) \
282  V(NumberEqual) \
283  V(NumberLessThan) \
284  V(NumberLessThanOrEqual) \
285  V(SpeculativeNumberEqual) \
286  V(SpeculativeNumberLessThan) \
287  V(SpeculativeNumberLessThanOrEqual) \
288  V(ReferenceEqual) \
289  V(SameValue) \
290  V(StringEqual) \
291  V(StringLessThan) \
292  V(StringLessThanOrEqual)
293 
294 #define SIMPLIFIED_NUMBER_BINOP_LIST(V) \
295  V(NumberAdd) \
296  V(NumberSubtract) \
297  V(NumberMultiply) \
298  V(NumberDivide) \
299  V(NumberModulus) \
300  V(NumberBitwiseOr) \
301  V(NumberBitwiseXor) \
302  V(NumberBitwiseAnd) \
303  V(NumberShiftLeft) \
304  V(NumberShiftRight) \
305  V(NumberShiftRightLogical) \
306  V(NumberAtan2) \
307  V(NumberImul) \
308  V(NumberMax) \
309  V(NumberMin) \
310  V(NumberPow)
311 
312 #define SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(V) \
313  V(SpeculativeNumberAdd) \
314  V(SpeculativeNumberSubtract) \
315  V(SpeculativeNumberMultiply) \
316  V(SpeculativeNumberDivide) \
317  V(SpeculativeNumberModulus) \
318  V(SpeculativeNumberBitwiseAnd) \
319  V(SpeculativeNumberBitwiseOr) \
320  V(SpeculativeNumberBitwiseXor) \
321  V(SpeculativeNumberShiftLeft) \
322  V(SpeculativeNumberShiftRight) \
323  V(SpeculativeNumberShiftRightLogical) \
324  V(SpeculativeSafeIntegerAdd) \
325  V(SpeculativeSafeIntegerSubtract)
326 
327 #define SIMPLIFIED_NUMBER_UNOP_LIST(V) \
328  V(NumberAbs) \
329  V(NumberAcos) \
330  V(NumberAcosh) \
331  V(NumberAsin) \
332  V(NumberAsinh) \
333  V(NumberAtan) \
334  V(NumberAtanh) \
335  V(NumberCbrt) \
336  V(NumberCeil) \
337  V(NumberClz32) \
338  V(NumberCos) \
339  V(NumberCosh) \
340  V(NumberExp) \
341  V(NumberExpm1) \
342  V(NumberFloor) \
343  V(NumberFround) \
344  V(NumberLog) \
345  V(NumberLog1p) \
346  V(NumberLog2) \
347  V(NumberLog10) \
348  V(NumberRound) \
349  V(NumberSign) \
350  V(NumberSin) \
351  V(NumberSinh) \
352  V(NumberSqrt) \
353  V(NumberTan) \
354  V(NumberTanh) \
355  V(NumberTrunc) \
356  V(NumberToBoolean) \
357  V(NumberToInt32) \
358  V(NumberToString) \
359  V(NumberToUint32) \
360  V(NumberToUint8Clamped) \
361  V(NumberSilenceNaN)
362 
363 #define SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(V) V(SpeculativeToNumber)
364 
365 #define SIMPLIFIED_OTHER_OP_LIST(V) \
366  V(PlainPrimitiveToNumber) \
367  V(PlainPrimitiveToWord32) \
368  V(PlainPrimitiveToFloat64) \
369  V(BooleanNot) \
370  V(StringConcat) \
371  V(StringToNumber) \
372  V(StringCharCodeAt) \
373  V(StringCodePointAt) \
374  V(StringFromSingleCharCode) \
375  V(StringFromSingleCodePoint) \
376  V(StringIndexOf) \
377  V(StringLength) \
378  V(StringToLowerCaseIntl) \
379  V(StringToUpperCaseIntl) \
380  V(StringSubstring) \
381  V(CheckBounds) \
382  V(CheckIf) \
383  V(CheckMaps) \
384  V(CheckNumber) \
385  V(CheckInternalizedString) \
386  V(CheckReceiver) \
387  V(CheckReceiverOrNullOrUndefined) \
388  V(CheckString) \
389  V(CheckSymbol) \
390  V(CheckSmi) \
391  V(CheckHeapObject) \
392  V(CheckFloat64Hole) \
393  V(CheckNotTaggedHole) \
394  V(CheckEqualsInternalizedString) \
395  V(CheckEqualsSymbol) \
396  V(CompareMaps) \
397  V(ConvertReceiver) \
398  V(ConvertTaggedHoleToUndefined) \
399  V(TypeOf) \
400  V(Allocate) \
401  V(AllocateRaw) \
402  V(LoadFieldByIndex) \
403  V(LoadField) \
404  V(LoadElement) \
405  V(LoadTypedElement) \
406  V(LoadDataViewElement) \
407  V(StoreField) \
408  V(StoreElement) \
409  V(StoreTypedElement) \
410  V(StoreDataViewElement) \
411  V(StoreSignedSmallElement) \
412  V(TransitionAndStoreElement) \
413  V(TransitionAndStoreNumberElement) \
414  V(TransitionAndStoreNonNumberElement) \
415  V(ToBoolean) \
416  V(NumberIsFloat64Hole) \
417  V(NumberIsFinite) \
418  V(ObjectIsFiniteNumber) \
419  V(NumberIsInteger) \
420  V(ObjectIsSafeInteger) \
421  V(NumberIsSafeInteger) \
422  V(ObjectIsInteger) \
423  V(ObjectIsArrayBufferView) \
424  V(ObjectIsBigInt) \
425  V(ObjectIsCallable) \
426  V(ObjectIsConstructor) \
427  V(ObjectIsDetectableCallable) \
428  V(ObjectIsMinusZero) \
429  V(NumberIsMinusZero) \
430  V(ObjectIsNaN) \
431  V(NumberIsNaN) \
432  V(ObjectIsNonCallable) \
433  V(ObjectIsNumber) \
434  V(ObjectIsReceiver) \
435  V(ObjectIsSmi) \
436  V(ObjectIsString) \
437  V(ObjectIsSymbol) \
438  V(ObjectIsUndetectable) \
439  V(ArgumentsFrame) \
440  V(ArgumentsLength) \
441  V(NewDoubleElements) \
442  V(NewSmiOrObjectElements) \
443  V(NewArgumentsElements) \
444  V(NewConsString) \
445  V(DelayedStringConstant) \
446  V(EnsureWritableFastElements) \
447  V(MaybeGrowFastElements) \
448  V(TransitionElementsKind) \
449  V(FindOrderedHashMapEntry) \
450  V(FindOrderedHashMapEntryForInt32Key) \
451  V(PoisonIndex) \
452  V(RuntimeAbort) \
453  V(DateNow)
454 
455 #define SIMPLIFIED_OP_LIST(V) \
456  SIMPLIFIED_CHANGE_OP_LIST(V) \
457  SIMPLIFIED_CHECKED_OP_LIST(V) \
458  SIMPLIFIED_COMPARE_BINOP_LIST(V) \
459  SIMPLIFIED_NUMBER_BINOP_LIST(V) \
460  SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(V) \
461  SIMPLIFIED_NUMBER_UNOP_LIST(V) \
462  SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(V) \
463  SIMPLIFIED_OTHER_OP_LIST(V)
464 
465 // Opcodes for Machine-level operators.
466 #define MACHINE_COMPARE_BINOP_LIST(V) \
467  V(Word32Equal) \
468  V(Word64Equal) \
469  V(Int32LessThan) \
470  V(Int32LessThanOrEqual) \
471  V(Uint32LessThan) \
472  V(Uint32LessThanOrEqual) \
473  V(Int64LessThan) \
474  V(Int64LessThanOrEqual) \
475  V(Uint64LessThan) \
476  V(Uint64LessThanOrEqual) \
477  V(Float32Equal) \
478  V(Float32LessThan) \
479  V(Float32LessThanOrEqual) \
480  V(Float64Equal) \
481  V(Float64LessThan) \
482  V(Float64LessThanOrEqual)
483 
484 #define MACHINE_UNOP_32_LIST(V) \
485  V(Word32Clz) \
486  V(Word32Ctz) \
487  V(Int32AbsWithOverflow) \
488  V(Word32ReverseBits) \
489  V(Word32ReverseBytes)
490 
491 #define MACHINE_BINOP_32_LIST(V) \
492  V(Word32And) \
493  V(Word32Or) \
494  V(Word32Xor) \
495  V(Word32Shl) \
496  V(Word32Shr) \
497  V(Word32Sar) \
498  V(Word32Ror) \
499  V(Int32Add) \
500  V(Int32AddWithOverflow) \
501  V(Int32Sub) \
502  V(Int32SubWithOverflow) \
503  V(Int32Mul) \
504  V(Int32MulWithOverflow) \
505  V(Int32MulHigh) \
506  V(Int32Div) \
507  V(Int32Mod) \
508  V(Uint32Div) \
509  V(Uint32Mod) \
510  V(Uint32MulHigh)
511 
512 #define MACHINE_BINOP_64_LIST(V) \
513  V(Word64And) \
514  V(Word64Or) \
515  V(Word64Xor) \
516  V(Word64Shl) \
517  V(Word64Shr) \
518  V(Word64Sar) \
519  V(Word64Ror) \
520  V(Int64Add) \
521  V(Int64AddWithOverflow) \
522  V(Int64Sub) \
523  V(Int64SubWithOverflow) \
524  V(Int64Mul) \
525  V(Int64Div) \
526  V(Int64Mod) \
527  V(Uint64Div) \
528  V(Uint64Mod)
529 
530 #define MACHINE_FLOAT32_UNOP_LIST(V) \
531  V(Float32Abs) \
532  V(Float32Neg) \
533  V(Float32RoundDown) \
534  V(Float32RoundTiesEven) \
535  V(Float32RoundTruncate) \
536  V(Float32RoundUp) \
537  V(Float32Sqrt)
538 
539 #define MACHINE_FLOAT32_BINOP_LIST(V) \
540  V(Float32Add) \
541  V(Float32Sub) \
542  V(Float32Mul) \
543  V(Float32Div) \
544  V(Float32Max) \
545  V(Float32Min)
546 
547 #define MACHINE_FLOAT64_UNOP_LIST(V) \
548  V(Float64Abs) \
549  V(Float64Acos) \
550  V(Float64Acosh) \
551  V(Float64Asin) \
552  V(Float64Asinh) \
553  V(Float64Atan) \
554  V(Float64Atanh) \
555  V(Float64Cbrt) \
556  V(Float64Cos) \
557  V(Float64Cosh) \
558  V(Float64Exp) \
559  V(Float64Expm1) \
560  V(Float64Log) \
561  V(Float64Log1p) \
562  V(Float64Log10) \
563  V(Float64Log2) \
564  V(Float64Neg) \
565  V(Float64RoundDown) \
566  V(Float64RoundTiesAway) \
567  V(Float64RoundTiesEven) \
568  V(Float64RoundTruncate) \
569  V(Float64RoundUp) \
570  V(Float64Sin) \
571  V(Float64Sinh) \
572  V(Float64Sqrt) \
573  V(Float64Tan) \
574  V(Float64Tanh)
575 
576 #define MACHINE_FLOAT64_BINOP_LIST(V) \
577  V(Float64Atan2) \
578  V(Float64Max) \
579  V(Float64Min) \
580  V(Float64Add) \
581  V(Float64Sub) \
582  V(Float64Mul) \
583  V(Float64Div) \
584  V(Float64Mod) \
585  V(Float64Pow)
586 
587 #define MACHINE_WORD64_ATOMIC_OP_LIST(V) \
588  V(Word64AtomicLoad) \
589  V(Word64AtomicStore) \
590  V(Word64AtomicAdd) \
591  V(Word64AtomicSub) \
592  V(Word64AtomicAnd) \
593  V(Word64AtomicOr) \
594  V(Word64AtomicXor) \
595  V(Word64AtomicExchange) \
596  V(Word64AtomicCompareExchange)
597 
598 #define MACHINE_OP_LIST(V) \
599  MACHINE_UNOP_32_LIST(V) \
600  MACHINE_BINOP_32_LIST(V) \
601  MACHINE_BINOP_64_LIST(V) \
602  MACHINE_COMPARE_BINOP_LIST(V) \
603  MACHINE_FLOAT32_BINOP_LIST(V) \
604  MACHINE_FLOAT32_UNOP_LIST(V) \
605  MACHINE_FLOAT64_BINOP_LIST(V) \
606  MACHINE_FLOAT64_UNOP_LIST(V) \
607  MACHINE_WORD64_ATOMIC_OP_LIST(V) \
608  V(DebugAbort) \
609  V(DebugBreak) \
610  V(Comment) \
611  V(Load) \
612  V(PoisonedLoad) \
613  V(Store) \
614  V(StackSlot) \
615  V(Word32Popcnt) \
616  V(Word64Popcnt) \
617  V(Word64Clz) \
618  V(Word64Ctz) \
619  V(Word64ReverseBits) \
620  V(Word64ReverseBytes) \
621  V(Int64AbsWithOverflow) \
622  V(BitcastTaggedToWord) \
623  V(BitcastWordToTagged) \
624  V(BitcastWordToTaggedSigned) \
625  V(TruncateFloat64ToWord32) \
626  V(ChangeFloat32ToFloat64) \
627  V(ChangeFloat64ToInt32) \
628  V(ChangeFloat64ToInt64) \
629  V(ChangeFloat64ToUint32) \
630  V(ChangeFloat64ToUint64) \
631  V(Float64SilenceNaN) \
632  V(TruncateFloat64ToInt64) \
633  V(TruncateFloat64ToUint32) \
634  V(TruncateFloat32ToInt32) \
635  V(TruncateFloat32ToUint32) \
636  V(TryTruncateFloat32ToInt64) \
637  V(TryTruncateFloat64ToInt64) \
638  V(TryTruncateFloat32ToUint64) \
639  V(TryTruncateFloat64ToUint64) \
640  V(ChangeInt32ToFloat64) \
641  V(ChangeInt32ToInt64) \
642  V(ChangeInt64ToFloat64) \
643  V(ChangeUint32ToFloat64) \
644  V(ChangeUint32ToUint64) \
645  V(TruncateFloat64ToFloat32) \
646  V(TruncateInt64ToInt32) \
647  V(RoundFloat64ToInt32) \
648  V(RoundInt32ToFloat32) \
649  V(RoundInt64ToFloat32) \
650  V(RoundInt64ToFloat64) \
651  V(RoundUint32ToFloat32) \
652  V(RoundUint64ToFloat32) \
653  V(RoundUint64ToFloat64) \
654  V(BitcastFloat32ToInt32) \
655  V(BitcastFloat64ToInt64) \
656  V(BitcastInt32ToFloat32) \
657  V(BitcastInt64ToFloat64) \
658  V(Float64ExtractLowWord32) \
659  V(Float64ExtractHighWord32) \
660  V(Float64InsertLowWord32) \
661  V(Float64InsertHighWord32) \
662  V(TaggedPoisonOnSpeculation) \
663  V(Word32PoisonOnSpeculation) \
664  V(Word64PoisonOnSpeculation) \
665  V(LoadStackPointer) \
666  V(LoadFramePointer) \
667  V(LoadParentFramePointer) \
668  V(UnalignedLoad) \
669  V(UnalignedStore) \
670  V(Int32PairAdd) \
671  V(Int32PairSub) \
672  V(Int32PairMul) \
673  V(Word32PairShl) \
674  V(Word32PairShr) \
675  V(Word32PairSar) \
676  V(ProtectedLoad) \
677  V(ProtectedStore) \
678  V(Word32AtomicLoad) \
679  V(Word32AtomicStore) \
680  V(Word32AtomicExchange) \
681  V(Word32AtomicCompareExchange) \
682  V(Word32AtomicAdd) \
683  V(Word32AtomicSub) \
684  V(Word32AtomicAnd) \
685  V(Word32AtomicOr) \
686  V(Word32AtomicXor) \
687  V(Word32AtomicPairLoad) \
688  V(Word32AtomicPairStore) \
689  V(Word32AtomicPairAdd) \
690  V(Word32AtomicPairSub) \
691  V(Word32AtomicPairAnd) \
692  V(Word32AtomicPairOr) \
693  V(Word32AtomicPairXor) \
694  V(Word32AtomicPairExchange) \
695  V(Word32AtomicPairCompareExchange) \
696  V(SpeculationFence) \
697  V(SignExtendWord8ToInt32) \
698  V(SignExtendWord16ToInt32) \
699  V(SignExtendWord8ToInt64) \
700  V(SignExtendWord16ToInt64) \
701  V(SignExtendWord32ToInt64) \
702  V(UnsafePointerAdd)
703 
704 #define MACHINE_SIMD_OP_LIST(V) \
705  V(F32x4Splat) \
706  V(F32x4ExtractLane) \
707  V(F32x4ReplaceLane) \
708  V(F32x4SConvertI32x4) \
709  V(F32x4UConvertI32x4) \
710  V(F32x4Abs) \
711  V(F32x4Neg) \
712  V(F32x4RecipApprox) \
713  V(F32x4RecipSqrtApprox) \
714  V(F32x4Add) \
715  V(F32x4AddHoriz) \
716  V(F32x4Sub) \
717  V(F32x4Mul) \
718  V(F32x4Min) \
719  V(F32x4Max) \
720  V(F32x4Eq) \
721  V(F32x4Ne) \
722  V(F32x4Lt) \
723  V(F32x4Le) \
724  V(F32x4Gt) \
725  V(F32x4Ge) \
726  V(I32x4Splat) \
727  V(I32x4ExtractLane) \
728  V(I32x4ReplaceLane) \
729  V(I32x4SConvertF32x4) \
730  V(I32x4SConvertI16x8Low) \
731  V(I32x4SConvertI16x8High) \
732  V(I32x4Neg) \
733  V(I32x4Shl) \
734  V(I32x4ShrS) \
735  V(I32x4Add) \
736  V(I32x4AddHoriz) \
737  V(I32x4Sub) \
738  V(I32x4Mul) \
739  V(I32x4MinS) \
740  V(I32x4MaxS) \
741  V(I32x4Eq) \
742  V(I32x4Ne) \
743  V(I32x4LtS) \
744  V(I32x4LeS) \
745  V(I32x4GtS) \
746  V(I32x4GeS) \
747  V(I32x4UConvertF32x4) \
748  V(I32x4UConvertI16x8Low) \
749  V(I32x4UConvertI16x8High) \
750  V(I32x4ShrU) \
751  V(I32x4MinU) \
752  V(I32x4MaxU) \
753  V(I32x4LtU) \
754  V(I32x4LeU) \
755  V(I32x4GtU) \
756  V(I32x4GeU) \
757  V(I16x8Splat) \
758  V(I16x8ExtractLane) \
759  V(I16x8ReplaceLane) \
760  V(I16x8SConvertI8x16Low) \
761  V(I16x8SConvertI8x16High) \
762  V(I16x8Neg) \
763  V(I16x8Shl) \
764  V(I16x8ShrS) \
765  V(I16x8SConvertI32x4) \
766  V(I16x8Add) \
767  V(I16x8AddSaturateS) \
768  V(I16x8AddHoriz) \
769  V(I16x8Sub) \
770  V(I16x8SubSaturateS) \
771  V(I16x8Mul) \
772  V(I16x8MinS) \
773  V(I16x8MaxS) \
774  V(I16x8Eq) \
775  V(I16x8Ne) \
776  V(I16x8LtS) \
777  V(I16x8LeS) \
778  V(I16x8GtS) \
779  V(I16x8GeS) \
780  V(I16x8UConvertI8x16Low) \
781  V(I16x8UConvertI8x16High) \
782  V(I16x8ShrU) \
783  V(I16x8UConvertI32x4) \
784  V(I16x8AddSaturateU) \
785  V(I16x8SubSaturateU) \
786  V(I16x8MinU) \
787  V(I16x8MaxU) \
788  V(I16x8LtU) \
789  V(I16x8LeU) \
790  V(I16x8GtU) \
791  V(I16x8GeU) \
792  V(I8x16Splat) \
793  V(I8x16ExtractLane) \
794  V(I8x16ReplaceLane) \
795  V(I8x16SConvertI16x8) \
796  V(I8x16Neg) \
797  V(I8x16Shl) \
798  V(I8x16ShrS) \
799  V(I8x16Add) \
800  V(I8x16AddSaturateS) \
801  V(I8x16Sub) \
802  V(I8x16SubSaturateS) \
803  V(I8x16Mul) \
804  V(I8x16MinS) \
805  V(I8x16MaxS) \
806  V(I8x16Eq) \
807  V(I8x16Ne) \
808  V(I8x16LtS) \
809  V(I8x16LeS) \
810  V(I8x16GtS) \
811  V(I8x16GeS) \
812  V(I8x16UConvertI16x8) \
813  V(I8x16AddSaturateU) \
814  V(I8x16SubSaturateU) \
815  V(I8x16ShrU) \
816  V(I8x16MinU) \
817  V(I8x16MaxU) \
818  V(I8x16LtU) \
819  V(I8x16LeU) \
820  V(I8x16GtU) \
821  V(I8x16GeU) \
822  V(S128Load) \
823  V(S128Store) \
824  V(S128Zero) \
825  V(S128Not) \
826  V(S128And) \
827  V(S128Or) \
828  V(S128Xor) \
829  V(S128Select) \
830  V(S8x16Shuffle) \
831  V(S1x4AnyTrue) \
832  V(S1x4AllTrue) \
833  V(S1x8AnyTrue) \
834  V(S1x8AllTrue) \
835  V(S1x16AnyTrue) \
836  V(S1x16AllTrue)
837 
838 #define VALUE_OP_LIST(V) \
839  COMMON_OP_LIST(V) \
840  SIMPLIFIED_OP_LIST(V) \
841  MACHINE_OP_LIST(V) \
842  MACHINE_SIMD_OP_LIST(V) \
843  JS_OP_LIST(V)
844 
845 // The combination of all operators at all levels and the common operators.
846 #define ALL_OP_LIST(V) \
847  CONTROL_OP_LIST(V) \
848  VALUE_OP_LIST(V)
849 
850 namespace v8 {
851 namespace internal {
852 namespace compiler {
853 
854 // Declare an enumeration with all the opcodes at all levels so that they
855 // can be globally, uniquely numbered.
856 class V8_EXPORT_PRIVATE IrOpcode {
857  public:
858  enum Value {
859 #define DECLARE_OPCODE(x) k##x,
860  ALL_OP_LIST(DECLARE_OPCODE)
861 #undef DECLARE_OPCODE
862  kLast = -1
863 #define COUNT_OPCODE(x) +1
864  ALL_OP_LIST(COUNT_OPCODE)
865 #undef COUNT_OPCODE
866  };
867 
868  // Returns the mnemonic name of an opcode.
869  static char const* Mnemonic(Value value);
870 
871  // Returns true if opcode for common operator.
872  static bool IsCommonOpcode(Value value) {
873  return kStart <= value && value <= kDead;
874  }
875 
876  // Returns true if opcode for control operator.
877  static bool IsControlOpcode(Value value) {
878  return kStart <= value && value <= kEnd;
879  }
880 
881  // Returns true if opcode for JavaScript operator.
882  static bool IsJsOpcode(Value value) {
883  return kJSEqual <= value && value <= kJSDebugger;
884  }
885 
886  // Returns true if opcode for constant operator.
887  static bool IsConstantOpcode(Value value) {
888  return kInt32Constant <= value && value <= kRelocatableInt64Constant;
889  }
890 
891  static bool IsPhiOpcode(Value value) {
892  return value == kPhi || value == kEffectPhi;
893  }
894 
895  static bool IsMergeOpcode(Value value) {
896  return value == kMerge || value == kLoop;
897  }
898 
899  static bool IsIfProjectionOpcode(Value value) {
900  return kIfTrue <= value && value <= kIfDefault;
901  }
902 
903  // Returns true if opcode terminates control flow in a graph (i.e. respective
904  // nodes are expected to have control uses by the graphs {End} node only).
905  static bool IsGraphTerminator(Value value) {
906  return value == kDeoptimize || value == kReturn || value == kTailCall ||
907  value == kTerminate || value == kThrow;
908  }
909 
910  // Returns true if opcode can be inlined.
911  static bool IsInlineeOpcode(Value value) {
912  return value == kJSConstruct || value == kJSCall;
913  }
914 
915  // Returns true if opcode for comparison operator.
916  static bool IsComparisonOpcode(Value value) {
917  return (kJSEqual <= value && value <= kJSGreaterThanOrEqual) ||
918  (kNumberEqual <= value && value <= kStringLessThanOrEqual) ||
919  (kWord32Equal <= value && value <= kFloat64LessThanOrEqual);
920  }
921 
922  static bool IsContextChainExtendingOpcode(Value value) {
923  return kJSCreateFunctionContext <= value && value <= kJSCreateBlockContext;
924  }
925 };
926 
927 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, IrOpcode::Value);
928 
929 } // namespace compiler
930 } // namespace internal
931 } // namespace v8
932 
933 #endif // V8_COMPILER_OPCODES_H_
Definition: libplatform.h:13