Namespace#exit() calls this._stack.lastIndexOf(context) with the expectation that context is at index 0. That means you're basically doing an O(n*m) operation here, right?