mjs@apple.com | 52b6760 | 2008-09-22 03:15:52 +0000 | [diff] [blame] | 1 | /* |
mark.lam@apple.com | 6b81029 | 2021-11-11 17:31:37 +0000 | [diff] [blame] | 2 | * Copyright (C) 2008-2021 Apple Inc. All Rights Reserved. |
mjs@apple.com | 52b6760 | 2008-09-22 03:15:52 +0000 | [diff] [blame] | 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Lesser General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Lesser General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Lesser General Public |
| 15 | * License along with this library; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 | * |
| 18 | */ |
| 19 | |
ryanhaddad@apple.com | 22104f5 | 2016-09-28 17:08:17 +0000 | [diff] [blame] | 20 | #pragma once |
mjs@apple.com | 52b6760 | 2008-09-22 03:15:52 +0000 | [diff] [blame] | 21 | |
fpizlo@apple.com | 6ea42db | 2016-03-08 21:15:07 +0000 | [diff] [blame] | 22 | #include "ButterflyInlines.h" |
fpizlo@apple.com | 9a17595 | 2016-09-28 21:55:53 +0000 | [diff] [blame] | 23 | #include "GCDeferralContextInlines.h" |
mjs@apple.com | 52b6760 | 2008-09-22 03:15:52 +0000 | [diff] [blame] | 24 | #include "JSArray.h" |
fpizlo@apple.com | 6ea42db | 2016-03-08 21:15:07 +0000 | [diff] [blame] | 25 | #include "JSCInlines.h" |
barraclough@apple.com | 0a0af1a | 2012-03-23 19:57:28 +0000 | [diff] [blame] | 26 | #include "JSGlobalObject.h" |
commit-queue@webkit.org | f78337d | 2019-11-12 22:09:37 +0000 | [diff] [blame] | 27 | #include "ObjectConstructor.h" |
fpizlo@apple.com | 6ea42db | 2016-03-08 21:15:07 +0000 | [diff] [blame] | 28 | #include "RegExpInlines.h" |
barraclough@apple.com | 0a0af1a | 2012-03-23 19:57:28 +0000 | [diff] [blame] | 29 | #include "RegExpObject.h" |
mjs@apple.com | 52b6760 | 2008-09-22 03:15:52 +0000 | [diff] [blame] | 30 | |
| 31 | namespace JSC { |
| 32 | |
ysuzuki@apple.com | e5fb32b | 2022-04-22 05:41:35 +0000 | [diff] [blame^] | 33 | static constexpr PropertyOffset RegExpMatchesArrayIndexPropertyOffset = firstOutOfLineOffset; |
| 34 | static constexpr PropertyOffset RegExpMatchesArrayInputPropertyOffset = firstOutOfLineOffset + 1; |
| 35 | static constexpr PropertyOffset RegExpMatchesArrayGroupsPropertyOffset = firstOutOfLineOffset + 2; |
| 36 | static constexpr PropertyOffset RegExpMatchesArrayIndicesPropertyOffset = firstOutOfLineOffset + 3; |
| 37 | static constexpr PropertyOffset RegExpMatchesIndicesGroupsPropertyOffset = firstOutOfLineOffset; |
fpizlo@apple.com | 6ea42db | 2016-03-08 21:15:07 +0000 | [diff] [blame] | 38 | |
mark.lam@apple.com | 2147640 | 2017-04-27 19:24:07 +0000 | [diff] [blame] | 39 | ALWAYS_INLINE JSArray* tryCreateUninitializedRegExpMatchesArray(ObjectInitializationScope& scope, GCDeferralContext* deferralContext, Structure* structure, unsigned initialLength) |
fpizlo@apple.com | 6ea42db | 2016-03-08 21:15:07 +0000 | [diff] [blame] | 40 | { |
mark.lam@apple.com | 2147640 | 2017-04-27 19:24:07 +0000 | [diff] [blame] | 41 | VM& vm = scope.vm(); |
fpizlo@apple.com | bc16ddb | 2016-09-06 01:02:22 +0000 | [diff] [blame] | 42 | unsigned vectorLength = initialLength; |
fpizlo@apple.com | 6ea42db | 2016-03-08 21:15:07 +0000 | [diff] [blame] | 43 | if (vectorLength > MAX_STORAGE_VECTOR_LENGTH) |
ross.kirsling@sony.com | 2abe6c6 | 2020-05-11 02:36:05 +0000 | [diff] [blame] | 44 | return nullptr; |
fpizlo@apple.com | 6ea42db | 2016-03-08 21:15:07 +0000 | [diff] [blame] | 45 | |
keith_miller@apple.com | 66c5765 | 2018-06-18 23:53:27 +0000 | [diff] [blame] | 46 | const bool hasIndexingHeader = true; |
| 47 | Butterfly* butterfly = Butterfly::tryCreateUninitialized(vm, nullptr, 0, structure->outOfLineCapacity(), hasIndexingHeader, vectorLength * sizeof(EncodedJSValue), deferralContext); |
| 48 | if (UNLIKELY(!butterfly)) |
fpizlo@apple.com | bc16ddb | 2016-09-06 01:02:22 +0000 | [diff] [blame] | 49 | return nullptr; |
keith_miller@apple.com | 66c5765 | 2018-06-18 23:53:27 +0000 | [diff] [blame] | 50 | |
fpizlo@apple.com | 6ea42db | 2016-03-08 21:15:07 +0000 | [diff] [blame] | 51 | butterfly->setVectorLength(vectorLength); |
| 52 | butterfly->setPublicLength(initialLength); |
mark.lam@apple.com | 2147640 | 2017-04-27 19:24:07 +0000 | [diff] [blame] | 53 | |
keith_miller@apple.com | 66c5765 | 2018-06-18 23:53:27 +0000 | [diff] [blame] | 54 | for (unsigned i = initialLength; i < vectorLength; ++i) |
keith_miller@apple.com | c02f5d3 | 2018-05-22 18:04:31 +0000 | [diff] [blame] | 55 | butterfly->contiguous().atUnsafe(i).clear(); |
mark.lam@apple.com | 2147640 | 2017-04-27 19:24:07 +0000 | [diff] [blame] | 56 | |
| 57 | JSArray* result = JSArray::createWithButterfly(vm, deferralContext, structure, butterfly); |
keith_miller@apple.com | 66c5765 | 2018-06-18 23:53:27 +0000 | [diff] [blame] | 58 | |
mark.lam@apple.com | 35ad20b | 2020-07-22 01:40:59 +0000 | [diff] [blame] | 59 | scope.notifyAllocated(result); |
mark.lam@apple.com | 2147640 | 2017-04-27 19:24:07 +0000 | [diff] [blame] | 60 | return result; |
fpizlo@apple.com | 6ea42db | 2016-03-08 21:15:07 +0000 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | ALWAYS_INLINE JSArray* createRegExpMatchesArray( |
| 64 | VM& vm, JSGlobalObject* globalObject, JSString* input, const String& inputValue, |
| 65 | RegExp* regExp, unsigned startOffset, MatchResult& result) |
| 66 | { |
mark.lam@apple.com | 4b9b5c6 | 2020-06-04 21:07:42 +0000 | [diff] [blame] | 67 | if constexpr (validateDFGDoesGC) |
mark.lam@apple.com | 6b81029 | 2021-11-11 17:31:37 +0000 | [diff] [blame] | 68 | vm.verifyCanGC(); |
mark.lam@apple.com | 8eafba5 | 2019-02-22 02:02:32 +0000 | [diff] [blame] | 69 | |
fpizlo@apple.com | 6ea42db | 2016-03-08 21:15:07 +0000 | [diff] [blame] | 70 | Vector<int, 32> subpatternResults; |
ysuzuki@apple.com | f99e5d8 | 2020-04-08 20:01:39 +0000 | [diff] [blame] | 71 | int position = regExp->matchInline(globalObject, vm, inputValue, startOffset, subpatternResults); |
fpizlo@apple.com | 6ea42db | 2016-03-08 21:15:07 +0000 | [diff] [blame] | 72 | if (position == -1) { |
| 73 | result = MatchResult::failed(); |
| 74 | return nullptr; |
| 75 | } |
| 76 | |
| 77 | result.start = position; |
| 78 | result.end = subpatternResults[1]; |
| 79 | |
| 80 | JSArray* array; |
msaboff@apple.com | dd96c36 | 2021-02-18 19:14:34 +0000 | [diff] [blame] | 81 | JSArray* indicesArray = nullptr; |
fpizlo@apple.com | 6ea42db | 2016-03-08 21:15:07 +0000 | [diff] [blame] | 82 | |
| 83 | // FIXME: This should handle array allocation errors gracefully. |
| 84 | // https://bugs.webkit.org/show_bug.cgi?id=155144 |
| 85 | |
msaboff@apple.com | 8e26fe2 | 2017-09-07 23:13:38 +0000 | [diff] [blame] | 86 | unsigned numSubpatterns = regExp->numSubpatterns(); |
| 87 | bool hasNamedCaptures = regExp->hasNamedCaptures(); |
msaboff@apple.com | dd96c36 | 2021-02-18 19:14:34 +0000 | [diff] [blame] | 88 | bool createIndices = regExp->hasIndices(); |
commit-queue@webkit.org | f78337d | 2019-11-12 22:09:37 +0000 | [diff] [blame] | 89 | JSObject* groups = hasNamedCaptures ? constructEmptyObject(vm, globalObject->nullPrototypeObjectStructure()) : nullptr; |
msaboff@apple.com | dd96c36 | 2021-02-18 19:14:34 +0000 | [diff] [blame] | 90 | Structure* matchStructure = createIndices ? globalObject->regExpMatchesArrayWithIndicesStructure() : globalObject->regExpMatchesArrayStructure(); |
| 91 | |
| 92 | JSObject* indicesGroups = createIndices && hasNamedCaptures ? constructEmptyObject(vm, globalObject->nullPrototypeObjectStructure()) : nullptr; |
msaboff@apple.com | 8e26fe2 | 2017-09-07 23:13:38 +0000 | [diff] [blame] | 93 | |
fpizlo@apple.com | bc16ddb | 2016-09-06 01:02:22 +0000 | [diff] [blame] | 94 | auto setProperties = [&] () { |
| 95 | array->putDirect(vm, RegExpMatchesArrayIndexPropertyOffset, jsNumber(result.start)); |
| 96 | array->putDirect(vm, RegExpMatchesArrayInputPropertyOffset, input); |
commit-queue@webkit.org | f78337d | 2019-11-12 22:09:37 +0000 | [diff] [blame] | 97 | array->putDirect(vm, RegExpMatchesArrayGroupsPropertyOffset, hasNamedCaptures ? groups : jsUndefined()); |
keith_miller@apple.com | 66c5765 | 2018-06-18 23:53:27 +0000 | [diff] [blame] | 98 | |
| 99 | ASSERT(!array->butterfly()->indexingHeader()->preCapacity(matchStructure)); |
| 100 | auto capacity = matchStructure->outOfLineCapacity(); |
| 101 | auto size = matchStructure->outOfLineSize(); |
sbarati@apple.com | 64b8449 | 2019-11-04 23:57:34 +0000 | [diff] [blame] | 102 | gcSafeZeroMemory(static_cast<JSValue*>(array->butterfly()->base(0, capacity)), (capacity - size) * sizeof(JSValue)); |
msaboff@apple.com | dd96c36 | 2021-02-18 19:14:34 +0000 | [diff] [blame] | 103 | |
| 104 | if (createIndices) { |
| 105 | array->putDirect(vm, RegExpMatchesArrayIndicesPropertyOffset, indicesArray); |
| 106 | |
| 107 | Structure* indicesStructure = globalObject->regExpMatchesIndicesArrayStructure(); |
| 108 | |
msaboff@apple.com | 51fb24b | 2021-02-19 20:50:48 +0000 | [diff] [blame] | 109 | indicesArray->putDirect(vm, RegExpMatchesIndicesGroupsPropertyOffset, indicesGroups ? indicesGroups : jsUndefined()); |
msaboff@apple.com | dd96c36 | 2021-02-18 19:14:34 +0000 | [diff] [blame] | 110 | |
| 111 | ASSERT(!indicesArray->butterfly()->indexingHeader()->preCapacity(indicesStructure)); |
| 112 | auto indicesCapacity = indicesStructure->outOfLineCapacity(); |
| 113 | auto indicesSize = indicesStructure->outOfLineSize(); |
| 114 | gcSafeZeroMemory(static_cast<JSValue*>(indicesArray->butterfly()->base(0, indicesCapacity)), (indicesCapacity - indicesSize) * sizeof(JSValue)); |
| 115 | } |
| 116 | }; |
| 117 | |
| 118 | auto createIndexArray = [&] (GCDeferralContext& deferralContext, int start, int end) { |
| 119 | ObjectInitializationScope scope(vm); |
| 120 | |
| 121 | JSArray* result = JSArray::tryCreateUninitializedRestricted(scope, &deferralContext, globalObject->arrayStructureForIndexingTypeDuringAllocation(ArrayWithContiguous), 2); |
| 122 | result->initializeIndexWithoutBarrier(scope, 0, jsNumber(start)); |
| 123 | result->initializeIndexWithoutBarrier(scope, 1, jsNumber(end)); |
| 124 | |
| 125 | return result; |
fpizlo@apple.com | bc16ddb | 2016-09-06 01:02:22 +0000 | [diff] [blame] | 126 | }; |
msaboff@apple.com | 8e26fe2 | 2017-09-07 23:13:38 +0000 | [diff] [blame] | 127 | |
fpizlo@apple.com | 6ea42db | 2016-03-08 21:15:07 +0000 | [diff] [blame] | 128 | if (UNLIKELY(globalObject->isHavingABadTime())) { |
mark.lam@apple.com | 6b81029 | 2021-11-11 17:31:37 +0000 | [diff] [blame] | 129 | GCDeferralContext deferralContext(vm); |
msaboff@apple.com | dd96c36 | 2021-02-18 19:14:34 +0000 | [diff] [blame] | 130 | ObjectInitializationScope matchesArrayScope(vm); |
| 131 | ObjectInitializationScope indicesArrayScope(vm); |
| 132 | array = JSArray::tryCreateUninitializedRestricted(matchesArrayScope, &deferralContext, matchStructure, numSubpatterns + 1); |
| 133 | |
| 134 | if (createIndices) |
| 135 | indicesArray = JSArray::tryCreateUninitializedRestricted(indicesArrayScope, &deferralContext, globalObject->regExpMatchesIndicesArrayStructure(), numSubpatterns + 1); |
keith_miller@apple.com | 66c5765 | 2018-06-18 23:53:27 +0000 | [diff] [blame] | 136 | |
mark.lam@apple.com | c2e98e8 | 2017-03-23 20:31:18 +0000 | [diff] [blame] | 137 | // FIXME: we should probably throw an out of memory error here, but |
| 138 | // when making this change we should check that all clients of this |
| 139 | // function will correctly handle an exception being thrown from here. |
| 140 | // https://bugs.webkit.org/show_bug.cgi?id=169786 |
| 141 | RELEASE_ASSERT(array); |
| 142 | |
fpizlo@apple.com | bc16ddb | 2016-09-06 01:02:22 +0000 | [diff] [blame] | 143 | setProperties(); |
| 144 | |
msaboff@apple.com | dd96c36 | 2021-02-18 19:14:34 +0000 | [diff] [blame] | 145 | array->initializeIndexWithoutBarrier(matchesArrayScope, 0, jsSubstringOfResolved(vm, &deferralContext, input, result.start, result.end - result.start)); |
| 146 | |
fpizlo@apple.com | bc16ddb | 2016-09-06 01:02:22 +0000 | [diff] [blame] | 147 | for (unsigned i = 1; i <= numSubpatterns; ++i) { |
| 148 | int start = subpatternResults[2 * i]; |
fpizlo@apple.com | 9a17595 | 2016-09-28 21:55:53 +0000 | [diff] [blame] | 149 | JSValue value; |
fpizlo@apple.com | bc16ddb | 2016-09-06 01:02:22 +0000 | [diff] [blame] | 150 | if (start >= 0) |
ysuzuki@apple.com | cb663b3 | 2019-03-01 03:13:31 +0000 | [diff] [blame] | 151 | value = jsSubstringOfResolved(vm, &deferralContext, input, start, subpatternResults[2 * i + 1] - start); |
fpizlo@apple.com | 9a17595 | 2016-09-28 21:55:53 +0000 | [diff] [blame] | 152 | else |
| 153 | value = jsUndefined(); |
msaboff@apple.com | dd96c36 | 2021-02-18 19:14:34 +0000 | [diff] [blame] | 154 | array->initializeIndexWithoutBarrier(matchesArrayScope, i, value); |
| 155 | } |
| 156 | |
| 157 | if (createIndices) { |
| 158 | for (unsigned i = 0; i <= numSubpatterns; ++i) { |
| 159 | int start = subpatternResults[2 * i]; |
| 160 | JSValue value; |
| 161 | if (start >= 0) |
| 162 | indicesArray->initializeIndexWithoutBarrier(indicesArrayScope, i, createIndexArray(deferralContext, start, subpatternResults[2 * i + 1])); |
| 163 | else |
| 164 | indicesArray->initializeIndexWithoutBarrier(indicesArrayScope, i, jsUndefined()); |
| 165 | } |
fpizlo@apple.com | 6ea42db | 2016-03-08 21:15:07 +0000 | [diff] [blame] | 166 | } |
| 167 | } else { |
mark.lam@apple.com | 6b81029 | 2021-11-11 17:31:37 +0000 | [diff] [blame] | 168 | GCDeferralContext deferralContext(vm); |
msaboff@apple.com | dd96c36 | 2021-02-18 19:14:34 +0000 | [diff] [blame] | 169 | ObjectInitializationScope matchesArrayScope(vm); |
| 170 | ObjectInitializationScope indicesArrayScope(vm); |
| 171 | array = tryCreateUninitializedRegExpMatchesArray(matchesArrayScope, &deferralContext, matchStructure, numSubpatterns + 1); |
| 172 | |
| 173 | if (createIndices) |
| 174 | indicesArray = tryCreateUninitializedRegExpMatchesArray(indicesArrayScope, &deferralContext, globalObject->regExpMatchesIndicesArrayStructure(), numSubpatterns + 1); |
keith_miller@apple.com | 66c5765 | 2018-06-18 23:53:27 +0000 | [diff] [blame] | 175 | |
| 176 | // FIXME: we should probably throw an out of memory error here, but |
| 177 | // when making this change we should check that all clients of this |
| 178 | // function will correctly handle an exception being thrown from here. |
| 179 | // https://bugs.webkit.org/show_bug.cgi?id=169786 |
fpizlo@apple.com | 6ea42db | 2016-03-08 21:15:07 +0000 | [diff] [blame] | 180 | RELEASE_ASSERT(array); |
| 181 | |
fpizlo@apple.com | bc16ddb | 2016-09-06 01:02:22 +0000 | [diff] [blame] | 182 | setProperties(); |
| 183 | |
msaboff@apple.com | dd96c36 | 2021-02-18 19:14:34 +0000 | [diff] [blame] | 184 | array->initializeIndexWithoutBarrier(matchesArrayScope, 0, jsSubstringOfResolved(vm, &deferralContext, input, result.start, result.end - result.start), ArrayWithContiguous); |
fpizlo@apple.com | 6ea42db | 2016-03-08 21:15:07 +0000 | [diff] [blame] | 185 | |
fpizlo@apple.com | bc16ddb | 2016-09-06 01:02:22 +0000 | [diff] [blame] | 186 | for (unsigned i = 1; i <= numSubpatterns; ++i) { |
| 187 | int start = subpatternResults[2 * i]; |
fpizlo@apple.com | 9a17595 | 2016-09-28 21:55:53 +0000 | [diff] [blame] | 188 | JSValue value; |
fpizlo@apple.com | bc16ddb | 2016-09-06 01:02:22 +0000 | [diff] [blame] | 189 | if (start >= 0) |
ysuzuki@apple.com | cb663b3 | 2019-03-01 03:13:31 +0000 | [diff] [blame] | 190 | value = jsSubstringOfResolved(vm, &deferralContext, input, start, subpatternResults[2 * i + 1] - start); |
fpizlo@apple.com | 9a17595 | 2016-09-28 21:55:53 +0000 | [diff] [blame] | 191 | else |
| 192 | value = jsUndefined(); |
msaboff@apple.com | dd96c36 | 2021-02-18 19:14:34 +0000 | [diff] [blame] | 193 | array->initializeIndexWithoutBarrier(matchesArrayScope, i, value, ArrayWithContiguous); |
| 194 | } |
| 195 | |
| 196 | if (createIndices) { |
| 197 | for (unsigned i = 0; i <= numSubpatterns; ++i) { |
| 198 | int start = subpatternResults[2 * i]; |
| 199 | JSValue value; |
| 200 | if (start >= 0) |
| 201 | indicesArray->initializeIndexWithoutBarrier(indicesArrayScope, i, createIndexArray(deferralContext, start, subpatternResults[2 * i + 1])); |
| 202 | else |
| 203 | indicesArray->initializeIndexWithoutBarrier(indicesArrayScope, i, jsUndefined()); |
| 204 | } |
keith_miller@apple.com | 66c5765 | 2018-06-18 23:53:27 +0000 | [diff] [blame] | 205 | } |
| 206 | } |
| 207 | |
| 208 | // Now the object is safe to scan by GC. |
| 209 | |
msaboff@apple.com | dd96c36 | 2021-02-18 19:14:34 +0000 | [diff] [blame] | 210 | // We initialize the groups and indices objects late as they could allocate, which with the current API could cause |
keith_miller@apple.com | 66c5765 | 2018-06-18 23:53:27 +0000 | [diff] [blame] | 211 | // allocations. |
commit-queue@webkit.org | f78337d | 2019-11-12 22:09:37 +0000 | [diff] [blame] | 212 | if (hasNamedCaptures) { |
keith_miller@apple.com | 66c5765 | 2018-06-18 23:53:27 +0000 | [diff] [blame] | 213 | for (unsigned i = 1; i <= numSubpatterns; ++i) { |
| 214 | String groupName = regExp->getCaptureGroupName(i); |
msaboff@apple.com | dd96c36 | 2021-02-18 19:14:34 +0000 | [diff] [blame] | 215 | if (!groupName.isEmpty()) { |
mark.lam@apple.com | 5ba0779 | 2019-08-27 22:14:52 +0000 | [diff] [blame] | 216 | groups->putDirect(vm, Identifier::fromString(vm, groupName), array->getIndexQuickly(i)); |
msaboff@apple.com | dd96c36 | 2021-02-18 19:14:34 +0000 | [diff] [blame] | 217 | if (createIndices) |
| 218 | indicesGroups->putDirect(vm, Identifier::fromString(vm, groupName), indicesArray->getIndexQuickly(i)); |
| 219 | } |
fpizlo@apple.com | 6ea42db | 2016-03-08 21:15:07 +0000 | [diff] [blame] | 220 | } |
| 221 | } |
msaboff@apple.com | dd96c36 | 2021-02-18 19:14:34 +0000 | [diff] [blame] | 222 | |
fpizlo@apple.com | 6ea42db | 2016-03-08 21:15:07 +0000 | [diff] [blame] | 223 | return array; |
| 224 | } |
| 225 | |
ysuzuki@apple.com | 52e98bb | 2019-10-22 09:24:48 +0000 | [diff] [blame] | 226 | inline JSArray* createRegExpMatchesArray(JSGlobalObject* globalObject, JSString* string, RegExp* regExp, unsigned startOffset) |
fpizlo@apple.com | 68cf74d | 2016-03-08 00:34:44 +0000 | [diff] [blame] | 227 | { |
ysuzuki@apple.com | 52e98bb | 2019-10-22 09:24:48 +0000 | [diff] [blame] | 228 | VM& vm = getVM(globalObject); |
ysuzuki@apple.com | 782a6d3 | 2019-09-28 03:40:23 +0000 | [diff] [blame] | 229 | auto scope = DECLARE_THROW_SCOPE(vm); |
| 230 | |
fpizlo@apple.com | 68cf74d | 2016-03-08 00:34:44 +0000 | [diff] [blame] | 231 | MatchResult ignoredResult; |
ysuzuki@apple.com | 52e98bb | 2019-10-22 09:24:48 +0000 | [diff] [blame] | 232 | String input = string->value(globalObject); |
ysuzuki@apple.com | 782a6d3 | 2019-09-28 03:40:23 +0000 | [diff] [blame] | 233 | RETURN_IF_EXCEPTION(scope, { }); |
| 234 | |
ysuzuki@apple.com | 7c2addb | 2022-04-11 04:57:33 +0000 | [diff] [blame] | 235 | RELEASE_AND_RETURN(scope, createRegExpMatchesArray(vm, globalObject, string, WTFMove(input), regExp, startOffset, ignoredResult)); |
fpizlo@apple.com | 68cf74d | 2016-03-08 00:34:44 +0000 | [diff] [blame] | 236 | } |
| 237 | JSArray* createEmptyRegExpMatchesArray(JSGlobalObject*, JSString*, RegExp*); |
fpizlo@apple.com | 7518ba2 | 2016-03-06 20:11:09 +0000 | [diff] [blame] | 238 | Structure* createRegExpMatchesArrayStructure(VM&, JSGlobalObject*); |
msaboff@apple.com | dd96c36 | 2021-02-18 19:14:34 +0000 | [diff] [blame] | 239 | Structure* createRegExpMatchesArrayWithIndicesStructure(VM&, JSGlobalObject*); |
| 240 | Structure* createRegExpMatchesIndicesArrayStructure(VM&, JSGlobalObject*); |
fpizlo@apple.com | 7518ba2 | 2016-03-06 20:11:09 +0000 | [diff] [blame] | 241 | Structure* createRegExpMatchesArraySlowPutStructure(VM&, JSGlobalObject*); |
msaboff@apple.com | dd96c36 | 2021-02-18 19:14:34 +0000 | [diff] [blame] | 242 | Structure* createRegExpMatchesArrayWithIndicesSlowPutStructure(VM&, JSGlobalObject*); |
| 243 | Structure* createRegExpMatchesIndicesArraySlowPutStructure(VM&, JSGlobalObject*); |
akling@apple.com | 24400d2 | 2014-05-23 22:13:50 +0000 | [diff] [blame] | 244 | |
ryanhaddad@apple.com | 22104f5 | 2016-09-28 17:08:17 +0000 | [diff] [blame] | 245 | } // namespace JSC |