@@ -237,6 +237,11 @@ GlobOpt::KillLiveElems(IR::IndirOpnd * indirOpnd, BVSparse<JitArenaAllocator> *
237237 this ->KillAllFields (bv); // This also kills all property type values, as the same bit-vector tracks those stack syms
238238 SetAnyPropertyMayBeWrittenTo ();
239239 }
240+ else if (inGlobOpt && indexOpnd && !indexOpnd->GetValueType ().IsInt () && !currentBlock->globOptData .IsInt32TypeSpecialized (indexOpnd->m_sym ))
241+ {
242+ // Write/delete to a non-integer numeric index can't alias a name on the RHS of a dot, but it change object layout
243+ this ->KillAllObjectTypes (bv);
244+ }
240245}
241246
242247void
@@ -406,7 +411,8 @@ GlobOpt::ProcessFieldKills(IR::Instr *instr, BVSparse<JitArenaAllocator> *bv, bo
406411 KillLiveFields (this ->lengthEquivBv , bv);
407412 if (inGlobOpt)
408413 {
409- KillObjectHeaderInlinedTypeSyms (this ->currentBlock , false );
414+ // Deleting an item, or pushing a property to a non-array, may change object layout
415+ KillAllObjectTypes (bv);
410416 }
411417 break ;
412418
@@ -423,27 +429,32 @@ GlobOpt::ProcessFieldKills(IR::Instr *instr, BVSparse<JitArenaAllocator> *bv, bo
423429 case Js::OpCode::CallDirect:
424430 fnHelper = instr->GetSrc1 ()->AsHelperCallOpnd ()->m_fnHelper ;
425431
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)
432+ switch (fnHelper)
430433 {
431- if ( nullptr != this -> lengthEquivBv )
432- {
433- KillLiveFields ( this -> lengthEquivBv , bv);
434- }
435- if (inGlobOpt )
436- {
437- KillObjectHeaderInlinedTypeSyms (this ->currentBlock , false );
438- }
439- }
434+ case IR::JnHelperMethod::HelperArray_Shift:
435+ case IR::JnHelperMethod::HelperArray_Splice:
436+ case IR::JnHelperMethod::HelperArray_Unshift:
437+ // Kill length field for built-ins that can update it.
438+ if (nullptr != this -> lengthEquivBv )
439+ {
440+ KillLiveFields (this ->lengthEquivBv , bv );
441+ }
442+ // fall through
440443
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);
444+ case IR::JnHelperMethod::HelperArray_Reverse:
445+ // Deleting an item may change object layout
446+ if (inGlobOpt)
447+ {
448+ KillAllObjectTypes (bv);
449+ }
450+ break ;
451+
452+ case IR::JnHelperMethod::HelperRegExp_Exec:
453+ case IR::JnHelperMethod::HelperString_Match:
454+ case IR::JnHelperMethod::HelperString_Replace:
455+ // Consider: We may not need to kill all fields here.
456+ this ->KillAllFields (bv);
457+ break ;
447458 }
448459 break ;
449460
0 commit comments