From bc4d446073ae5fa11fdee9d01c4a389de6001404 Mon Sep 17 00:00:00 2001 From: uzlopak Date: Sun, 28 Nov 2021 13:42:55 +0100 Subject: [PATCH 1/2] fix inline caching deoptimization --- deps/dicer/lib/Dicer.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/deps/dicer/lib/Dicer.js b/deps/dicer/lib/Dicer.js index 9d580cb..93bfc97 100644 --- a/deps/dicer/lib/Dicer.js +++ b/deps/dicer/lib/Dicer.js @@ -175,9 +175,10 @@ Dicer.prototype._oninfo = function(isMatch, data, start, end) { this._part._read = function(n) { self._unpause(); }; - ev = this._isPreamble ? 'preamble' : 'part'; - if (this._events[ev]) - this.emit(ev, this._part); + if (this._isPreamble && this._events['preamble']) + this.emit('preamble', this._part); + else if (this._isPreamble !== true && this._events['part']) + this.emit('part', this._part); else this._ignore(); if (!this._isPreamble) From bc09007d7f81278e3aa513d3d502663b37f0baf7 Mon Sep 17 00:00:00 2001 From: uzlopak Date: Mon, 29 Nov 2021 14:37:13 +0100 Subject: [PATCH 2/2] remove ev instantiation --- deps/dicer/lib/Dicer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/dicer/lib/Dicer.js b/deps/dicer/lib/Dicer.js index 93bfc97..0d1f994 100644 --- a/deps/dicer/lib/Dicer.js +++ b/deps/dicer/lib/Dicer.js @@ -139,7 +139,7 @@ Dicer.prototype._ignore = function() { }; Dicer.prototype._oninfo = function(isMatch, data, start, end) { - var buf, self = this, i = 0, r, ev, shouldWriteMore = true; + var buf, self = this, i = 0, r, shouldWriteMore = true; if (!this._part && this._justMatched && data) { while (this._dashes < 2 && (start + i) < end) {