Bug 185039 - DFGArgumentsEliminationPhase should be able to get rid of allocations for NewArrayWithSpread made of other NewArrayWithSpread
Summary: DFGArgumentsEliminationPhase should be able to get rid of allocations for New...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Robin Morisset
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-26 12:20 PDT by Robin Morisset
Modified: 2018-04-26 12:20 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Morisset 2018-04-26 12:20:29 PDT
I am thinking of code like the following (admittedly a bit artificial):
function f(...a) {
    var b = [...a, ...a];
    var c = [...b, 42, ...b]
    // do stuff with c here without letting it escape
}
There is no good reason for this code not to be optimized, but currently we only optimize NewArrayWithSpread if its Spread(s) come from a NewArrayBuffer or a CreateRest, and not if they come for example from a NewArrayWithSpread.