Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bf06534

Browse filesBrowse files
bmeureraddaleax
authored andcommitted
stream: ensure that instanceof fast-path is hit.
With the new Ignition+TurboFan pipeline, the instanceof fast-path can be missed if the right-hand side needs a TDZ check, i.e. is const declared on a surrounding scope. This doesn't apply to Node 8 at this point, where it's at V8 5.8, but it applies as soon as V8 5.9 rolls. There's work going on in Ignition (and TurboFan) to optimize those TDZ checks properly, but those changes will land in V8 6.1, so might not end up in Node 8. One way to work-around this in Node core for now is to use var instead of const for those right-hand sides for instanceof for now, especially Buffer in case of streams. This is not beautiful, but proper ducktape. Improves readable-bigread.js by ~23% with Node LKGR. PR-URL: #13403 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Calvin Metcalf <calvin.metcalf@gmail.com>
1 parent 12036a1 commit bf06534
Copy full SHA for bf06534

File tree

Expand file treeCollapse file tree

2 files changed

+6
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-2
lines changed
Open diff view settings
Collapse file

‎lib/_stream_readable.js‎

Copy file name to clipboardExpand all lines: lib/_stream_readable.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ Readable.ReadableState = ReadableState;
2626

2727
const EE = require('events');
2828
const Stream = require('stream');
29-
const Buffer = require('buffer').Buffer;
29+
// TODO(bmeurer): Change this back to const once hole checks are
30+
// properly optimized away early in Ignition+TurboFan.
31+
var Buffer = require('buffer').Buffer;
3032
const util = require('util');
3133
const debug = util.debuglog('stream');
3234
const BufferList = require('internal/streams/BufferList');
Collapse file

‎lib/_stream_wrap.js‎

Copy file name to clipboardExpand all lines: lib/_stream_wrap.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ const assert = require('assert');
44
const util = require('util');
55
const Socket = require('net').Socket;
66
const JSStream = process.binding('js_stream').JSStream;
7-
const Buffer = require('buffer').Buffer;
7+
// TODO(bmeurer): Change this back to const once hole checks are
8+
// properly optimized away early in Ignition+TurboFan.
9+
var Buffer = require('buffer').Buffer;
810
const uv = process.binding('uv');
911
const debug = util.debuglog('stream_wrap');
1012

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.