stream: prevent object map change in TransformState
authorEvan Lucas <evanlucas@me.com>
Tue, 2 Feb 2016 00:17:48 +0000 (18:17 -0600)
committerMyles Borins <mborins@us.ibm.com>
Mon, 21 Mar 2016 19:57:54 +0000 (12:57 -0700)
TransformState has the writeencoding property that gets set on the
first _write. It is not declared when the transform state is initially
constructed and can cause a deopt.

PR-URL: https://github.com/nodejs/node/pull/5032
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
lib/_stream_transform.js

index eec4422..9c24394 100644 (file)
@@ -58,6 +58,7 @@ function TransformState(stream) {
   this.transforming = false;
   this.writecb = null;
   this.writechunk = null;
+  this.writeencoding = null;
 }
 
 function afterTransform(stream, er, data) {