Avoid obj.hasOwnProperty in favor of Object.prototype.hasOwnPrototype

Reimplement #1818, with replacing all hasOwnPrototype and adding a test.
Merge pull request #1874 from ichernev/has-own

Avoid obj.hasOwnProperty in favor of Object.prototype.hasOwnPrototype

@changelog
@section bugfix