Bug 164536
| Summary: | We could strength reduce Spread(ArrayUse:@child) if its only consumer is NewArrayWithSpread | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Saam Barati <saam> |
| Component: | JavaScriptCore | Assignee: | Saam Barati <saam> |
| Status: | NEW | ||
| Severity: | Normal | CC: | benjamin, fpizlo, ggaren, gskachkov, jfbastien, keith_miller, mark.lam, msaboff, oliver, ticaiolima, ysuzuki |
| Priority: | P2 | ||
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Saam Barati
Right now, we are basically doing an extra memcpy into a JSFixedArray, however, if we know that NewArrayWithSpread is the only consumer
of a Spread, we could get rid of the spread, and have the NewArrayWithSpread just consume the array itself. NewArrayWithSpread is likely
to be the only consumer of the node since that's how we emit bytecode. If we write CSE rules in the future for Spread, this may not
be the case, but it's likely a good optimization to eliminate the Spread node here and just have NewArrayWithSpread understand how
to read the values out of a JS array.
For example:
```
a: ...
b: Spread(ArrayUse:@a)
c: NewArrayWithSpread(KnownCellUse:@b)
```
could be transformed into:
```
a: ...
c: NewArrayWithSpread(ArrayUse:@a)
```
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |