forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathRepatch.cpp
More file actions
2655 lines (2361 loc) · 126 KB
/
Copy pathRepatch.cpp
File metadata and controls
2655 lines (2361 loc) · 126 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (C) 2011-2023 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "Repatch.h"
#include "BinarySwitch.h"
#include "CCallHelpers.h"
#include "CacheableIdentifierInlines.h"
#include "CallFrameShuffler.h"
#include "DFGOperations.h"
#include "DFGSpeculativeJIT.h"
#include "DOMJITGetterSetter.h"
#include "DirectArguments.h"
#include "ECMAMode.h"
#include "ExecutableBaseInlines.h"
#include "FTLThunks.h"
#include "FullCodeOrigin.h"
#include "FunctionCodeBlock.h"
#include "GCAwareJITStubRoutine.h"
#include "GetterSetter.h"
#include "GetterSetterAccessCase.h"
#include "ICStats.h"
#include "InlineAccess.h"
#include "InlineCacheCompiler.h"
#include "InstanceOfAccessCase.h"
#include "IntrinsicGetterAccessCase.h"
#include "JIT.h"
#include "JITInlines.h"
#include "JITThunks.h"
#include "JSCInlines.h"
#include "JSModuleNamespaceObject.h"
#include "JSWebAssembly.h"
#include "JSWebAssemblyInstance.h"
#include "JSWebAssemblyModule.h"
#include "LLIntData.h"
#include "LinkBuffer.h"
#include "MaxFrameExtentForSlowPathCall.h"
#include "ModuleNamespaceAccessCase.h"
#include "PropertyInlineCache.h"
#include "PropertyInlineCacheClearingWatchpoint.h"
#include "RegExpObject.h"
#include "ScopedArguments.h"
#include "ScratchRegisterAllocator.h"
#include "StackAlignment.h"
#include "StructureRareDataInlines.h"
#include "SuperSampler.h"
#include "ThunkGenerators.h"
#include "WebAssemblyFunction.h"
#include <wtf/CommaPrinter.h>
#include <wtf/ListDump.h>
#include <wtf/StringPrintStream.h>
namespace JSC {
static void linkSlowFor(VM& vm, CallLinkInfo& callLinkInfo)
{
if (callLinkInfo.type() == CallLinkInfo::Type::Optimizing)
callLinkInfo.setVirtualCall(vm);
}
void linkMonomorphicCall(VM& vm, JSCell* owner, CallLinkInfo& callLinkInfo, CodeBlock* calleeCodeBlock, JSObject* callee, CodePtr<JSEntryPtrTag> codePtr)
{
CodeBlock* callerCodeBlock = dynamicDowncast<CodeBlock>(owner); // WebAssembly -> JS stubs don't have a valid CodeBlock.
ASSERT(owner);
if (Options::forceICFailure()) [[unlikely]]
return;
if (vm.gilOff()) [[unlikely]] {
// AB18-D (amended per review): N mutators can take the same call
// site's slow path concurrently (both saw Mode::Init + seenOnce()).
// The Init->Monomorphic transition — and, per precondition 11
// (INTEGRATE-jit), every other call-link transition writer — is
// serialized on the single process-wide link lock; per-CodeBlock
// locking was rejected in review (it covered one writer pair out of
// six and risked caller/callee ABBA between mutually-recursive
// CodeBlocks). The loser keeps the winner's publication and just
// returns: linkFor computed codePtr for THIS call independently of
// the IC, so the current call still lands on a correct target.
// Taking the callee push under the SAME lock also serializes it
// against every other locked push/remove (the SentinelLinkedList
// prev/next corruption signature); the isOnList() re-check makes a
// racing upgrade-relink idempotent rather than a double push.
Locker locker { CallLinkInfo::s_callLinkSerializationLock };
if (callLinkInfo.isLinked() || callLinkInfo.stub())
return; // Lost the race; the winner's link stands.
callLinkInfo.setMonomorphicCallee(vm, owner, callee, calleeCodeBlock, codePtr);
callLinkInfo.setLastSeenCallee(vm, owner, callee);
if (shouldDumpDisassemblyFor(callerCodeBlock))
dataLog("Linking call in ", FullCodeOrigin(callerCodeBlock, callLinkInfo.codeOrigin()), " to ", pointerDump(calleeCodeBlock), ", entrypoint at ", codePtr, "\n");
if (calleeCodeBlock && !callLinkInfo.isOnList())
calleeCodeBlock->linkIncomingCall(owner, &callLinkInfo);
if (callLinkInfo.specializationKind() == CodeSpecializationKind::CodeForCall)
return;
linkSlowFor(vm, callLinkInfo);
return;
}
ASSERT(!callLinkInfo.stub());
ASSERT(!callLinkInfo.isLinked());
callLinkInfo.setMonomorphicCallee(vm, owner, callee, calleeCodeBlock, codePtr);
callLinkInfo.setLastSeenCallee(vm, owner, callee);
if (shouldDumpDisassemblyFor(callerCodeBlock))
dataLog("Linking call in ", FullCodeOrigin(callerCodeBlock, callLinkInfo.codeOrigin()), " to ", pointerDump(calleeCodeBlock), ", entrypoint at ", codePtr, "\n");
if (calleeCodeBlock)
calleeCodeBlock->linkIncomingCall(owner, &callLinkInfo);
if (callLinkInfo.specializationKind() == CodeSpecializationKind::CodeForCall)
return;
linkSlowFor(vm, callLinkInfo);
}
CodePtr<JSEntryPtrTag> jsToWasmICCodePtr(CodeSpecializationKind kind, JSObject* callee)
{
#if ENABLE(WEBASSEMBLY)
if (!callee)
return nullptr;
if (kind != CodeSpecializationKind::CodeForCall)
return nullptr;
if (auto* wasmFunction = dynamicDowncast<WebAssemblyFunction>(callee))
return wasmFunction->jsCallICEntrypoint();
#else
UNUSED_PARAM(kind);
UNUSED_PARAM(callee);
#endif
return nullptr;
}
static void linkPolymorphicCallImpl(VM& vm, JSCell* owner, CallFrame* callFrame, CallLinkInfo& callLinkInfo, CallVariant newVariant)
{
// Precondition-11 loser path: gilOff we run under
// s_callLinkSerializationLock (taken in linkPolymorphicCall), but a
// racing slow-path entrant may have already moved this site to Virtual
// while we waited on the lock. Virtual is terminal, and its m_callee
// slot holds the raw always-call sentinel (polymorphicCalleeMask), so
// the callee() read below would hand a non-cell word (0x1) to the
// WriteBarrier cell validation. Same lost-the-race bail shape as
// linkMonomorphicCall: the winner's virtual link stands, and the
// current call was dispatched independently of the IC, so just return.
if (vm.gilOff() && callLinkInfo.mode() == CallLinkInfo::Mode::Virtual) [[unlikely]]
return;
if (!newVariant || Options::forceICFailure()) {
callLinkInfo.setVirtualCall(vm);
return;
}
CodeBlock* callerCodeBlock = dynamicDowncast<CodeBlock>(owner); // WebAssembly -> JS stubs don't have a valid CodeBlock.
ASSERT(owner);
#if ENABLE(WEBASSEMBLY)
bool isWebAssembly = owner->inherits<JSWebAssemblyModule>();
#else
bool isWebAssembly = false;
#endif
bool isTailCall = callLinkInfo.isTailCall();
bool isClosureCall = false;
CallVariantList list;
if (PolymorphicCallStubRoutine* stub = callLinkInfo.stub()) {
list = stub->variants();
isClosureCall = stub->isClosureCall();
} else if (JSObject* oldCallee = callLinkInfo.callee())
list = CallVariantList { CallVariant(oldCallee) };
list = variantListWithVariant(list, newVariant);
// If there are any closure calls then it makes sense to treat all of them as closure calls.
// This makes switching on callee cheaper. It also produces profiling that's easier on the DFG;
// the DFG doesn't really want to deal with a combination of closure and non-closure callees.
if (!isClosureCall) {
for (CallVariant variant : list) {
if (variant.isClosureCall()) {
list = despecifiedVariantList(list);
isClosureCall = true;
break;
}
}
}
if (isClosureCall)
callLinkInfo.setHasSeenClosure();
// If we are over the limit, just use a normal virtual call.
unsigned maxPolymorphicCallVariantListSize;
if (isWebAssembly)
maxPolymorphicCallVariantListSize = Options::maxPolymorphicCallVariantListSizeForWasmToJS();
else if (callerCodeBlock->jitType() == JITCode::topTierJIT())
maxPolymorphicCallVariantListSize = Options::maxPolymorphicCallVariantListSizeForTopTier();
else
maxPolymorphicCallVariantListSize = Options::maxPolymorphicCallVariantListSize();
// We use list.size() instead of callSlots.size() because we respect CallVariant size for now.
if (list.size() > maxPolymorphicCallVariantListSize) {
callLinkInfo.setVirtualCall(vm);
return;
}
Vector<CallSlot, 16> callSlots;
// Figure out what our cases are.
for (CallVariant variant : list) {
CodeBlock* codeBlock = nullptr;
if (variant.executable() && !variant.executable()->isHostFunction()) {
ExecutableBase* executable = variant.executable();
codeBlock = uncheckedDowncast<FunctionExecutable>(executable)->codeBlockForCall();
// If we cannot handle a callee, because we don't have a CodeBlock,
// assume that it's better for this whole thing to be a virtual call.
if (!codeBlock) {
callLinkInfo.setVirtualCall(vm);
return;
}
}
JSCell* caseValue = nullptr;
if (isClosureCall) {
caseValue = variant.executable();
// FIXME: We could add a fast path for InternalFunction with closure call.
// https://bugs.webkit.org/show_bug.cgi?id=179311
if (!caseValue)
continue;
} else {
if (auto* function = variant.function())
caseValue = function;
else
caseValue = variant.internalFunction();
}
CallSlot slot;
CodePtr<JSEntryPtrTag> codePtr;
if (variant.executable()) {
// gilOff, ScriptExecutable::installCode retracts the
// m_jitCodeForCall mirror FIRST (retract-first store order,
// runtime/ScriptExecutable.cpp) under a lock domain that
// s_callLinkSerializationLock does not cover, so the mirror read
// in hasJITCodeForCall() can be transiently null even though the
// variant genuinely has code. The per-variant CodeBlock snapshot
// taken above is the authoritative witness — the value path below
// already derives the entrypoint through it (ANNEX CBI item 3,
// AB17c F4). So under gilOff, assert the witness each downstream
// deref actually relies on: the snapshot's jitCode() for script
// executables (codeBlock non-null — non-host variants with a null
// snapshot already bailed to setVirtualCall above), and the
// mirror for hosts, which publish m_jitCodeForCall once at
// construction and never retract, so the mirror check stays
// race-free and meaningful for them.
ASSERT(vm.gilOff()
? (codeBlock ? !!codeBlock->jitCode() : variant.executable()->hasJITCodeForCall())
: variant.executable()->hasJITCodeForCall());
codePtr = jsToWasmICCodePtr(callLinkInfo.specializationKind(), variant.function());
if (!codePtr) {
ArityCheckMode arityCheck = ArityCheckMode::ArityCheckNotRequired;
if (codeBlock) {
ASSERT(!variant.executable()->isHostFunction());
if ((callFrame->argumentCountIncludingThis() < static_cast<size_t>(codeBlock->numParameters()) || callLinkInfo.isVarargs()))
arityCheck = ArityCheckMode::MustCheckArity;
}
if (vm.gilOff() && codeBlock) [[unlikely]] {
// ANNEX CBI item 3 (AB17c F4): derive the entrypoint
// THROUGH the per-variant CodeBlock snapshot taken
// above. The executable's m_jitCodeForCall mirror is
// (a) transiently NULL during a live installCode (the
// retract-first store order) — generatedJITCodeForCall
// unconditionally derefs it — and (b) independently
// republished, so reading it here could pair a target
// from one tier with slot.m_codeBlock from another.
// Host functions (codeBlock == nullptr) keep the mirror
// read: their jitCode is set once at creation.
codePtr = codeBlock->jitCode()->addressForCall(arityCheck);
} else
codePtr = variant.executable()->generatedJITCodeForCall()->addressForCall(arityCheck);
slot.m_arityCheckMode = arityCheck;
}
} else {
ASSERT(variant.internalFunction());
codePtr = vm.getCTIInternalFunctionTrampolineFor(CodeSpecializationKind::CodeForCall);
}
slot.m_index = callSlots.size();
slot.m_target = codePtr;
slot.m_codeBlock = codeBlock;
slot.m_calleeOrExecutable = caseValue;
callSlots.append(WTF::move(slot));
}
bool notUsingCounting = isWebAssembly || callerCodeBlock->jitType() == JITCode::topTierJIT();
if (callSlots.isEmpty())
notUsingCounting = true;
CallFrame* callerFrame = nullptr;
if (!isTailCall)
callerFrame = callFrame->callerFrame();
MacroAssemblerCodeRef<JITStubRoutinePtrTag> code;
#if ENABLE(JIT)
if (Options::useJIT()) {
CommonJITThunkID jitThunk = CommonJITThunkID::PolymorphicThunkForClosure;
if (notUsingCounting)
jitThunk = isClosureCall ? CommonJITThunkID::PolymorphicTopTierThunkForClosure : CommonJITThunkID::PolymorphicTopTierThunk;
else
jitThunk = isClosureCall ? CommonJITThunkID::PolymorphicThunkForClosure : CommonJITThunkID::PolymorphicThunk;
code = vm.getCTIStub(jitThunk).retagged<JITStubRoutinePtrTag>();
}
#endif
if (!code) {
if (isClosureCall)
code = LLInt::getCodeRef<JITStubRoutinePtrTag>(llint_polymorphic_closure_call_trampoline);
else
code = LLInt::getCodeRef<JITStubRoutinePtrTag>(llint_polymorphic_normal_call_trampoline);
}
auto stubRoutine = PolymorphicCallStubRoutine::create(WTF::move(code), vm, owner, callerFrame, callLinkInfo, callSlots, notUsingCounting, isClosureCall);
// If there had been a previous stub routine, that one will die as soon as the GC runs and sees
// that it's no longer on stack.
callLinkInfo.setStub(vm, WTF::move(stubRoutine));
}
void linkPolymorphicCall(VM& vm, JSCell* owner, CallFrame* callFrame, CallLinkInfo& callLinkInfo, CallVariant newVariant)
{
// During execution of linkPolymorphicCall, we strongly assume that we never do GC.
// GC jettisons CodeBlocks, changes CallLinkInfo etc. and breaks assumption done before and after this call.
DeferGCForAWhile deferGCForAWhile(vm);
if (vm.gilOff()) [[unlikely]] {
// AB18-D (amended per review): this is a transition writer too — it
// reads the current stub/callee, then setStub/setVirtualCall rewrite
// the mirrors, swap m_stub, publish a record, and remove() this node
// from a callee's m_incomingCalls. All of that must be in the
// precondition-11 writer set, serialized on the same link lock as
// linkMonomorphicCall — the reviewed proposal locked only the
// Init->Monomorphic pair. Holding the lock across stub creation is
// acceptable: rare slow path, GC is deferred above, and the lock
// nests nothing (single process-wide lock; holders never park).
Locker locker { CallLinkInfo::s_callLinkSerializationLock };
linkPolymorphicCallImpl(vm, owner, callFrame, callLinkInfo, newVariant);
return;
}
linkPolymorphicCallImpl(vm, owner, callFrame, callLinkInfo, newVariant);
}
#if ENABLE(JIT)
static ECMAMode NODELETE ecmaModeFor(PutByKind putByKind)
{
switch (putByKind) {
case PutByKind::ByIdSloppy:
case PutByKind::ByValSloppy:
case PutByKind::ByIdDirectSloppy:
case PutByKind::ByValDirectSloppy:
return ECMAMode::sloppy();
case PutByKind::ByIdStrict:
case PutByKind::ByValStrict:
case PutByKind::ByIdDirectStrict:
case PutByKind::ByValDirectStrict:
case PutByKind::DefinePrivateNameById:
case PutByKind::DefinePrivateNameByVal:
case PutByKind::SetPrivateNameById:
case PutByKind::SetPrivateNameByVal:
return ECMAMode::strict();
}
RELEASE_ASSERT_NOT_REACHED();
}
void ftlThunkAwareRepatchCall(CodeBlock* codeBlock, CodeLocationCall<JSInternalPtrTag> call, CodePtr<CFunctionPtrTag> newCalleeFunction)
{
#if ENABLE(FTL_JIT)
if (codeBlock->jitType() == JITType::FTLJIT) {
VM& vm = codeBlock->vm();
FTL::Thunks& thunks = *vm.ftlThunks;
CodePtr<JITThunkPtrTag> slowPathThunk = MacroAssembler::readCallTarget<JITThunkPtrTag>(call);
FTL::SlowPathCallKey key = thunks.keyForSlowPathCallThunk(slowPathThunk);
key = key.withCallTarget(newCalleeFunction);
MacroAssembler::repatchCall(call, thunks.getSlowPathCallThunk(vm, key).code());
return;
}
#else // ENABLE(FTL_JIT)
UNUSED_PARAM(codeBlock);
#endif // ENABLE(FTL_JIT)
MacroAssembler::repatchCall(call, newCalleeFunction.retagged<OperationPtrTag>());
}
// TSAN ic-stubinfo (SPEC-jit §5.1/D3): IC state is mutable multi-field data;
// every writer must hold the owner CodeBlock's m_lock. This primitive
// REQUIRES the caller to hold codeBlock->m_lock already — the tryCache*
// bodies and the reset* family (reached from PropertyInlineCache::reset,
// whose callers all hold the lock) satisfy that. Callers on the lock-free
// GaveUp/megamorphic-demotion tails must use repatchSlowPathCallLocking
// below instead: without the lock, two slow paths demoting the same shared
// IC concurrently (or racing a locked Optimize-revert writer in tryCache*)
// make m_slowOperation a plain-store data race.
static void repatchSlowPathCall(CodeBlock* codeBlock, PropertyInlineCache& propertyCache, CodePtr<CFunctionPtrTag> newCalleeFunction)
{
if (auto* handlerIC = dynamicDowncast<HandlerPropertyInlineCache>(propertyCache)) {
handlerIC->m_slowOperation = newCalleeFunction.retagged<OperationPtrTag>();
return;
}
ftlThunkAwareRepatchCall(codeBlock, downcast<RepatchingPropertyInlineCache>(propertyCache).m_slowPathCallLocation, newCalleeFunction);
}
// See above: the lock-acquiring shape for the repatch* tails, which run AFTER
// tryCache* released the locker. The store itself does not allocate, so a
// plain ConcurrentJSLocker suffices (no GC-safe bracket needed).
static void repatchSlowPathCallLocking(CodeBlock* codeBlock, PropertyInlineCache& propertyCache, CodePtr<CFunctionPtrTag> newCalleeFunction)
{
ConcurrentJSLocker locker(codeBlock->m_lock);
repatchSlowPathCall(codeBlock, propertyCache, newCalleeFunction);
}
enum InlineCacheAction {
GiveUpOnCache,
RetryCacheLater,
AttemptToCache,
PromoteToMegamorphic,
};
static InlineCacheAction actionForCell(VM& vm, JSCell* cell)
{
Structure* structure = cell->structure();
TypeInfo typeInfo = structure->typeInfo();
if (typeInfo.prohibitsPropertyCaching())
return GiveUpOnCache;
if (structure->isUncacheableDictionary()) {
if (structure->hasBeenFlattenedBefore())
return GiveUpOnCache;
if (vm.gilOff()) [[unlikely]] {
// O2/GT11 (stw-watchdog-timeout root cause, transition-vs-write):
// every tryCache* caller holds codeBlock->m_lock (rank 6b) here,
// and flag-on flattenDictionaryObject routes through
// flattenDictionaryStructureUnderStop — a §10.6 per-event stop.
// Requesting a stop while holding a lock that other mutators
// block on WITH heap access held (ConcurrentJSLocker has no
// access-release bracket) wedges the conductor's quiescence
// predicate into the 30s watchdog. Skip the inline flatten: the
// IC stays uncached this round and the access keeps taking the
// slow path — a perf forgone, never a correctness change.
return RetryCacheLater;
}
// Flattening could have changed the offset, so return early for another try.
asObject(cell)->flattenDictionaryObject(vm);
return RetryCacheLater;
}
if (!structure->propertyAccessesAreCacheable())
return GiveUpOnCache;
return AttemptToCache;
}
static bool NODELETE forceICFailure(JSGlobalObject*)
{
return Options::forceICFailure();
}
ALWAYS_INLINE static void fireWatchpointsAndClearStubIfNeeded(VM& vm, PropertyInlineCache& propertyCache, CodeBlock* codeBlock, AccessGenerationResult& result)
{
if (result.shouldResetStubAndFireWatchpoints()) {
result.fireWatchpoints(vm);
{
GCSafeConcurrentJSLocker locker(codeBlock->m_lock, vm);
propertyCache.reset(locker, vm, codeBlock);
}
}
}
CacheableIdentifier nonStringPrimitiveKeyForSubscript(VM& vm, JSValue subscript)
{
if (subscript.isUndefined())
return CacheableIdentifier::createFromImmortalIdentifier(vm.propertyNames->undefinedKeyword.impl());
if (subscript.isNull())
return CacheableIdentifier::createFromImmortalIdentifier(vm.propertyNames->nullKeyword.impl());
if (subscript.isTrue())
return CacheableIdentifier::createFromImmortalIdentifier(vm.propertyNames->trueKeyword.impl());
if (subscript.isFalse())
return CacheableIdentifier::createFromImmortalIdentifier(vm.propertyNames->falseKeyword.impl());
return { };
}
struct NonStringPrimitiveKeyInfo {
SUPPRESS_UNCOUNTED_MEMBER UniquedStringImpl* uid;
AccessCase::AccessType loadType;
AccessCase::AccessType missType;
AccessCase::AccessType replaceType;
AccessCase::AccessType transitionType;
};
static std::optional<NonStringPrimitiveKeyInfo> nonStringPrimitiveKeyInfoForUID(VM& vm, UniquedStringImpl* uid)
{
if (uid == vm.propertyNames->undefinedKeyword.impl()) {
return NonStringPrimitiveKeyInfo {
uid, AccessCase::IndexedUndefinedKeyLoad, AccessCase::IndexedUndefinedKeyMiss,
AccessCase::IndexedUndefinedKeyReplace, AccessCase::IndexedUndefinedKeyTransition
};
}
if (uid == vm.propertyNames->nullKeyword.impl()) {
return NonStringPrimitiveKeyInfo {
uid, AccessCase::IndexedNullKeyLoad, AccessCase::IndexedNullKeyMiss,
AccessCase::IndexedNullKeyReplace, AccessCase::IndexedNullKeyTransition
};
}
if (uid == vm.propertyNames->trueKeyword.impl()) {
return NonStringPrimitiveKeyInfo {
uid, AccessCase::IndexedTrueKeyLoad, AccessCase::IndexedTrueKeyMiss,
AccessCase::IndexedTrueKeyReplace, AccessCase::IndexedTrueKeyTransition
};
}
if (uid == vm.propertyNames->falseKeyword.impl()) {
return NonStringPrimitiveKeyInfo {
uid, AccessCase::IndexedFalseKeyLoad, AccessCase::IndexedFalseKeyMiss,
AccessCase::IndexedFalseKeyReplace, AccessCase::IndexedFalseKeyTransition
};
}
return std::nullopt;
}
inline CodePtr<CFunctionPtrTag> NODELETE appropriateGetByOptimizeFunction(GetByKind kind)
{
switch (kind) {
case GetByKind::ById:
return operationGetByIdOptimize;
case GetByKind::ByIdWithThis:
return operationGetByIdWithThisOptimize;
case GetByKind::TryById:
return operationTryGetByIdOptimize;
case GetByKind::ByIdDirect:
return operationGetByIdDirectOptimize;
case GetByKind::ByVal:
return operationGetByValOptimize;
case GetByKind::ByValWithThis:
return operationGetByValWithThisOptimize;
case GetByKind::PrivateName:
return operationGetPrivateNameOptimize;
case GetByKind::PrivateNameById:
return operationGetPrivateNameByIdOptimize;
}
RELEASE_ASSERT_NOT_REACHED();
}
inline CodePtr<CFunctionPtrTag> NODELETE appropriateGetByGaveUpFunction(GetByKind kind)
{
switch (kind) {
case GetByKind::ById:
return operationGetByIdGaveUp;
case GetByKind::ByIdWithThis:
return operationGetByIdWithThisGaveUp;
case GetByKind::TryById:
return operationTryGetByIdGaveUp;
case GetByKind::ByIdDirect:
return operationGetByIdDirectGaveUp;
case GetByKind::ByVal:
return operationGetByValGaveUp;
case GetByKind::ByValWithThis:
return operationGetByValWithThisGaveUp;
case GetByKind::PrivateName:
return operationGetPrivateNameGaveUp;
case GetByKind::PrivateNameById:
return operationGetPrivateNameByIdGaveUp;
}
RELEASE_ASSERT_NOT_REACHED();
}
static InlineCacheAction tryCacheGetBy(JSGlobalObject* globalObject, CodeBlock* codeBlock, JSValue baseValue, CacheableIdentifier propertyName, const PropertySlot& slot, PropertyInlineCache& propertyCache, GetByKind kind, bool isNonStringPrimitiveKey)
{
VM& vm = globalObject->vm();
AccessGenerationResult result;
{
GCSafeConcurrentJSLocker locker(codeBlock->m_lock, globalObject->vm());
if (forceICFailure(globalObject))
return GiveUpOnCache;
// FIXME: Cache property access for immediates.
if (!baseValue.isCell())
return GiveUpOnCache;
JSCell* baseCell = baseValue.asCell();
const bool isPrivate = kind == GetByKind::PrivateName || kind == GetByKind::PrivateNameById;
RefPtr<AccessCase> newCase;
if (propertyName == vm.propertyNames->length) {
auto lengthPropertyName = CacheableIdentifier::createFromImmortalIdentifier(vm.propertyNames->length.impl());
if (isJSArray(baseCell)) {
if (propertyCache.cacheType() == CacheType::Unset
&& slot.slotBase() == baseCell
&& InlineAccess::isCacheableArrayLength(propertyCache, uncheckedDowncast<JSArray>(baseCell))) {
bool generatedCodeInline = InlineAccess::generateArrayLength(propertyCache, uncheckedDowncast<JSArray>(baseCell));
if (generatedCodeInline) {
repatchSlowPathCall(codeBlock, propertyCache, appropriateGetByOptimizeFunction(kind));
propertyCache.initArrayLength(locker);
return RetryCacheLater;
}
}
newCase = AccessCase::create(vm, codeBlock, AccessCase::ArrayLength, lengthPropertyName);
} else if (isJSString(baseCell)) {
if (propertyCache.cacheType() == CacheType::Unset
&& InlineAccess::isCacheableStringLength(propertyCache)) {
bool generatedCodeInline = InlineAccess::generateStringLength(propertyCache);
if (generatedCodeInline) {
repatchSlowPathCall(codeBlock, propertyCache, appropriateGetByOptimizeFunction(kind));
propertyCache.initStringLength(locker);
return RetryCacheLater;
}
}
newCase = AccessCase::create(vm, codeBlock, AccessCase::StringLength, lengthPropertyName);
} else if (DirectArguments* arguments = dynamicDowncast<DirectArguments>(baseCell)) {
// If there were overrides, then we can handle this as a normal property load! Guarding
// this with such a check enables us to add an IC case for that load if needed.
if (!arguments->overrodeThings())
newCase = AccessCase::create(vm, codeBlock, AccessCase::DirectArgumentsLength, lengthPropertyName);
} else if (ScopedArguments* arguments = dynamicDowncast<ScopedArguments>(baseCell)) {
// Ditto.
if (!arguments->overrodeThings())
newCase = AccessCase::create(vm, codeBlock, AccessCase::ScopedArgumentsLength, lengthPropertyName);
}
}
if (!newCase && propertyName == vm.propertyNames->lastIndex) {
if (is<RegExpObject>(baseCell))
newCase = AccessCase::create(vm, codeBlock, AccessCase::RegExpLastIndexLoad, CacheableIdentifier::createFromImmortalIdentifier(vm.propertyNames->lastIndex.impl()));
}
if (!propertyName.isSymbol() && baseCell->inherits<JSModuleNamespaceObject>() && !slot.isUnset()) {
if (auto moduleNamespaceSlot = slot.moduleNamespaceSlot())
newCase = ModuleNamespaceAccessCase::create(vm, codeBlock, propertyName, uncheckedDowncast<JSModuleNamespaceObject>(baseCell), moduleNamespaceSlot->environment, ScopeOffset(moduleNamespaceSlot->scopeOffset));
}
if (!propertyName.isPrivateName() && baseCell->inherits<ProxyObject>()) {
switch (kind) {
case GetByKind::ById:
case GetByKind::ByIdWithThis: {
propertyName.ensureIsCell(vm);
newCase = AccessCase::create(vm, codeBlock, AccessCase::ProxyObjectLoad, propertyName);
break;
}
case GetByKind::ByVal:
case GetByKind::ByValWithThis: {
newCase = AccessCase::create(vm, codeBlock, AccessCase::IndexedProxyObjectLoad, nullptr);
break;
}
case GetByKind::PrivateName:
case GetByKind::PrivateNameById:
RELEASE_ASSERT_NOT_REACHED();
default:
break;
}
}
if (!newCase) {
if (!slot.isCacheable() && !slot.isUnset())
return GiveUpOnCache;
ObjectPropertyConditionSet conditionSet;
Structure* structure = baseCell->structure();
bool loadTargetFromProxy = false;
if (baseCell->type() == GlobalProxyType) {
if (isPrivate)
return GiveUpOnCache;
baseValue = uncheckedDowncast<JSGlobalProxy>(baseCell)->target();
baseCell = baseValue.asCell();
structure = baseCell->structure();
loadTargetFromProxy = true;
}
InlineCacheAction action = actionForCell(vm, baseCell);
if (action != AttemptToCache)
return action;
if (vm.gilOff() && !slot.isUnset() && (slot.isCacheableValue() || slot.isCacheableGetter())) [[unlikely]] {
// OM-1 (gilOff() mode-split) — GetBy analog of the
// tryCachePutBy Replace/Setter revalidation: the slow-path
// operation filled `slot` {slotBase, cachedOffset} DURING
// getOwnPropertySlot, but the guarding structure is read NOW.
// GIL-off, another mutator can transition base or the holder
// between those points (delete / dictionary flatten shift
// named offsets), so publishing (structure-now, offset-then)
// keys an IC that loads a sibling slot on every future hit
// (named-property corruption), or treats a data slot as a
// GetterSetter and calls through a non-callable cell. Bind
// the offset to the structure the IC will actually be keyed
// on: for self access that is `structure` itself (its
// uid->offset table is immutable for non-dictionaries, so
// this hard-closes the tear including A->B->A); for proto
// hits it is the holder's current structure, which is also
// what generateConditionsForPrototypePropertyHit asserts
// against. getConcurrently is the structure-lock walk; the
// codeBlock-lock -> structure-lock order here is the existing
// concurrent-JIT order (same as the landed PutBy OM-1 guard).
// Require the entry's kind to match the slot's. Cacheable
// dictionaries mutate their table in place under the same
// structureID, invisible to the IC guard; refuse those.
JSObject* slotBaseObject = slot.slotBase();
if (!slotBaseObject)
return RetryCacheLater;
Structure* validationStructure = slot.slotBase() == baseValue ? structure : slotBaseObject->structure();
// T4-ic-never-settles-giloff (alloctax2 #4, restore caching):
// previously refused ALL dictionaries here, which under GIL-off
// (where O2/GT11 forbids flattening from IC paths) made
// global-object / cacheable-dictionary self loads return
// RetryCacheLater forever — the Optimize operation never
// settles and every execution pays the full tryCache walk.
// CACHEABLE dictionaries are safe to revalidate and key on:
// getConcurrently() is the structure-lock walk, the
// uid->offset binding for an existing slot is stable (adds
// append, replace keeps the offset, delete transitions to an
// UNCACHEABLE dictionary i.e. a different StructureID so the
// IC guard fails), and startWatchingPropertyForReplacements
// covers in-place value churn. Only UNCACHEABLE dictionaries
// mutate their table in a way the IC guard cannot observe.
if (validationStructure->isUncacheableDictionary())
return RetryCacheLater;
unsigned attributes;
PropertyOffset tableOffset = validationStructure->getConcurrently(propertyName.uid(), attributes);
if (tableOffset != slot.cachedOffset())
return RetryCacheLater;
if (slot.isCacheableGetter() != !!(attributes & PropertyAttribute::Accessor))
return RetryCacheLater;
if (attributes & PropertyAttribute::CustomAccessorOrValue)
return RetryCacheLater;
}
// Optimize self access.
if (propertyCache.cacheType() == CacheType::Unset
&& slot.isCacheableValue()
&& slot.slotBase() == baseValue
&& !slot.watchpointSet()
&& !structure->needImpurePropertyWatchpoint()
&& !loadTargetFromProxy) {
bool generatedCodeInline = InlineAccess::generateSelfPropertyAccess(propertyCache, structure, slot.cachedOffset());
if (generatedCodeInline) {
LOG_IC((ICEvent::GetBySelfPatch, structure->classInfoForCells(), slot.slotBase() == baseValue));
structure->startWatchingPropertyForReplacements(vm, slot.cachedOffset());
repatchSlowPathCall(codeBlock, propertyCache, appropriateGetByOptimizeFunction(kind));
propertyCache.initGetByIdSelf(locker, codeBlock, structure, slot.cachedOffset());
return RetryCacheLater;
}
}
RefPtr<PolyProtoAccessChain> prototypeAccessChain;
PropertyOffset offset = slot.isUnset() ? invalidOffset : slot.cachedOffset();
if (slot.isCustom() && slot.slotBase() == baseValue) {
// To cache self customs, we must disallow dictionaries because we
// need to be informed if the custom goes away since we cache the
// constant function pointer.
if (!prepareChainForCaching(globalObject, slot.slotBase(), propertyName.uid(), slot.slotBase()))
return GiveUpOnCache;
}
if (slot.isUnset() || slot.slotBase() != baseValue) {
if (structure->typeInfo().prohibitsPropertyCaching())
return GiveUpOnCache;
if (structure->isDictionary()) {
if (structure->hasBeenFlattenedBefore())
return GiveUpOnCache;
if (vm.gilOff()) [[unlikely]] {
// O2/GT11 (AB17e: sibling site of the actionForCell
// gate): we hold codeBlock->m_lock (rank 6b) with
// heap access, and flag-on flattenDictionaryStructure
// ALWAYS routes through the §10.6 per-event stop —
// requesting a stop here wedges the conductor's
// quiescence predicate into the 30s watchdog. Rule:
// gilOff, NEVER flatten from any IC-caching path;
// flattening happens only from unlocked runtime
// sites. Perf forgone, never a correctness change.
return RetryCacheLater;
}
structure->flattenDictionaryStructure(vm, uncheckedDowncast<JSObject>(baseCell));
return RetryCacheLater; // We may have changed property offsets.
}
if (slot.isUnset() && structure->typeInfo().getOwnPropertySlotIsImpureForPropertyAbsence())
return GiveUpOnCache;
// If a kind is GetByKind::ByIdDirect or GetByKind::PrivateName, we do not need to investigate prototype chains further.
// Cacheability just depends on the head structure.
if (kind != GetByKind::ByIdDirect && !isPrivate) {
auto cacheStatus = prepareChainForCaching(globalObject, baseCell, propertyName.uid(), slot);
if (!cacheStatus)
return GiveUpOnCache;
if (cacheStatus->flattenedDictionary) {
// Property offsets may have changed due to flattening. We'll cache later.
return RetryCacheLater;
}
if (cacheStatus->usesPolyProto) {
prototypeAccessChain = PolyProtoAccessChain::tryCreate(globalObject, baseCell, propertyName, slot);
if (!prototypeAccessChain)
return GiveUpOnCache;
ASSERT(slot.isCacheableCustom() || prototypeAccessChain->slotBaseStructure(vm, structure)->get(vm, propertyName.uid()) == offset);
} else {
// We use ObjectPropertyConditionSet instead for faster accesses.
prototypeAccessChain = nullptr;
// FIXME: Maybe this `if` should be inside generateConditionsForPropertyBlah.
// https://bugs.webkit.org/show_bug.cgi?id=185215
if (slot.isUnset()) {
conditionSet = generateConditionsForPropertyMiss(
vm, codeBlock, globalObject, structure, propertyName.uid());
} else if (!slot.isCacheableCustom()) {
conditionSet = generateConditionsForPrototypePropertyHit(
vm, codeBlock, globalObject, structure, slot.slotBase(),
propertyName.uid());
if (vm.gilOff()) [[unlikely]] {
// OM-1: generateConditionsForPrototypePropertyHit
// re-walks the holder AFTER the revalidation guard
// above, so GIL-off a racing transition can leave
// the freshly generated condition's offset
// disagreeing with the slot's. That is a benign
// publish-time race, not a corrupted invariant —
// refuse the cache attempt instead of crashing.
if (conditionSet.isValid() && conditionSet.slotBaseCondition().offset() != offset)
return RetryCacheLater;
} else
RELEASE_ASSERT(!conditionSet.isValid() || conditionSet.slotBaseCondition().offset() == offset);
} else {
conditionSet = generateConditionsForPrototypePropertyHitCustom(
vm, codeBlock, globalObject, structure, slot.slotBase(),
propertyName.uid(), slot.attributes());
}
if (!conditionSet.isValid())
return GiveUpOnCache;
}
}
}
JSFunction* getter = nullptr;
if (slot.isCacheableGetter())
getter = dynamicDowncast<JSFunction>(slot.getterSetter()->getter());
std::optional<DOMAttributeAnnotation> domAttribute;
if (slot.isCacheableCustom() && slot.domAttribute())
domAttribute = slot.domAttribute();
if (kind == GetByKind::TryById) {
AccessCase::AccessType type;
if (slot.isCacheableValue())
type = AccessCase::Load;
else if (slot.isUnset())
type = AccessCase::Miss;
else if (slot.isCacheableGetter())
type = AccessCase::GetGetter;
else
RELEASE_ASSERT_NOT_REACHED();
newCase = ProxyableAccessCase::create(vm, codeBlock, type, propertyName, offset, structure, conditionSet, loadTargetFromProxy, slot.watchpointSet(), WTF::move(prototypeAccessChain));
} else if (!loadTargetFromProxy && getter && InlineCacheCompiler::canEmitIntrinsicGetter(propertyCache, getter, structure))
newCase = IntrinsicGetterAccessCase::create(vm, codeBlock, propertyName, slot.cachedOffset(), structure, conditionSet, getter, WTF::move(prototypeAccessChain));
else {
if (isPrivate) {
RELEASE_ASSERT(!slot.isUnset());
RELEASE_ASSERT(conditionSet.isEmpty());
constexpr bool isGlobalProxy = false;
if (!slot.isCacheable())
return GiveUpOnCache;
newCase = ProxyableAccessCase::create(vm, codeBlock, AccessCase::Load, propertyName, offset, structure,
conditionSet, isGlobalProxy, slot.watchpointSet(), WTF::move(prototypeAccessChain));
} else if (slot.isCacheableValue() || slot.isUnset()) {
newCase = ProxyableAccessCase::create(vm, codeBlock, slot.isUnset() ? AccessCase::Miss : AccessCase::Load,
propertyName, offset, structure, conditionSet, loadTargetFromProxy, slot.watchpointSet(), WTF::move(prototypeAccessChain));
} else {
AccessCase::AccessType type;
if (slot.isCacheableGetter())
type = AccessCase::Getter;
else if (slot.attributes() & PropertyAttribute::CustomAccessor)
type = AccessCase::CustomAccessorGetter;
else
type = AccessCase::CustomValueGetter;
if ((kind == GetByKind::ByIdWithThis || kind == GetByKind::ByValWithThis) && type == AccessCase::CustomAccessorGetter && domAttribute)
return GiveUpOnCache;
CodePtr<CustomAccessorPtrTag> customAccessor;
if (slot.isCacheableCustom())
customAccessor = slot.customGetter();
newCase = GetterSetterAccessCase::create(
vm, codeBlock, type, propertyName, offset, structure, conditionSet, loadTargetFromProxy,
slot.watchpointSet(), customAccessor,
slot.isCacheableCustom() && slot.slotBase() != baseValue ? slot.slotBase() : nullptr,
domAttribute, WTF::move(prototypeAccessChain));
}
}
}
LOG_IC((ICEvent::GetByAddAccessCase, baseValue.classInfoOrNull(), slot.slotBase() == baseValue));
if (isNonStringPrimitiveKey) {
if (!newCase)
return GiveUpOnCache;
auto keyInfo = nonStringPrimitiveKeyInfoForUID(vm, propertyName.uid());
ASSERT(keyInfo);
switch (newCase->type()) {
case AccessCase::Load:
newCase->convertToNonStringPrimitiveKeyAccessType(keyInfo->loadType);
break;
case AccessCase::Miss:
newCase->convertToNonStringPrimitiveKeyAccessType(keyInfo->missType);
break;
default:
return GiveUpOnCache;
}
}
result = propertyCache.addAccessCase(locker, globalObject, codeBlock, ECMAMode::strict(), isNonStringPrimitiveKey ? nullptr : propertyName, WTF::move(newCase));
if (result.generatedSomeCode())
LOG_IC((ICEvent::GetByReplaceWithJump, baseValue.classInfoOrNull(), slot.slotBase() == baseValue));
}
fireWatchpointsAndClearStubIfNeeded(vm, propertyCache, codeBlock, result);
if (result.generatedMegamorphicCode())
return PromoteToMegamorphic;
return result.shouldGiveUpNow() ? GiveUpOnCache : RetryCacheLater;
}
void repatchGetBy(JSGlobalObject* globalObject, CodeBlock* codeBlock, JSValue baseValue, CacheableIdentifier propertyName, const PropertySlot& slot, PropertyInlineCache& propertyCache, GetByKind kind, bool isNonStringPrimitiveKey)
{
SuperSamplerScope superSamplerScope(false);
switch (tryCacheGetBy(globalObject, codeBlock, baseValue, propertyName, slot, propertyCache, kind, isNonStringPrimitiveKey)) {
case PromoteToMegamorphic: {
switch (kind) {
case GetByKind::ById:
repatchSlowPathCallLocking(codeBlock, propertyCache, operationGetByIdMegamorphic);
break;
case GetByKind::ByIdWithThis:
repatchSlowPathCallLocking(codeBlock, propertyCache, operationGetByIdWithThisMegamorphic);
break;
case GetByKind::ByVal:
repatchSlowPathCallLocking(codeBlock, propertyCache, operationGetByValMegamorphic);
break;
case GetByKind::ByValWithThis:
repatchSlowPathCallLocking(codeBlock, propertyCache, operationGetByValWithThisMegamorphic);
break;
default:
RELEASE_ASSERT_NOT_REACHED();
break;
}
break;
}
case GiveUpOnCache:
repatchSlowPathCallLocking(codeBlock, propertyCache, appropriateGetByGaveUpFunction(kind));
break;
case RetryCacheLater:
// T4-ic-never-settles-giloff (alloctax2 #4, escalation): GIL-off, the
// O2/GT11 "never flatten from an IC path" rule plus the OM-1
// uncacheable-dictionary refusal above make several RetryCacheLater
// returns permanent — the condition never clears, so this site stays
// wired to operationGetBy*Optimize forever and every call pays
// considerRepatchingCacheImpl + tryCacheGetBy for nothing (the +1.43G
// / 15.5% residual on the pc-loop bench). Count consecutive retries
// that left the IC still at Unset; once a small threshold is crossed,
// repatch to the GaveUp operation — the same cheap settled state
// GIL-on reaches after a single flatten. gilOff-gated so flag-off