Changeset 199511 in webkit


Ignore:
Timestamp:
Apr 13, 2016 1:00:31 PM (8 years ago)
Author:
mark.lam@apple.com
Message:

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

    r199510 r199511  
     12016-04-13  Mark Lam  <mark.lam@apple.com>
     2
     3        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-13  Jiewen Tan  <jiewen_tan@apple.com>
    231
  • trunk/Source/JavaScriptCore/ChangeLog

    r199508 r199511  
     12016-04-13  Mark Lam  <mark.lam@apple.com>
     2
     3        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-12  Filip Pizlo  <fpizlo@apple.com>
    285
  • trunk/Source/JavaScriptCore/builtins/RegExpPrototype.js

    r199502 r199511  
    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

    r199502 r199511  
    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

    r199397 r199511  
    975975    case IsObject:
    976976    case IsObjectOrNull:
    977     case IsFunction: {
     977    case IsFunction:
     978    case IsRegExpObject: {
    978979        AbstractValue child = forNode(node->child1());
    979980        if (child.value()) {
     
    10501051                    setConstant(node, jsBoolean(false));
    10511052                break;
     1053            case IsRegExpObject:
     1054                setConstant(node, jsBoolean(child.value().isObject() && child.value().getObject()->type() == RegExpObjectType));
     1055                break;
    10521056            default:
    10531057                constantWasSet = false;
     
    11921196            }
    11931197            break;
     1198
     1199        case IsRegExpObject:
     1200            // We don't have a SpeculatedType for Proxies yet so we can't do better at proving false.
     1201            if (!(child.m_type & ~SpecRegExpObject)) {
     1202                setConstant(node, jsBoolean(true));
     1203                constantWasSet = true;
     1204                break;
     1205            }
     1206            if (!(child.m_type & SpecObject)) {
     1207                setConstant(node, jsBoolean(false));
     1208                constantWasSet = true;
     1209                break;
     1210            }
     1211            break;
     1212
    11941213        default:
    11951214            break;
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r199397 r199511  
    22402240        set(VirtualRegister(resultOperand), regExpExec);
    22412241       
     2242        return true;
     2243    }
     2244
     2245    case IsRegExpObjectIntrinsic: {
     2246        ASSERT(argumentCountIncludingThis == 2);
     2247
     2248        insertChecks();
     2249        Node* isRegExpObject = addToGraph(IsRegExpObject, OpInfo(prediction), get(virtualRegisterForArgument(1, registerOffset)));
     2250        set(VirtualRegister(resultOperand), isRegExpObject);
    22422251        return true;
    22432252    }
  • trunk/Source/JavaScriptCore/dfg/DFGClobberize.h

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

    r199397 r199511  
    163163    case IsObjectOrNull:
    164164    case IsFunction:
     165    case IsRegExpObject:
    165166    case TypeOf:
    166167    case LogicalNot:
  • trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp

    r199397 r199511  
    15111511        case IsObjectOrNull:
    15121512        case IsFunction:
     1513        case IsRegExpObject:
    15131514        case CreateDirectArguments:
    15141515        case CreateClonedArguments:
  • trunk/Source/JavaScriptCore/dfg/DFGNodeType.h

    r199397 r199511  
    310310    macro(IsObjectOrNull, NodeResultBoolean) \
    311311    macro(IsFunction, NodeResultBoolean) \
     312    macro(IsRegExpObject, NodeResultBoolean) \
    312313    macro(TypeOf, NodeResultJS) \
    313314    macro(LogicalNot, NodeResultBoolean) \
  • trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp

    r199397 r199511  
    432432        case IsObject:
    433433        case IsObjectOrNull:
    434         case IsFunction: {
     434        case IsFunction:
     435        case IsRegExpObject: {
    435436            changed |= setPrediction(SpecBoolean);
    436437            break;
  • trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h

    r199397 r199511  
    263263    case IsObjectOrNull:
    264264    case IsFunction:
     265    case IsRegExpObject:
    265266    case TypeOf:
    266267    case LogicalNot:
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r199397 r199511  
    34243424    callOperation(operationIsArrayConstructor, resultGPR, valueRegs);
    34253425    unblessedBooleanResult(resultGPR, node);
     3426}
     3427
     3428void SpeculativeJIT::compileIsRegExpObject(Node* node)
     3429{
     3430    JSValueOperand value(this, node->child1());
     3431    GPRFlushedCallResult result(this);
     3432
     3433    JSValueRegs valueRegs = value.jsValueRegs();
     3434    GPRReg resultGPR = result.gpr();
     3435
     3436    JITCompiler::Jump isNotCell = m_jit.branchIfNotCell(valueRegs);
     3437
     3438    m_jit.compare8(JITCompiler::Equal,
     3439        JITCompiler::Address(valueRegs.payloadGPR(), JSCell::typeInfoTypeOffset()),
     3440        TrustedImm32(RegExpObjectType),
     3441        resultGPR);
     3442    blessBoolean(resultGPR);
     3443    JITCompiler::Jump done = m_jit.jump();
     3444
     3445    isNotCell.link(&m_jit);
     3446    moveFalseTo(resultGPR);
     3447
     3448    done.link(&m_jit);
     3449    blessedBooleanResult(resultGPR, node);
    34263450}
    34273451
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h

    r199397 r199511  
    738738    void compileIsArrayConstructor(Node*);
    739739    void compileIsArrayObject(Node*);
     740    void compileIsRegExpObject(Node*);
    740741   
    741742    void emitCall(Node*);
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp

    r199397 r199511  
    45304530        break;
    45314531    }
     4532
     4533    case IsRegExpObject: {
     4534        compileIsRegExpObject(node);
     4535        break;
     4536    }
     4537
    45324538    case TypeOf: {
    45334539        compileTypeOf(node);
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp

    r199397 r199511  
    45434543    }
    45444544
     4545    case IsRegExpObject: {
     4546        compileIsRegExpObject(node);
     4547        break;
     4548    }
     4549
    45454550    case TypeOf: {
    45464551        compileTypeOf(node);
  • trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp

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

    r199397 r199511  
    870870        case IsFunction:
    871871            compileIsFunction();
     872            break;
     873        case IsRegExpObject:
     874            compileIsRegExpObject();
    872875            break;
    873876        case TypeOf:
     
    59035906        setBoolean(result);
    59045907    }
    5905    
     5908
     5909    void compileIsRegExpObject()
     5910    {
     5911        LValue value = lowJSValue(m_node->child1());
     5912
     5913        LBasicBlock isCellCase = m_out.newBlock();
     5914        LBasicBlock continuation = m_out.newBlock();
     5915
     5916        ValueFromBlock notCellResult = m_out.anchor(m_out.booleanFalse);
     5917        m_out.branch(
     5918            isCell(value, provenType(m_node->child1())), unsure(isCellCase), unsure(continuation));
     5919
     5920        LBasicBlock lastNext = m_out.appendTo(isCellCase, continuation);
     5921        ValueFromBlock cellResult = m_out.anchor(isRegExpObject(value, provenType(m_node->child1())));
     5922        m_out.jump(continuation);
     5923
     5924        m_out.appendTo(continuation, lastNext);
     5925        setBoolean(m_out.phi(m_out.boolean, notCellResult, cellResult));
     5926    }
     5927
    59065928    void compileTypeOf()
    59075929    {
     
    99519973            m_out.constInt32(MasqueradesAsUndefined | TypeOfShouldCallGetCallData));
    99529974    }
    9953    
     9975
     9976    LValue isRegExpObject(LValue cell, SpeculatedType type = SpecFullTop)
     9977    {
     9978        if (LValue proven = isProvenValue(type & SpecCell, SpecRegExpObject))
     9979            return proven;
     9980        return m_out.equal(
     9981            m_out.load8ZeroExt32(cell, m_heaps.JSCell_typeInfoType),
     9982            m_out.constInt32(RegExpObjectType));
     9983    }
     9984
    99549985    LValue isType(LValue cell, JSType type)
    99559986    {
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h

    r199502 r199511  
    415415    macro(isArrayConstructor) \
    416416    macro(isConstructor) \
    417     macro(isRegExp) \
     417    macro(isRegExpObject) \
    418418    macro(concatMemcpy) \
    419419    macro(appendMemcpy) \
     
    434434    macro(regExpProtoStickyGetter) \
    435435    macro(regExpProtoUnicodeGetter) \
     436    macro(regExpSearchFast) \
    436437    macro(regExpSplitFast) \
    437438    macro(stringIncludesInternal) \
  • trunk/Source/JavaScriptCore/runtime/ECMAScriptSpecInternalFunctions.cpp

    r199502 r199511  
    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

    r199502 r199511  
    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

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

    r199502 r199511  
    633633
    634634        GlobalPropertyInfo(vm.propertyNames->isConstructorPrivateName, JSFunction::create(vm, this, 1, String(), esSpecIsConstructor, NoIntrinsic), DontEnum | DontDelete | ReadOnly),
    635         GlobalPropertyInfo(vm.propertyNames->isRegExpPrivateName, JSFunction::create(vm, this, 1, String(), esSpecIsRegExp, NoIntrinsic), DontEnum | DontDelete | ReadOnly),
     635        GlobalPropertyInfo(vm.propertyNames->isRegExpObjectPrivateName, JSFunction::create(vm, this, 1, String(), esSpecIsRegExpObject, IsRegExpObjectIntrinsic), DontEnum | DontDelete | ReadOnly),
    636636        GlobalPropertyInfo(vm.propertyNames->builtinNames().speciesConstructorPrivateName(), JSFunction::createBuiltinFunction(vm, globalObjectSpeciesConstructorCodeGenerator(vm), this), DontEnum | DontDelete | ReadOnly),
    637637
     
    649649        GlobalPropertyInfo(vm.propertyNames->builtinNames().advanceStringIndexPrivateName(), JSFunction::createBuiltinFunction(vm, regExpPrototypeAdvanceStringIndexCodeGenerator(vm), this), DontEnum | DontDelete | ReadOnly),
    650650        GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpExecPrivateName(), JSFunction::createBuiltinFunction(vm, regExpPrototypeRegExpExecCodeGenerator(vm), this), DontEnum | DontDelete | ReadOnly),
     651        GlobalPropertyInfo(vm.propertyNames->regExpSearchFastPrivateName, JSFunction::create(vm, this, 2, String(), regExpProtoFuncSearchFast), DontEnum | DontDelete | ReadOnly),
    651652        GlobalPropertyInfo(vm.propertyNames->regExpSplitFastPrivateName, JSFunction::create(vm, this, 2, String(), regExpProtoFuncSplitFast), DontEnum | DontDelete | ReadOnly),
    652653
  • trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp

    r199502 r199511  
    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
     
    420419}
    421420
    422 EncodedJSValue JSC_HOST_CALL regExpProtoFuncSearch(ExecState* exec)
    423 {
    424     JSValue thisValue = exec->thisValue();
    425     if (!thisValue.inherits(RegExpObject::info()))
    426         return throwVMTypeError(exec);
     421EncodedJSValue JSC_HOST_CALL regExpProtoFuncSearchFast(ExecState* exec)
     422{
     423    VM& vm = exec->vm();
     424    JSValue thisValue = exec->thisValue();
    427425    RegExp* regExp = asRegExpObject(thisValue)->regExp();
    428426
    429     JSString* string = exec->argument(0).toString(exec);
     427    JSString* string = exec->uncheckedArgument(0).toString(exec);
    430428    String s = string->value(exec);
    431     if (exec->hadException())
     429    if (vm.exception())
    432430        return JSValue::encode(jsUndefined());
    433431
    434432    RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor();
    435     MatchResult result = regExpConstructor->performMatch(exec->vm(), regExp, string, s, 0);
     433    MatchResult result = regExpConstructor->performMatch(vm, regExp, string, s, 0);
    436434    return JSValue::encode(result ? jsNumber(result.start) : jsNumber(-1));
    437435}
  • trunk/Source/JavaScriptCore/runtime/RegExpPrototype.h

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

    r199502 r199511  
    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

    r196498 r199511  
    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.