Ensure safe object

Applies a bit of micro-optimization to ensureSafeObject.

This version matches the "alternate 2.2" version here: http://jsperf.com/ensuresafeobject/2

alternate 2.3 is a bit faster and simpler, but would break backwards compatibility.