BrowserWorks / Waterfox-Classic

The Waterfox Classic repository, for legacy systems and customisation.
https://classic.waterfox.net
Mozilla Public License 2.0
175 stars 34 forks source link

SpiderMonkey backports part 3 (logical assignment operators, fixes #118) #138

Closed buttercookie42 closed 1 year ago

buttercookie42 commented 2 years ago

‘I didn't have the time to write a short pull request, so I wrote a long one instead.’

The actual implementation of the logical assignment operators was quite compact (just three bugs – 1629106, 1639591 and 1684020), but apart from some refactorings that could be worked around relatively easily, there were two larger main dependencies:

  1. The {Name,Elem,PropOp}Emitters introduced in bug 1466000
  2. The last-minute spec changed introduced in bug 1639591 (grr!) suddenly introduced a dependency on the two-operator overload of emitAssignmentRhs(), which was introduced in bug 1571289 and quite a few more precursors.

So circling back to the slightly altered quote at the top, because I didn't want to write a custom abridged implementation of those requirements, I instead ended up dragging quite a few more additional bugs into this part of the backporting series.

If I remember correctly, the first few bugs starting from 1405122 to 1420400 are mostly just ride-alongs, i.e. I think I mostly stumbled across them while backporting something else in the same code area, but they wouldn't have been strictly necessary.

The various function name related changes starting from bug 1371591 to 1449887 and continuing at 1523791 up to 1571289 are all leading up to that emitAssignmentRhs() mentioned above.

Bug 1409295 I stumbled across while pinching the small emitCall()-refactoring from bug 1456404 – it seems that for Firefox 58, i.e. not all that long after 56, the endianness of the bytecode operands was swapped around, which initially caused some weird failures, because the backport from bug 1456404 of course already assumed the new endianness, which Waterfox didn't yet have.

The various Emitter-related changes are relatively straightforward – moving various emitters out the large pile in BytecodeEmitter.cpp/.h into their own dedicated files, plus preparatory changes made to the If…- and Try…-Emitters. Some small modifications have been done as required to account for the legacy JS features that were already removed in Firefox and that for the time being still survive in Waterfox (I think mainly related to conditional catch statements and a small bit regarding array/generator comprehensions).

One unexpected bonus was that after finishing the full backport of bug bug 1466000, I could also remove the workarounds that had to be introduced during the original optional chaining backport in order to work around the at-the-time missing CallOrNewEmitter.

MrAlex94 commented 1 year ago

Cheers! As always, will test to the best of our ability then merge :-)

reallyuniquename commented 1 year ago

Any ETA for the latest builds?