This repository was archived by the owner on Oct 15, 2020. It is now read-only.
Commit e41955f
deps: update ChakraCore to chakra-core/ChakraCore@965f77965c
[1.8>1.9] [MERGE #4627 @meg-gupta] Fix missed copyprop opportunity due to unhandled InitFld case
Merge pull request #4627 from meg-gupta:fixopt
```var num = 50;
function inlineCall(tnum) {
return {x : tnum}; // InitFld
}
function foo (obj) {
var tnum = num;
var sum = 0;
while (tnum >= 0) {
var retObj = inlineCall(tnum);
if (tnum > 10) {
sum += retObj.x; // missed copy prop opportunity
}
tnum--;
}
return sum;
}
var obj = {};
foo(obj);
foo(obj);
foo(obj)
```
We were not setting a property initialized from InitFld instruction on the liveFields bit vector,
this led to returning null valueInfo when we queried through GlobOptBlockData::FindPropertyValue,
because that function checks if the property is live first and then queries its valauenumber from the symToValue map.
This pattern comes up in forof on array iterators, the constructor returns an object literal and we miss copy proping
Reviewed-By: chakrabot <[email protected]>1 parent d626720 commit e41955f
2 files changed
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3662 | 3662 | | |
3663 | 3663 | | |
3664 | 3664 | | |
3665 | | - | |
3666 | 3665 | | |
3667 | 3666 | | |
3668 | 3667 | | |
| |||
4847 | 4846 | | |
4848 | 4847 | | |
4849 | 4848 | | |
| 4849 | + | |
| 4850 | + | |
4850 | 4851 | | |
4851 | 4852 | | |
4852 | 4853 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
476 | 480 | | |
477 | 481 | | |
478 | 482 | | |
| |||
504 | 508 | | |
505 | 509 | | |
506 | 510 | | |
507 | | - | |
| 511 | + | |
508 | 512 | | |
509 | 513 | | |
510 | 514 | | |
| |||
0 commit comments