22
33const {
44 ArrayIsArray,
5+ ArrayPrototypeFilter,
6+ ArrayPrototypeIncludes,
7+ ArrayPrototypeMap,
8+ ArrayPrototypePush,
9+ ArrayPrototypeSplice,
10+ ArrayPrototypeUnshift,
511 Boolean,
612 NumberIsSafeInteger,
713 ObjectDefineProperties,
814 ObjectDefineProperty,
915 ObjectKeys,
10- Set ,
16+ SafeSet ,
1117 Symbol,
1218} = primordials ;
1319
@@ -394,7 +400,9 @@ class PerformanceObserver extends AsyncResource {
394400 if ( ! ArrayIsArray ( entryTypes ) ) {
395401 throw new ERR_INVALID_ARG_VALUE ( 'options.entryTypes' , entryTypes ) ;
396402 }
397- const filteredEntryTypes = entryTypes . filter ( filterTypes ) . map ( mapTypes ) ;
403+ const filteredEntryTypes =
404+ ArrayPrototypeMap ( ArrayPrototypeFilter ( entryTypes , filterTypes ) ,
405+ mapTypes ) ;
398406 if ( filteredEntryTypes . length === 0 ) {
399407 throw new ERR_VALID_PERFORMANCE_ENTRY_TYPE ( ) ;
400408 }
@@ -421,7 +429,7 @@ class PerformanceObserver extends AsyncResource {
421429class Performance {
422430 constructor ( ) {
423431 this [ kIndex ] = {
424- [ kMarks ] : new Set ( )
432+ [ kMarks ] : new SafeSet ( )
425433 } ;
426434 }
427435
@@ -588,7 +596,7 @@ function observersCallback(entry) {
588596setupObservers ( observersCallback ) ;
589597
590598function filterTypes ( i ) {
591- return observerableTypes . indexOf ( `${ i } ` ) >= 0 ;
599+ return ArrayPrototypeIncludes ( observerableTypes , `${ i } ` ) ;
592600}
593601
594602function mapTypes ( i ) {
@@ -626,15 +634,15 @@ function sortedInsert(list, entry) {
626634 const entryStartTime = entry . startTime ;
627635 if ( list . length === 0 ||
628636 ( list [ list . length - 1 ] . startTime < entryStartTime ) ) {
629- list . push ( entry ) ;
637+ ArrayPrototypePush ( list , entry ) ;
630638 return ;
631639 }
632640 if ( list [ 0 ] && ( list [ 0 ] . startTime > entryStartTime ) ) {
633- list . unshift ( entry ) ;
641+ ArrayPrototypeUnshift ( list , entry ) ;
634642 return ;
635643 }
636644 const location = getInsertLocation ( list , entryStartTime ) ;
637- list . splice ( location , 0 , entry ) ;
645+ ArrayPrototypeSplice ( list , location , 0 , entry ) ;
638646}
639647
640648class ELDHistogram extends Histogram {
0 commit comments