facebook/hhvm — pull request #3811 by tstarling (2014-09-22 05:10:42+00:00)
Title: EZC: Fix count() and conversion to boolean of ProxyArray

Fix JIT versions of count() and conversion of array to boolean, so that they work with ProxyArray. In both cases, duplicate the logic in ArrayData::size() -- if the sign bit of the size field is unset, use that field, otherwise call vsize().

The resulting generated machine code for conversion to boolean is along the lines of:

mov 0x4(%rdi),%eax
test %eax,%eax
js 0xf80049b
setne %al

where 0xf80049b is the slow path. This is similar to the machine code I previously reported for ArrayData::size() in code review of 1717e028f18 (see #3065).

Added test case which previously failed.