code: public static Object getStopIterationObject(Scriptable scope) {
          Scriptable top = ScriptableObject.getTopLevelScope(scope);
          return ScriptableObject.getTopScopeValue(top, ITERATOR_TAG);
      }
docs: Get the value of the "StopIteration" object. Note that this value
  is stored in the top-level scope using "associateValue" so the
  value can still be found even if a script overwrites or deletes
  the global "StopIteration" property.
  @param scope a scope whose parent chain reaches a top-level scope
  @return the StopIteration object