@@ -406,7 +406,8 @@ GlobOpt::ProcessFieldKills(IR::Instr *instr, BVSparse<JitArenaAllocator> *bv, bo
406
406
KillLiveFields (this ->lengthEquivBv , bv);
407
407
if (inGlobOpt)
408
408
{
409
- KillObjectHeaderInlinedTypeSyms (this ->currentBlock , false );
409
+ // Deleting an item, or pushing a property to a non-array, may change object layout
410
+ KillAllObjectTypes (bv);
410
411
}
411
412
break ;
412
413
@@ -423,27 +424,32 @@ GlobOpt::ProcessFieldKills(IR::Instr *instr, BVSparse<JitArenaAllocator> *bv, bo
423
424
case Js::OpCode::CallDirect:
424
425
fnHelper = instr->GetSrc1 ()->AsHelperCallOpnd ()->m_fnHelper ;
425
426
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)
430
428
{
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
440
438
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 ;
447
453
}
448
454
break ;
449
455
0 commit comments