Closed
Bug 1307494
Opened 8 years ago
Closed 4 years ago
Improve type information for default parameters
Categories
(Core :: JavaScript Engine: JIT, defect, P3)
Core
JavaScript Engine: JIT
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: jandem, Unassigned)
References
(Blocks 2 open bugs)
Details
(Keywords: perf)
See bug 1306450. The following pattern is quite common:
if (x === undefined)
x = 0;
ES6 default arguments use similar bytecode:
function f(x = 0) {}
IonBuilder has code to optimize TypeSets when using these comparisons, but it doesn't handle this case. After the if-statement, we should be able to remove |undefined| from x's TypeSet, with some analysis.
Updated•8 years ago
|
Blocks: es6perf
Summary: Improve type information for optional arguments → Improve type information for default parameters
Updated•8 years ago
|
Assignee: nobody → evilpies
Updated•8 years ago
|
Assignee: evilpies → nobody
Comment 1•8 years ago
|
||
Is this still a problem? I think I get the correct information for this trivial example.
> function f(x) {
> if (x === undefined)
> x = 0;
> return x;
> }
>
> function g(x = 0) {
> return x;
> }
>
> f()
> g()
Comment 2•8 years ago
|
||
This example is probably too trivial. We want good type information even when the call to f or g is not inlined and the method is called with no parameter, undefined and some number like 0.
So even when type of x is undefined or a number the type inside the body (or after the if) is still a number.
Comment 3•4 years ago
|
||
We don't have TypeSets anymore.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•