Skip to content

Commit 6479e1b

Browse files
author
Meghana Gupta
committed
[1.6>1.7] [MERGE #3536 @meg-gupta] Do not peep closure stack symbols
Merge pull request #3536 from meg-gupta:fixclosure
2 parents 94db98c + c1e3990 commit 6479e1b

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

lib/Backend/Lower.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10078,7 +10078,9 @@ Lowerer::CreateOpndForSlotAccess(IR::Opnd * opnd)
1007810078
// Stack closure syms are made to look like slot accesses for the benefit of GlobOpt, so that it can do proper
1007910079
// copy prop and implicit call bailout. But what we really want is local stack load/store.
1008010080
// Don't do this for loop body, though, since we don't have the value saved on the stack.
10081-
return IR::SymOpnd::New(dstSym->m_stackSym, 0, TyMachReg, this->m_func);
10081+
IR::SymOpnd * closureSym = IR::SymOpnd::New(dstSym->m_stackSym, 0, TyMachReg, this->m_func);
10082+
closureSym->GetStackSym()->m_isClosureSym = true;
10083+
return closureSym;
1008210084
}
1008310085

1008410086
int32 offset = dstSym->m_propertyId;

lib/Backend/Peeps.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,14 @@ Peeps::ClearRegMap()
384384
void
385385
Peeps::SetReg(RegNum reg, StackSym *sym)
386386
{
387-
this->ClearReg(sym->scratch.peeps.reg);
388387
this->ClearReg(reg);
389388

389+
if (sym->m_isClosureSym)
390+
{
391+
return;
392+
}
393+
394+
this->ClearReg(sym->scratch.peeps.reg);
390395
this->regMap[reg] = sym;
391396
sym->scratch.peeps.reg = reg;
392397
}

lib/Backend/Sym.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ StackSym::New(SymID id, IRType type, Js::RegSlot byteCodeRegSlot, Func *func)
5454
stackSym->m_isArgCaptured = false;
5555
stackSym->m_requiresBailOnNotNumber = false;
5656
stackSym->m_isCatchObjectSym = false;
57+
stackSym->m_isClosureSym = false;
5758
stackSym->m_builtInIndex = Js::BuiltinFunction::None;
5859
stackSym->m_slotNum = StackSym::InvalidSlot;
5960

@@ -503,7 +504,7 @@ StackSym::CloneDef(Func *func)
503504
newSym->m_allocated = m_allocated;
504505
newSym->m_isInlinedArgSlot = m_isInlinedArgSlot;
505506
newSym->m_isCatchObjectSym = m_isCatchObjectSym;
506-
507+
newSym->m_isClosureSym = m_isClosureSym;
507508
newSym->m_type = m_type;
508509

509510
newSym->CopySymAttrs(this);

lib/Backend/Sym.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ class StackSym: public Sym
231231
uint8 m_isArgCaptured: 1; // True if there is a ByteCodeArgOutCapture for this symbol
232232
uint8 m_nonEscapingArgObjAlias : 1;
233233
uint8 m_isCatchObjectSym : 1; // a catch object sym (used while jitting loop bodies)
234+
uint m_isClosureSym : 1;
234235
IRType m_type;
235236
Js::BuiltinFunction m_builtInIndex;
236237

0 commit comments

Comments
 (0)