Fix several devirtualization issues
When doing interface devirtualization, if the object type is canonical,
ensure that the owner type is too. The jit may present a mixed set
when inlining a shared method into a non-shared method. Ideally the
jit would also be able to present exact object types in such cases but
currently it cannot guarantee this. Closes dotnet/coreclr#10311.
Adjust contracts to address some contract violations seen in desktop
testing. Make the helper non-static and fold in some of the info that
was passed from the caller to bring the desktop and CoreCLR implementations
closer.
Disallow interface devirt if the method is final but the class is not
exact or final, since derived classes can still override final methods
when implementing interfaces.
Don't try and devirtualize interface calls from com objects.
Add some related test cases.
Commit migrated from https://github.com/dotnet/coreclr/commit/
d02fbd29384dc10217c35af0aea3ee862c07ac63