049921b45f
This fixes a huge performance regression (introduced in [0]) of a synthetic microbenchmark - MicroClosureCreateTearoffClassSecondTime - that happens to have a gigantic function with a large number of call sites in them. All of those call sites stay monomorphic but all of them will have to go to runtime for miss handler because the target code was disabled (the unoptimized code got disabled, since optimized target code was installed). The particular target function in question is `_GrowableArray.add()`. The cause for the regression is that the miss handler will lookup the ICData based on linearly walking PcDescriptors to find deopt-id which it uses to get ICData from function's ic-data array. Interestingly enough it only regresses ia32 but not x64 (the only two architectures this benchmark is run on). The reason for that is that x64 uses exactness tracking and therefore doesn't switch to monomorphic calls. This CL: If a monomorphic call site had a miss because the cached old target was disabled, we go to runtime to find the real target. Another thread may have transitioned the call site already from monomorphic to polymorphic. When resolving the target function we take advantage of a back reference from the `ICData::entries()` back to the `ICData` to avoid the O(N) lookups. [0] https://dart-review.googlesource.com/c/sdk/+/206373 TEST=Existing test suite. Change-Id: Ia066a846f5f50e5a575f0734c9453d2368f80780 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207133 Commit-Queue: Martin Kustermann <kustermann@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com>