annotate modules/javafx.web/src/main/native/Source/JavaScriptCore/dfg/DFGDoesGC.cpp @ 11208:db2c977a840b

8220147: Cherry pick GTK WebKit 2.22.7 changes Reviewed-by: mbilla, kcr
author arajkumar
date Fri, 08 Mar 2019 14:03:47 +0530
parents ab4db0272524
children a1fb556cdd7d
rev   line source
kcr@9800 1 /*
mbilla@10730 2 * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
kcr@9800 3 *
kcr@9800 4 * Redistribution and use in source and binary forms, with or without
kcr@9800 5 * modification, are permitted provided that the following conditions
kcr@9800 6 * are met:
kcr@9800 7 * 1. Redistributions of source code must retain the above copyright
kcr@9800 8 * notice, this list of conditions and the following disclaimer.
kcr@9800 9 * 2. Redistributions in binary form must reproduce the above copyright
kcr@9800 10 * notice, this list of conditions and the following disclaimer in the
kcr@9800 11 * documentation and/or other materials provided with the distribution.
kcr@9800 12 *
kcr@9800 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
kcr@9800 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
kcr@9800 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
kcr@9800 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
kcr@9800 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
kcr@9800 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
kcr@9800 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
kcr@9800 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
kcr@9800 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
kcr@9800 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
kcr@9800 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
kcr@9800 24 */
kcr@9800 25
kcr@9800 26 #include "config.h"
kcr@9800 27 #include "DFGDoesGC.h"
kcr@9800 28
kcr@9800 29 #if ENABLE(DFG_JIT)
kcr@9800 30
kcr@9800 31 #include "DFGClobberize.h"
kcr@9800 32 #include "DFGGraph.h"
kcr@9800 33 #include "DFGNode.h"
kcr@9800 34 #include "Operations.h"
kcr@9800 35
kcr@9800 36 namespace JSC { namespace DFG {
kcr@9800 37
kcr@9800 38 bool doesGC(Graph& graph, Node* node)
kcr@9800 39 {
kcr@9800 40 if (clobbersHeap(graph, node))
kcr@9800 41 return true;
kcr@9800 42
kcr@9800 43 // Now consider nodes that don't clobber the world but that still may GC. This includes all
kcr@9800 44 // nodes. By convention we put world-clobbering nodes in the block of "false" cases but we can
kcr@9800 45 // put them anywhere.
kcr@9800 46 switch (node->op()) {
kcr@9800 47 case JSConstant:
kcr@9800 48 case DoubleConstant:
kcr@9800 49 case Int52Constant:
arajkumar@10587 50 case LazyJSConstant:
kcr@9800 51 case Identity:
arajkumar@10954 52 case IdentityWithProfile:
kcr@9800 53 case GetCallee:
arajkumar@10954 54 case SetCallee:
arajkumar@10587 55 case GetArgumentCountIncludingThis:
arajkumar@10954 56 case SetArgumentCountIncludingThis:
kcr@10196 57 case GetRestLength:
kcr@9800 58 case GetLocal:
kcr@9800 59 case SetLocal:
kcr@9800 60 case MovHint:
arajkumar@10954 61 case InitializeEntrypointArguments:
kcr@9800 62 case ZombieHint:
kcr@10196 63 case ExitOK:
kcr@9800 64 case Phantom:
kcr@9800 65 case Upsilon:
kcr@9800 66 case Phi:
kcr@9800 67 case Flush:
kcr@9800 68 case PhantomLocal:
kcr@9800 69 case SetArgument:
kcr@9800 70 case BitAnd:
kcr@9800 71 case BitOr:
kcr@9800 72 case BitXor:
kcr@9800 73 case BitLShift:
kcr@9800 74 case BitRShift:
kcr@9800 75 case BitURShift:
kcr@9800 76 case ValueToInt32:
kcr@9800 77 case UInt32ToNumber:
kcr@9800 78 case DoubleAsInt32:
kcr@9800 79 case ArithAdd:
kcr@9800 80 case ArithClz32:
kcr@9800 81 case ArithSub:
kcr@9800 82 case ArithNegate:
kcr@9800 83 case ArithMul:
kcr@9800 84 case ArithIMul:
kcr@9800 85 case ArithDiv:
kcr@9800 86 case ArithMod:
kcr@9800 87 case ArithAbs:
kcr@9800 88 case ArithMin:
kcr@9800 89 case ArithMax:
kcr@9800 90 case ArithPow:
kcr@9800 91 case ArithSqrt:
kcr@10196 92 case ArithRandom:
kcr@9800 93 case ArithRound:
kcr@10196 94 case ArithFloor:
kcr@10196 95 case ArithCeil:
arajkumar@10587 96 case ArithTrunc:
kcr@9800 97 case ArithFRound:
mbilla@10730 98 case ArithUnary:
kcr@9800 99 case ValueAdd:
arajkumar@11139 100 case ValueNegate:
arajkumar@10587 101 case TryGetById:
kcr@9800 102 case GetById:
kcr@9800 103 case GetByIdFlush:
arajkumar@10587 104 case GetByIdWithThis:
arajkumar@10954 105 case GetByIdDirect:
arajkumar@10954 106 case GetByIdDirectFlush:
kcr@9800 107 case PutById:
kcr@9800 108 case PutByIdFlush:
arajkumar@10587 109 case PutByIdWithThis:
arajkumar@10587 110 case PutByValWithThis:
kcr@9800 111 case PutByIdDirect:
kcr@10196 112 case PutGetterById:
kcr@10196 113 case PutSetterById:
kcr@10196 114 case PutGetterSetterById:
kcr@10196 115 case PutGetterByVal:
kcr@10196 116 case PutSetterByVal:
arajkumar@10587 117 case DefineDataProperty:
arajkumar@10587 118 case DefineAccessorProperty:
arajkumar@10587 119 case DeleteById:
arajkumar@10587 120 case DeleteByVal:
kcr@9800 121 case CheckStructure:
arajkumar@10954 122 case CheckStructureOrEmpty:
arajkumar@10954 123 case CheckStructureImmediate:
kcr@9800 124 case GetExecutable:
kcr@9800 125 case GetButterfly:
mbilla@10730 126 case CheckSubClass:
kcr@9800 127 case CheckArray:
kcr@9800 128 case GetScope:
kcr@9800 129 case SkipScope:
arajkumar@10587 130 case GetGlobalObject:
arajkumar@10954 131 case GetGlobalThis:
kcr@9800 132 case GetClosureVar:
kcr@9800 133 case PutClosureVar:
arajkumar@10587 134 case GetRegExpObjectLastIndex:
arajkumar@10587 135 case SetRegExpObjectLastIndex:
arajkumar@10587 136 case RecordRegExpCachedResult:
kcr@9800 137 case GetGlobalVar:
kcr@10196 138 case GetGlobalLexicalVariable:
kcr@10196 139 case PutGlobalVariable:
kcr@9800 140 case CheckCell:
kcr@9800 141 case CheckNotEmpty:
arajkumar@10954 142 case AssertNotEmpty:
arajkumar@10587 143 case CheckStringIdent:
kcr@9800 144 case RegExpExec:
arajkumar@10954 145 case RegExpExecNonGlobalOrSticky:
kcr@9800 146 case RegExpTest:
arajkumar@10954 147 case RegExpMatchFast:
arajkumar@11139 148 case RegExpMatchFastGlobal:
arajkumar@10954 149 case CompareBelow:
arajkumar@10954 150 case CompareBelowEq:
arajkumar@10587 151 case CompareEqPtr:
arajkumar@11139 152 case SameValue:
kcr@9800 153 case Call:
arajkumar@10587 154 case DirectCall:
kcr@10196 155 case TailCallInlinedCaller:
arajkumar@10587 156 case DirectTailCallInlinedCaller:
kcr@9800 157 case Construct:
arajkumar@10587 158 case DirectConstruct:
kcr@9800 159 case CallVarargs:
arajkumar@10587 160 case CallEval:
kcr@10196 161 case TailCallVarargsInlinedCaller:
kcr@9800 162 case ConstructVarargs:
kcr@9800 163 case LoadVarargs:
kcr@9800 164 case CallForwardVarargs:
kcr@9800 165 case ConstructForwardVarargs:
kcr@10196 166 case TailCallForwardVarargs:
kcr@10196 167 case TailCallForwardVarargsInlinedCaller:
kcr@9800 168 case ProfileType:
kcr@9800 169 case ProfileControlFlow:
kcr@10196 170 case OverridesHasInstance:
kcr@9800 171 case InstanceOf:
kcr@10196 172 case InstanceOfCustom:
arajkumar@10587 173 case IsEmpty:
kcr@9800 174 case IsUndefined:
kcr@9800 175 case IsBoolean:
kcr@9800 176 case IsNumber:
arajkumar@10954 177 case NumberIsInteger:
kcr@9800 178 case IsObject:
kcr@9800 179 case IsObjectOrNull:
kcr@9800 180 case IsFunction:
arajkumar@10587 181 case IsCellWithType:
arajkumar@10587 182 case IsTypedArrayView:
kcr@9800 183 case TypeOf:
kcr@9800 184 case LogicalNot:
kcr@9800 185 case ToPrimitive:
arajkumar@10587 186 case ToNumber:
kcr@9800 187 case ToString:
kcr@9800 188 case CallStringConstructor:
arajkumar@10587 189 case NumberToStringWithRadix:
arajkumar@10954 190 case NumberToStringWithValidRadixConstant:
arajkumar@11139 191 case InByVal:
arajkumar@11139 192 case InById:
arajkumar@10587 193 case HasOwnProperty:
kcr@9800 194 case Jump:
kcr@9800 195 case Branch:
kcr@9800 196 case Switch:
arajkumar@10954 197 case EntrySwitch:
kcr@9800 198 case Return:
kcr@10196 199 case TailCall:
arajkumar@10587 200 case DirectTailCall:
kcr@10196 201 case TailCallVarargs:
kcr@9800 202 case Throw:
kcr@9800 203 case CountExecution:
arajkumar@10954 204 case SuperSamplerBegin:
arajkumar@10954 205 case SuperSamplerEnd:
kcr@9800 206 case ForceOSRExit:
arajkumar@10954 207 case CPUIntrinsic:
mbilla@10730 208 case CheckTraps:
kcr@9800 209 case StringFromCharCode:
arajkumar@10954 210 case NormalizeMapKey:
arajkumar@10587 211 case GetMapBucket:
arajkumar@10954 212 case GetMapBucketHead:
arajkumar@10954 213 case GetMapBucketNext:
arajkumar@10954 214 case LoadKeyFromMapBucket:
arajkumar@10954 215 case LoadValueFromMapBucket:
arajkumar@10954 216 case ExtractValueFromWeakMapGet:
arajkumar@10954 217 case WeakMapGet:
arajkumar@10954 218 case WeakSetAdd:
arajkumar@10954 219 case WeakMapSet:
kcr@9800 220 case Unreachable:
arajkumar@11139 221 case ExtractOSREntryLocal:
arajkumar@10954 222 case ExtractCatchLocal:
arajkumar@11139 223 case ClearCatchLocals:
kcr@9800 224 case CheckTierUpInLoop:
kcr@9800 225 case CheckTierUpAtReturn:
kcr@9800 226 case CheckTierUpAndOSREnter:
kcr@9800 227 case LoopHint:
kcr@9800 228 case StoreBarrier:
arajkumar@10587 229 case FencedStoreBarrier:
kcr@9800 230 case InvalidationPoint:
kcr@9800 231 case NotifyWrite:
kcr@9800 232 case CheckInBounds:
kcr@9800 233 case ConstantStoragePointer:
kcr@9800 234 case Check:
arajkumar@10954 235 case CheckVarargs:
kcr@10196 236 case CheckTypeInfoFlags:
kcr@9800 237 case MultiGetByOffset:
kcr@9800 238 case ValueRep:
kcr@9800 239 case DoubleRep:
kcr@9800 240 case Int52Rep:
kcr@9800 241 case GetGetter:
kcr@9800 242 case GetSetter:
kcr@9800 243 case GetByVal:
arajkumar@10587 244 case GetByValWithThis:
kcr@9800 245 case GetArrayLength:
mbilla@10730 246 case GetVectorLength:
kcr@9800 247 case ArrayPush:
kcr@9800 248 case ArrayPop:
kcr@9800 249 case StringCharAt:
kcr@9800 250 case StringCharCodeAt:
kcr@9800 251 case GetTypedArrayByteOffset:
arajkumar@10954 252 case GetPrototypeOf:
kcr@9800 253 case PutByValDirect:
kcr@9800 254 case PutByVal:
kcr@9800 255 case PutByValAlias:
kcr@9800 256 case PutStructure:
kcr@9800 257 case GetByOffset:
kcr@9800 258 case GetGetterSetterByOffset:
kcr@9800 259 case PutByOffset:
kcr@9800 260 case GetEnumerableLength:
kcr@9800 261 case HasGenericProperty:
kcr@9800 262 case HasStructureProperty:
kcr@9800 263 case HasIndexedProperty:
kcr@9800 264 case GetDirectPname:
kcr@9800 265 case FiatInt52:
kcr@9800 266 case BooleanToNumber:
kcr@9800 267 case CheckBadCell:
kcr@9800 268 case BottomValue:
kcr@9800 269 case PhantomNewObject:
kcr@9800 270 case PhantomNewFunction:
kcr@10196 271 case PhantomNewGeneratorFunction:
arajkumar@10587 272 case PhantomNewAsyncFunction:
arajkumar@10954 273 case PhantomNewAsyncGeneratorFunction:
kcr@9800 274 case PhantomCreateActivation:
kcr@9800 275 case PhantomDirectArguments:
arajkumar@10587 276 case PhantomCreateRest:
arajkumar@10587 277 case PhantomNewArrayWithSpread:
arajkumar@10954 278 case PhantomNewArrayBuffer:
arajkumar@10587 279 case PhantomSpread:
kcr@9800 280 case PhantomClonedArguments:
arajkumar@10954 281 case PhantomNewRegexp:
kcr@9800 282 case GetMyArgumentByVal:
arajkumar@10587 283 case GetMyArgumentByValOutOfBounds:
kcr@9800 284 case ForwardVarargs:
kcr@9800 285 case PutHint:
kcr@9800 286 case PutStack:
kcr@9800 287 case KillStack:
kcr@9800 288 case GetStack:
kcr@9800 289 case GetFromArguments:
kcr@9800 290 case PutToArguments:
arajkumar@10587 291 case GetArgument:
arajkumar@10587 292 case LogShadowChickenPrologue:
arajkumar@10587 293 case LogShadowChickenTail:
arajkumar@10587 294 case GetDynamicVar:
arajkumar@10587 295 case PutDynamicVar:
mbilla@10730 296 case ResolveScopeForHoistingFuncDeclInEval:
arajkumar@10587 297 case ResolveScope:
arajkumar@10587 298 case NukeStructureAndSetButterfly:
mbilla@10730 299 case AtomicsAdd:
mbilla@10730 300 case AtomicsAnd:
mbilla@10730 301 case AtomicsCompareExchange:
mbilla@10730 302 case AtomicsExchange:
mbilla@10730 303 case AtomicsLoad:
mbilla@10730 304 case AtomicsOr:
mbilla@10730 305 case AtomicsStore:
mbilla@10730 306 case AtomicsSub:
mbilla@10730 307 case AtomicsXor:
mbilla@10730 308 case AtomicsIsLockFree:
arajkumar@11139 309 case MatchStructure:
arajkumar@11139 310 case FilterCallLinkStatus:
arajkumar@11139 311 case FilterGetByIdStatus:
arajkumar@11139 312 case FilterPutByIdStatus:
arajkumar@11139 313 case FilterInByIdStatus:
arajkumar@11139 314 case DataViewGetInt:
arajkumar@11139 315 case DataViewGetFloat:
arajkumar@11139 316 case DataViewSet:
kcr@9800 317 return false;
kcr@9800 318
arajkumar@10954 319 case PushWithScope:
kcr@9800 320 case CreateActivation:
kcr@9800 321 case CreateDirectArguments:
kcr@9800 322 case CreateScopedArguments:
kcr@9800 323 case CreateClonedArguments:
arajkumar@10587 324 case CallObjectConstructor:
arajkumar@10954 325 case ToObject:
kcr@9800 326 case ToThis:
kcr@9800 327 case CreateThis:
arajkumar@11139 328 case ObjectCreate:
kcr@9800 329 case AllocatePropertyStorage:
kcr@9800 330 case ReallocatePropertyStorage:
kcr@9800 331 case Arrayify:
kcr@9800 332 case ArrayifyToStructure:
kcr@9800 333 case NewObject:
kcr@9800 334 case NewArray:
arajkumar@10587 335 case NewArrayWithSpread:
arajkumar@10587 336 case Spread:
kcr@9800 337 case NewArrayWithSize:
kcr@9800 338 case NewArrayBuffer:
kcr@9800 339 case NewRegexp:
kcr@9800 340 case NewStringObject:
kcr@9800 341 case MakeRope:
kcr@9800 342 case NewFunction:
kcr@10196 343 case NewGeneratorFunction:
arajkumar@10954 344 case NewAsyncGeneratorFunction:
arajkumar@10587 345 case NewAsyncFunction:
kcr@9800 346 case NewTypedArray:
arajkumar@10587 347 case ThrowStaticError:
kcr@9800 348 case GetPropertyEnumerator:
kcr@9800 349 case GetEnumeratorStructurePname:
kcr@9800 350 case GetEnumeratorGenericPname:
kcr@9800 351 case ToIndexString:
kcr@9800 352 case MaterializeNewObject:
kcr@9800 353 case MaterializeCreateActivation:
arajkumar@10587 354 case SetFunctionName:
kcr@10196 355 case StrCat:
kcr@10196 356 case StringReplace:
arajkumar@10587 357 case StringReplaceRegExp:
arajkumar@10954 358 case StringSlice:
arajkumar@11139 359 case StringValueOf:
arajkumar@10587 360 case CreateRest:
arajkumar@10587 361 case ToLowerCase:
arajkumar@10587 362 case CallDOMGetter:
arajkumar@10587 363 case CallDOM:
arajkumar@10587 364 case ArraySlice:
mbilla@10730 365 case ArrayIndexOf:
arajkumar@10587 366 case ParseInt: // We might resolve a rope even though we don't clobber anything.
arajkumar@10954 367 case SetAdd:
arajkumar@10954 368 case MapSet:
kcr@9800 369 return true;
kcr@9800 370
arajkumar@11208 371 case CompareEq:
arajkumar@11208 372 case CompareLess:
arajkumar@11208 373 case CompareLessEq:
arajkumar@11208 374 case CompareGreater:
arajkumar@11208 375 case CompareGreaterEq:
arajkumar@11208 376 if (node->isBinaryUseKind(Int32Use)
arajkumar@11208 377 #if USE(JSVALUE64)
arajkumar@11208 378 || node->isBinaryUseKind(Int52RepUse)
arajkumar@11208 379 #endif
arajkumar@11208 380 || node->isBinaryUseKind(DoubleRepUse)
arajkumar@11208 381 || node->isBinaryUseKind(StringIdentUse)
arajkumar@11208 382 )
arajkumar@11208 383 return false;
arajkumar@11208 384 if (node->op() == CompareEq) {
arajkumar@11208 385 if (node->isBinaryUseKind(BooleanUse)
arajkumar@11208 386 || node->isBinaryUseKind(SymbolUse)
arajkumar@11208 387 || node->isBinaryUseKind(ObjectUse)
arajkumar@11208 388 || node->isBinaryUseKind(ObjectUse, ObjectOrOtherUse) || node->isBinaryUseKind(ObjectOrOtherUse, ObjectUse))
arajkumar@11208 389 return false;
arajkumar@11208 390 }
arajkumar@11208 391 return true;
arajkumar@11208 392
arajkumar@11208 393 case CompareStrictEq:
arajkumar@11208 394 if (node->isBinaryUseKind(BooleanUse)
arajkumar@11208 395 || node->isBinaryUseKind(Int32Use)
arajkumar@11208 396 #if USE(JSVALUE64)
arajkumar@11208 397 || node->isBinaryUseKind(Int52RepUse)
arajkumar@11208 398 #endif
arajkumar@11208 399 || node->isBinaryUseKind(DoubleRepUse)
arajkumar@11208 400 || node->isBinaryUseKind(SymbolUse)
arajkumar@11208 401 || node->isBinaryUseKind(SymbolUse, UntypedUse)
arajkumar@11208 402 || node->isBinaryUseKind(UntypedUse, SymbolUse)
arajkumar@11208 403 || node->isBinaryUseKind(StringIdentUse)
arajkumar@11208 404 || node->isBinaryUseKind(ObjectUse, UntypedUse) || node->isBinaryUseKind(UntypedUse, ObjectUse)
arajkumar@11208 405 || node->isBinaryUseKind(ObjectUse)
arajkumar@11208 406 || node->isBinaryUseKind(MiscUse, UntypedUse) || node->isBinaryUseKind(UntypedUse, MiscUse)
arajkumar@11208 407 || node->isBinaryUseKind(StringIdentUse, NotStringVarUse) || node->isBinaryUseKind(NotStringVarUse, StringIdentUse))
arajkumar@11208 408 return false;
arajkumar@11208 409 return true;
arajkumar@11208 410
arajkumar@11139 411 case GetIndexedPropertyStorage:
arajkumar@11139 412 if (node->arrayMode().type() == Array::String)
arajkumar@11139 413 return true;
arajkumar@11139 414 return false;
arajkumar@11139 415
arajkumar@10954 416 case MapHash:
arajkumar@10954 417 switch (node->child1().useKind()) {
arajkumar@10954 418 case BooleanUse:
arajkumar@10954 419 case Int32Use:
arajkumar@10954 420 case SymbolUse:
arajkumar@10954 421 case ObjectUse:
arajkumar@10954 422 return false;
arajkumar@10954 423 default:
arajkumar@10954 424 // We might resolve a rope.
arajkumar@10954 425 return true;
arajkumar@10954 426 }
arajkumar@10954 427
kcr@9800 428 case MultiPutByOffset:
kcr@9800 429 return node->multiPutByOffsetData().reallocatesStorage();
kcr@9800 430
kcr@9800 431 case LastNodeType:
kcr@9800 432 RELEASE_ASSERT_NOT_REACHED();
kcr@9800 433 return true;
kcr@9800 434 }
kcr@9800 435
kcr@9800 436 RELEASE_ASSERT_NOT_REACHED();
kcr@9800 437 return true;
kcr@9800 438 }
kcr@9800 439
kcr@9800 440 } } // namespace JSC::DFG
kcr@9800 441
kcr@9800 442 #endif // ENABLE(DFG_JIT)