]>
Commit | Line | Data |
---|---|---|
ed1e77d3 A |
1 | /* |
2 | * Copyright (C) 2014, 2015 Apple Inc. All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions | |
6 | * are met: | |
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. | |
12 | * | |
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. | |
24 | */ | |
25 | ||
26 | #include "config.h" | |
27 | #include "DFGDoesGC.h" | |
28 | ||
29 | #if ENABLE(DFG_JIT) | |
30 | ||
31 | #include "DFGClobberize.h" | |
32 | #include "DFGGraph.h" | |
33 | #include "DFGNode.h" | |
34 | #include "Operations.h" | |
35 | ||
36 | namespace JSC { namespace DFG { | |
37 | ||
38 | bool doesGC(Graph& graph, Node* node) | |
39 | { | |
40 | if (clobbersHeap(graph, node)) | |
41 | return true; | |
42 | ||
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 | |
45 | // put them anywhere. | |
46 | switch (node->op()) { | |
47 | case JSConstant: | |
48 | case DoubleConstant: | |
49 | case Int52Constant: | |
50 | case Identity: | |
51 | case GetCallee: | |
52 | case GetArgumentCount: | |
53 | case GetLocal: | |
54 | case SetLocal: | |
55 | case MovHint: | |
56 | case ZombieHint: | |
57 | case Phantom: | |
58 | case Upsilon: | |
59 | case Phi: | |
60 | case Flush: | |
61 | case PhantomLocal: | |
62 | case GetLocalUnlinked: | |
63 | case SetArgument: | |
64 | case BitAnd: | |
65 | case BitOr: | |
66 | case BitXor: | |
67 | case BitLShift: | |
68 | case BitRShift: | |
69 | case BitURShift: | |
70 | case ValueToInt32: | |
71 | case UInt32ToNumber: | |
72 | case DoubleAsInt32: | |
73 | case ArithAdd: | |
74 | case ArithClz32: | |
75 | case ArithSub: | |
76 | case ArithNegate: | |
77 | case ArithMul: | |
78 | case ArithIMul: | |
79 | case ArithDiv: | |
80 | case ArithMod: | |
81 | case ArithAbs: | |
82 | case ArithMin: | |
83 | case ArithMax: | |
84 | case ArithPow: | |
85 | case ArithSqrt: | |
86 | case ArithRound: | |
87 | case ArithFRound: | |
88 | case ArithSin: | |
89 | case ArithCos: | |
90 | case ArithLog: | |
91 | case ValueAdd: | |
92 | case GetById: | |
93 | case GetByIdFlush: | |
94 | case PutById: | |
95 | case PutByIdFlush: | |
96 | case PutByIdDirect: | |
97 | case CheckStructure: | |
98 | case GetExecutable: | |
99 | case GetButterfly: | |
100 | case CheckArray: | |
101 | case GetScope: | |
102 | case SkipScope: | |
103 | case GetClosureVar: | |
104 | case PutClosureVar: | |
105 | case GetGlobalVar: | |
106 | case PutGlobalVar: | |
107 | case VarInjectionWatchpoint: | |
108 | case CheckCell: | |
109 | case CheckNotEmpty: | |
110 | case RegExpExec: | |
111 | case RegExpTest: | |
112 | case CompareLess: | |
113 | case CompareLessEq: | |
114 | case CompareGreater: | |
115 | case CompareGreaterEq: | |
116 | case CompareEq: | |
117 | case CompareEqConstant: | |
118 | case CompareStrictEq: | |
119 | case Call: | |
120 | case Construct: | |
121 | case CallVarargs: | |
122 | case ConstructVarargs: | |
123 | case LoadVarargs: | |
124 | case CallForwardVarargs: | |
125 | case ConstructForwardVarargs: | |
126 | case NativeCall: | |
127 | case NativeConstruct: | |
128 | case Breakpoint: | |
129 | case ProfileWillCall: | |
130 | case ProfileDidCall: | |
131 | case ProfileType: | |
132 | case ProfileControlFlow: | |
133 | case CheckHasInstance: | |
134 | case InstanceOf: | |
135 | case IsUndefined: | |
136 | case IsBoolean: | |
137 | case IsNumber: | |
138 | case IsString: | |
139 | case IsObject: | |
140 | case IsObjectOrNull: | |
141 | case IsFunction: | |
142 | case TypeOf: | |
143 | case LogicalNot: | |
144 | case ToPrimitive: | |
145 | case ToString: | |
146 | case CallStringConstructor: | |
147 | case In: | |
148 | case Jump: | |
149 | case Branch: | |
150 | case Switch: | |
151 | case Return: | |
152 | case Throw: | |
153 | case CountExecution: | |
154 | case ForceOSRExit: | |
155 | case CheckWatchdogTimer: | |
156 | case StringFromCharCode: | |
157 | case Unreachable: | |
158 | case ExtractOSREntryLocal: | |
159 | case CheckTierUpInLoop: | |
160 | case CheckTierUpAtReturn: | |
161 | case CheckTierUpAndOSREnter: | |
162 | case CheckTierUpWithNestedTriggerAndOSREnter: | |
163 | case LoopHint: | |
164 | case StoreBarrier: | |
165 | case InvalidationPoint: | |
166 | case NotifyWrite: | |
167 | case CheckInBounds: | |
168 | case ConstantStoragePointer: | |
169 | case Check: | |
170 | case MultiGetByOffset: | |
171 | case ValueRep: | |
172 | case DoubleRep: | |
173 | case Int52Rep: | |
174 | case GetGetter: | |
175 | case GetSetter: | |
176 | case GetByVal: | |
177 | case GetIndexedPropertyStorage: | |
178 | case GetArrayLength: | |
179 | case ArrayPush: | |
180 | case ArrayPop: | |
181 | case StringCharAt: | |
182 | case StringCharCodeAt: | |
183 | case GetTypedArrayByteOffset: | |
184 | case PutByValDirect: | |
185 | case PutByVal: | |
186 | case PutByValAlias: | |
187 | case PutStructure: | |
188 | case GetByOffset: | |
189 | case GetGetterSetterByOffset: | |
190 | case PutByOffset: | |
191 | case GetEnumerableLength: | |
192 | case HasGenericProperty: | |
193 | case HasStructureProperty: | |
194 | case HasIndexedProperty: | |
195 | case GetDirectPname: | |
196 | case FiatInt52: | |
197 | case BooleanToNumber: | |
198 | case CheckBadCell: | |
199 | case BottomValue: | |
200 | case PhantomNewObject: | |
201 | case PhantomNewFunction: | |
202 | case PhantomCreateActivation: | |
203 | case PhantomDirectArguments: | |
204 | case PhantomClonedArguments: | |
205 | case GetMyArgumentByVal: | |
206 | case ForwardVarargs: | |
207 | case PutHint: | |
208 | case CheckStructureImmediate: | |
209 | case PutStack: | |
210 | case KillStack: | |
211 | case GetStack: | |
212 | case GetFromArguments: | |
213 | case PutToArguments: | |
214 | return false; | |
215 | ||
216 | case CreateActivation: | |
217 | case CreateDirectArguments: | |
218 | case CreateScopedArguments: | |
219 | case CreateClonedArguments: | |
220 | case ToThis: | |
221 | case CreateThis: | |
222 | case AllocatePropertyStorage: | |
223 | case ReallocatePropertyStorage: | |
224 | case Arrayify: | |
225 | case ArrayifyToStructure: | |
226 | case NewObject: | |
227 | case NewArray: | |
228 | case NewArrayWithSize: | |
229 | case NewArrayBuffer: | |
230 | case NewRegexp: | |
231 | case NewStringObject: | |
232 | case MakeRope: | |
233 | case NewFunction: | |
234 | case NewTypedArray: | |
235 | case ThrowReferenceError: | |
236 | case GetPropertyEnumerator: | |
237 | case GetEnumeratorStructurePname: | |
238 | case GetEnumeratorGenericPname: | |
239 | case ToIndexString: | |
240 | case MaterializeNewObject: | |
241 | case MaterializeCreateActivation: | |
242 | return true; | |
243 | ||
244 | case MultiPutByOffset: | |
245 | return node->multiPutByOffsetData().reallocatesStorage(); | |
246 | ||
247 | case LastNodeType: | |
248 | RELEASE_ASSERT_NOT_REACHED(); | |
249 | return true; | |
250 | } | |
251 | ||
252 | RELEASE_ASSERT_NOT_REACHED(); | |
253 | return true; | |
254 | } | |
255 | ||
256 | } } // namespace JSC::DFG | |
257 | ||
258 | #endif // ENABLE(DFG_JIT) |