@@ -228,6 +228,11 @@ GlobOpt::KillLiveElems(IR::IndirOpnd * indirOpnd, BVSparse<JitArenaAllocator> *
228228 this ->KillAllFields (bv); // This also kills all property type values, as the same bit-vector tracks those stack syms
229229 SetAnyPropertyMayBeWrittenTo ();
230230 }
231+ else if (inGlobOpt && indexOpnd && !indexOpnd->GetValueType ().IsInt () && !currentBlock->globOptData .IsInt32TypeSpecialized (indexOpnd->m_sym ))
232+ {
233+ // Write/delete to a non-integer numeric index can't alias a name on the RHS of a dot, but it change object layout
234+ this ->KillAllObjectTypes (bv);
235+ }
231236}
232237
233238void
@@ -397,7 +402,8 @@ GlobOpt::ProcessFieldKills(IR::Instr *instr, BVSparse<JitArenaAllocator> *bv, bo
397402 KillLiveFields (this ->lengthEquivBv , bv);
398403 if (inGlobOpt)
399404 {
400- KillObjectHeaderInlinedTypeSyms (this ->currentBlock , false );
405+ // Deleting an item, or pushing a property to a non-array, may change object layout
406+ KillAllObjectTypes (bv);
401407 }
402408 break ;
403409
@@ -414,27 +420,32 @@ GlobOpt::ProcessFieldKills(IR::Instr *instr, BVSparse<JitArenaAllocator> *bv, bo
414420 case Js::OpCode::CallDirect:
415421 fnHelper = instr->GetSrc1 ()->AsHelperCallOpnd ()->m_fnHelper ;
416422
417- // Kill length field for built-ins that can update it.
418- if (fnHelper == IR::JnHelperMethod::HelperArray_Shift
419- || fnHelper == IR::JnHelperMethod::HelperArray_Splice
420- || fnHelper == IR::JnHelperMethod::HelperArray_Unshift)
423+ switch (fnHelper)
421424 {
422- if ( nullptr != this -> lengthEquivBv )
423- {
424- KillLiveFields ( this -> lengthEquivBv , bv);
425- }
426- if (inGlobOpt )
427- {
428- KillObjectHeaderInlinedTypeSyms (this ->currentBlock , false );
429- }
430- }
425+ case IR::JnHelperMethod::HelperArray_Shift:
426+ case IR::JnHelperMethod::HelperArray_Splice:
427+ case IR::JnHelperMethod::HelperArray_Unshift:
428+ // Kill length field for built-ins that can update it.
429+ if (nullptr != this -> lengthEquivBv )
430+ {
431+ KillLiveFields (this ->lengthEquivBv , bv );
432+ }
433+ // fall through
431434
432- if ((fnHelper == IR::JnHelperMethod::HelperRegExp_Exec)
433- || (fnHelper == IR::JnHelperMethod::HelperString_Match)
434- || (fnHelper == IR::JnHelperMethod::HelperString_Replace))
435- {
436- // Consider: We may not need to kill all fields here.
437- this ->KillAllFields (bv);
435+ case IR::JnHelperMethod::HelperArray_Reverse:
436+ // Deleting an item may change object layout
437+ if (inGlobOpt)
438+ {
439+ KillAllObjectTypes (bv);
440+ }
441+ break ;
442+
443+ case IR::JnHelperMethod::HelperRegExp_Exec:
444+ case IR::JnHelperMethod::HelperString_Match:
445+ case IR::JnHelperMethod::HelperString_Replace:
446+ // Consider: We may not need to kill all fields here.
447+ this ->KillAllFields (bv);
448+ break ;
438449 }
439450 break ;
440451
0 commit comments