2 * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include "DFGNodeFlags.h"
32 namespace JSC { namespace DFG {
34 // This macro defines a set of information about all known node types, used to populate NodeId, NodeType below.
35 #define FOR_EACH_DFG_OP(macro) \
36 /* A constant in the CodeBlock's constant pool. */\
37 macro(JSConstant, NodeResultJS) \
39 /* Constants with specific representations. */\
40 macro(DoubleConstant, NodeResultDouble) \
41 macro(Int52Constant, NodeResultInt52) \
43 /* Lazy JSValue constant. We don't know the JSValue bits of it yet. */\
44 macro(LazyJSConstant, NodeResultJS) \
46 /* Marker to indicate that an operation was optimized entirely and all that is left */\
47 /* is to make one node alias another. CSE will later usually eliminate this node, */\
48 /* though it may choose not to if it would corrupt predictions (very rare). */\
49 macro(Identity, NodeResultJS) \
50 /* Used for debugging to force a profile to appear as anything we want. */ \
51 macro(IdentityWithProfile, NodeResultJS | NodeMustGenerate) \
53 /* Nodes for handling functions (both as call and as construct). */\
54 macro(ToThis, NodeResultJS) \
55 macro(CreateThis, NodeResultJS) /* Note this is not MustGenerate since we're returning it anyway. */ \
56 macro(GetCallee, NodeResultJS) \
57 macro(GetArgumentCountIncludingThis, NodeResultInt32) \
59 /* Nodes for local variable access. These nodes are linked together using Phi nodes. */\
60 /* Any two nodes that are part of the same Phi graph will share the same */\
61 /* VariableAccessData, and thus will share predictions. FIXME: We should come up with */\
62 /* better names for a lot of these. https://bugs.webkit.org/show_bug.cgi?id=137307. */\
63 /* Note that GetLocal is MustGenerate because it's our only way of knowing that some other */\
64 /* basic block might have read a local variable in bytecode. We only remove GetLocals if it */\
65 /* is redundant because of an earlier GetLocal or SetLocal in the same block. We could make */\
66 /* these not MustGenerate and use a more sophisticated analysis to insert PhantomLocals in */\
67 /* the same way that we insert Phantoms. That's hard and probably not profitable. See */\
68 /* https://bugs.webkit.org/show_bug.cgi?id=144086 */\
69 macro(GetLocal, NodeResultJS | NodeMustGenerate) \
72 macro(PutStack, NodeMustGenerate) \
73 macro(KillStack, NodeMustGenerate) \
74 macro(GetStack, NodeResultJS) \
76 macro(MovHint, NodeMustGenerate) \
77 macro(ZombieHint, NodeMustGenerate) \
78 macro(ExitOK, NodeMustGenerate) /* Indicates that exit state is intact. */ \
79 macro(Phantom, NodeMustGenerate) \
80 macro(Check, NodeMustGenerate) /* Used if we want just a type check but not liveness. Non-checking uses will be removed. */\
83 macro(Flush, NodeMustGenerate) \
84 macro(PhantomLocal, NodeMustGenerate) \
86 /* Hint that this is where bytecode thinks is a good place to OSR. Note that this */\
87 /* will exist even in inlined loops. This has no execution semantics but it must */\
88 /* survive all DCE. We treat this as being a can-exit because tier-up to FTL may */\
89 /* want all state. */\
90 macro(LoopHint, NodeMustGenerate) \
92 /* Special node for OSR entry into the FTL. Indicates that we're loading a local */\
93 /* variable from the scratch buffer. */\
94 macro(ExtractOSREntryLocal, NodeResultJS) \
95 macro(ExtractCatchLocal, NodeResultJS) \
97 /* Tier-up checks from the DFG to the FTL. */\
98 macro(CheckTierUpInLoop, NodeMustGenerate) \
99 macro(CheckTierUpAndOSREnter, NodeMustGenerate) \
100 macro(CheckTierUpAtReturn, NodeMustGenerate) \
102 /* Marker for an argument being set at the prologue of a function. */\
103 macro(SetArgument, 0) \
105 /* Marker of location in the IR where we may possibly perform jump replacement to */\
106 /* invalidate this code block. */\
107 macro(InvalidationPoint, NodeMustGenerate) \
109 /* Nodes for bitwise operations. */\
110 macro(BitAnd, NodeResultInt32) \
111 macro(BitOr, NodeResultInt32) \
112 macro(BitXor, NodeResultInt32) \
113 macro(BitLShift, NodeResultInt32) \
114 macro(BitRShift, NodeResultInt32) \
115 macro(BitURShift, NodeResultInt32) \
116 /* Bitwise operators call ToInt32 on their operands. */\
117 macro(ValueToInt32, NodeResultInt32) \
118 /* Used to box the result of URShift nodes (result has range 0..2^32-1). */\
119 macro(UInt32ToNumber, NodeResultNumber) \
120 /* Converts booleans to numbers but passes everything else through. */\
121 macro(BooleanToNumber, NodeResultJS) \
123 /* Attempt to truncate a double to int32; this will exit if it can't do it. */\
124 macro(DoubleAsInt32, NodeResultInt32) \
126 /* Change the representation of a value. */\
127 macro(DoubleRep, NodeResultDouble) \
128 macro(Int52Rep, NodeResultInt52) \
129 macro(ValueRep, NodeResultJS) \
131 /* Bogus type asserting node. Useful for testing, disappears during Fixup. */\
132 macro(FiatInt52, NodeResultJS) \
134 /* Nodes for arithmetic operations. Note that if they do checks other than just type checks, */\
135 /* then they are MustGenerate. This is probably stricter than it needs to be - for example */\
136 /* they won't do checks if they are speculated double. Also, we could kill these if we do it */\
137 /* before AI starts eliminating downstream operations based on proofs, for example in the */\
138 /* case of "var tmp = a + b; return (tmp | 0) == tmp;". If a, b are speculated integer then */\
139 /* this is only true if we do the overflow check - hence the need to keep it alive. More */\
140 /* generally, we need to keep alive any operation whose checks cause filtration in AI. */\
141 macro(ArithAdd, NodeResultNumber | NodeMustGenerate) \
142 macro(ArithClz32, NodeResultInt32 | NodeMustGenerate) \
143 macro(ArithSub, NodeResultNumber | NodeMustGenerate) \
144 macro(ArithNegate, NodeResultNumber | NodeMustGenerate) \
145 macro(ArithMul, NodeResultNumber | NodeMustGenerate) \
146 macro(ArithIMul, NodeResultInt32) \
147 macro(ArithDiv, NodeResultNumber | NodeMustGenerate) \
148 macro(ArithMod, NodeResultNumber | NodeMustGenerate) \
149 macro(ArithAbs, NodeResultNumber | NodeMustGenerate) \
150 macro(ArithMin, NodeResultNumber) \
151 macro(ArithMax, NodeResultNumber) \
152 macro(ArithFRound, NodeResultDouble | NodeMustGenerate) \
153 macro(ArithPow, NodeResultDouble) \
154 macro(ArithRandom, NodeResultDouble | NodeMustGenerate) \
155 macro(ArithRound, NodeResultNumber | NodeMustGenerate) \
156 macro(ArithFloor, NodeResultNumber | NodeMustGenerate) \
157 macro(ArithCeil, NodeResultNumber | NodeMustGenerate) \
158 macro(ArithTrunc, NodeResultNumber | NodeMustGenerate) \
159 macro(ArithSqrt, NodeResultDouble | NodeMustGenerate) \
160 macro(ArithUnary, NodeResultDouble | NodeMustGenerate) \
162 /* Add of values may either be arithmetic, or result in string concatenation. */\
163 macro(ValueAdd, NodeResultJS | NodeMustGenerate) \
165 /* Add of values that always convers its inputs to strings. May have two or three kids. */\
166 macro(StrCat, NodeResultJS | NodeMustGenerate) \
168 /* Property access. */\
169 /* PutByValAlias indicates a 'put' aliases a prior write to the same property. */\
170 /* Since a put to 'length' may invalidate optimizations here, */\
171 /* this must be the directly subsequent property put. Note that PutByVal */\
172 /* opcodes use VarArgs beause they may have up to 4 children. */\
173 macro(GetByVal, NodeResultJS | NodeMustGenerate) \
174 macro(GetByValWithThis, NodeResultJS | NodeMustGenerate) \
175 macro(GetMyArgumentByVal, NodeResultJS | NodeMustGenerate) \
176 macro(GetMyArgumentByValOutOfBounds, NodeResultJS | NodeMustGenerate) \
177 macro(LoadVarargs, NodeMustGenerate) \
178 macro(ForwardVarargs, NodeMustGenerate) \
179 macro(PutByValDirect, NodeMustGenerate | NodeHasVarArgs) \
180 macro(PutByVal, NodeMustGenerate | NodeHasVarArgs) \
181 macro(PutByValAlias, NodeMustGenerate | NodeHasVarArgs) \
182 macro(TryGetById, NodeResultJS) \
183 macro(GetById, NodeResultJS | NodeMustGenerate) \
184 macro(GetByIdFlush, NodeResultJS | NodeMustGenerate) \
185 macro(GetByIdWithThis, NodeResultJS | NodeMustGenerate) \
186 macro(PutById, NodeMustGenerate) \
187 macro(PutByIdFlush, NodeMustGenerate) \
188 macro(PutByIdDirect, NodeMustGenerate) \
189 macro(PutByIdWithThis, NodeMustGenerate) \
190 macro(PutByValWithThis, NodeMustGenerate | NodeHasVarArgs) \
191 macro(PutGetterById, NodeMustGenerate) \
192 macro(PutSetterById, NodeMustGenerate) \
193 macro(PutGetterSetterById, NodeMustGenerate) \
194 macro(PutGetterByVal, NodeMustGenerate) \
195 macro(PutSetterByVal, NodeMustGenerate) \
196 macro(DefineDataProperty, NodeMustGenerate | NodeHasVarArgs) \
197 macro(DefineAccessorProperty, NodeMustGenerate | NodeHasVarArgs) \
198 macro(DeleteById, NodeResultBoolean | NodeMustGenerate) \
199 macro(DeleteByVal, NodeResultBoolean | NodeMustGenerate) \
200 macro(CheckStructure, NodeMustGenerate) \
201 macro(CheckStructureOrEmpty, NodeMustGenerate) \
202 macro(GetExecutable, NodeResultJS) \
203 macro(PutStructure, NodeMustGenerate) \
204 macro(AllocatePropertyStorage, NodeMustGenerate | NodeResultStorage) \
205 macro(ReallocatePropertyStorage, NodeMustGenerate | NodeResultStorage) \
206 macro(GetButterfly, NodeResultStorage) \
207 macro(NukeStructureAndSetButterfly, NodeMustGenerate) \
208 macro(CheckArray, NodeMustGenerate) \
209 macro(Arrayify, NodeMustGenerate) \
210 macro(ArrayifyToStructure, NodeMustGenerate) \
211 macro(GetIndexedPropertyStorage, NodeResultStorage) \
212 macro(ConstantStoragePointer, NodeResultStorage) \
213 macro(GetGetter, NodeResultJS) \
214 macro(GetSetter, NodeResultJS) \
215 macro(GetByOffset, NodeResultJS) \
216 macro(GetGetterSetterByOffset, NodeResultJS) \
217 macro(MultiGetByOffset, NodeResultJS | NodeMustGenerate) \
218 macro(PutByOffset, NodeMustGenerate) \
219 macro(MultiPutByOffset, NodeMustGenerate) \
220 macro(GetArrayLength, NodeResultInt32) \
221 macro(GetVectorLength, NodeResultInt32) \
222 macro(GetTypedArrayByteOffset, NodeResultInt32) \
223 macro(GetScope, NodeResultJS) \
224 macro(SkipScope, NodeResultJS) \
225 macro(ResolveScope, NodeResultJS | NodeMustGenerate) \
226 macro(ResolveScopeForHoistingFuncDeclInEval, NodeResultJS | NodeMustGenerate) \
227 macro(GetGlobalObject, NodeResultJS) \
228 macro(GetGlobalThis, NodeResultJS) \
229 macro(GetClosureVar, NodeResultJS) \
230 macro(PutClosureVar, NodeMustGenerate) \
231 macro(GetGlobalVar, NodeResultJS) \
232 macro(GetGlobalLexicalVariable, NodeResultJS) \
233 macro(PutGlobalVariable, NodeMustGenerate) \
234 macro(GetDynamicVar, NodeResultJS | NodeMustGenerate) \
235 macro(PutDynamicVar, NodeMustGenerate) \
236 macro(NotifyWrite, NodeMustGenerate) \
237 macro(GetRegExpObjectLastIndex, NodeResultJS) \
238 macro(SetRegExpObjectLastIndex, NodeMustGenerate) \
239 macro(RecordRegExpCachedResult, NodeMustGenerate | NodeHasVarArgs) \
240 macro(CheckCell, NodeMustGenerate) \
241 macro(CheckNotEmpty, NodeMustGenerate) \
242 macro(CheckBadCell, NodeMustGenerate) \
243 macro(CheckInBounds, NodeMustGenerate) \
244 macro(CheckStringIdent, NodeMustGenerate) \
245 macro(CheckTypeInfoFlags, NodeMustGenerate) /* Takes an OpInfo with the flags you want to test are set */\
246 macro(CheckSubClass, NodeMustGenerate) \
247 macro(ParseInt, NodeMustGenerate | NodeResultJS) \
248 macro(GetPrototypeOf, NodeMustGenerate | NodeResultJS) \
250 /* Atomics object functions. */\
251 macro(AtomicsAdd, NodeResultJS | NodeMustGenerate | NodeHasVarArgs) \
252 macro(AtomicsAnd, NodeResultJS | NodeMustGenerate | NodeHasVarArgs) \
253 macro(AtomicsCompareExchange, NodeResultJS | NodeMustGenerate | NodeHasVarArgs) \
254 macro(AtomicsExchange, NodeResultJS | NodeMustGenerate | NodeHasVarArgs) \
255 macro(AtomicsIsLockFree, NodeResultBoolean) \
256 macro(AtomicsLoad, NodeResultJS | NodeMustGenerate) \
257 macro(AtomicsOr, NodeResultJS | NodeMustGenerate | NodeHasVarArgs) \
258 macro(AtomicsStore, NodeResultJS | NodeMustGenerate | NodeHasVarArgs) \
259 macro(AtomicsSub, NodeResultJS | NodeMustGenerate | NodeHasVarArgs) \
260 macro(AtomicsXor, NodeResultJS | NodeMustGenerate | NodeHasVarArgs) \
262 /* Optimizations for array mutation. */\
263 macro(ArrayPush, NodeResultJS | NodeMustGenerate | NodeHasVarArgs) \
264 macro(ArrayPop, NodeResultJS | NodeMustGenerate) \
265 macro(ArraySlice, NodeResultJS | NodeMustGenerate | NodeHasVarArgs) \
266 macro(ArrayIndexOf, NodeResultInt32 | NodeHasVarArgs) \
268 /* Optimizations for regular expression matching. */\
269 macro(RegExpExec, NodeResultJS | NodeMustGenerate) \
270 macro(RegExpTest, NodeResultJS | NodeMustGenerate) \
271 macro(StringReplace, NodeResultJS | NodeMustGenerate) \
272 macro(StringReplaceRegExp, NodeResultJS | NodeMustGenerate) \
274 /* Optimizations for string access */ \
275 macro(StringCharCodeAt, NodeResultInt32) \
276 macro(StringCharAt, NodeResultJS) \
277 macro(StringFromCharCode, NodeResultJS) \
279 /* Nodes for comparison operations. */\
280 macro(CompareLess, NodeResultBoolean | NodeMustGenerate) \
281 macro(CompareLessEq, NodeResultBoolean | NodeMustGenerate) \
282 macro(CompareGreater, NodeResultBoolean | NodeMustGenerate) \
283 macro(CompareGreaterEq, NodeResultBoolean | NodeMustGenerate) \
284 macro(CompareBelow, NodeResultBoolean) \
285 macro(CompareBelowEq, NodeResultBoolean) \
286 macro(CompareEq, NodeResultBoolean | NodeMustGenerate) \
287 macro(CompareStrictEq, NodeResultBoolean) \
288 macro(CompareEqPtr, NodeResultBoolean) \
291 macro(Call, NodeResultJS | NodeMustGenerate | NodeHasVarArgs) \
292 macro(DirectCall, NodeResultJS | NodeMustGenerate | NodeHasVarArgs) \
293 macro(Construct, NodeResultJS | NodeMustGenerate | NodeHasVarArgs) \
294 macro(DirectConstruct, NodeResultJS | NodeMustGenerate | NodeHasVarArgs) \
295 macro(CallVarargs, NodeResultJS | NodeMustGenerate) \
296 macro(CallForwardVarargs, NodeResultJS | NodeMustGenerate) \
297 macro(ConstructVarargs, NodeResultJS | NodeMustGenerate) \
298 macro(ConstructForwardVarargs, NodeResultJS | NodeMustGenerate) \
299 macro(TailCallInlinedCaller, NodeResultJS | NodeMustGenerate | NodeHasVarArgs) \
300 macro(DirectTailCallInlinedCaller, NodeResultJS | NodeMustGenerate | NodeHasVarArgs) \
301 macro(TailCallVarargsInlinedCaller, NodeResultJS | NodeMustGenerate) \
302 macro(TailCallForwardVarargsInlinedCaller, NodeResultJS | NodeMustGenerate) \
303 macro(CallEval, NodeResultJS | NodeMustGenerate | NodeHasVarArgs) \
305 /* Shadow Chicken */\
306 macro(LogShadowChickenPrologue, NodeMustGenerate) \
307 macro(LogShadowChickenTail, NodeMustGenerate) \
310 macro(NewObject, NodeResultJS) \
311 macro(NewArray, NodeResultJS | NodeHasVarArgs) \
312 macro(NewArrayWithSpread, NodeResultJS | NodeHasVarArgs) \
313 macro(NewArrayWithSize, NodeResultJS | NodeMustGenerate) \
314 macro(NewArrayBuffer, NodeResultJS) \
315 macro(NewTypedArray, NodeResultJS | NodeMustGenerate) \
316 macro(NewRegexp, NodeResultJS) \
317 /* Rest Parameter */\
318 macro(GetRestLength, NodeResultInt32) \
319 macro(CreateRest, NodeResultJS | NodeMustGenerate) \
321 macro(Spread, NodeResultJS | NodeMustGenerate) \
322 /* Support for allocation sinking. */\
323 macro(PhantomNewObject, NodeResultJS | NodeMustGenerate) \
324 macro(PutHint, NodeMustGenerate) \
325 macro(CheckStructureImmediate, NodeMustGenerate) \
326 macro(MaterializeNewObject, NodeResultJS | NodeHasVarArgs) \
327 macro(PhantomNewFunction, NodeResultJS | NodeMustGenerate) \
328 macro(PhantomNewGeneratorFunction, NodeResultJS | NodeMustGenerate) \
329 macro(PhantomNewAsyncFunction, NodeResultJS | NodeMustGenerate) \
330 macro(PhantomNewAsyncGeneratorFunction, NodeResultJS | NodeMustGenerate) \
331 macro(PhantomCreateActivation, NodeResultJS | NodeMustGenerate) \
332 macro(MaterializeCreateActivation, NodeResultJS | NodeHasVarArgs) \
334 /* Nodes for misc operations. */\
335 macro(OverridesHasInstance, NodeMustGenerate | NodeResultBoolean) \
336 macro(InstanceOf, NodeResultBoolean) \
337 macro(InstanceOfCustom, NodeMustGenerate | NodeResultBoolean) \
339 macro(IsCellWithType, NodeResultBoolean) \
340 macro(IsEmpty, NodeResultBoolean) \
341 macro(IsUndefined, NodeResultBoolean) \
342 macro(IsBoolean, NodeResultBoolean) \
343 macro(IsNumber, NodeResultBoolean) \
344 macro(IsObject, NodeResultBoolean) \
345 macro(IsObjectOrNull, NodeResultBoolean) \
346 macro(IsFunction, NodeResultBoolean) \
347 macro(IsTypedArrayView, NodeResultBoolean) \
348 macro(TypeOf, NodeResultJS) \
349 macro(LogicalNot, NodeResultBoolean) \
350 macro(ToPrimitive, NodeResultJS | NodeMustGenerate) \
351 macro(ToString, NodeResultJS | NodeMustGenerate) \
352 macro(ToNumber, NodeResultJS | NodeMustGenerate) \
353 macro(ToObject, NodeResultJS | NodeMustGenerate) \
354 macro(CallObjectConstructor, NodeResultJS) \
355 macro(CallStringConstructor, NodeResultJS | NodeMustGenerate) \
356 macro(NumberToStringWithRadix, NodeResultJS | NodeMustGenerate) \
357 macro(NumberToStringWithValidRadixConstant, NodeResultJS) \
358 macro(NewStringObject, NodeResultJS) \
359 macro(MakeRope, NodeResultJS) \
360 macro(In, NodeResultBoolean | NodeMustGenerate) \
361 macro(ProfileType, NodeMustGenerate) \
362 macro(ProfileControlFlow, NodeMustGenerate) \
363 macro(SetFunctionName, NodeMustGenerate) \
364 macro(HasOwnProperty, NodeResultBoolean) \
366 macro(CreateActivation, NodeResultJS) \
367 macro(PushWithScope, NodeResultJS | NodeMustGenerate) \
369 macro(CreateDirectArguments, NodeResultJS) \
370 macro(PhantomDirectArguments, NodeResultJS | NodeMustGenerate) \
371 macro(PhantomCreateRest, NodeResultJS | NodeMustGenerate) \
372 macro(PhantomSpread, NodeResultJS | NodeMustGenerate) \
373 macro(PhantomNewArrayWithSpread, NodeResultJS | NodeMustGenerate | NodeHasVarArgs) \
374 macro(PhantomNewArrayBuffer, NodeResultJS | NodeMustGenerate) \
375 macro(CreateScopedArguments, NodeResultJS) \
376 macro(CreateClonedArguments, NodeResultJS) \
377 macro(PhantomClonedArguments, NodeResultJS | NodeMustGenerate) \
378 macro(GetFromArguments, NodeResultJS) \
379 macro(PutToArguments, NodeMustGenerate) \
380 macro(GetArgument, NodeResultJS) \
382 macro(NewFunction, NodeResultJS) \
384 macro(NewGeneratorFunction, NodeResultJS) \
386 macro(NewAsyncGeneratorFunction, NodeResultJS) \
388 macro(NewAsyncFunction, NodeResultJS) \
390 /* Block terminals. */\
391 macro(Jump, NodeMustGenerate) \
392 macro(Branch, NodeMustGenerate) \
393 macro(Switch, NodeMustGenerate) \
394 macro(EntrySwitch, NodeMustGenerate) \
395 macro(Return, NodeMustGenerate) \
396 macro(TailCall, NodeMustGenerate | NodeHasVarArgs) \
397 macro(DirectTailCall, NodeMustGenerate | NodeHasVarArgs) \
398 macro(TailCallVarargs, NodeMustGenerate) \
399 macro(TailCallForwardVarargs, NodeMustGenerate) \
400 macro(Unreachable, NodeMustGenerate) \
401 macro(Throw, NodeMustGenerate) \
402 macro(ThrowStaticError, NodeMustGenerate) \
404 /* Count execution. */\
405 macro(CountExecution, NodeMustGenerate) \
406 /* Super sampler. */\
407 macro(SuperSamplerBegin, NodeMustGenerate) \
408 macro(SuperSamplerEnd, NodeMustGenerate) \
410 /* This is a pseudo-terminal. It means that execution should fall out of DFG at */\
411 /* this point, but execution does continue in the basic block - just in a */\
412 /* different compiler. */\
413 macro(ForceOSRExit, NodeMustGenerate) \
415 /* Vends a bottom JS value. It is invalid to ever execute this. Useful for cases */\
416 /* where we know that we would have exited but we'd like to still track the control */\
418 macro(BottomValue, NodeResultJS) \
420 /* Checks for VM traps. If there is a trap, we'll jettison or call operation operationHandleTraps. */ \
421 macro(CheckTraps, NodeMustGenerate) \
422 /* Write barriers */\
423 macro(StoreBarrier, NodeMustGenerate) \
424 macro(FencedStoreBarrier, NodeMustGenerate) \
426 /* For-in enumeration opcodes */\
427 macro(GetEnumerableLength, NodeMustGenerate | NodeResultJS) \
428 macro(HasIndexedProperty, NodeResultBoolean) \
429 macro(HasStructureProperty, NodeResultBoolean) \
430 macro(HasGenericProperty, NodeResultBoolean) \
431 macro(GetDirectPname, NodeMustGenerate | NodeHasVarArgs | NodeResultJS) \
432 macro(GetPropertyEnumerator, NodeMustGenerate | NodeResultJS) \
433 macro(GetEnumeratorStructurePname, NodeMustGenerate | NodeResultJS) \
434 macro(GetEnumeratorGenericPname, NodeMustGenerate | NodeResultJS) \
435 macro(ToIndexString, NodeResultJS) \
436 /* Nodes for JSMap and JSSet */ \
437 macro(MapHash, NodeResultInt32) \
438 macro(NormalizeMapKey, NodeResultJS) \
439 macro(GetMapBucket, NodeResultJS) \
440 macro(GetMapBucketHead, NodeResultJS) \
441 macro(GetMapBucketNext, NodeResultJS) \
442 macro(LoadKeyFromMapBucket, NodeResultJS) \
443 macro(LoadValueFromMapBucket, NodeResultJS) \
444 macro(SetAdd, NodeMustGenerate) \
445 macro(MapSet, NodeMustGenerate | NodeHasVarArgs) \
446 /* Nodes for JSWeakMap and JSWeakSet */ \
447 macro(WeakMapGet, NodeResultJS) \
448 macro(ExtractValueFromWeakMapGet, NodeResultJS) \
450 macro(StringSlice, NodeResultJS) \
451 macro(ToLowerCase, NodeResultJS) \
452 /* Nodes for DOM JIT */\
453 macro(CallDOMGetter, NodeResultJS | NodeMustGenerate) \
454 macro(CallDOM, NodeResultJS | NodeMustGenerate) \
455 /* Metadata node that initializes the state for flushed argument types at an entrypoint in the program. */ \
456 /* Currently, we only use this for the blocks an EntrySwitch branches to at the root of the program. */ \
457 /* This is only used in SSA. */ \
458 macro(InitializeEntrypointArguments, NodeMustGenerate) \
460 /* Used for $vm performance debugging */ \
461 macro(CPUIntrinsic, NodeResultJS | NodeMustGenerate) \
464 // This enum generates a monotonically increasing id for all Node types,
465 // and is used by the subsequent enum to fill out the id (as accessed via the NodeIdMask).
467 #define DFG_OP_ENUM(opcode, flags) opcode,
468 FOR_EACH_DFG_OP(DFG_OP_ENUM)
473 // Specifies the default flags for each node.
474 inline NodeFlags defaultFlags(NodeType op)
477 #define DFG_OP_ENUM(opcode, flags) case opcode: return flags;
478 FOR_EACH_DFG_OP(DFG_OP_ENUM)
481 RELEASE_ASSERT_NOT_REACHED();
486 inline bool isAtomicsIntrinsic(NodeType op)
491 case AtomicsCompareExchange:
492 case AtomicsExchange:
498 case AtomicsIsLockFree:
505 static const unsigned maxNumExtraAtomicsArgs = 2;
507 inline unsigned numExtraAtomicsArgs(NodeType op)
514 case AtomicsExchange:
520 case AtomicsCompareExchange:
523 RELEASE_ASSERT_NOT_REACHED();
528 } } // namespace JSC::DFG
530 #endif // ENABLE(DFG_JIT)