Closed Bug 1662073 Opened 5 years ago Closed 5 years ago

Various RegExp/Irregexp cleanups

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

RESOLVED FIXED
82 Branch
Tracking Status
firefox82 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(8 files)

Umbrella issue for various small clean-ups in RegExp/Irregexp code:

  • Update "make_unicode.py" to work under Python 3.7.
  • Remove no longer needed code from "make_unicode.py".
  • Remove effectively dead code in RegExp code.
  • Avoid unnecessary rooting in RegExp named capturing code.
  • ...

next() throws StopIteration when the iterator has been exhausted. Before
PEP 479, throwing StopIteration implicitly closes a generator and is not
propagated to the caller. After PEP 479, the StopIteration error is propagated
to the caller.

These macros were used by the local irregexp copy to implement Unicode RegExps.
They have been replaced by calls to ICU.

Depends on D88789

The files generated by these functions were already removed.

Depends on D88790

The skip out-param is only read when InterpretDollar returns true, so we
can remove both assignments which are followed by return false.

Drive-by change:

  • Move another assignment to skip to appear directly before return true, so
    it's more obvious that skip only needs to be set on success.
  • Add a blank line before a comment, per our normal style guides.

Depends on D88791

Remove unnecessary rooting and move a rooting variable outside of a loop. Sadly
we still don't have static analysis to catch this (bug 1362038).

Drive-by change:

  • Add more blank lines before comments.

Depends on D88792

These two loops can be simplified to use ranged for-loops, reducing a bit of
boilerplate code.

Depends on D88793

It seems nice to also assert the array length is divisible by two, given that
the array is created entirely elsewhere.

Depends on D88794

Add a getShared accessor to RegExpObject to retrieve a previously assigned
RegExpShared object. And then replace two calls to the fallible
RegExpObject::getShared() method with the new accessor. This way we can
avoid calling a fallible method whose return value is ignored.

Depends on D88795

Severity: -- → N/A
Priority: -- → P2
Pushed by btara@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d77322fe8d1b Part 1: Make make_unicode.py Python3.7 compatible (PEP 479). r=iain https://hg.mozilla.org/integration/autoland/rev/d69b33dc4238 Part 2: Removed no longer used Unicode case folding macros. r=iain https://hg.mozilla.org/integration/autoland/rev/9b07e4b58ce1 Part 3: Remove irregexp table generation from Unicode script. r=iain https://hg.mozilla.org/integration/autoland/rev/747a630e409c Part 4: Remove unnecessary assignment to `skip` out-param in InterpretDollar. r=iain https://hg.mozilla.org/integration/autoland/rev/de9376528044 Part 5: Remove unnecessary rooting for RegExp named captures. r=iain https://hg.mozilla.org/integration/autoland/rev/2fc5e4134cf1 Part 6: Use ranged for-loops in RegExp named capturing code. r=iain https://hg.mozilla.org/integration/autoland/rev/7d6facecd556 Part 7: Assert named capturing groups array length is divisible by two. r=iain https://hg.mozilla.org/integration/autoland/rev/c5bdc46e971b Part 8: Add `getShared` accessor to RegExp object. r=iain
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: