Add fast path for Array.prototype.indexOf/lastIndexOf
Summary:
If this is truly an Array object, go fast path, otherwise, falls to
slow path. In fast path, use specialized loop given the type of search
value and reverse mode. For checking Number, add a new function that
returns double value if the HV is a number and returns NaN if it's not.
This avoids repeated tag checking in isNumber() and getNumber()
for HV32 mode.
On the given benchmark it's ~12X faster on both HV32 and HV64 mode.
Differential Revision: D58201521
This pull request was exported from Phabricator. Differential Revision: D58201521
This pull request was exported from Phabricator. Differential Revision: D58201521
Nice! For the reference: this fixes https://github.com/facebook/hermes/issues/1270 Related to https://github.com/facebook/hermes/issues/1573 and https://github.com/facebook/react-native/issues/36296