Closed Bug 1626713 Opened 4 years ago Closed 4 years ago

Parse regexps using new irregexp import

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
mozilla76
Tracking Status
firefox76 --- fixed

People

(Reporter: iain, Assigned: iain)

References

Details

Attachments

(4 files)

Now that all the patches in bug 1594545 have landed, we have a fully functional copy of irregexp sitting inside SM; it's just not hooked up to anything.

The regexp API has three main entry points: parsing, compiling, and executing. Parsing is the easiest, so I'm starting there.

If we are using the new import, we don't need the old one.

Note about the testing functions: disRegExp appears to have been broken since we added unicode support. parseRegExp is used for a set of tests (in jit_test/tests/regexp_parse) that hardcode an expected parse tree for various expressions. I don't think either function provides much value.

This is the interface for SM-to-irregexp calls. Eventually it will support CheckPatternSyntax, CompilePattern, and Execute. For now, we just hook things up so that JSContext owns an Isolate.

Depends on D69259

This is the first point at which we can actually run irregexp code. For now, it doesn't do much: it can verify that a regexp has valid syntax, but actually reporting syntax errors doesn't happen until the next patch, and we hit a MOZ_CRASH if you try to actually execute the regexp. (Nevertheless, it works well enough to expose some dumb off-by-one errors in the shim code.)

Depends on D69260

I had to upstream a patch rewriting irregexp's error handling to make this work, but we should have very nearly the same syntax errors as the old implementation. There are a few small exceptions in cases where we added unicode support after importing, and decided to report slightly different things, but nothing that seems like it should matter. There are two dead error messages. I have made a note to remove them after the old implementation is gone and no longer needs them.

ReportSyntaxError is based as closely as possible on the existing implementation in irregexp/RegExpParser.cpp.

Depends on D69261

Pushed by iireland@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9def7a103c25
Part 1: Remove old engine from ENABLE_NEW_REGEXP builds r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/71800b0febdc
Part 2: Add RegExpAPI r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/50141d10eb45
Part 3: CheckPatternSyntax r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/1b3459cf03a7
Part 4: Syntax errors r=mgaudet
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: