replacing all isType tests that relied on string comparisons with versions that check for existence of known methods and properties. Less safe, but more than an order of magnitude faster.
(cherry picked from commit 4be6a194cdc039c7a1cbcef8812027289f997b20)