Replace is_object/is_array with switch on gettype

When checking multiple types, this is ~10% slower in the worst case, and ~30-33% faster for the average and best case.

See #218
Use reference to current stack frame

(saves quite a few array lookups)

See #218
No need for elseif with returns :)

/cc @keradus
One more unnecessary else/return combo.
Merge pull request #223 from bobthecow/feature/faster-type-checking

Faster context lookups