isReferenceTo() optimized for parameters
(cherry picked from commit 7e02642)