@@ -314,56 +314,6 @@ IRBuilder::AddEnvOpndForInnerFrameDisplay(IR::Instr *instr, uint offset)
314314 }
315315}
316316
317- bool
318- IRBuilder::DoSlotArrayCheck (IR::SymOpnd *fieldOpnd, bool doDynamicCheck)
319- {
320- if (PHASE_OFF (Js::ClosureRangeCheckPhase, m_func))
321- {
322- return true ;
323- }
324-
325- PropertySym *propertySym = fieldOpnd->m_sym ->AsPropertySym ();
326- IR::Instr *instrDef = propertySym->m_stackSym ->m_instrDef ;
327- IR::Opnd *allocOpnd = nullptr ;
328-
329- if (instrDef == nullptr )
330- {
331- if (doDynamicCheck)
332- {
333- return false ;
334- }
335- Js::Throw::FatalInternalError ();
336- }
337- switch (instrDef->m_opcode )
338- {
339- case Js::OpCode::NewScopeSlots:
340- case Js::OpCode::NewStackScopeSlots:
341- case Js::OpCode::NewScopeSlotsWithoutPropIds:
342- allocOpnd = instrDef->GetSrc1 ();
343- break ;
344-
345- case Js::OpCode::LdSlot:
346- case Js::OpCode::LdSlotArr:
347- if (doDynamicCheck)
348- {
349- return false ;
350- }
351- // fall through
352- default :
353- Js::Throw::FatalInternalError ();
354- }
355-
356- uint32 allocCount = allocOpnd->AsIntConstOpnd ()->AsUint32 ();
357- uint32 slotId = (uint32)propertySym->m_propertyId ;
358-
359- if (slotId >= allocCount)
360- {
361- Js::Throw::FatalInternalError ();
362- }
363-
364- return true ;
365- }
366-
367317// /----------------------------------------------------------------------------
368318// /
369319// / IRBuilder::Build
@@ -904,40 +854,6 @@ IRBuilder::Build()
904854void
905855IRBuilder::EmitClosureRangeChecks ()
906856{
907- // Emit closure range checks
908- if (m_func->slotArrayCheckTable )
909- {
910- // Local slot array checks, should only be necessary in jitted loop bodies.
911- FOREACH_HASHTABLE_ENTRY (uint32, bucket, m_func->slotArrayCheckTable )
912- {
913- uint32 slotId = bucket.element ;
914- Assert (slotId != (uint32)-1 && slotId >= Js::ScopeSlots::FirstSlotIndex);
915-
916- if (slotId > Js::ScopeSlots::FirstSlotIndex)
917- {
918- // Emit a SlotArrayCheck instruction, chained to the instruction (LdSlot) that defines the pointer.
919- StackSym *stackSym = m_func->m_symTable ->FindStackSym (bucket.value );
920- Assert (stackSym && stackSym->m_instrDef );
921-
922- IR::Instr *instrDef = stackSym->m_instrDef ;
923- IR::Instr *insertInstr = instrDef->m_next ;
924- IR::RegOpnd *dstOpnd = instrDef->UnlinkDst ()->AsRegOpnd ();
925- IR::Instr *instr = IR::Instr::New (Js::OpCode::SlotArrayCheck, dstOpnd, m_func);
926-
927- dstOpnd = IR::RegOpnd::New (TyVar, m_func);
928- instrDef->SetDst (dstOpnd);
929- instr->SetSrc1 (dstOpnd);
930-
931- // Attach the slot ID to the check instruction.
932- IR::IntConstOpnd *slotIdOpnd = IR::IntConstOpnd::New (bucket.element , TyUint32, m_func);
933- instr->SetSrc2 (slotIdOpnd);
934-
935- insertInstr->InsertBefore (instr);
936- }
937- }
938- NEXT_HASHTABLE_ENTRY;
939- }
940-
941857 if (m_func->frameDisplayCheckTable )
942858 {
943859 // Frame display checks. Again, chain to the instruction (LdEnv/LdSlot).
@@ -3571,8 +3487,6 @@ IRBuilder::BuildElementSlotI1(Js::OpCode newOpcode, uint32 offset, Js::RegSlot r
35713487 if (IsLoopBody ())
35723488 {
35733489 fieldOpnd = this ->BuildFieldOpnd (Js::OpCode::LdSlotArr, closureSym->m_id , slotId, (Js::PropertyIdIndexType)-1 , PropertyKindSlotArray);
3574- // Need a dynamic check on the size of the local slot array.
3575- m_func->GetTopFunc ()->AddSlotArrayCheck (fieldOpnd);
35763490 }
35773491 }
35783492 else if (IsLoopBody ())
@@ -3594,11 +3508,6 @@ IRBuilder::BuildElementSlotI1(Js::OpCode newOpcode, uint32 offset, Js::RegSlot r
35943508 }
35953509 this ->AddInstr (instr, offset);
35963510
3597- if (!m_func->DoStackFrameDisplay () && IsLoopBody ())
3598- {
3599- // Need a dynamic check on the size of the local slot array.
3600- m_func->GetTopFunc ()->AddSlotArrayCheck (fieldOpnd);
3601- }
36023511 break ;
36033512
36043513 case Js::OpCode::LdParamObjSlot:
@@ -3676,8 +3585,6 @@ IRBuilder::BuildElementSlotI1(Js::OpCode newOpcode, uint32 offset, Js::RegSlot r
36763585 if (IsLoopBody ())
36773586 {
36783587 fieldOpnd = this ->BuildFieldOpnd (Js::OpCode::LdSlotArr, closureSym->m_id , slotId, (Js::PropertyIdIndexType)-1 , PropertyKindSlotArray);
3679- // Need a dynamic check on the size of the local slot array.
3680- m_func->GetTopFunc ()->AddSlotArrayCheck (fieldOpnd);
36813588 }
36823589 }
36833590 else
@@ -3697,11 +3604,6 @@ IRBuilder::BuildElementSlotI1(Js::OpCode newOpcode, uint32 offset, Js::RegSlot r
36973604 instr->SetSrc2 (fieldOpnd);
36983605 }
36993606
3700- if (!m_func->DoStackFrameDisplay () && IsLoopBody ())
3701- {
3702- // Need a dynamic check on the size of the local slot array.
3703- m_func->GetTopFunc ()->AddSlotArrayCheck (fieldOpnd);
3704- }
37053607 break ;
37063608
37073609 case Js::OpCode::StParamObjSlot:
@@ -4013,11 +3915,6 @@ IRBuilder::BuildElementSlotI2(Js::OpCode newOpcode, uint32 offset, Js::RegSlot r
40133915 else
40143916 {
40153917 fieldOpnd = this ->BuildFieldOpnd (Js::OpCode::StSlot, slotId1, slotId2, (Js::PropertyIdIndexType)-1 , PropertyKindSlots);
4016- if (!this ->DoSlotArrayCheck (fieldOpnd, IsLoopBody ()))
4017- {
4018- // Need a dynamic check on the size of the local slot array.
4019- m_func->GetTopFunc ()->AddSlotArrayCheck (fieldOpnd);
4020- }
40213918 }
40223919 newOpcode =
40233920 newOpcode == Js::OpCode::StInnerObjSlot || newOpcode == Js::OpCode::StInnerSlot ?
@@ -4056,11 +3953,6 @@ IRBuilder::BuildElementSlotI2(Js::OpCode newOpcode, uint32 offset, Js::RegSlot r
40563953 else
40573954 {
40583955 fieldOpnd = this ->BuildFieldOpnd (Js::OpCode::LdSlot, slotId1, slotId2, (Js::PropertyIdIndexType)-1 , PropertyKindSlots);
4059- if (!this ->DoSlotArrayCheck (fieldOpnd, IsLoopBody ()))
4060- {
4061- // Need a dynamic check on the size of the local slot array.
4062- m_func->GetTopFunc ()->AddSlotArrayCheck (fieldOpnd);
4063- }
40643956 }
40653957 regOpnd = this ->BuildDstOpnd (regSlot);
40663958 instr = IR::Instr::New (Js::OpCode::LdSlot, regOpnd, fieldOpnd, m_func);
0 commit comments