File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -1537,6 +1537,17 @@ GlobOpt::OptArguments(IR::Instr *instr)
1537
1537
CannotAllocateArgumentsObjectOnStack(instr->m_func);
1538
1538
return;
1539
1539
}
1540
+
1541
+ // Disable stack args if we are aliasing arguments inside try block to a writethrough symbol.
1542
+ // We don't have precise tracking of these symbols, so bailout couldn't know if it needs to restore arguments object or not after exception
1543
+ Region* tryRegion = this->currentRegion ? this->currentRegion->GetSelfOrFirstTryAncestor() : nullptr;
1544
+ if (tryRegion && tryRegion->GetType() == RegionTypeTry &&
1545
+ tryRegion->writeThroughSymbolsSet &&
1546
+ tryRegion->writeThroughSymbolsSet->Test(dst->AsRegOpnd()->m_sym->m_id))
1547
+ {
1548
+ CannotAllocateArgumentsObjectOnStack(instr->m_func);
1549
+ return;
1550
+ }
1540
1551
if(!dst->AsRegOpnd()->GetStackSym()->m_nonEscapingArgObjAlias)
1541
1552
{
1542
1553
CurrentBlockData()->TrackArgumentsSym(dst->AsRegOpnd());
Original file line number Diff line number Diff line change
1
+ function bar ( ) {
2
+ throw new Error ( ) ;
3
+ }
4
+ function foo ( ) {
5
+ try {
6
+ x = arguments ;
7
+ bar ( ) ;
8
+ } catch ( e ) {
9
+ return x . length ;
10
+ }
11
+ var x = {
12
+ j : 1 ,
13
+ k : 2.2
14
+ } ;
15
+ }
16
+ foo ( ) ;
17
+ foo ( ) ;
18
+ let pass = foo ( ) === 0 ;
19
+
20
+ print ( pass ? "Pass" : "Fail" )
Original file line number Diff line number Diff line change 1611
1611
<compile-flags >-maxinterpretcount:1 -maxsimplejitruncount:1</compile-flags >
1612
1612
</default >
1613
1613
</test >
1614
+ <test >
1615
+ <default >
1616
+ <files >argrestoreintry.js</files >
1617
+ <compile-flags >-maxinterpretcount:1 -maxsimplejitruncount:1</compile-flags >
1618
+ </default >
1619
+ </test >
1614
1620
</regress-exe >
You can’t perform that action at this time.
0 commit comments