The main purpose of keepAlive() is to communicate to B3 that an LValue needs to be kept alive pass the last opportunity for a GC. The only way we can get a GC is via a function call. Hence, what keepAlive() really needs to communicate is that the LValue needs to be kept alive pass the last function call. Function calls read and write HeapRange::top(). Currently, B3 does not shuffle writes. Hence, simply inserting the keepAlive() after the calls that can GC is sufficient. But to be strictly correct, keepAlive() should also declare that it reads HeapRange::top(). This will guarantee that the keepAlive patchpoint won't ever be moved before the function call should B3 gain the ability to shuffle writes in the future.
Created attachment 373057 [details] proposed patch.
Comment on attachment 373057 [details] proposed patch. r=me
Comment on attachment 373057 [details] proposed patch. R=me too.
Thanks for the reviews. Landed in r246910: <http://trac.webkit.org/r246910>.
<rdar://problem/52296737>