2 * Copyright (C) 2014-2016 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
53 case GetArgumentCount:
65 case GetLocalUnlinked:
102 case GetByIdWithThis:
105 case PutByIdWithThis:
106 case PutByValWithThis:
110 case PutGetterSetterById:
121 case GetGlobalObject:
124 case GetRegExpObjectLastIndex:
125 case SetRegExpObjectLastIndex:
126 case RecordRegExpCachedResult:
128 case GetGlobalLexicalVariable:
129 case PutGlobalVariable:
130 case VarInjectionWatchpoint:
139 case CompareGreaterEq:
141 case CompareStrictEq:
143 case TailCallInlinedCaller:
146 case TailCallVarargsInlinedCaller:
147 case ConstructVarargs:
149 case CallForwardVarargs:
150 case ConstructForwardVarargs:
151 case TailCallForwardVarargs:
152 case TailCallForwardVarargsInlinedCaller:
153 case ProfileWillCall:
156 case ProfileControlFlow:
157 case OverridesHasInstance:
159 case InstanceOfCustom:
173 case CallStringConstructor:
180 case TailCallVarargs:
184 case CheckWatchdogTimer:
185 case StringFromCharCode:
187 case ExtractOSREntryLocal:
188 case CheckTierUpInLoop:
189 case CheckTierUpAtReturn:
190 case CheckTierUpAndOSREnter:
193 case InvalidationPoint:
196 case ConstantStoragePointer:
198 case CheckTypeInfoFlags:
199 case MultiGetByOffset:
206 case GetByValWithThis:
207 case GetIndexedPropertyStorage:
212 case StringCharCodeAt:
213 case GetTypedArrayByteOffset:
219 case GetGetterSetterByOffset:
221 case GetEnumerableLength:
222 case HasGenericProperty:
223 case HasStructureProperty:
224 case HasIndexedProperty:
227 case BooleanToNumber:
230 case PhantomNewObject:
231 case PhantomNewFunction:
232 case PhantomNewGeneratorFunction:
233 case PhantomCreateActivation:
234 case PhantomDirectArguments:
235 case PhantomClonedArguments:
236 case GetMyArgumentByVal:
237 case GetMyArgumentByValOutOfBounds:
240 case CheckStructureImmediate:
244 case GetFromArguments:
247 case LogShadowChickenPrologue:
248 case LogShadowChickenTail:
254 case CreateActivation:
255 case CreateDirectArguments:
256 case CreateScopedArguments:
257 case CreateClonedArguments:
260 case AllocatePropertyStorage:
261 case ReallocatePropertyStorage:
263 case ArrayifyToStructure:
266 case NewArrayWithSize:
269 case NewStringObject:
272 case NewGeneratorFunction:
274 case ThrowReferenceError:
275 case GetPropertyEnumerator:
276 case GetEnumeratorStructurePname:
277 case GetEnumeratorGenericPname:
279 case MaterializeNewObject:
280 case MaterializeCreateActivation:
281 case SetFunctionName:
284 case StringReplaceRegExp:
287 case MultiPutByOffset:
288 return node->multiPutByOffsetData().reallocatesStorage();
291 RELEASE_ASSERT_NOT_REACHED();
295 RELEASE_ASSERT_NOT_REACHED();
299 } } // namespace JSC::DFG
301 #endif // ENABLE(DFG_JIT)