Changeset 238411 in webkit
- Timestamp:
- Nov 20, 2018 9:15:31 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r238391 r238411 1 2018-11-20 Saam barati <sbarati@apple.com> 2 3 Merging an IC variant may lead to the IC status containing overlapping structure sets 4 https://bugs.webkit.org/show_bug.cgi?id=191869 5 <rdar://problem/45403453> 6 7 Reviewed by Mark Lam. 8 9 * stress/merging-ic-variants-should-bail-if-structures-overlap.js: Added. 10 1 11 2018-11-19 Mark Lam <mark.lam@apple.com> 2 12 -
trunk/Source/JavaScriptCore/ChangeLog
r238392 r238411 1 2018-11-20 Saam barati <sbarati@apple.com> 2 3 Merging an IC variant may lead to the IC status containing overlapping structure sets 4 https://bugs.webkit.org/show_bug.cgi?id=191869 5 <rdar://problem/45403453> 6 7 Reviewed by Mark Lam. 8 9 When merging two IC variant lists, we may end up in a world where we have 10 overlapping structure sets. We defend against this when we append a new 11 variant, but we should also defend against it once we merge in a new variant. 12 13 Consider this case with MultiPutByOffset, where we merge two PutByIdStatuses 14 together, P1 and P2. 15 16 Let's consider these structures: 17 s1 = {} 18 s2 = {p: 0} 19 s3 = {p: 0, p2: 1} 20 21 P1 contains these variants: 22 Transition: [s1 => s2] 23 Replace: [s2, s3] 24 25 P2 contains: 26 Replace: [s2] 27 28 Because of the ordering of the variants, we may end up combining 29 P2's replace into P1's transition, forming this new list: 30 Transition: [(s1, s2) => s2] 31 Replace: [s2, s3] 32 33 Obviously the ideal thing here is to have some ordering when we merge 34 in variants to choose the most ideal option. It'd be ideal for P2's 35 Replace to be merged into P1's replace. 36 37 If we notice that this is super important, we can implement some kind 38 of ordering. None of our tests (until this patch) stress this. This patch 39 just makes it so we defend against this crazy scenario by falling back 40 to the slow path gracefully. This prevents us from emitting invalid 41 IR in FTL->B3 lowering by creating a switch with two case labels being 42 identical values. 43 44 * bytecode/ICStatusUtils.h: 45 (JSC::appendICStatusVariant): 46 1 47 2018-11-20 Fujii Hironori <Hironori.Fujii@sony.com> 2 48 -
trunk/Source/JavaScriptCore/bytecode/ICStatusUtils.h
r234086 r238411 35 35 // Attempt to merge this variant with an already existing variant. 36 36 for (unsigned i = 0; i < variants.size(); ++i) { 37 if (variants[i].attemptToMerge(variant)) 37 VariantType& mergedVariant = variants[i]; 38 if (mergedVariant.attemptToMerge(variant)) { 39 for (unsigned j = 0; j < variants.size(); ++j) { 40 if (i == j) 41 continue; 42 if (variants[j].structureSet().overlaps(mergedVariant.structureSet())) 43 return false; 44 } 38 45 return true; 46 } 39 47 } 40 48
Note: See TracChangeset
for help on using the changeset viewer.