Skip to content

Commit 48295e3

Browse files
committed
[MERGE chakra-core#857] PRE bookkeeping fix
Merge pull request chakra-core#857 from pleath:killallfields When we clear out live fields on discovering that implicit calls prevent loop optimization, we leave the same syms in the loop's initialValueFieldMap, resulting in later asserts. Two things: should use the KillAllFields API to clear out the live fields BV, and that API should walk the loop hierarchy setting the allFieldsKilled bits.
2 parents 219bbbf + ae916c1 commit 48295e3

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

lib/Backend/GlobOpt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ GlobOpt::OptBlock(BasicBlock *block)
584584
Assert(!TrackHoistableFields() || !HasHoistableFields(&this->blockData));
585585
if (!DoFieldCopyProp() && !DoFieldRefOpts())
586586
{
587-
this->blockData.liveFields->ClearAll();
587+
this->KillAllFields(blockData.liveFields);
588588
}
589589
}
590590

lib/Backend/GlobOptFields.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,10 @@ GlobOpt::KillLiveFields(StackSym * stackSym, BVSparse<JitArenaAllocator> * bv)
310310
bv->Clear(propertySym->m_id);
311311
if (this->IsLoopPrePass())
312312
{
313-
this->rootLoopPrePass->fieldKilled->Set(propertySym->m_id);
313+
for (Loop * loop = this->rootLoopPrePass; loop != nullptr; loop = loop->parent)
314+
{
315+
loop->fieldKilled->Set(propertySym->m_id);
316+
}
314317
}
315318
else if (bv->IsEmpty())
316319
{
@@ -339,7 +342,10 @@ void GlobOpt::KillLiveFields(BVSparse<JitArenaAllocator> *const propertyEquivSet
339342

340343
if (this->IsLoopPrePass())
341344
{
342-
this->rootLoopPrePass->fieldKilled->Or(propertyEquivSet);
345+
for (Loop * loop = this->rootLoopPrePass; loop != nullptr; loop = loop->parent)
346+
{
347+
loop->fieldKilled->Or(propertyEquivSet);
348+
}
343349
}
344350
}
345351
}
@@ -382,7 +388,10 @@ GlobOpt::KillAllFields(BVSparse<JitArenaAllocator> * bv)
382388
bv->ClearAll();
383389
if (this->IsLoopPrePass())
384390
{
385-
this->rootLoopPrePass->allFieldsKilled = true;
391+
for (Loop * loop = this->rootLoopPrePass; loop != nullptr; loop = loop->parent)
392+
{
393+
loop->allFieldsKilled = true;
394+
}
386395
}
387396
}
388397

0 commit comments

Comments
 (0)