diff --git a/lib/internal/freelist.js b/lib/internal/freelist.js index ac2b12c4d45a54..6366bc8f9d2002 100644 --- a/lib/internal/freelist.js +++ b/lib/internal/freelist.js @@ -1,6 +1,8 @@ 'use strict'; const { + ArrayPrototypePop, + ArrayPrototypePush, ReflectApply, } = primordials; @@ -14,13 +16,13 @@ class FreeList { alloc() { return this.list.length > 0 ? - this.list.pop() : + ArrayPrototypePop(this.list) : ReflectApply(this.ctor, this, arguments); } free(obj) { if (this.list.length < this.max) { - this.list.push(obj); + ArrayPrototypePush(this.list, obj); return true; } return false;