Changeset 246567 in webkit


Ignore:
Timestamp:
Jun 18, 2019 2:21:48 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

[ESNExt] String.prototype.matchAll
https://bugs.webkit.org/show_bug.cgi?id=186694

Patch by Alexey Shvayka <Alexey Shvayka> on 2019-06-18
Reviewed by Yusuke Suzuki.

Implement String.prototype.matchAll.
(https://tc39.es/ecma262/#sec-string.prototype.matchall)

JSTests:

  • test262/config.yaml:

Source/JavaScriptCore:

Also rename @globalPrivate @constructor functions and C++ variables holding them.

Shipping in Chrome since version 73.
Shipping in Firefox since version 67.

  • CMakeLists.txt:
  • DerivedSources-input.xcfilelist:
  • DerivedSources.make:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • Scripts/wkbuiltins/builtins_generate_combined_header.py:

(get_var_name):
(generate_section_for_global_private_code_name_macro):

  • Sources.txt:
  • builtins/ArrayPrototype.js:

(globalPrivate.ArrayIterator):
(values):
(keys):
(entries):
(globalPrivate.createArrayIterator): Deleted.

  • builtins/AsyncFromSyncIteratorPrototype.js:

(globalPrivate.createAsyncFromSyncIterator):
(globalPrivate.AsyncFromSyncIterator):
(globalPrivate.AsyncFromSyncIteratorConstructor): Deleted.

  • builtins/BuiltinNames.h:
  • builtins/MapPrototype.js:

(globalPrivate.MapIterator):
(values):
(keys):
(entries):
(globalPrivate.createMapIterator): Deleted.

  • builtins/RegExpPrototype.js:

(globalPrivate.RegExpStringIterator):
(overriddenName.string_appeared_here.matchAll):

  • builtins/RegExpStringIteratorPrototype.js: Added.

(next):

  • builtins/SetPrototype.js:

(globalPrivate.SetIterator):
(values):
(entries):
(globalPrivate.createSetIterator): Deleted.

  • builtins/StringPrototype.js:

(matchAll):

  • builtins/TypedArrayPrototype.js:

(values):
(keys):
(entries):

  • runtime/CommonIdentifiers.h:
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::init):

  • runtime/RegExpPrototype.cpp:

(JSC::RegExpPrototype::finishCreation):

  • runtime/RegExpStringIteratorPrototype.cpp: Added.

(JSC::RegExpStringIteratorPrototype::finishCreation):

  • runtime/RegExpStringIteratorPrototype.h: Added.
  • runtime/StringPrototype.cpp:

LayoutTests:

  • js/Object-getOwnPropertyNames-expected.txt:
  • js/script-tests/Object-getOwnPropertyNames.js:
Location:
trunk
Files:
3 added
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r246553 r246567  
     12019-06-18  Alexey Shvayka  <shvaikalesh@gmail.com>
     2
     3        [ESNExt] String.prototype.matchAll
     4        https://bugs.webkit.org/show_bug.cgi?id=186694
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        Implement String.prototype.matchAll.
     9        (https://tc39.es/ecma262/#sec-string.prototype.matchall)
     10
     11        * test262/config.yaml:
     12
    1132019-06-18  Tadeu Zagallo  <tzagallo@apple.com>
    214
  • trunk/JSTests/test262/config.yaml

    r245869 r246567  
    1313    # https://bugs.webkit.org/show_bug.cgi?id=166693
    1414    - async-iteration
    15     # https://bugs.webkit.org/show_bug.cgi?id=186694
    16     - String.prototype.matchAll
    17     - Symbol.matchAll
    1815    # https://bugs.webkit.org/show_bug.cgi?id=174931
    1916    - regexp-lookbehind
  • trunk/LayoutTests/ChangeLog

    r246565 r246567  
     12019-06-18  Alexey Shvayka  <shvaikalesh@gmail.com>
     2
     3        [ESNExt] String.prototype.matchAll
     4        https://bugs.webkit.org/show_bug.cgi?id=186694
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        Implement String.prototype.matchAll.
     9        (https://tc39.es/ecma262/#sec-string.prototype.matchall)
     10
     11        * js/Object-getOwnPropertyNames-expected.txt:
     12        * js/script-tests/Object-getOwnPropertyNames.js:
     13
    1142019-06-18  Keith Miller  <keith_miller@apple.com>
    215
  • trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt

    r235589 r246567  
    5050PASS getSortedOwnPropertyNames(Array.prototype) is ['concat', 'constructor', 'copyWithin', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'flat', 'flatMap', 'forEach', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift', 'values']
    5151PASS getSortedOwnPropertyNames(String) is ['fromCharCode', 'fromCodePoint', 'length', 'name', 'prototype', 'raw']
    52 PASS getSortedOwnPropertyNames(String.prototype) is ['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'codePointAt', 'concat', 'constructor', 'endsWith', 'fixed', 'fontcolor', 'fontsize', 'includes', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'normalize', 'padEnd', 'padStart', 'repeat', 'replace', 'search', 'slice', 'small', 'split', 'startsWith', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimEnd', 'trimLeft', 'trimRight', 'trimStart', 'valueOf']
     52PASS getSortedOwnPropertyNames(String.prototype) is ['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'codePointAt', 'concat', 'constructor', 'endsWith', 'fixed', 'fontcolor', 'fontsize', 'includes', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'matchAll', 'normalize', 'padEnd', 'padStart', 'repeat', 'replace', 'search', 'slice', 'small', 'split', 'startsWith', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimEnd', 'trimLeft', 'trimRight', 'trimStart', 'valueOf']
    5353PASS getSortedOwnPropertyNames(Boolean) is ['length', 'name', 'prototype']
    5454PASS getSortedOwnPropertyNames(Boolean.prototype) is ['constructor', 'toString', 'valueOf']
     
    6363PASS getSortedOwnPropertyNames(Math) is ['E','LN10','LN2','LOG10E','LOG2E','PI','SQRT1_2','SQRT2','abs','acos','acosh','asin','asinh','atan','atan2','atanh','cbrt','ceil','clz32','cos','cosh','exp','expm1','floor','fround','hypot','imul','log','log10','log1p','log2','max','min','pow','random','round','sign','sin','sinh','sqrt','tan','tanh','trunc']
    6464PASS getSortedOwnPropertyNames(JSON) is ['parse', 'stringify']
    65 PASS getSortedOwnPropertyNames(Symbol) is ['asyncIterator','for', 'hasInstance', 'isConcatSpreadable', 'iterator', 'keyFor', 'length', 'match', 'name', 'prototype', 'replace', 'search', 'species', 'split', 'toPrimitive', 'toStringTag', 'unscopables']
     65PASS getSortedOwnPropertyNames(Symbol) is ['asyncIterator','for', 'hasInstance', 'isConcatSpreadable', 'iterator', 'keyFor', 'length', 'match', 'matchAll', 'name', 'prototype', 'replace', 'search', 'species', 'split', 'toPrimitive', 'toStringTag', 'unscopables']
    6666PASS getSortedOwnPropertyNames(Symbol.prototype) is ['constructor', 'description', 'toString', 'valueOf']
    6767PASS getSortedOwnPropertyNames(Map) is ['length', 'name', 'prototype']
  • trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js

    r235589 r246567  
    5959    "Array.prototype": "['concat', 'constructor', 'copyWithin', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'flat', 'flatMap', 'forEach', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift', 'values']",
    6060    "String": "['fromCharCode', 'fromCodePoint', 'length', 'name', 'prototype', 'raw']",
    61     "String.prototype": "['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'codePointAt', 'concat', 'constructor', 'endsWith', 'fixed', 'fontcolor', 'fontsize', 'includes', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'normalize', 'padEnd', 'padStart', 'repeat', 'replace', 'search', 'slice', 'small', 'split', 'startsWith', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimEnd', 'trimLeft', 'trimRight', 'trimStart', 'valueOf']",
     61    "String.prototype": "['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'codePointAt', 'concat', 'constructor', 'endsWith', 'fixed', 'fontcolor', 'fontsize', 'includes', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'matchAll', 'normalize', 'padEnd', 'padStart', 'repeat', 'replace', 'search', 'slice', 'small', 'split', 'startsWith', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimEnd', 'trimLeft', 'trimRight', 'trimStart', 'valueOf']",
    6262    "Boolean": "['length', 'name', 'prototype']",
    6363    "Boolean.prototype": "['constructor', 'toString', 'valueOf']",
     
    7272    "Math": "['E','LN10','LN2','LOG10E','LOG2E','PI','SQRT1_2','SQRT2','abs','acos','acosh','asin','asinh','atan','atan2','atanh','cbrt','ceil','clz32','cos','cosh','exp','expm1','floor','fround','hypot','imul','log','log10','log1p','log2','max','min','pow','random','round','sign','sin','sinh','sqrt','tan','tanh','trunc']",
    7373    "JSON": "['parse', 'stringify']",
    74     "Symbol": "['asyncIterator','for', 'hasInstance', 'isConcatSpreadable', 'iterator', 'keyFor', 'length', 'match', 'name', 'prototype', 'replace', 'search', 'species', 'split', 'toPrimitive', 'toStringTag', 'unscopables']",
     74    "Symbol": "['asyncIterator','for', 'hasInstance', 'isConcatSpreadable', 'iterator', 'keyFor', 'length', 'match', 'matchAll', 'name', 'prototype', 'replace', 'search', 'species', 'split', 'toPrimitive', 'toStringTag', 'unscopables']",
    7575    "Symbol.prototype": "['constructor', 'description', 'toString', 'valueOf']",
    7676    "Map": "['length', 'name', 'prototype']",
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r246126 r246567  
    8989    runtime/RegExpConstructor.cpp
    9090    runtime/RegExpPrototype.cpp
     91    runtime/RegExpStringIteratorPrototype.cpp
    9192    runtime/SetPrototype.cpp
    9293    runtime/StringConstructor.cpp
     
    932933    runtime/RegExpKey.h
    933934    runtime/RegExpObject.h
     935    runtime/RegExpStringIteratorPrototype.h
    934936    runtime/RuntimeFlags.h
    935937    runtime/RuntimeType.h
     
    12051207    ${JAVASCRIPTCORE_DIR}/builtins/ReflectObject.js
    12061208    ${JAVASCRIPTCORE_DIR}/builtins/RegExpPrototype.js
     1209    ${JAVASCRIPTCORE_DIR}/builtins/RegExpStringIteratorPrototype.js
    12071210    ${JAVASCRIPTCORE_DIR}/builtins/SetIteratorPrototype.js
    12081211    ${JAVASCRIPTCORE_DIR}/builtins/SetPrototype.js
  • trunk/Source/JavaScriptCore/ChangeLog

    r246565 r246567  
     12019-06-18  Alexey Shvayka  <shvaikalesh@gmail.com>
     2
     3        [ESNExt] String.prototype.matchAll
     4        https://bugs.webkit.org/show_bug.cgi?id=186694
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        Implement String.prototype.matchAll.
     9        (https://tc39.es/ecma262/#sec-string.prototype.matchall)
     10
     11        Also rename @globalPrivate @constructor functions and C++ variables holding them.
     12
     13        Shipping in Chrome since version 73.
     14        Shipping in Firefox since version 67.
     15
     16        * CMakeLists.txt:
     17        * DerivedSources-input.xcfilelist:
     18        * DerivedSources.make:
     19        * JavaScriptCore.xcodeproj/project.pbxproj:
     20        * Scripts/wkbuiltins/builtins_generate_combined_header.py:
     21        (get_var_name):
     22        (generate_section_for_global_private_code_name_macro):
     23        * Sources.txt:
     24        * builtins/ArrayPrototype.js:
     25        (globalPrivate.ArrayIterator):
     26        (values):
     27        (keys):
     28        (entries):
     29        (globalPrivate.createArrayIterator): Deleted.
     30        * builtins/AsyncFromSyncIteratorPrototype.js:
     31        (globalPrivate.createAsyncFromSyncIterator):
     32        (globalPrivate.AsyncFromSyncIterator):
     33        (globalPrivate.AsyncFromSyncIteratorConstructor): Deleted.
     34        * builtins/BuiltinNames.h:
     35        * builtins/MapPrototype.js:
     36        (globalPrivate.MapIterator):
     37        (values):
     38        (keys):
     39        (entries):
     40        (globalPrivate.createMapIterator): Deleted.
     41        * builtins/RegExpPrototype.js:
     42        (globalPrivate.RegExpStringIterator):
     43        (overriddenName.string_appeared_here.matchAll):
     44        * builtins/RegExpStringIteratorPrototype.js: Added.
     45        (next):
     46        * builtins/SetPrototype.js:
     47        (globalPrivate.SetIterator):
     48        (values):
     49        (entries):
     50        (globalPrivate.createSetIterator): Deleted.
     51        * builtins/StringPrototype.js:
     52        (matchAll):
     53        * builtins/TypedArrayPrototype.js:
     54        (values):
     55        (keys):
     56        (entries):
     57        * runtime/CommonIdentifiers.h:
     58        * runtime/JSGlobalObject.cpp:
     59        (JSC::JSGlobalObject::init):
     60        * runtime/RegExpPrototype.cpp:
     61        (JSC::RegExpPrototype::finishCreation):
     62        * runtime/RegExpStringIteratorPrototype.cpp: Added.
     63        (JSC::RegExpStringIteratorPrototype::finishCreation):
     64        * runtime/RegExpStringIteratorPrototype.h: Added.
     65        * runtime/StringPrototype.cpp:
     66
    1672019-06-18  Keith Miller  <keith_miller@apple.com>
    268
  • trunk/Source/JavaScriptCore/DerivedSources-input.xcfilelist

    r244100 r246567  
    5050$(PROJECT_DIR)/builtins/ReflectObject.js
    5151$(PROJECT_DIR)/builtins/RegExpPrototype.js
     52$(PROJECT_DIR)/builtins/RegExpStringIteratorPrototype.js
    5253$(PROJECT_DIR)/builtins/SetIteratorPrototype.js
    5354$(PROJECT_DIR)/builtins/SetPrototype.js
  • trunk/Source/JavaScriptCore/DerivedSources.make

    r243011 r246567  
    112112    $(JavaScriptCore)/builtins/ReflectObject.js \
    113113    $(JavaScriptCore)/builtins/RegExpPrototype.js \
     114    ${JavaScriptCore}/builtins/RegExpStringIteratorPrototype.js \
    114115    $(JavaScriptCore)/builtins/SetIteratorPrototype.js \
    115116    $(JavaScriptCore)/builtins/SetPrototype.js \
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r246565 r246567  
    39263926                7E4EE7080EBB7963005934AA /* StructureChain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StructureChain.h; sourceTree = "<group>"; };
    39273927                7E4EE70E0EBB7A5B005934AA /* StructureChain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StructureChain.cpp; sourceTree = "<group>"; };
     3928                84925A9A22B30CBA00D1DFFF /* RegExpStringIteratorPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegExpStringIteratorPrototype.cpp; sourceTree = "<group>"; };
     3929                84925A9B22B30CBA00D1DFFF /* RegExpStringIteratorPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpStringIteratorPrototype.h; sourceTree = "<group>"; };
     3930                84925A9C22B30CC800D1DFFF /* RegExpStringIteratorPrototype.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = RegExpStringIteratorPrototype.js; sourceTree = "<group>"; };
    39283931                860161DF0F3A83C100F84710 /* AbstractMacroAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AbstractMacroAssembler.h; sourceTree = "<group>"; };
    39293932                860161E00F3A83C100F84710 /* MacroAssemblerX86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerX86.h; sourceTree = "<group>"; };
     
    72607263                                BCD202BF0E1706A7002C7E82 /* RegExpPrototype.cpp */,
    72617264                                BCD202C00E1706A7002C7E82 /* RegExpPrototype.h */,
     7265                                84925A9A22B30CBA00D1DFFF /* RegExpStringIteratorPrototype.cpp */,
     7266                                84925A9B22B30CBA00D1DFFF /* RegExpStringIteratorPrototype.h */,
    72627267                                70B0A9D01A9B66200001306A /* RuntimeFlags.h */,
    72637268                                527773DD1AAF83AC00BDE7E8 /* RuntimeType.cpp */,
     
    83498354                                7CF9BC5F1B65D9B1009DB1EF /* ReflectObject.js */,
    83508355                                654788421C937D2C000781A0 /* RegExpPrototype.js */,
     8356                                84925A9C22B30CC800D1DFFF /* RegExpStringIteratorPrototype.js */,
    83518357                                7035587D1C418419004BD7BF /* SetPrototype.js */,
    83528358                                7CF9BC601B65D9B1009DB1EF /* StringConstructor.js */,
  • trunk/Source/JavaScriptCore/Scripts/wkbuiltins/builtins_generate_combined_header.py

    r240718 r246567  
    3434from builtins_templates import BuiltinsGeneratorTemplates as Templates
    3535
     36
     37def get_var_name(function):
     38    var_name = function.function_name
     39    if function.is_constructor:
     40        return var_name[:1].lower() + var_name[1:] + 'Constructor'
     41    return var_name
     42
    3643log = logging.getLogger('global')
    37 
    3844
    3945class BuiltinsCombinedHeaderGenerator(BuiltinsGenerator):
     
    165171        for function in functions:
    166172            function_args = {
     173                'varName': get_var_name(function),
    167174                'funcName': function.function_name,
    168175                'codeName': BuiltinsGenerator.mangledNameForFunction(function),
    169176            }
    170177
    171             lines.append("    macro(%(funcName)s, %(codeName)s) \\" % function_args)
     178            lines.append("    macro(%(varName)s, %(funcName)s, %(codeName)s) \\" % function_args)
    172179
    173180        return '\n'.join(lines)
  • trunk/Source/JavaScriptCore/Sources.txt

    r246565 r246567  
    923923runtime/RegExpObject.cpp
    924924runtime/RegExpPrototype.cpp
     925runtime/RegExpStringIteratorPrototype.cpp
    925926runtime/RuntimeType.cpp
    926927runtime/SamplingCounter.cpp
  • trunk/Source/JavaScriptCore/builtins/ArrayPrototype.js

    r239761 r246567  
    2727@constructor
    2828@globalPrivate
    29 function createArrayIterator(iteratedObject, kind, iterationFunction)
     29function ArrayIterator(iteratedObject, kind, iterationFunction)
    3030{
    3131    "use strict";
     
    4242    "use strict";
    4343
    44     return new @createArrayIterator(@toObject(this, "Array.prototype.values requires that |this| not be null or undefined"), "value", @arrayIteratorValueNext);
     44    return new @ArrayIterator(@toObject(this, "Array.prototype.values requires that |this| not be null or undefined"), "value", @arrayIteratorValueNext);
    4545}
    4646
     
    4949    "use strict";
    5050
    51     return new @createArrayIterator(@toObject(this, "Array.prototype.keys requires that |this| not be null or undefined"), "key", @arrayIteratorKeyNext);
     51    return new @ArrayIterator(@toObject(this, "Array.prototype.keys requires that |this| not be null or undefined"), "key", @arrayIteratorKeyNext);
    5252}
    5353
     
    5656    "use strict";
    5757
    58     return new @createArrayIterator(@toObject(this, "Array.prototype.entries requires that |this| not be null or undefined"), "key+value", @arrayIteratorKeyValueNext);
     58    return new @ArrayIterator(@toObject(this, "Array.prototype.entries requires that |this| not be null or undefined"), "key+value", @arrayIteratorKeyValueNext);
    5959}
    6060
  • trunk/Source/JavaScriptCore/builtins/AsyncFromSyncIteratorPrototype.js

    r242365 r246567  
    157157        @throwTypeError('Only objects can be wrapped by async-from-sync wrapper');
    158158
    159     return new @AsyncFromSyncIteratorConstructor(syncIterator, nextMethod);
     159    return new @AsyncFromSyncIterator(syncIterator, nextMethod);
    160160}
    161161
    162162@globalPrivate
    163163@constructor
    164 function AsyncFromSyncIteratorConstructor(syncIterator, nextMethod)
     164function AsyncFromSyncIterator(syncIterator, nextMethod)
    165165{
    166166    "use strict";
  • trunk/Source/JavaScriptCore/builtins/BuiltinNames.h

    r242382 r246567  
    165165    macro(regExpSplitFast) \
    166166    macro(regExpTestFast) \
     167    macro(regExpStringIteratorRegExp) \
     168    macro(regExpStringIteratorString) \
     169    macro(regExpStringIteratorGlobal) \
     170    macro(regExpStringIteratorUnicode) \
     171    macro(regExpStringIteratorDone) \
    167172    macro(stringIncludesInternal) \
    168173    macro(stringSplitFast) \
  • trunk/Source/JavaScriptCore/builtins/MapPrototype.js

    r230459 r246567  
    2626@constructor
    2727@globalPrivate
    28 function createMapIterator(iteratedObject, kind)
     28function MapIterator(iteratedObject, kind)
    2929{
    3030    "use strict";
     
    4343        @throwTypeError("Map.prototype.values requires that |this| be Map");
    4444
    45     return new @createMapIterator(this, @iterationKindValue);
     45    return new @MapIterator(this, @iterationKindValue);
    4646}
    4747
     
    5353        @throwTypeError("Map.prototype.keys requires that |this| be Map");
    5454
    55     return new @createMapIterator(this, @iterationKindKey);
     55    return new @MapIterator(this, @iterationKindKey);
    5656}
    5757
     
    6363        @throwTypeError("Map.prototype.entries requires that |this| be Map");
    6464
    65     return new @createMapIterator(this, @iterationKindKeyValue);
     65    return new @MapIterator(this, @iterationKindKeyValue);
    6666}
    6767
  • trunk/Source/JavaScriptCore/builtins/RegExpPrototype.js

    r238267 r246567  
    2525
    2626@globalPrivate
     27@constructor
     28function RegExpStringIterator(regExp, string, global, fullUnicode)
     29{
     30    "use strict";
     31
     32    @putByIdDirectPrivate(this, "regExpStringIteratorRegExp", regExp);
     33    @putByIdDirectPrivate(this, "regExpStringIteratorString", string);
     34    @putByIdDirectPrivate(this, "regExpStringIteratorGlobal", global);
     35    @putByIdDirectPrivate(this, "regExpStringIteratorUnicode", fullUnicode);
     36    @putByIdDirectPrivate(this, "regExpStringIteratorDone", false);
     37}
     38
     39@globalPrivate
    2740function advanceStringIndex(string, index, unicode)
    2841{
     
    141154        return @regExpMatchFast.@call(this, str);
    142155    return @matchSlow(this, str);
     156}
     157
     158@overriddenName="[Symbol.matchAll]"
     159function matchAll(strArg)
     160{
     161    "use strict";
     162
     163    let regExp = this;
     164    if (!@isObject(regExp))
     165        @throwTypeError("RegExp.prototype.@@matchAll requires |this| to be an Object");
     166
     167    let string = @toString(strArg);
     168    let Matcher = @speciesConstructor(regExp, @RegExp);
     169
     170    let flags = @toString(regExp.flags);
     171    let matcher = new Matcher(regExp, flags);
     172    matcher.lastIndex = @toLength(regExp.lastIndex);
     173
     174    let global = @stringIncludesInternal.@call(flags, "g");
     175    let fullUnicode = @stringIncludesInternal.@call(flags, "u");
     176
     177    return new @RegExpStringIterator(matcher, string, global, fullUnicode);
    143178}
    144179
  • trunk/Source/JavaScriptCore/builtins/SetPrototype.js

    r230459 r246567  
    2626@constructor
    2727@globalPrivate
    28 function createSetIterator(iteratedObject, kind)
     28function SetIterator(iteratedObject, kind)
    2929{
    3030    "use strict";
     
    4343        @throwTypeError("Set.prototype.values requires that |this| be Set");
    4444
    45     return new @createSetIterator(this, @iterationKindValue);
     45    return new @SetIterator(this, @iterationKindValue);
    4646}
    4747
     
    5353        @throwTypeError("Set.prototype.entries requires that |this| be Set");
    5454
    55     return new @createSetIterator(this, @iterationKindKeyValue);
     55    return new @SetIterator(this, @iterationKindKeyValue);
    5656}
    5757
  • trunk/Source/JavaScriptCore/builtins/StringPrototype.js

    r242047 r246567  
    4444}
    4545
     46function matchAll(arg)
     47{
     48    "use strict";
     49
     50    if (@isUndefinedOrNull(this))
     51        @throwTypeError("String.prototype.matchAll requires |this| not to be null nor undefined");
     52
     53    if (!@isUndefinedOrNull(arg)) {
     54        let matcher = arg.@matchAllSymbol;
     55        if (!@isUndefinedOrNull(matcher))
     56            return matcher.@call(arg, this);
     57    }
     58
     59    let string = @toString(this);
     60    let regExp = @regExpCreate(arg, "g");
     61    return regExp.@matchAllSymbol(string);
     62}
     63
    4664@globalPrivate
    4765function repeatSlowPath(string, count)
  • trunk/Source/JavaScriptCore/builtins/TypedArrayPrototype.js

    r239761 r246567  
    7373    "use strict";
    7474    @typedArrayLength(this);
    75     return new @createArrayIterator(this, "value", @arrayIteratorValueNext);
     75    return new @ArrayIterator(this, "value", @arrayIteratorValueNext);
    7676}
    7777
     
    8080    "use strict";
    8181    @typedArrayLength(this);
    82     return new @createArrayIterator(this, "key", @arrayIteratorKeyNext);
     82    return new @ArrayIterator(this, "key", @arrayIteratorKeyNext);
    8383}
    8484
     
    8787    "use strict";
    8888    @typedArrayLength(this);
    89     return new @createArrayIterator(this, "key+value", @arrayIteratorKeyValueNext);
     89    return new @ArrayIterator(this, "key+value", @arrayIteratorKeyValueNext);
    9090}
    9191
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h

    r246565 r246567  
    256256    macro(iterator) \
    257257    macro(match) \
     258    macro(matchAll) \
    258259    macro(replace) \
    259260    macro(search) \
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r246565 r246567  
    157157#include "RegExpObject.h"
    158158#include "RegExpPrototype.h"
     159#include "RegExpStringIteratorPrototype.h"
    159160#include "ScopedArguments.h"
    160161#include "SetConstructor.h"
     
    939940    m_regExpProtoSymbolReplace.set(vm, this, regExpSymbolReplace);
    940941
    941 #define CREATE_PRIVATE_GLOBAL_FUNCTION(name, code) JSFunction* name ## PrivateFunction = JSFunction::create(vm, code ## CodeGenerator(vm), this);
     942#define CREATE_PRIVATE_GLOBAL_FUNCTION(varName, funcName, code) JSFunction* varName ## PrivateFunction = JSFunction::create(vm, code ## CodeGenerator(vm), this);
    942943    JSC_FOREACH_BUILTIN_FUNCTION_PRIVATE_GLOBAL_NAME(CREATE_PRIVATE_GLOBAL_FUNCTION)
    943944#undef CREATE_PRIVATE_GLOBAL_FUNCTION
    944945
    945946    JSObject* arrayIteratorPrototype = ArrayIteratorPrototype::create(vm, this, ArrayIteratorPrototype::createStructure(vm, this, m_iteratorPrototype.get()));
    946     createArrayIteratorPrivateFunction->putDirect(vm, vm.propertyNames->prototype, arrayIteratorPrototype);
     947    arrayIteratorConstructorPrivateFunction->putDirect(vm, vm.propertyNames->prototype, arrayIteratorPrototype);
    947948
    948949    JSObject* asyncFromSyncIteratorPrototype = AsyncFromSyncIteratorPrototype::create(vm, this, AsyncFromSyncIteratorPrototype::createStructure(vm, this, m_iteratorPrototype.get()));
    949     AsyncFromSyncIteratorConstructorPrivateFunction->putDirect(vm, vm.propertyNames->prototype, asyncFromSyncIteratorPrototype);
     950    asyncFromSyncIteratorConstructorPrivateFunction->putDirect(vm, vm.propertyNames->prototype, asyncFromSyncIteratorPrototype);
    950951
    951952    JSObject* mapIteratorPrototype = MapIteratorPrototype::create(vm, this, MapIteratorPrototype::createStructure(vm, this, m_iteratorPrototype.get()));
    952     createMapIteratorPrivateFunction->putDirect(vm, vm.propertyNames->prototype, mapIteratorPrototype);
     953    mapIteratorConstructorPrivateFunction->putDirect(vm, vm.propertyNames->prototype, mapIteratorPrototype);
     954
     955    JSObject* regExpStringIteratorPrototype = RegExpStringIteratorPrototype::create(vm, this, RegExpStringIteratorPrototype::createStructure(vm, this, m_iteratorPrototype.get()));
     956    regExpStringIteratorConstructorPrivateFunction->putDirect(vm, vm.propertyNames->prototype, regExpStringIteratorPrototype);
    953957
    954958    JSObject* setIteratorPrototype = SetIteratorPrototype::create(vm, this, SetIteratorPrototype::createStructure(vm, this, m_iteratorPrototype.get()));
    955     createSetIteratorPrivateFunction->putDirect(vm, vm.propertyNames->prototype, setIteratorPrototype);
     959    setIteratorConstructorPrivateFunction->putDirect(vm, vm.propertyNames->prototype, setIteratorPrototype);
    956960
    957961    GlobalPropertyInfo staticGlobals[] = {
    958 #define INIT_PRIVATE_GLOBAL(name, code) GlobalPropertyInfo(vm.propertyNames->builtinNames().name ## PrivateName(), name ## PrivateFunction, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
     962#define INIT_PRIVATE_GLOBAL(varName, funcName, code) GlobalPropertyInfo(vm.propertyNames->builtinNames().funcName ## PrivateName(), varName ## PrivateFunction, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
    959963        JSC_FOREACH_BUILTIN_FUNCTION_PRIVATE_GLOBAL_NAME(INIT_PRIVATE_GLOBAL)
    960964#undef INIT_PRIVATE_GLOBAL
  • trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp

    r245082 r246567  
    7878    JSC_NATIVE_GETTER_WITHOUT_TRANSITION(vm.propertyNames->flags, regExpProtoGetterFlags, PropertyAttribute::DontEnum | PropertyAttribute::Accessor);
    7979    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->matchSymbol, regExpPrototypeMatchCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
     80    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->matchAllSymbol, regExpPrototypeMatchAllCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
    8081    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->replaceSymbol, regExpPrototypeReplaceCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
    8182    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->searchSymbol, regExpPrototypeSearchCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
  • trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp

    r245194 r246567  
    9999    concat    JSBuiltin    DontEnum|Function 1
    100100    match     JSBuiltin    DontEnum|Function 1
     101    matchAll  JSBuiltin    DontEnum|Function 1
    101102    padStart  JSBuiltin    DontEnum|Function 1
    102103    padEnd    JSBuiltin    DontEnum|Function 1
Note: See TracChangeset for help on using the changeset viewer.