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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
637819b7ab
commit
55f9c85a05
@ -26,7 +26,9 @@ Readable.ReadableState = ReadableState;
|
||||
|
||||
const EE = require('events');
|
||||
const Stream = require('stream');
|
||||
const Buffer = require('buffer').Buffer;
|
||||
// TODO(bmeurer): Change this back to const once hole checks are
|
||||
// properly optimized away early in Ignition+TurboFan.
|
||||
var Buffer = require('buffer').Buffer;
|
||||
const util = require('util');
|
||||
const debug = util.debuglog('stream');
|
||||
const BufferList = require('internal/streams/BufferList');
|
||||
|
@ -4,7 +4,9 @@ const assert = require('assert');
|
||||
const util = require('util');
|
||||
const Socket = require('net').Socket;
|
||||
const JSStream = process.binding('js_stream').JSStream;
|
||||
const Buffer = require('buffer').Buffer;
|
||||
// TODO(bmeurer): Change this back to const once hole checks are
|
||||
// properly optimized away early in Ignition+TurboFan.
|
||||
var Buffer = require('buffer').Buffer;
|
||||
const uv = process.binding('uv');
|
||||
const debug = util.debuglog('stream_wrap');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user