Skip to content

Commit 65f1bfe

Browse files
pleathMikeHolman
authored andcommitted
1 parent 15df2a6 commit 65f1bfe

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

lib/Backend/GlobOptFields.cpp

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,8 @@ GlobOpt::ProcessFieldKills(IR::Instr *instr, BVSparse<JitArenaAllocator> *bv, bo
406406
KillLiveFields(this->lengthEquivBv, bv);
407407
if (inGlobOpt)
408408
{
409-
KillObjectHeaderInlinedTypeSyms(this->currentBlock, false);
409+
// Deleting an item, or pushing a property to a non-array, may change object layout
410+
KillAllObjectTypes(bv);
410411
}
411412
break;
412413

@@ -423,27 +424,32 @@ GlobOpt::ProcessFieldKills(IR::Instr *instr, BVSparse<JitArenaAllocator> *bv, bo
423424
case Js::OpCode::CallDirect:
424425
fnHelper = instr->GetSrc1()->AsHelperCallOpnd()->m_fnHelper;
425426

426-
// Kill length field for built-ins that can update it.
427-
if(fnHelper == IR::JnHelperMethod::HelperArray_Shift
428-
|| fnHelper == IR::JnHelperMethod::HelperArray_Splice
429-
|| fnHelper == IR::JnHelperMethod::HelperArray_Unshift)
427+
switch (fnHelper)
430428
{
431-
if (nullptr != this->lengthEquivBv)
432-
{
433-
KillLiveFields(this->lengthEquivBv, bv);
434-
}
435-
if (inGlobOpt)
436-
{
437-
KillObjectHeaderInlinedTypeSyms(this->currentBlock, false);
438-
}
439-
}
429+
case IR::JnHelperMethod::HelperArray_Shift:
430+
case IR::JnHelperMethod::HelperArray_Splice:
431+
case IR::JnHelperMethod::HelperArray_Unshift:
432+
// Kill length field for built-ins that can update it.
433+
if (nullptr != this->lengthEquivBv)
434+
{
435+
KillLiveFields(this->lengthEquivBv, bv);
436+
}
437+
// fall through
440438

441-
if ((fnHelper == IR::JnHelperMethod::HelperRegExp_Exec)
442-
|| (fnHelper == IR::JnHelperMethod::HelperString_Match)
443-
|| (fnHelper == IR::JnHelperMethod::HelperString_Replace))
444-
{
445-
// Consider: We may not need to kill all fields here.
446-
this->KillAllFields(bv);
439+
case IR::JnHelperMethod::HelperArray_Reverse:
440+
// Deleting an item may change object layout
441+
if (inGlobOpt)
442+
{
443+
KillAllObjectTypes(bv);
444+
}
445+
break;
446+
447+
case IR::JnHelperMethod::HelperRegExp_Exec:
448+
case IR::JnHelperMethod::HelperString_Match:
449+
case IR::JnHelperMethod::HelperString_Replace:
450+
// Consider: We may not need to kill all fields here.
451+
this->KillAllFields(bv);
452+
break;
447453
}
448454
break;
449455

0 commit comments

Comments
 (0)