2 * Copyright (C) 2014-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.
27 #include "DFGDoesGC.h"
31 #include "DFGClobberize.h"
34 #include "Operations.h"
36 namespace JSC { namespace DFG {
38 bool doesGC(Graph& graph, Node* node)
40 if (clobbersHeap(graph, node))
43 // Now consider nodes that don't clobber the world but that still may GC. This includes all
44 // nodes. By convention we put world-clobbering nodes in the block of "false" cases but we can
52 case IdentityWithProfile:
54 case GetArgumentCountIncludingThis:
59 case InitializeEntrypointArguments:
67 case GetLocalUnlinked:
102 case GetByIdWithThis:
105 case PutByIdWithThis:
106 case PutByValWithThis:
110 case PutGetterSetterById:
113 case DefineDataProperty:
114 case DefineAccessorProperty:
118 case CheckStructureOrEmpty:
119 case CheckStructureImmediate:
122 case GetButterflyWithoutCaging:
127 case GetGlobalObject:
131 case GetRegExpObjectLastIndex:
132 case SetRegExpObjectLastIndex:
133 case RecordRegExpCachedResult:
135 case GetGlobalLexicalVariable:
136 case PutGlobalVariable:
139 case CheckStringIdent:
145 case CompareGreaterEq:
149 case CompareStrictEq:
153 case TailCallInlinedCaller:
154 case DirectTailCallInlinedCaller:
156 case DirectConstruct:
159 case TailCallVarargsInlinedCaller:
160 case ConstructVarargs:
162 case CallForwardVarargs:
163 case ConstructForwardVarargs:
164 case TailCallForwardVarargs:
165 case TailCallForwardVarargsInlinedCaller:
167 case ProfileControlFlow:
168 case OverridesHasInstance:
170 case InstanceOfCustom:
179 case IsTypedArrayView:
185 case CallStringConstructor:
186 case NumberToStringWithRadix:
187 case NumberToStringWithValidRadixConstant:
197 case TailCallVarargs:
200 case SuperSamplerBegin:
201 case SuperSamplerEnd:
205 case StringFromCharCode:
208 case GetMapBucketHead:
209 case GetMapBucketNext:
210 case LoadKeyFromMapBucket:
211 case LoadValueFromMapBucket:
214 case ExtractCatchLocal:
215 case ExtractOSREntryLocal:
216 case CheckTierUpInLoop:
217 case CheckTierUpAtReturn:
218 case CheckTierUpAndOSREnter:
221 case FencedStoreBarrier:
222 case InvalidationPoint:
225 case ConstantStoragePointer:
227 case CheckTypeInfoFlags:
228 case MultiGetByOffset:
235 case GetByValWithThis:
236 case GetIndexedPropertyStorage:
238 case GetVectorLength:
242 case StringCharCodeAt:
243 case GetTypedArrayByteOffset:
250 case GetGetterSetterByOffset:
252 case GetEnumerableLength:
253 case HasGenericProperty:
254 case HasStructureProperty:
255 case HasIndexedProperty:
258 case BooleanToNumber:
261 case PhantomNewObject:
262 case PhantomNewFunction:
263 case PhantomNewGeneratorFunction:
264 case PhantomNewAsyncFunction:
265 case PhantomNewAsyncGeneratorFunction:
266 case PhantomCreateActivation:
267 case PhantomDirectArguments:
268 case PhantomCreateRest:
269 case PhantomNewArrayWithSpread:
271 case PhantomClonedArguments:
272 case GetMyArgumentByVal:
273 case GetMyArgumentByValOutOfBounds:
279 case GetFromArguments:
282 case LogShadowChickenPrologue:
283 case LogShadowChickenTail:
286 case ResolveScopeForHoistingFuncDeclInEval:
288 case NukeStructureAndSetButterfly:
291 case AtomicsCompareExchange:
292 case AtomicsExchange:
298 case AtomicsIsLockFree:
302 case CreateActivation:
303 case CreateDirectArguments:
304 case CreateScopedArguments:
305 case CreateClonedArguments:
306 case CallObjectConstructor:
310 case AllocatePropertyStorage:
311 case ReallocatePropertyStorage:
313 case ArrayifyToStructure:
316 case NewArrayWithSpread:
318 case NewArrayWithSize:
321 case NewStringObject:
324 case NewGeneratorFunction:
325 case NewAsyncGeneratorFunction:
326 case NewAsyncFunction:
328 case ThrowStaticError:
329 case GetPropertyEnumerator:
330 case GetEnumeratorStructurePname:
331 case GetEnumeratorGenericPname:
333 case MaterializeNewObject:
334 case MaterializeCreateActivation:
335 case SetFunctionName:
338 case StringReplaceRegExp:
346 case ParseInt: // We might resolve a rope even though we don't clobber anything.
351 case MultiPutByOffset:
352 return node->multiPutByOffsetData().reallocatesStorage();
355 RELEASE_ASSERT_NOT_REACHED();
359 RELEASE_ASSERT_NOT_REACHED();
363 } } // namespace JSC::DFG
365 #endif // ENABLE(DFG_JIT)