DFG::InsertionSet should be tolerant of occasional out-of-order insertions
https://bugs.webkit.org/show_bug.cgi?id=148367
Reviewed by Geoffrey Garen and Saam Barati.
Since forever, the DFG::InsertionSet has been the way we insert nodes into DFG IR, and it
requires that you walk a block in order and perform insertions in order: you can't insert
something at index J, then at index I where I < J, except if you do a second pass.
This restriction makes sense, because it enables a very fast algorithm. And it's very
rare that a phase would need to insert things out of order.
But sometimes - rarely - we need to insert things slightly out-of-order. For example we
may want to insert a node at index J, but to insert a check associated with that node, we
may need to use index I where I < J. This will come up from the work on
https://bugs.webkit.org/show_bug.cgi?id=145204. And it has already come up in the past.
It seems like it would be best to just lift this restriction.
(JSC::DFG::InsertionSet::insertSlow):
(JSC::DFG::InsertionSet::InsertionSet):
(JSC::DFG::InsertionSet::graph):
(JSC::DFG::InsertionSet::insert):
(JSC::DFG::InsertionSet::execute):