Closed Bug 1021888 Opened 12 years ago Closed 2 years ago

Self-host Math.sign

Categories

(Core :: JavaScript Engine, enhancement)

enhancement

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: sunfish, Unassigned)

Details

Math.sign(x) could be implemented as x > 0 ? 1 : x < 0 ? -1 : x. We don't do that in the current C++ code because we don't trust all our C++ compilers to preserve NaN and negative-zero nuances, but that wouldn't be a problem in self-hosted JS.
Severity: normal → S3

Currently we are making use of ICs to cache whether we should expect -0 / NaN nuances, and generate integer options in Ion.
Making this from self-hosted code might be more challenging given that WarpBuilder does not remove branches which have no ICs in them, which would be the case of the else-part, which would let a double type flow out of the Phi instruction.

Thus I think our caching mechanism is superior to having it self-hosted at the moment.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.