[VMRefactor] Implement a function to check for global scope 

Removes the clutter of what function to call or property to check when determining globalscope.
Refactor task does regress and does not require new testcases
@ke-yu  @lukechurch 

Could we make this consistent with the pattern below?