code: function StringSearch(pattern) {
    CHECK_OBJECT_COERCIBLE(this, "String.prototype.search");
  
    if (!IS_NULL_OR_UNDEFINED(pattern)) {
      var searcher = pattern[searchSymbol];
      if (!IS_UNDEFINED(searcher)) {
        return %_Call(searcher, pattern, this);
      }
    }
  
    var subject = TO_STRING(this);
  
    // Equivalent to RegExpCreate (ES#sec-regexpcreate)
    var regexp = %_NewObject(GlobalRegExp, GlobalRegExp);
    RegExpInitialize(regexp, pattern);
    return %_Call(regexp[searchSymbol], regexp, subject);
  }
docs: ES6 21.1.3.15.