function StringRepeat(count) {
  CHECK_OBJECT_COERCIBLE(this, "String.prototype.repeat");

  var s = TO_STRING(this);
  var n = TO_INTEGER(count);

  if (n < 0 || n === INFINITY) throw MakeRangeError(kInvalidCountValue);

  // Early return to allow an arbitrarily-large repeat of the empty string.
  if (s.length === 0) return "";

  // The maximum string length is stored in a smi, so a longer repeat
  // must result in a range error.
  if (n > %_MaxSmi()) throw MakeRangeError(kInvalidCountValue);

  var r = "";
  while (true) {
    if (n & 1) r += s;
    n >>= 1;
    if (n === 0) return r;
    s += s;
  }
}
function StringRepeat(count) {
  CHECK_OBJECT_COERCIBLE(this, "String.prototype.repeat");

  var s = TO_STRING(this);
  var n = TO_INTEGER(count);

  if (n < 0 || n === INFINITY) throw MakeRangeError(kInvalidCountValue);

  
  if (s.length === 0) return "";

  
  
  if (n > %_MaxSmi()) throw MakeRangeError(kInvalidCountValue);

  var r = "";
  while (true) {
    if (n & 1) r += s;
    n >>= 1;
    if (n === 0) return r;
    s += s;
  }
}
function StringRepeat ( count ) { CHECK_OBJECT_COERCIBLE ( this , "String.prototype.repeat" ) ; var s = TO_STRING ( this ) ; var n = TO_INTEGER ( count ) ; if ( n < 0 || n === INFINITY ) throw MakeRangeError ( kInvalidCountValue ) ; // Early return to allow an arbitrarily-large repeat of the empty string. if ( s . length === 0 ) return "" ; // The maximum string length is stored in a smi, so a longer repeat // must result in a range error. if ( n > % _MaxSmi ( ) ) throw MakeRangeError ( kInvalidCountValue ) ; var r = "" ; while ( true ) { if ( n & 1 ) r += s ; n >>= 1 ; if ( n === 0 ) return r ; s += s ; } }
ES6, section 21.1.3.13
ES6 section 21 . 1 . 3 . 13