summaryrefslogtreecommitdiffstats
path: root/js/src/vm/SelfHosting.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-11-26 13:37:09 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-11-26 13:37:09 +0100
commit185a9a750878ed1d9705fbd162dbfe9bf2e4ea0c (patch)
tree9b83879173624e3dcb5ba6d1404fb89f2c47cb66 /js/src/vm/SelfHosting.cpp
parente8c40b0bc2aa25b9f85ddbe3949c296311cc0f3f (diff)
downloadUXP-185a9a750878ed1d9705fbd162dbfe9bf2e4ea0c.tar
UXP-185a9a750878ed1d9705fbd162dbfe9bf2e4ea0c.tar.gz
UXP-185a9a750878ed1d9705fbd162dbfe9bf2e4ea0c.tar.lz
UXP-185a9a750878ed1d9705fbd162dbfe9bf2e4ea0c.tar.xz
UXP-185a9a750878ed1d9705fbd162dbfe9bf2e4ea0c.zip
Issue #1302 - Add self-hosted implementation for string regex .matchAll
This resolves #1302.
Diffstat (limited to 'js/src/vm/SelfHosting.cpp')
-rw-r--r--js/src/vm/SelfHosting.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp
index 833410465..ffd707b14 100644
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -857,6 +857,24 @@ intrinsic_NewStringIterator(JSContext* cx, unsigned argc, Value* vp)
}
static bool
+intrinsic_NewRegExpStringIterator(JSContext* cx, unsigned argc, Value* vp)
+{
+ CallArgs args = CallArgsFromVp(argc, vp);
+ MOZ_ASSERT(args.length() == 0);
+
+ RootedObject proto(cx, GlobalObject::getOrCreateRegExpStringIteratorPrototype(cx, cx->global()));
+ if (!proto)
+ return false;
+
+ JSObject* obj = NewObjectWithGivenProto(cx, &RegExpStringIteratorObject::class_, proto);
+ if (!obj)
+ return false;
+
+ args.rval().setObject(*obj);
+ return true;
+}
+
+static bool
intrinsic_SetCanonicalName(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
@@ -2288,6 +2306,8 @@ static const JSFunctionSpec intrinsic_functions[] = {
JS_INLINABLE_FN("GuardToStringIterator",
intrinsic_GuardToBuiltin<StringIteratorObject>, 1,0,
IntrinsicGuardToStringIterator),
+ JS_FN("GuardToRegExpStringIterator",
+ intrinsic_GuardToBuiltin<RegExpStringIteratorObject>, 1,0),
JS_FN("_CreateMapIterationResultPair", intrinsic_CreateMapIterationResultPair, 0, 0),
JS_INLINABLE_FN("_GetNextMapEntryForIterator", intrinsic_GetNextMapEntryForIterator, 2,0,
@@ -2305,6 +2325,9 @@ static const JSFunctionSpec intrinsic_functions[] = {
JS_FN("NewStringIterator", intrinsic_NewStringIterator, 0,0),
JS_FN("CallStringIteratorMethodIfWrapped",
CallNonGenericSelfhostedMethod<Is<StringIteratorObject>>, 2,0),
+ JS_FN("NewRegExpStringIterator", intrinsic_NewRegExpStringIterator, 0,0),
+ JS_FN("CallRegExpStringIteratorMethodIfWrapped",
+ CallNonGenericSelfhostedMethod<Is<RegExpStringIteratorObject>>, 2,0),
JS_FN("IsStarGeneratorObject",
intrinsic_IsInstanceOfBuiltin<StarGeneratorObject>, 1,0),