I see that you are calling $this->msg( 'VisualEditor-anoneditwarning' ) twice (in some cases). I'm not sure if it's heavy or not, but if it is then consider assigning it to variable.