Changeset 199748 in webkit


Ignore:
Timestamp:
Apr 19, 2016 5:02:07 PM (8 years ago)
Author:
mark.lam@apple.com
Message:

Re-landing: ES6: Implement RegExp.prototype[@@search].
https://bugs.webkit.org/show_bug.cgi?id=156331

Reviewed by Keith Miller.

Source/JavaScriptCore:

What changed?

  1. Implemented search builtin in RegExpPrototype.js. The native path is now used as a fast path.
  2. Added DFG support for an IsRegExpObjectIntrinsic (modelled after the IsJSArrayIntrinsic).
  3. Renamed @isRegExp to @isRegExpObject to match the new IsRegExpObjectIntrinsic.
  4. Change the esSpecIsRegExpObject() implementation to check if the object's JSType is RegExpObjectType instead of walking the classinfo chain.
  • builtins/RegExpPrototype.js:

(search):

  • builtins/StringPrototype.js:

(search):

  • fixed some indentation.
  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::handleIntrinsicCall):

  • dfg/DFGClobberize.h:

(JSC::DFG::clobberize):

  • dfg/DFGDoesGC.cpp:

(JSC::DFG::doesGC):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGNodeType.h:
  • dfg/DFGPredictionPropagationPhase.cpp:

(JSC::DFG::PredictionPropagationPhase::propagate):

  • dfg/DFGSafeToExecute.h:

(JSC::DFG::safeToExecute):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileIsArrayConstructor):
(JSC::DFG::SpeculativeJIT::compileIsRegExpObject):
(JSC::DFG::SpeculativeJIT::compileCallObjectConstructor):

  • dfg/DFGSpeculativeJIT.h:
  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileIsFunction):
(JSC::FTL::DFG::LowerDFGToB3::compileIsRegExpObject):
(JSC::FTL::DFG::LowerDFGToB3::compileTypeOf):
(JSC::FTL::DFG::LowerDFGToB3::isExoticForTypeof):
(JSC::FTL::DFG::LowerDFGToB3::isRegExpObject):
(JSC::FTL::DFG::LowerDFGToB3::isType):

  • runtime/Intrinsic.h:
  • Added IsRegExpObjectIntrinsic.
  • runtime/CommonIdentifiers.h:
  • runtime/ECMAScriptSpecInternalFunctions.cpp:

(JSC::esSpecIsConstructor):

  • Changed to use uncheckedArgument since this is only called from internal code.

(JSC::esSpecIsRegExpObject):
(JSC::esSpecIsRegExp): Deleted.

  • runtime/ECMAScriptSpecInternalFunctions.h:
  • Changed to check the object for a JSType of RegExpObjectType.
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::init):

  • Added split fast path.
  • runtime/RegExpPrototype.cpp:

(JSC::RegExpPrototype::finishCreation):
(JSC::regExpProtoFuncSearchFast):
(JSC::regExpProtoFuncSearch): Deleted.

  • runtime/RegExpPrototype.h:
  • tests/es6.yaml:
  • tests/stress/regexp-search.js:
  • Rebased test.

LayoutTests:

  • js/regress/regexp-prototype-search-observable-side-effects-expected.txt: Added.
  • js/regress/regexp-prototype-search-observable-side-effects.html: Added.
  • js/regress/regexp-prototype-search-observable-side-effects2-expected.txt: Added.
  • js/regress/regexp-prototype-search-observable-side-effects2.html: Added.
  • js/regress/script-tests/regexp-prototype-search-observable-side-effects.js: Added.
  • js/regress/script-tests/regexp-prototype-search-observable-side-effects2.js: Added.
  • js/regress/script-tests/string-prototype-search-observable-side-effects.js: Added.
  • js/regress/script-tests/string-prototype-search-observable-side-effects2.js: Added.
  • js/regress/script-tests/string-prototype-search-observable-side-effects3.js: Added.
  • js/regress/script-tests/string-prototype-search-observable-side-effects4.js: Added.
  • js/regress/string-prototype-search-observable-side-effects-expected.txt: Added.
  • js/regress/string-prototype-search-observable-side-effects.html: Added.
  • js/regress/string-prototype-search-observable-side-effects2-expected.txt: Added.
  • js/regress/string-prototype-search-observable-side-effects2.html: Added.
  • js/regress/string-prototype-search-observable-side-effects3-expected.txt: Added.
  • js/regress/string-prototype-search-observable-side-effects3.html: Added.
  • js/regress/string-prototype-search-observable-side-effects4-expected.txt: Added.
  • js/regress/string-prototype-search-observable-side-effects4.html: Added.
Location:
trunk
Files:
18 added
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r199744 r199748  
     12016-04-19  Mark Lam  <mark.lam@apple.com>
     2
     3        Re-landing: ES6: Implement RegExp.prototype[@@search].
     4        https://bugs.webkit.org/show_bug.cgi?id=156331
     5
     6        Reviewed by Keith Miller.
     7
     8        * js/regress/regexp-prototype-search-observable-side-effects-expected.txt: Added.
     9        * js/regress/regexp-prototype-search-observable-side-effects.html: Added.
     10        * js/regress/regexp-prototype-search-observable-side-effects2-expected.txt: Added.
     11        * js/regress/regexp-prototype-search-observable-side-effects2.html: Added.
     12
     13        * js/regress/script-tests/regexp-prototype-search-observable-side-effects.js: Added.
     14        * js/regress/script-tests/regexp-prototype-search-observable-side-effects2.js: Added.
     15
     16        * js/regress/script-tests/string-prototype-search-observable-side-effects.js: Added.
     17        * js/regress/script-tests/string-prototype-search-observable-side-effects2.js: Added.
     18        * js/regress/script-tests/string-prototype-search-observable-side-effects3.js: Added.
     19        * js/regress/script-tests/string-prototype-search-observable-side-effects4.js: Added.
     20
     21        * js/regress/string-prototype-search-observable-side-effects-expected.txt: Added.
     22        * js/regress/string-prototype-search-observable-side-effects.html: Added.
     23        * js/regress/string-prototype-search-observable-side-effects2-expected.txt: Added.
     24        * js/regress/string-prototype-search-observable-side-effects2.html: Added.
     25        * js/regress/string-prototype-search-observable-side-effects3-expected.txt: Added.
     26        * js/regress/string-prototype-search-observable-side-effects3.html: Added.
     27        * js/regress/string-prototype-search-observable-side-effects4-expected.txt: Added.
     28        * js/regress/string-prototype-search-observable-side-effects4.html: Added.
     29
    1302016-04-19  Alex Christensen  <achristensen@webkit.org>
    231
  • trunk/Source/JavaScriptCore/ChangeLog

    r199745 r199748  
     12016-04-19  Mark Lam  <mark.lam@apple.com>
     2
     3        Re-landing: ES6: Implement RegExp.prototype[@@search].
     4        https://bugs.webkit.org/show_bug.cgi?id=156331
     5
     6        Reviewed by Keith Miller.
     7
     8        What changed?
     9        1. Implemented search builtin in RegExpPrototype.js.
     10           The native path is now used as a fast path.
     11        2. Added DFG support for an IsRegExpObjectIntrinsic (modelled after the
     12           IsJSArrayIntrinsic).
     13        3. Renamed @isRegExp to @isRegExpObject to match the new IsRegExpObjectIntrinsic.
     14        4. Change the esSpecIsRegExpObject() implementation to check if the object's
     15           JSType is RegExpObjectType instead of walking the classinfo chain.
     16
     17        * builtins/RegExpPrototype.js:
     18        (search):
     19        * builtins/StringPrototype.js:
     20        (search):
     21        - fixed some indentation.
     22
     23        * dfg/DFGAbstractInterpreterInlines.h:
     24        (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
     25        * dfg/DFGByteCodeParser.cpp:
     26        (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
     27        * dfg/DFGClobberize.h:
     28        (JSC::DFG::clobberize):
     29        * dfg/DFGDoesGC.cpp:
     30        (JSC::DFG::doesGC):
     31        * dfg/DFGFixupPhase.cpp:
     32        (JSC::DFG::FixupPhase::fixupNode):
     33        * dfg/DFGNodeType.h:
     34        * dfg/DFGPredictionPropagationPhase.cpp:
     35        (JSC::DFG::PredictionPropagationPhase::propagate):
     36        * dfg/DFGSafeToExecute.h:
     37        (JSC::DFG::safeToExecute):
     38        * dfg/DFGSpeculativeJIT.cpp:
     39        (JSC::DFG::SpeculativeJIT::compileIsArrayConstructor):
     40        (JSC::DFG::SpeculativeJIT::compileIsRegExpObject):
     41        (JSC::DFG::SpeculativeJIT::compileCallObjectConstructor):
     42        * dfg/DFGSpeculativeJIT.h:
     43        * dfg/DFGSpeculativeJIT32_64.cpp:
     44        (JSC::DFG::SpeculativeJIT::compile):
     45        * dfg/DFGSpeculativeJIT64.cpp:
     46        (JSC::DFG::SpeculativeJIT::compile):
     47        * ftl/FTLCapabilities.cpp:
     48        (JSC::FTL::canCompile):
     49        * ftl/FTLLowerDFGToB3.cpp:
     50        (JSC::FTL::DFG::LowerDFGToB3::compileNode):
     51        (JSC::FTL::DFG::LowerDFGToB3::compileIsFunction):
     52        (JSC::FTL::DFG::LowerDFGToB3::compileIsRegExpObject):
     53        (JSC::FTL::DFG::LowerDFGToB3::compileTypeOf):
     54        (JSC::FTL::DFG::LowerDFGToB3::isExoticForTypeof):
     55        (JSC::FTL::DFG::LowerDFGToB3::isRegExpObject):
     56        (JSC::FTL::DFG::LowerDFGToB3::isType):
     57        * runtime/Intrinsic.h:
     58        - Added IsRegExpObjectIntrinsic.
     59
     60        * runtime/CommonIdentifiers.h:
     61
     62        * runtime/ECMAScriptSpecInternalFunctions.cpp:
     63        (JSC::esSpecIsConstructor):
     64        - Changed to use uncheckedArgument since this is only called from internal code.
     65        (JSC::esSpecIsRegExpObject):
     66        (JSC::esSpecIsRegExp): Deleted.
     67        * runtime/ECMAScriptSpecInternalFunctions.h:
     68        - Changed to check the object for a JSType of RegExpObjectType.
     69
     70        * runtime/JSGlobalObject.cpp:
     71        (JSC::JSGlobalObject::init):
     72        - Added split fast path.
     73
     74        * runtime/RegExpPrototype.cpp:
     75        (JSC::RegExpPrototype::finishCreation):
     76        (JSC::regExpProtoFuncSearchFast):
     77        (JSC::regExpProtoFuncSearch): Deleted.
     78        * runtime/RegExpPrototype.h:
     79
     80        * tests/es6.yaml:
     81        * tests/stress/regexp-search.js:
     82        - Rebased test.
     83
    1842016-04-19  Mark Lam  <mark.lam@apple.com>
    285
  • trunk/Source/JavaScriptCore/builtins/RegExpPrototype.js

    r199731 r199748  
    109109}
    110110
     111// 21.2.5.9 RegExp.prototype[@@search] (string)
     112function search(strArg)
     113{
     114    "use strict";
     115
     116    let regexp = this;
     117
     118    // Check for observable side effects and call the fast path if there aren't any.
     119    if (@isRegExpObject(regexp) && @tryGetById(regexp, "exec") === @RegExp.prototype.@exec)
     120        return @regExpSearchFast.@call(regexp, strArg);
     121
     122    // 1. Let rx be the this value.
     123    // 2. If Type(rx) is not Object, throw a TypeError exception.
     124    if (!@isObject(this))
     125        throw new @TypeError("RegExp.prototype.@@search requires that |this| be an Object");
     126
     127    // 3. Let S be ? ToString(string).
     128    let str = @toString(strArg)
     129
     130    // 4. Let previousLastIndex be ? Get(rx, "lastIndex").
     131    let previousLastIndex = regexp.lastIndex;
     132    // 5. Perform ? Set(rx, "lastIndex", 0, true).
     133    regexp.lastIndex = 0;
     134    // 6. Let result be ? RegExpExec(rx, S).
     135    let result = @regExpExec(regexp, str);
     136    // 7. Perform ? Set(rx, "lastIndex", previousLastIndex, true).
     137    regexp.lastIndex = previousLastIndex;
     138    // 8. If result is null, return -1.
     139    if (result === null)
     140        return -1;
     141    // 9. Return ? Get(result, "index").
     142    return result.index;
     143}
     144
    111145function hasObservableSideEffectsForRegExpSplit(regexp) {
    112146    // This is accessed by the RegExpExec internal function.
     
    142176        return true;
    143177   
    144     return !@isRegExp(regexp);
     178    return !@isRegExpObject(regexp);
    145179}
    146180
  • trunk/Source/JavaScriptCore/builtins/StringPrototype.js

    r199731 r199748  
    5858
    5959    if (regexp != null) {
    60          var searcher = regexp[@symbolSearch];
    61          if (searcher != @undefined)
     60        var searcher = regexp[@symbolSearch];
     61        if (searcher != @undefined)
    6262            return searcher.@call(regexp, this);
    6363    }
  • trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h

    r199724 r199748  
    989989    case IsObject:
    990990    case IsObjectOrNull:
    991     case IsFunction: {
     991    case IsFunction:
     992    case IsRegExpObject: {
    992993        AbstractValue child = forNode(node->child1());
    993994        if (child.value()) {
     
    10641065                    setConstant(node, jsBoolean(false));
    10651066                break;
     1067            case IsRegExpObject:
     1068                setConstant(node, jsBoolean(child.value().isObject() && child.value().getObject()->type() == RegExpObjectType));
     1069                break;
    10661070            default:
    10671071                constantWasSet = false;
     
    12061210            }
    12071211            break;
     1212
     1213        case IsRegExpObject:
     1214            // We don't have a SpeculatedType for Proxies yet so we can't do better at proving false.
     1215            if (!(child.m_type & ~SpecRegExpObject)) {
     1216                setConstant(node, jsBoolean(true));
     1217                constantWasSet = true;
     1218                break;
     1219            }
     1220            if (!(child.m_type & SpecObject)) {
     1221                setConstant(node, jsBoolean(false));
     1222                constantWasSet = true;
     1223                break;
     1224            }
     1225            break;
     1226
    12081227        default:
    12091228            break;
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r199724 r199748  
    22422242        set(VirtualRegister(resultOperand), regExpExec);
    22432243       
     2244        return true;
     2245    }
     2246
     2247    case IsRegExpObjectIntrinsic: {
     2248        ASSERT(argumentCountIncludingThis == 2);
     2249
     2250        insertChecks();
     2251        Node* isRegExpObject = addToGraph(IsRegExpObject, OpInfo(prediction), get(virtualRegisterForArgument(1, registerOffset)));
     2252        set(VirtualRegister(resultOperand), isRegExpObject);
    22442253        return true;
    22452254    }
  • trunk/Source/JavaScriptCore/dfg/DFGClobberize.h

    r199724 r199748  
    161161    case IsString:
    162162    case IsObject:
     163    case IsRegExpObject:
    163164    case LogicalNot:
    164165    case CheckInBounds:
  • trunk/Source/JavaScriptCore/dfg/DFGDoesGC.cpp

    r199724 r199748  
    164164    case IsObjectOrNull:
    165165    case IsFunction:
     166    case IsRegExpObject:
    166167    case TypeOf:
    167168    case LogicalNot:
  • trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp

    r199724 r199748  
    15311531        case IsObjectOrNull:
    15321532        case IsFunction:
     1533        case IsRegExpObject:
    15331534        case CreateDirectArguments:
    15341535        case CreateClonedArguments:
  • trunk/Source/JavaScriptCore/dfg/DFGNodeType.h

    r199724 r199748  
    314314    macro(IsObjectOrNull, NodeResultBoolean) \
    315315    macro(IsFunction, NodeResultBoolean) \
     316    macro(IsRegExpObject, NodeResultBoolean) \
    316317    macro(TypeOf, NodeResultJS) \
    317318    macro(LogicalNot, NodeResultBoolean) \
  • trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp

    r199724 r199748  
    438438        case IsObject:
    439439        case IsObjectOrNull:
    440         case IsFunction: {
     440        case IsFunction:
     441        case IsRegExpObject: {
    441442            changed |= setPrediction(SpecBoolean);
    442443            break;
  • trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h

    r199724 r199748  
    264264    case IsObjectOrNull:
    265265    case IsFunction:
     266    case IsRegExpObject:
    266267    case TypeOf:
    267268    case LogicalNot:
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r199699 r199748  
    34413441    callOperation(operationIsArrayConstructor, resultGPR, valueRegs);
    34423442    unblessedBooleanResult(resultGPR, node);
     3443}
     3444
     3445void SpeculativeJIT::compileIsRegExpObject(Node* node)
     3446{
     3447    JSValueOperand value(this, node->child1());
     3448    GPRFlushedCallResult result(this);
     3449
     3450    JSValueRegs valueRegs = value.jsValueRegs();
     3451    GPRReg resultGPR = result.gpr();
     3452
     3453    JITCompiler::Jump isNotCell = m_jit.branchIfNotCell(valueRegs);
     3454
     3455    m_jit.compare8(JITCompiler::Equal,
     3456        JITCompiler::Address(valueRegs.payloadGPR(), JSCell::typeInfoTypeOffset()),
     3457        TrustedImm32(RegExpObjectType),
     3458        resultGPR);
     3459    blessBoolean(resultGPR);
     3460    JITCompiler::Jump done = m_jit.jump();
     3461
     3462    isNotCell.link(&m_jit);
     3463    moveFalseTo(resultGPR);
     3464
     3465    done.link(&m_jit);
     3466    blessedBooleanResult(resultGPR, node);
    34433467}
    34443468
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h

    r199699 r199748  
    739739    void compileIsArrayConstructor(Node*);
    740740    void compileIsArrayObject(Node*);
     741    void compileIsRegExpObject(Node*);
    741742   
    742743    void emitCall(Node*);
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp

    r199724 r199748  
    45364536        break;
    45374537    }
     4538
     4539    case IsRegExpObject: {
     4540        compileIsRegExpObject(node);
     4541        break;
     4542    }
     4543
    45384544    case TypeOf: {
    45394545        compileTypeOf(node);
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp

    r199724 r199748  
    45644564    }
    45654565
     4566    case IsRegExpObject: {
     4567        compileIsRegExpObject(node);
     4568        break;
     4569    }
     4570
    45664571    case TypeOf: {
    45674572        compileTypeOf(node);
  • trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp

    r199724 r199748  
    187187    case IsObjectOrNull:
    188188    case IsFunction:
     189    case IsRegExpObject:
    189190    case CheckTypeInfoFlags:
    190191    case OverridesHasInstance:
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r199724 r199748  
    870870        case IsFunction:
    871871            compileIsFunction();
     872            break;
     873        case IsRegExpObject:
     874            compileIsRegExpObject();
    872875            break;
    873876        case TypeOf:
     
    59265929        setBoolean(result);
    59275930    }
    5928    
     5931
     5932    void compileIsRegExpObject()
     5933    {
     5934        LValue value = lowJSValue(m_node->child1());
     5935
     5936        LBasicBlock isCellCase = m_out.newBlock();
     5937        LBasicBlock continuation = m_out.newBlock();
     5938
     5939        ValueFromBlock notCellResult = m_out.anchor(m_out.booleanFalse);
     5940        m_out.branch(
     5941            isCell(value, provenType(m_node->child1())), unsure(isCellCase), unsure(continuation));
     5942
     5943        LBasicBlock lastNext = m_out.appendTo(isCellCase, continuation);
     5944        ValueFromBlock cellResult = m_out.anchor(isRegExpObject(value, provenType(m_node->child1())));
     5945        m_out.jump(continuation);
     5946
     5947        m_out.appendTo(continuation, lastNext);
     5948        setBoolean(m_out.phi(m_out.boolean, notCellResult, cellResult));
     5949    }
     5950
    59295951    void compileTypeOf()
    59305952    {
     
    999910021            m_out.constInt32(MasqueradesAsUndefined | TypeOfShouldCallGetCallData));
    1000010022    }
    10001    
     10023
     10024    LValue isRegExpObject(LValue cell, SpeculatedType type = SpecFullTop)
     10025    {
     10026        if (LValue proven = isProvenValue(type & SpecCell, SpecRegExpObject))
     10027            return proven;
     10028        return m_out.equal(
     10029            m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoType),
     10030            m_out.constInt32(RegExpObjectType));
     10031    }
     10032
    1000210033    LValue isType(LValue cell, JSType type)
    1000310034    {
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h

    r199731 r199748  
    416416    macro(isArrayConstructor) \
    417417    macro(isConstructor) \
    418     macro(isRegExp) \
     418    macro(isRegExpObject) \
    419419    macro(concatMemcpy) \
    420420    macro(appendMemcpy) \
     
    435435    macro(regExpProtoStickyGetter) \
    436436    macro(regExpProtoUnicodeGetter) \
     437    macro(regExpSearchFast) \
    437438    macro(regExpSplitFast) \
    438439    macro(stringIncludesInternal) \
  • trunk/Source/JavaScriptCore/runtime/ECMAScriptSpecInternalFunctions.cpp

    r199731 r199748  
    3030#include "ConstructData.h"
    3131#include "JSCJSValueInlines.h"
    32 #include "ProxyObject.h"
    3332#include "RegExpObject.h"
    3433
     
    3736EncodedJSValue JSC_HOST_CALL esSpecIsConstructor(ExecState* exec)
    3837{
    39     bool isConstructor = exec->argument(0).isConstructor();
     38    bool isConstructor = exec->uncheckedArgument(0).isConstructor();
    4039    return JSValue::encode(jsBoolean(isConstructor));
    4140}
    4241
    43 EncodedJSValue JSC_HOST_CALL esSpecIsRegExp(ExecState* exec)
     42EncodedJSValue JSC_HOST_CALL esSpecIsRegExpObject(ExecState* exec)
    4443{
    45     bool isRegExp = exec->argument(0).inherits(RegExpObject::info());
    46     return JSValue::encode(jsBoolean(isRegExp));
     44    JSValue value = exec->uncheckedArgument(0);
     45    if (value.isObject())
     46        return JSValue::encode(jsBoolean(value.getObject()->type() == RegExpObjectType));
     47    return JSValue::encode(jsBoolean(false));
    4748}
    4849
  • trunk/Source/JavaScriptCore/runtime/ECMAScriptSpecInternalFunctions.h

    r199731 r199748  
    3232
    3333EncodedJSValue JSC_HOST_CALL esSpecIsConstructor(ExecState*);
    34 EncodedJSValue JSC_HOST_CALL esSpecIsRegExp(ExecState*);
     34EncodedJSValue JSC_HOST_CALL esSpecIsRegExpObject(ExecState*);
    3535
    3636} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/Intrinsic.h

    r199514 r199748  
    6161    IsArrayConstructorIntrinsic,
    6262    IsJSArrayIntrinsic,
     63    IsRegExpObjectIntrinsic,
    6364
    6465    // Getter intrinsics.
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r199731 r199748  
    635635
    636636        GlobalPropertyInfo(vm.propertyNames->isConstructorPrivateName, JSFunction::create(vm, this, 1, String(), esSpecIsConstructor, NoIntrinsic), DontEnum | DontDelete | ReadOnly),
    637         GlobalPropertyInfo(vm.propertyNames->isRegExpPrivateName, JSFunction::create(vm, this, 1, String(), esSpecIsRegExp, NoIntrinsic), DontEnum | DontDelete | ReadOnly),
     637        GlobalPropertyInfo(vm.propertyNames->isRegExpObjectPrivateName, JSFunction::create(vm, this, 1, String(), esSpecIsRegExpObject, IsRegExpObjectIntrinsic), DontEnum | DontDelete | ReadOnly),
    638638        GlobalPropertyInfo(vm.propertyNames->builtinNames().speciesConstructorPrivateName(), JSFunction::createBuiltinFunction(vm, globalObjectSpeciesConstructorCodeGenerator(vm), this), DontEnum | DontDelete | ReadOnly),
    639639
     
    651651        GlobalPropertyInfo(vm.propertyNames->builtinNames().advanceStringIndexPrivateName(), JSFunction::createBuiltinFunction(vm, regExpPrototypeAdvanceStringIndexCodeGenerator(vm), this), DontEnum | DontDelete | ReadOnly),
    652652        GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpExecPrivateName(), JSFunction::createBuiltinFunction(vm, regExpPrototypeRegExpExecCodeGenerator(vm), this), DontEnum | DontDelete | ReadOnly),
     653        GlobalPropertyInfo(vm.propertyNames->regExpSearchFastPrivateName, JSFunction::create(vm, this, 2, String(), regExpProtoFuncSearchFast), DontEnum | DontDelete | ReadOnly),
    653654        GlobalPropertyInfo(vm.propertyNames->regExpSplitFastPrivateName, JSFunction::create(vm, this, 2, String(), regExpProtoFuncSplitFast), DontEnum | DontDelete | ReadOnly),
    654655
  • trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp

    r199731 r199748  
    5050static EncodedJSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState*);
    5151static EncodedJSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState*);
    52 static EncodedJSValue JSC_HOST_CALL regExpProtoFuncSearch(ExecState*);
    5352static EncodedJSValue JSC_HOST_CALL regExpProtoGetterGlobal(ExecState*);
    5453static EncodedJSValue JSC_HOST_CALL regExpProtoGetterIgnoreCase(ExecState*);
     
    8281    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().matchPrivateName(), regExpProtoFuncMatchPrivate, DontEnum | DontDelete | ReadOnly, 1);
    8382    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->matchSymbol, regExpPrototypeMatchCodeGenerator, DontEnum);
    84     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->searchSymbol, regExpProtoFuncSearch, DontEnum, 1);
     83    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->searchSymbol, regExpPrototypeSearchCodeGenerator, DontEnum);
    8584    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->splitSymbol, regExpPrototypeSplitCodeGenerator, DontEnum);
    8685
     
    438437}
    439438
    440 EncodedJSValue JSC_HOST_CALL regExpProtoFuncSearch(ExecState* exec)
    441 {
    442     JSValue thisValue = exec->thisValue();
    443     if (!thisValue.inherits(RegExpObject::info()))
    444         return throwVMTypeError(exec);
     439EncodedJSValue JSC_HOST_CALL regExpProtoFuncSearchFast(ExecState* exec)
     440{
     441    VM& vm = exec->vm();
     442    JSValue thisValue = exec->thisValue();
    445443    RegExp* regExp = asRegExpObject(thisValue)->regExp();
    446444
    447     JSString* string = exec->argument(0).toString(exec);
     445    JSString* string = exec->uncheckedArgument(0).toString(exec);
    448446    String s = string->value(exec);
    449     if (exec->hadException())
     447    if (vm.exception())
    450448        return JSValue::encode(jsUndefined());
    451449
    452450    RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor();
    453     MatchResult result = regExpConstructor->performMatch(exec->vm(), regExp, string, s, 0);
     451    MatchResult result = regExpConstructor->performMatch(vm, regExp, string, s, 0);
    454452    return JSValue::encode(result ? jsNumber(result.start) : jsNumber(-1));
    455453}
  • trunk/Source/JavaScriptCore/runtime/RegExpPrototype.h

    r199731 r199748  
    5959};
    6060
     61EncodedJSValue JSC_HOST_CALL regExpProtoFuncSearchFast(ExecState*);
    6162EncodedJSValue JSC_HOST_CALL regExpProtoFuncSplitFast(ExecState*);
    6263
  • trunk/Source/JavaScriptCore/tests/es6.yaml

    r199731 r199748  
    10061006  cmd: runES6 :fail
    10071007- path: es6/Proxy_internal_get_calls_RegExp.prototype[Symbol.search].js
    1008   cmd: runES6 :fail
     1008  cmd: runES6 :normal
    10091009- path: es6/Proxy_internal_get_calls_RegExp.prototype[Symbol.split].js
    10101010  cmd: runES6 :normal
  • trunk/Source/JavaScriptCore/tests/stress/regexp-search.js

    r199514 r199748  
    6060    shouldThrow(function () {
    6161        RegExp.prototype[Symbol.search].call(primitive)
    62     }, 'TypeError: Type error');
     62    }, 'TypeError: RegExp.prototype.@@search requires that |this| be an Object');
    6363}
    6464
Note: See TracChangeset for help on using the changeset viewer.