Increase reference count for new key only if it is really a new key

This pull request is to fix a potential memory leak in dictionary. 

The type of key of dictionary is ``StackValue``, so we need to do deep comparison for key's equality. If two keys are equal, we shouldn't increase the reference count for new key because we won't put it into the dictionary.