Closed
Bug 827108
Opened 12 years ago
Closed 1 month ago
Make distinction between double's where NaN are observed and not
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: h4writer, Unassigned)
References
Details
Just for reference atm. Currently I think the impact isn't big enough for the added complexity.
If we would be able to determine a double can't be a NaN it could simplify some codegeneration a bit and improve speed.
The case I'm looking at is: raytrace.js:223
initialize : function(x, y, z) {
this.x = (x ? x : 0);
this.y = (y ? y : 0);
this.z = (z ? z : 0);
},
We can determine that x, y and z are never undefined in the benchmark. Actually the type is always double in this benchmark, but we can specialize the code to:
initialize : function(x, y, z) {
this.x = x;
this.y = y;
this.z = z;
},
because NaN also returns false and need a 0. In this testcase NaN never occurs and removing the "if" would give a 1% increase on v8-raytrace.
Another way to solve this, is to decide that when NaN occurs in TestDAndBranch we bailout. Because NaN shouldn't be the main path and it doesn't matter if that path is slow ...
Assignee | ||
Updated•10 years ago
|
Assignee: general → nobody
Updated•2 years ago
|
Severity: normal → S3
Comment 2•1 month ago
|
||
This doesn't seem actionable. In general, we don't really have any way to guarantee that a function is never called with NaN arguments. It's also not clear to me how bailing out in TestDAndBranch would help. We have to test for NaN either way. If we never see a NaN, then the two cases are effectively identical. If we ever do see a NaN, then we would rather generate the (quite cheap) code to handle that case, instead of paying the cost of a bailout.
Status: NEW → RESOLVED
Closed: 1 month ago
Flags: needinfo?(iireland)
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•