diff --git a/lib/timers.js b/lib/timers.js index 6fc552fac7d444..cc8d6432058a82 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -218,11 +218,11 @@ function TimersList(msecs, unrefed) { if (unrefed === true) timer.unref(); timer.start(msecs); - - timer[kOnTimeout] = listOnTimeout; } -function listOnTimeout() { +// adds listOnTimeout to the C++ object prototype, as +// V8 would not inline it otherwise. +TimerWrap.prototype[kOnTimeout] = function listOnTimeout() { var list = this._list; var msecs = list.msecs; @@ -291,7 +291,7 @@ function listOnTimeout() { return; this.close(); -} +}; // An optimization so that the try/finally only de-optimizes (since at least v8