Line data Source code
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(JSCloneObject) \
138 : V(JSCreate) \
139 : V(JSCreateArguments) \
140 : V(JSCreateArray) \
141 : V(JSCreateArrayFromIterable) \
142 : V(JSCreateArrayIterator) \
143 : V(JSCreateAsyncFunctionObject) \
144 : V(JSCreateBoundFunction) \
145 : V(JSCreateClosure) \
146 : V(JSCreateCollectionIterator) \
147 : V(JSCreateEmptyLiteralArray) \
148 : V(JSCreateEmptyLiteralObject) \
149 : V(JSCreateGeneratorObject) \
150 : V(JSCreateIterResultObject) \
151 : V(JSCreateKeyValueArray) \
152 : V(JSCreateLiteralArray) \
153 : V(JSCreateLiteralObject) \
154 : V(JSCreateLiteralRegExp) \
155 : V(JSCreateObject) \
156 : V(JSCreatePromise) \
157 : V(JSCreateStringIterator) \
158 : V(JSCreateTypedArray)
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(ChangeCompressedToTaggedSigned) \
241 : V(ChangeTaggedToCompressedSigned) \
242 : V(ChangeInt31ToTaggedSigned) \
243 : V(ChangeInt32ToTagged) \
244 : V(ChangeInt64ToTagged) \
245 : V(ChangeUint32ToTagged) \
246 : V(ChangeUint64ToTagged) \
247 : V(ChangeFloat64ToTagged) \
248 : V(ChangeFloat64ToTaggedPointer) \
249 : V(ChangeTaggedToBit) \
250 : V(ChangeBitToTagged) \
251 : V(TruncateTaggedToWord32) \
252 : V(TruncateTaggedToFloat64) \
253 : V(TruncateTaggedToBit) \
254 : V(TruncateTaggedPointerToBit)
255 :
256 : #define SIMPLIFIED_CHECKED_OP_LIST(V) \
257 : V(CheckedInt32Add) \
258 : V(CheckedInt32Sub) \
259 : V(CheckedInt32Div) \
260 : V(CheckedInt32Mod) \
261 : V(CheckedUint32Div) \
262 : V(CheckedUint32Mod) \
263 : V(CheckedInt32Mul) \
264 : V(CheckedInt32ToTaggedSigned) \
265 : V(CheckedInt64ToInt32) \
266 : V(CheckedInt64ToTaggedSigned) \
267 : V(CheckedUint32Bounds) \
268 : V(CheckedUint32ToInt32) \
269 : V(CheckedUint32ToTaggedSigned) \
270 : V(CheckedUint64Bounds) \
271 : V(CheckedUint64ToInt32) \
272 : V(CheckedUint64ToTaggedSigned) \
273 : V(CheckedFloat64ToInt32) \
274 : V(CheckedFloat64ToInt64) \
275 : V(CheckedTaggedSignedToInt32) \
276 : V(CheckedTaggedToInt32) \
277 : V(CheckedTruncateTaggedToWord32) \
278 : V(CheckedTaggedToFloat64) \
279 : V(CheckedTaggedToInt64) \
280 : V(CheckedTaggedToTaggedSigned) \
281 : V(CheckedTaggedToTaggedPointer) \
282 : V(CheckedCompressedToTaggedSigned) \
283 : V(CheckedCompressedToTaggedPointer) \
284 : V(CheckedTaggedToCompressedSigned) \
285 : V(CheckedTaggedToCompressedPointer)
286 :
287 : #define SIMPLIFIED_COMPARE_BINOP_LIST(V) \
288 : V(NumberEqual) \
289 : V(NumberLessThan) \
290 : V(NumberLessThanOrEqual) \
291 : V(SpeculativeNumberEqual) \
292 : V(SpeculativeNumberLessThan) \
293 : V(SpeculativeNumberLessThanOrEqual) \
294 : V(ReferenceEqual) \
295 : V(SameValue) \
296 : V(NumberSameValue) \
297 : V(StringEqual) \
298 : V(StringLessThan) \
299 : V(StringLessThanOrEqual)
300 :
301 : #define SIMPLIFIED_NUMBER_BINOP_LIST(V) \
302 : V(NumberAdd) \
303 : V(NumberSubtract) \
304 : V(NumberMultiply) \
305 : V(NumberDivide) \
306 : V(NumberModulus) \
307 : V(NumberBitwiseOr) \
308 : V(NumberBitwiseXor) \
309 : V(NumberBitwiseAnd) \
310 : V(NumberShiftLeft) \
311 : V(NumberShiftRight) \
312 : V(NumberShiftRightLogical) \
313 : V(NumberAtan2) \
314 : V(NumberImul) \
315 : V(NumberMax) \
316 : V(NumberMin) \
317 : V(NumberPow)
318 :
319 : #define SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(V) \
320 : V(SpeculativeNumberAdd) \
321 : V(SpeculativeNumberSubtract) \
322 : V(SpeculativeNumberMultiply) \
323 : V(SpeculativeNumberDivide) \
324 : V(SpeculativeNumberModulus) \
325 : V(SpeculativeNumberBitwiseAnd) \
326 : V(SpeculativeNumberBitwiseOr) \
327 : V(SpeculativeNumberBitwiseXor) \
328 : V(SpeculativeNumberShiftLeft) \
329 : V(SpeculativeNumberShiftRight) \
330 : V(SpeculativeNumberShiftRightLogical) \
331 : V(SpeculativeSafeIntegerAdd) \
332 : V(SpeculativeSafeIntegerSubtract)
333 :
334 : #define SIMPLIFIED_NUMBER_UNOP_LIST(V) \
335 : V(NumberAbs) \
336 : V(NumberAcos) \
337 : V(NumberAcosh) \
338 : V(NumberAsin) \
339 : V(NumberAsinh) \
340 : V(NumberAtan) \
341 : V(NumberAtanh) \
342 : V(NumberCbrt) \
343 : V(NumberCeil) \
344 : V(NumberClz32) \
345 : V(NumberCos) \
346 : V(NumberCosh) \
347 : V(NumberExp) \
348 : V(NumberExpm1) \
349 : V(NumberFloor) \
350 : V(NumberFround) \
351 : V(NumberLog) \
352 : V(NumberLog1p) \
353 : V(NumberLog2) \
354 : V(NumberLog10) \
355 : V(NumberRound) \
356 : V(NumberSign) \
357 : V(NumberSin) \
358 : V(NumberSinh) \
359 : V(NumberSqrt) \
360 : V(NumberTan) \
361 : V(NumberTanh) \
362 : V(NumberTrunc) \
363 : V(NumberToBoolean) \
364 : V(NumberToInt32) \
365 : V(NumberToString) \
366 : V(NumberToUint32) \
367 : V(NumberToUint8Clamped) \
368 : V(NumberSilenceNaN)
369 :
370 : #define SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(V) V(SpeculativeToNumber)
371 :
372 : #define SIMPLIFIED_OTHER_OP_LIST(V) \
373 : V(PlainPrimitiveToNumber) \
374 : V(PlainPrimitiveToWord32) \
375 : V(PlainPrimitiveToFloat64) \
376 : V(BooleanNot) \
377 : V(StringConcat) \
378 : V(StringToNumber) \
379 : V(StringCharCodeAt) \
380 : V(StringCodePointAt) \
381 : V(StringFromSingleCharCode) \
382 : V(StringFromSingleCodePoint) \
383 : V(StringIndexOf) \
384 : V(StringLength) \
385 : V(StringToLowerCaseIntl) \
386 : V(StringToUpperCaseIntl) \
387 : V(StringSubstring) \
388 : V(CheckBounds) \
389 : V(CheckIf) \
390 : V(CheckMaps) \
391 : V(CheckNumber) \
392 : V(CheckReceiver) \
393 : V(CheckReceiverOrNullOrUndefined) \
394 : V(CheckInternalizedString) \
395 : V(CheckNonEmptyString) \
396 : V(CheckNonEmptyOneByteString) \
397 : V(CheckNonEmptyTwoByteString) \
398 : V(CheckString) \
399 : V(CheckSymbol) \
400 : V(CheckSmi) \
401 : V(CheckHeapObject) \
402 : V(CheckFloat64Hole) \
403 : V(CheckNotTaggedHole) \
404 : V(CheckEqualsInternalizedString) \
405 : V(CheckEqualsSymbol) \
406 : V(CompareMaps) \
407 : V(ConvertReceiver) \
408 : V(ConvertTaggedHoleToUndefined) \
409 : V(TypeOf) \
410 : V(Allocate) \
411 : V(AllocateRaw) \
412 : V(LoadFieldByIndex) \
413 : V(LoadField) \
414 : V(LoadElement) \
415 : V(LoadMessage) \
416 : V(LoadTypedElement) \
417 : V(LoadDataViewElement) \
418 : V(LoadStackArgument) \
419 : V(StoreField) \
420 : V(StoreElement) \
421 : V(StoreMessage) \
422 : V(StoreTypedElement) \
423 : V(StoreDataViewElement) \
424 : V(StoreSignedSmallElement) \
425 : V(TransitionAndStoreElement) \
426 : V(TransitionAndStoreNumberElement) \
427 : V(TransitionAndStoreNonNumberElement) \
428 : V(ToBoolean) \
429 : V(NumberIsFloat64Hole) \
430 : V(NumberIsFinite) \
431 : V(ObjectIsFiniteNumber) \
432 : V(NumberIsInteger) \
433 : V(ObjectIsSafeInteger) \
434 : V(NumberIsSafeInteger) \
435 : V(ObjectIsInteger) \
436 : V(ObjectIsArrayBufferView) \
437 : V(ObjectIsBigInt) \
438 : V(ObjectIsCallable) \
439 : V(ObjectIsConstructor) \
440 : V(ObjectIsDetectableCallable) \
441 : V(ObjectIsMinusZero) \
442 : V(NumberIsMinusZero) \
443 : V(ObjectIsNaN) \
444 : V(NumberIsNaN) \
445 : V(ObjectIsNonCallable) \
446 : V(ObjectIsNumber) \
447 : V(ObjectIsReceiver) \
448 : V(ObjectIsSmi) \
449 : V(ObjectIsString) \
450 : V(ObjectIsSymbol) \
451 : V(ObjectIsUndetectable) \
452 : V(ArgumentsFrame) \
453 : V(ArgumentsLength) \
454 : V(NewDoubleElements) \
455 : V(NewSmiOrObjectElements) \
456 : V(NewArgumentsElements) \
457 : V(NewConsOneByteString) \
458 : V(NewConsTwoByteString) \
459 : V(NewConsString) \
460 : V(DelayedStringConstant) \
461 : V(EnsureWritableFastElements) \
462 : V(MaybeGrowFastElements) \
463 : V(TransitionElementsKind) \
464 : V(FindOrderedHashMapEntry) \
465 : V(FindOrderedHashMapEntryForInt32Key) \
466 : V(PoisonIndex) \
467 : V(RuntimeAbort) \
468 : V(DateNow)
469 :
470 : #define SIMPLIFIED_OP_LIST(V) \
471 : SIMPLIFIED_CHANGE_OP_LIST(V) \
472 : SIMPLIFIED_CHECKED_OP_LIST(V) \
473 : SIMPLIFIED_COMPARE_BINOP_LIST(V) \
474 : SIMPLIFIED_NUMBER_BINOP_LIST(V) \
475 : SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(V) \
476 : SIMPLIFIED_NUMBER_UNOP_LIST(V) \
477 : SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(V) \
478 : SIMPLIFIED_OTHER_OP_LIST(V)
479 :
480 : // Opcodes for Machine-level operators.
481 : #define MACHINE_COMPARE_BINOP_LIST(V) \
482 : V(Word32Equal) \
483 : V(Word64Equal) \
484 : V(Int32LessThan) \
485 : V(Int32LessThanOrEqual) \
486 : V(Uint32LessThan) \
487 : V(Uint32LessThanOrEqual) \
488 : V(Int64LessThan) \
489 : V(Int64LessThanOrEqual) \
490 : V(Uint64LessThan) \
491 : V(Uint64LessThanOrEqual) \
492 : V(Float32Equal) \
493 : V(Float32LessThan) \
494 : V(Float32LessThanOrEqual) \
495 : V(Float64Equal) \
496 : V(Float64LessThan) \
497 : V(Float64LessThanOrEqual)
498 :
499 : #define MACHINE_UNOP_32_LIST(V) \
500 : V(Word32Clz) \
501 : V(Word32Ctz) \
502 : V(Int32AbsWithOverflow) \
503 : V(Word32ReverseBits) \
504 : V(Word32ReverseBytes)
505 :
506 : #define MACHINE_BINOP_32_LIST(V) \
507 : V(Word32And) \
508 : V(Word32Or) \
509 : V(Word32Xor) \
510 : V(Word32Shl) \
511 : V(Word32Shr) \
512 : V(Word32Sar) \
513 : V(Word32Ror) \
514 : V(Int32Add) \
515 : V(Int32AddWithOverflow) \
516 : V(Int32Sub) \
517 : V(Int32SubWithOverflow) \
518 : V(Int32Mul) \
519 : V(Int32MulWithOverflow) \
520 : V(Int32MulHigh) \
521 : V(Int32Div) \
522 : V(Int32Mod) \
523 : V(Uint32Div) \
524 : V(Uint32Mod) \
525 : V(Uint32MulHigh)
526 :
527 : #define MACHINE_BINOP_64_LIST(V) \
528 : V(Word64And) \
529 : V(Word64Or) \
530 : V(Word64Xor) \
531 : V(Word64Shl) \
532 : V(Word64Shr) \
533 : V(Word64Sar) \
534 : V(Word64Ror) \
535 : V(Int64Add) \
536 : V(Int64AddWithOverflow) \
537 : V(Int64Sub) \
538 : V(Int64SubWithOverflow) \
539 : V(Int64Mul) \
540 : V(Int64Div) \
541 : V(Int64Mod) \
542 : V(Uint64Div) \
543 : V(Uint64Mod)
544 :
545 : #define MACHINE_FLOAT32_UNOP_LIST(V) \
546 : V(Float32Abs) \
547 : V(Float32Neg) \
548 : V(Float32RoundDown) \
549 : V(Float32RoundTiesEven) \
550 : V(Float32RoundTruncate) \
551 : V(Float32RoundUp) \
552 : V(Float32Sqrt)
553 :
554 : #define MACHINE_FLOAT32_BINOP_LIST(V) \
555 : V(Float32Add) \
556 : V(Float32Sub) \
557 : V(Float32Mul) \
558 : V(Float32Div) \
559 : V(Float32Max) \
560 : V(Float32Min)
561 :
562 : #define MACHINE_FLOAT64_UNOP_LIST(V) \
563 : V(Float64Abs) \
564 : V(Float64Acos) \
565 : V(Float64Acosh) \
566 : V(Float64Asin) \
567 : V(Float64Asinh) \
568 : V(Float64Atan) \
569 : V(Float64Atanh) \
570 : V(Float64Cbrt) \
571 : V(Float64Cos) \
572 : V(Float64Cosh) \
573 : V(Float64Exp) \
574 : V(Float64Expm1) \
575 : V(Float64Log) \
576 : V(Float64Log1p) \
577 : V(Float64Log10) \
578 : V(Float64Log2) \
579 : V(Float64Neg) \
580 : V(Float64RoundDown) \
581 : V(Float64RoundTiesAway) \
582 : V(Float64RoundTiesEven) \
583 : V(Float64RoundTruncate) \
584 : V(Float64RoundUp) \
585 : V(Float64Sin) \
586 : V(Float64Sinh) \
587 : V(Float64Sqrt) \
588 : V(Float64Tan) \
589 : V(Float64Tanh)
590 :
591 : #define MACHINE_FLOAT64_BINOP_LIST(V) \
592 : V(Float64Atan2) \
593 : V(Float64Max) \
594 : V(Float64Min) \
595 : V(Float64Add) \
596 : V(Float64Sub) \
597 : V(Float64Mul) \
598 : V(Float64Div) \
599 : V(Float64Mod) \
600 : V(Float64Pow)
601 :
602 : #define MACHINE_WORD64_ATOMIC_OP_LIST(V) \
603 : V(Word64AtomicLoad) \
604 : V(Word64AtomicStore) \
605 : V(Word64AtomicAdd) \
606 : V(Word64AtomicSub) \
607 : V(Word64AtomicAnd) \
608 : V(Word64AtomicOr) \
609 : V(Word64AtomicXor) \
610 : V(Word64AtomicExchange) \
611 : V(Word64AtomicCompareExchange)
612 :
613 : #define MACHINE_OP_LIST(V) \
614 : MACHINE_UNOP_32_LIST(V) \
615 : MACHINE_BINOP_32_LIST(V) \
616 : MACHINE_BINOP_64_LIST(V) \
617 : MACHINE_COMPARE_BINOP_LIST(V) \
618 : MACHINE_FLOAT32_BINOP_LIST(V) \
619 : MACHINE_FLOAT32_UNOP_LIST(V) \
620 : MACHINE_FLOAT64_BINOP_LIST(V) \
621 : MACHINE_FLOAT64_UNOP_LIST(V) \
622 : MACHINE_WORD64_ATOMIC_OP_LIST(V) \
623 : V(DebugAbort) \
624 : V(DebugBreak) \
625 : V(Comment) \
626 : V(Load) \
627 : V(PoisonedLoad) \
628 : V(Store) \
629 : V(StackSlot) \
630 : V(Word32Popcnt) \
631 : V(Word64Popcnt) \
632 : V(Word64Clz) \
633 : V(Word64Ctz) \
634 : V(Word64ReverseBits) \
635 : V(Word64ReverseBytes) \
636 : V(Int64AbsWithOverflow) \
637 : V(BitcastTaggedToWord) \
638 : V(BitcastWordToTagged) \
639 : V(BitcastWordToTaggedSigned) \
640 : V(TruncateFloat64ToWord32) \
641 : V(ChangeFloat32ToFloat64) \
642 : V(ChangeFloat64ToInt32) \
643 : V(ChangeFloat64ToInt64) \
644 : V(ChangeFloat64ToUint32) \
645 : V(ChangeFloat64ToUint64) \
646 : V(Float64SilenceNaN) \
647 : V(TruncateFloat64ToInt64) \
648 : V(TruncateFloat64ToUint32) \
649 : V(TruncateFloat32ToInt32) \
650 : V(TruncateFloat32ToUint32) \
651 : V(TryTruncateFloat32ToInt64) \
652 : V(TryTruncateFloat64ToInt64) \
653 : V(TryTruncateFloat32ToUint64) \
654 : V(TryTruncateFloat64ToUint64) \
655 : V(ChangeInt32ToFloat64) \
656 : V(ChangeInt32ToInt64) \
657 : V(ChangeInt64ToFloat64) \
658 : V(ChangeUint32ToFloat64) \
659 : V(ChangeUint32ToUint64) \
660 : V(ChangeTaggedToCompressed) \
661 : V(ChangeTaggedPointerToCompressedPointer) \
662 : V(ChangeTaggedSignedToCompressedSigned) \
663 : V(ChangeCompressedToTagged) \
664 : V(ChangeCompressedPointerToTaggedPointer) \
665 : V(ChangeCompressedSignedToTaggedSigned) \
666 : V(TruncateFloat64ToFloat32) \
667 : V(TruncateInt64ToInt32) \
668 : V(RoundFloat64ToInt32) \
669 : V(RoundInt32ToFloat32) \
670 : V(RoundInt64ToFloat32) \
671 : V(RoundInt64ToFloat64) \
672 : V(RoundUint32ToFloat32) \
673 : V(RoundUint64ToFloat32) \
674 : V(RoundUint64ToFloat64) \
675 : V(BitcastFloat32ToInt32) \
676 : V(BitcastFloat64ToInt64) \
677 : V(BitcastInt32ToFloat32) \
678 : V(BitcastInt64ToFloat64) \
679 : V(Float64ExtractLowWord32) \
680 : V(Float64ExtractHighWord32) \
681 : V(Float64InsertLowWord32) \
682 : V(Float64InsertHighWord32) \
683 : V(TaggedPoisonOnSpeculation) \
684 : V(Word32PoisonOnSpeculation) \
685 : V(Word64PoisonOnSpeculation) \
686 : V(LoadStackPointer) \
687 : V(LoadFramePointer) \
688 : V(LoadParentFramePointer) \
689 : V(UnalignedLoad) \
690 : V(UnalignedStore) \
691 : V(Int32PairAdd) \
692 : V(Int32PairSub) \
693 : V(Int32PairMul) \
694 : V(Word32PairShl) \
695 : V(Word32PairShr) \
696 : V(Word32PairSar) \
697 : V(ProtectedLoad) \
698 : V(ProtectedStore) \
699 : V(Word32AtomicLoad) \
700 : V(Word32AtomicStore) \
701 : V(Word32AtomicExchange) \
702 : V(Word32AtomicCompareExchange) \
703 : V(Word32AtomicAdd) \
704 : V(Word32AtomicSub) \
705 : V(Word32AtomicAnd) \
706 : V(Word32AtomicOr) \
707 : V(Word32AtomicXor) \
708 : V(Word32AtomicPairLoad) \
709 : V(Word32AtomicPairStore) \
710 : V(Word32AtomicPairAdd) \
711 : V(Word32AtomicPairSub) \
712 : V(Word32AtomicPairAnd) \
713 : V(Word32AtomicPairOr) \
714 : V(Word32AtomicPairXor) \
715 : V(Word32AtomicPairExchange) \
716 : V(Word32AtomicPairCompareExchange) \
717 : V(SignExtendWord8ToInt32) \
718 : V(SignExtendWord16ToInt32) \
719 : V(SignExtendWord8ToInt64) \
720 : V(SignExtendWord16ToInt64) \
721 : V(SignExtendWord32ToInt64) \
722 : V(UnsafePointerAdd)
723 :
724 : #define MACHINE_SIMD_OP_LIST(V) \
725 : V(F32x4Splat) \
726 : V(F32x4ExtractLane) \
727 : V(F32x4ReplaceLane) \
728 : V(F32x4SConvertI32x4) \
729 : V(F32x4UConvertI32x4) \
730 : V(F32x4Abs) \
731 : V(F32x4Neg) \
732 : V(F32x4RecipApprox) \
733 : V(F32x4RecipSqrtApprox) \
734 : V(F32x4Add) \
735 : V(F32x4AddHoriz) \
736 : V(F32x4Sub) \
737 : V(F32x4Mul) \
738 : V(F32x4Min) \
739 : V(F32x4Max) \
740 : V(F32x4Eq) \
741 : V(F32x4Ne) \
742 : V(F32x4Lt) \
743 : V(F32x4Le) \
744 : V(F32x4Gt) \
745 : V(F32x4Ge) \
746 : V(I32x4Splat) \
747 : V(I32x4ExtractLane) \
748 : V(I32x4ReplaceLane) \
749 : V(I32x4SConvertF32x4) \
750 : V(I32x4SConvertI16x8Low) \
751 : V(I32x4SConvertI16x8High) \
752 : V(I32x4Neg) \
753 : V(I32x4Shl) \
754 : V(I32x4ShrS) \
755 : V(I32x4Add) \
756 : V(I32x4AddHoriz) \
757 : V(I32x4Sub) \
758 : V(I32x4Mul) \
759 : V(I32x4MinS) \
760 : V(I32x4MaxS) \
761 : V(I32x4Eq) \
762 : V(I32x4Ne) \
763 : V(I32x4LtS) \
764 : V(I32x4LeS) \
765 : V(I32x4GtS) \
766 : V(I32x4GeS) \
767 : V(I32x4UConvertF32x4) \
768 : V(I32x4UConvertI16x8Low) \
769 : V(I32x4UConvertI16x8High) \
770 : V(I32x4ShrU) \
771 : V(I32x4MinU) \
772 : V(I32x4MaxU) \
773 : V(I32x4LtU) \
774 : V(I32x4LeU) \
775 : V(I32x4GtU) \
776 : V(I32x4GeU) \
777 : V(I16x8Splat) \
778 : V(I16x8ExtractLane) \
779 : V(I16x8ReplaceLane) \
780 : V(I16x8SConvertI8x16Low) \
781 : V(I16x8SConvertI8x16High) \
782 : V(I16x8Neg) \
783 : V(I16x8Shl) \
784 : V(I16x8ShrS) \
785 : V(I16x8SConvertI32x4) \
786 : V(I16x8Add) \
787 : V(I16x8AddSaturateS) \
788 : V(I16x8AddHoriz) \
789 : V(I16x8Sub) \
790 : V(I16x8SubSaturateS) \
791 : V(I16x8Mul) \
792 : V(I16x8MinS) \
793 : V(I16x8MaxS) \
794 : V(I16x8Eq) \
795 : V(I16x8Ne) \
796 : V(I16x8LtS) \
797 : V(I16x8LeS) \
798 : V(I16x8GtS) \
799 : V(I16x8GeS) \
800 : V(I16x8UConvertI8x16Low) \
801 : V(I16x8UConvertI8x16High) \
802 : V(I16x8ShrU) \
803 : V(I16x8UConvertI32x4) \
804 : V(I16x8AddSaturateU) \
805 : V(I16x8SubSaturateU) \
806 : V(I16x8MinU) \
807 : V(I16x8MaxU) \
808 : V(I16x8LtU) \
809 : V(I16x8LeU) \
810 : V(I16x8GtU) \
811 : V(I16x8GeU) \
812 : V(I8x16Splat) \
813 : V(I8x16ExtractLane) \
814 : V(I8x16ReplaceLane) \
815 : V(I8x16SConvertI16x8) \
816 : V(I8x16Neg) \
817 : V(I8x16Shl) \
818 : V(I8x16ShrS) \
819 : V(I8x16Add) \
820 : V(I8x16AddSaturateS) \
821 : V(I8x16Sub) \
822 : V(I8x16SubSaturateS) \
823 : V(I8x16Mul) \
824 : V(I8x16MinS) \
825 : V(I8x16MaxS) \
826 : V(I8x16Eq) \
827 : V(I8x16Ne) \
828 : V(I8x16LtS) \
829 : V(I8x16LeS) \
830 : V(I8x16GtS) \
831 : V(I8x16GeS) \
832 : V(I8x16UConvertI16x8) \
833 : V(I8x16AddSaturateU) \
834 : V(I8x16SubSaturateU) \
835 : V(I8x16ShrU) \
836 : V(I8x16MinU) \
837 : V(I8x16MaxU) \
838 : V(I8x16LtU) \
839 : V(I8x16LeU) \
840 : V(I8x16GtU) \
841 : V(I8x16GeU) \
842 : V(S128Load) \
843 : V(S128Store) \
844 : V(S128Zero) \
845 : V(S128Not) \
846 : V(S128And) \
847 : V(S128Or) \
848 : V(S128Xor) \
849 : V(S128Select) \
850 : V(S8x16Shuffle) \
851 : V(S1x4AnyTrue) \
852 : V(S1x4AllTrue) \
853 : V(S1x8AnyTrue) \
854 : V(S1x8AllTrue) \
855 : V(S1x16AnyTrue) \
856 : V(S1x16AllTrue)
857 :
858 : #define VALUE_OP_LIST(V) \
859 : COMMON_OP_LIST(V) \
860 : SIMPLIFIED_OP_LIST(V) \
861 : MACHINE_OP_LIST(V) \
862 : MACHINE_SIMD_OP_LIST(V) \
863 : JS_OP_LIST(V)
864 :
865 : // The combination of all operators at all levels and the common operators.
866 : #define ALL_OP_LIST(V) \
867 : CONTROL_OP_LIST(V) \
868 : VALUE_OP_LIST(V)
869 :
870 : namespace v8 {
871 : namespace internal {
872 : namespace compiler {
873 :
874 : // Declare an enumeration with all the opcodes at all levels so that they
875 : // can be globally, uniquely numbered.
876 : class V8_EXPORT_PRIVATE IrOpcode {
877 : public:
878 : enum Value {
879 : #define DECLARE_OPCODE(x) k##x,
880 : ALL_OP_LIST(DECLARE_OPCODE)
881 : #undef DECLARE_OPCODE
882 : kLast = -1
883 : #define COUNT_OPCODE(x) +1
884 : ALL_OP_LIST(COUNT_OPCODE)
885 : #undef COUNT_OPCODE
886 : };
887 :
888 : // Returns the mnemonic name of an opcode.
889 : static char const* Mnemonic(Value value);
890 :
891 : // Returns true if opcode for common operator.
892 : static bool IsCommonOpcode(Value value) {
893 737 : return kStart <= value && value <= kDead;
894 : }
895 :
896 : // Returns true if opcode for control operator.
897 : static bool IsControlOpcode(Value value) {
898 737 : return kStart <= value && value <= kEnd;
899 : }
900 :
901 : // Returns true if opcode for JavaScript operator.
902 : static bool IsJsOpcode(Value value) {
903 1286500386 : return kJSEqual <= value && value <= kJSDebugger;
904 : }
905 :
906 : // Returns true if opcode for constant operator.
907 : static bool IsConstantOpcode(Value value) {
908 70281090 : return kInt32Constant <= value && value <= kRelocatableInt64Constant;
909 : }
910 :
911 : static bool IsPhiOpcode(Value value) {
912 344730469 : return value == kPhi || value == kEffectPhi;
913 : }
914 :
915 : static bool IsMergeOpcode(Value value) {
916 343062506 : return value == kMerge || value == kLoop;
917 : }
918 :
919 : static bool IsIfProjectionOpcode(Value value) {
920 18884061 : return kIfTrue <= value && value <= kIfDefault;
921 : }
922 :
923 : // Returns true if opcode terminates control flow in a graph (i.e. respective
924 : // nodes are expected to have control uses by the graphs {End} node only).
925 : static bool IsGraphTerminator(Value value) {
926 550940 : return value == kDeoptimize || value == kReturn || value == kTailCall ||
927 395362 : value == kTerminate || value == kThrow;
928 : }
929 :
930 : // Returns true if opcode can be inlined.
931 : static bool IsInlineeOpcode(Value value) {
932 33763274 : return value == kJSConstruct || value == kJSCall;
933 : }
934 :
935 : // Returns true if opcode for comparison operator.
936 : static bool IsComparisonOpcode(Value value) {
937 1513240 : return (kJSEqual <= value && value <= kJSGreaterThanOrEqual) ||
938 2269842 : (kNumberEqual <= value && value <= kStringLessThanOrEqual) ||
939 756602 : (kWord32Equal <= value && value <= kFloat64LessThanOrEqual);
940 : }
941 :
942 : static bool IsContextChainExtendingOpcode(Value value) {
943 43513 : return kJSCreateFunctionContext <= value && value <= kJSCreateBlockContext;
944 : }
945 : };
946 :
947 : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, IrOpcode::Value);
948 :
949 : } // namespace compiler
950 : } // namespace internal
951 : } // namespace v8
952 :
953 : #endif // V8_COMPILER_OPCODES_H_
|