deps/v8/src/js/string.js
function StringSlice(start, end) {
  CHECK_OBJECT_COERCIBLE(this, "String.prototype.slice");

  var s = TO_STRING(this);
  var s_len = s.length;
  var start_i = TO_INTEGER(start);
  var end_i = s_len;
  if (!IS_UNDEFINED(end)) {
    end_i = TO_INTEGER(end);
  }

  if (start_i < 0) {
    start_i += s_len;
    if (start_i < 0) {
      start_i = 0;
    }
  } else {
    if (start_i > s_len) {
      return '';
    }
  }

  if (end_i < 0) {
    end_i += s_len;
    if (end_i < 0) {
      return '';
    }
  } else {
    if (end_i > s_len) {
      end_i = s_len;
    }
  }

  if (end_i <= start_i) {
    return '';
  }

  return %_SubString(s, start_i, end_i);
}
function StringSlice(start, end) {
  CHECK_OBJECT_COERCIBLE(this, "String.prototype.slice");

  var s = TO_STRING(this);
  var s_len = s.length;
  var start_i = TO_INTEGER(start);
  var end_i = s_len;
  if (!IS_UNDEFINED(end)) {
    end_i = TO_INTEGER(end);
  }

  if (start_i < 0) {
    start_i += s_len;
    if (start_i < 0) {
      start_i = 0;
    }
  } else {
    if (start_i > s_len) {
      return '';
    }
  }

  if (end_i < 0) {
    end_i += s_len;
    if (end_i < 0) {
      return '';
    }
  } else {
    if (end_i > s_len) {
      end_i = s_len;
    }
  }

  if (end_i <= start_i) {
    return '';
  }

  return %_SubString(s, start_i, end_i);
}
function StringSlice ( start , end ) { CHECK_OBJECT_COERCIBLE ( this , "String.prototype.slice" ) ; var s = TO_STRING ( this ) ; var s_len = s . length ; var start_i = TO_INTEGER ( start ) ; var end_i = s_len ; if ( ! IS_UNDEFINED ( end ) ) { end_i = TO_INTEGER ( end ) ; } if ( start_i < 0 ) { start_i += s_len ; if ( start_i < 0 ) { start_i = 0 ; } } else { if ( start_i > s_len ) { return '' ; } } if ( end_i < 0 ) { end_i += s_len ; if ( end_i < 0 ) { return '' ; } } else { if ( end_i > s_len ) { end_i = s_len ; } } if ( end_i <= start_i ) { return '' ; } return % _SubString ( s , start_i , end_i ) ; }
ECMA-262 section 15.5.4.13
ECMA - 262 section 15 . 5 . 4 . 13