File tree Expand file tree Collapse file tree 1 file changed +20
-13
lines changed Expand file tree Collapse file tree 1 file changed +20
-13
lines changed Original file line number Diff line number Diff line change @@ -476,6 +476,20 @@ namespace Js
476
476
}
477
477
}
478
478
479
+ CallbackInfoList::EditingIterator TryFindCallbackInfoIterator (CallbackInfoList * list, ProfileId callSiteId)
480
+ {
481
+ CallbackInfoList::EditingIterator iter = list->GetEditingIterator ();
482
+ while (iter.Next ())
483
+ {
484
+ if (iter.Data ()->callSiteId == callSiteId)
485
+ {
486
+ return iter;
487
+ }
488
+ }
489
+
490
+ return iter;
491
+ }
492
+
479
493
CallbackInfo * DynamicProfileInfo::FindCallbackInfo (FunctionBody * funcBody, ProfileId callSiteId)
480
494
{
481
495
CallbackInfoList * list = funcBody->GetCallbackInfoList ();
@@ -484,14 +498,11 @@ namespace Js
484
498
return nullptr ;
485
499
}
486
500
487
- FOREACH_SLIST_ENTRY (Field (CallbackInfo *), callbackInfo, list)
501
+ CallbackInfoList::EditingIterator iter = TryFindCallbackInfoIterator (list, callSiteId);
502
+ if (iter.IsValid ())
488
503
{
489
- if (callbackInfo->callSiteId == callSiteId)
490
- {
491
- return callbackInfo;
492
- }
504
+ return iter.Data ();
493
505
}
494
- NEXT_SLIST_ENTRY;
495
506
496
507
return nullptr ;
497
508
}
@@ -506,14 +517,10 @@ namespace Js
506
517
funcBody->SetCallbackInfoList (list);
507
518
}
508
519
509
- CallbackInfoList::EditingIterator iter = list-> GetEditingIterator ( );
510
- while (iter.Next ())
520
+ CallbackInfoList::EditingIterator iter = TryFindCallbackInfoIterator (list, callSiteId );
521
+ if (iter.IsValid ())
511
522
{
512
- Field (CallbackInfo*) callbackInfo = iter.Data ();
513
- if (callbackInfo->callSiteId == callSiteId)
514
- {
515
- return callbackInfo;
516
- }
523
+ return iter.Data ();
517
524
}
518
525
519
526
// Callsite is not already in the list, so add it to the end.
You can’t perform that action at this time.
0 commit comments