Further improve the DecRef code sequence using PGO
commitdb29ebcb30461ed11d95e4d382a3e215c4963b09
authorGuilherme Ottoni <ottoni@fb.com>
Fri, 16 Jun 2017 19:42:06 +0000 (16 12:42 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Fri, 16 Jun 2017 19:58:58 +0000 (16 12:58 -0700)
tree1871fbc4c3bcdda59a4c64bff4697d67d3bd8909
parent207bfbcab2720c4426d6cc6536704274ac950b23
Further improve the DecRef code sequence using PGO

Summary:
This diff extends the DecRefProfile to count the frequency of each of the 4
possible cases for a generic DecRef:
  a) uncounted
  b) counted type, but persistent (count < 1)
  c) counted type, and gets released (count == 1)
  d) counted type, and survives the DecRef (count > 1)

This information is then used in Optimize translations to further specialize the
code for the most common case.  This can save one branch for the most common
case.  Note that the previous sequence was the optimal for the release case (c),
which is unlikely to be the most common.  This diff also uses this profile
information to decide whether to put the rare cases in the cold code area (we
were only doing this for the release path).

Reviewed By: paulbiss

Differential Revision: D5262937

fbshipit-source-id: 927f6908ab245c020dd932811f6d11cdc513c6da
hphp/runtime/base/runtime-option.h
hphp/runtime/vm/jit/irlower-refcount.cpp
hphp/runtime/vm/jit/profile-decref.h [new file with mode: 0644]