[VMRefactor] Implement a function to check for global scope 

Removes the clutter of what function to call or property to check when determining globalscope.