Closed Bug 1651445 Opened 4 years ago Closed 4 years ago

Stop using CallNonGenericMethod for Number methods

Categories

(Core :: JavaScript: Standard Library, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
mozilla80
Tracking Status
firefox80 --- fixed

People

(Reporter: evilpie, Assigned: evilpie)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

Currently we are using CallNonGenericMethod for all Number methods. That function is sort of broken (see bug 1535587). Instead we implement something closer to the spec's thisNumberValue using UnwrapAndTypeCheckThis. Number is really a easy case because we can just return a C++ double.

With this change we also get slightly improved error messages,
before

toString method called on incompatible boolean

after

Number.prototype.toString called on incompatible boolean

This also fixes a bug similar to bug 1644878, where Number.prototype.toLocaleString.call(false) used to produce

std_Number_valueOf method called on incompatible boolean

Pushed by evilpies@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/500b6b395b10
Stop using CallNonGenericMethod for Number methods. r=anba
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla80
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: