Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7435491
lib: use arrow functions instead of bind
JungMinu Aug 21, 2015
8c71854
doc: fix link in addons.markdown
secretfader Dec 17, 2015
1dd09a8
doc: Typo in buffer.markdown referencing buf.write()
chrisJohn404 Dec 17, 2015
46c44c8
doc: fix, modernize examples in docs
jasnell Dec 14, 2015
645577f
http: Remove an unnecessary assignment
gigabo Dec 17, 2015
1a07eab
debugger: guard against call from non-node context
bnoordhuis Dec 17, 2015
d187c6e
test: try other ipv6 localhost alternatives
mscdex Dec 17, 2015
89c32bc
node: fix erroneously named function call
trevnorris Nov 10, 2015
369f795
http_parser: use pushValueToArray for headers
trevnorris Nov 10, 2015
3f19d4a
fs: use pushValueToArray for readdir(Sync)
trevnorris Nov 10, 2015
4f07866
node: improve GetActiveHandles performance
trevnorris Nov 11, 2015
b73bb71
node: improve performance of hrtime()
trevnorris Nov 11, 2015
e808658
node: improve accessor perf of process.env
trevnorris Nov 11, 2015
6406dbb
crypto: load PFX chain the same way as regular one
indutny Dec 5, 2015
569e5eb
test: fix flaky test-net-error-twice
mscdex Dec 18, 2015
72b6b4f
module: always decorate thrown errors
mscdex Dec 15, 2015
09c9110
repl: use String#repeat instead of Array#join
evanlucas Nov 18, 2015
dd935c2
assert: typed array deepequal performance fix
claudiorodriguez Dec 17, 2015
8168669
http: remove excess calls to removeSocket
Dec 6, 2015
2888ec3
src: remove forwards for v8::GC*logueCallback
ofrobots Dec 21, 2015
1009a82
repl: Fixed node repl history edge case.
zeusdeux Dec 1, 2015
b7fd395
2015-12-22, Version 5.3.1 (Stable)
Fishrock123 Dec 22, 2015
d3d2216
Working on v5.3.2
Fishrock123 Dec 22, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
lib: use arrow functions instead of bind
use `arrow functions` instead of `bind(this)` in order to improve
performance through optimizations.

PR-URL: #3622
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
  • Loading branch information
JungMinu authored and Fishrock123 committed Dec 22, 2015
commit 7435491fabea298cefb3d0ee6398e34cda9f2818
16 changes: 9 additions & 7 deletions lib/_debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function Client() {
protocol.execute(d);
});

protocol.onResponse = this._onResponse.bind(this);
protocol.onResponse = (res) => this._onResponse(res);
}
inherits(Client, net.Socket);
exports.Client = Client;
Expand Down Expand Up @@ -734,7 +734,7 @@ function Interface(stdin, stdout, args) {
prompt: 'debug> ',
input: this.stdin,
output: this.stdout,
eval: this.controlEval.bind(this),
eval: (code, ctx, file, cb) => this.controlEval(code, ctx, file, cb),
useGlobal: false,
ignoreUndefined: true
};
Expand Down Expand Up @@ -765,7 +765,7 @@ function Interface(stdin, stdout, args) {
});

// Handle all possible exits
process.on('exit', this.killChild.bind(this));
process.on('exit', () => this.killChild());
process.once('SIGTERM', process.exit.bind(process, 0));
process.once('SIGHUP', process.exit.bind(process, 0));

Expand Down Expand Up @@ -1587,7 +1587,8 @@ Interface.prototype.repl = function() {
this.repl.on('exit', exitDebugRepl);

// Set new
this.repl.eval = this.debugEval.bind(this);
this.repl.eval = (code, ctx, file, cb) =>
this.debugEval(code, ctx, file, cb);
this.repl.context = {};

// Swap history
Expand All @@ -1602,7 +1603,8 @@ Interface.prototype.repl = function() {
// Exit debug repl
Interface.prototype.exitRepl = function() {
// Restore eval
this.repl.eval = this.controlEval.bind(this);
this.repl.eval = (code, ctx, file, cb) =>
this.controlEval(code, ctx, file, cb);

// Swap history
this.history.debug = this.repl.rli.history;
Expand Down Expand Up @@ -1689,8 +1691,8 @@ Interface.prototype.trySpawn = function(cb) {
// pipe stream into debugger
this.child = spawn(process.execPath, childArgs);

this.child.stdout.on('data', this.childPrint.bind(this));
this.child.stderr.on('data', this.childPrint.bind(this));
this.child.stdout.on('data', (text) => this.childPrint(text));
this.child.stderr.on('data', (text) => this.childPrint(text));
}

this.pause();
Expand Down
11 changes: 6 additions & 5 deletions lib/_tls_legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,14 +704,15 @@ function SecurePair(context, isServer, requestCert, rejectUnauthorized,
this._rejectUnauthorized);

if (this._isServer) {
this.ssl.onhandshakestart = onhandshakestart.bind(this);
this.ssl.onhandshakedone = onhandshakedone.bind(this);
this.ssl.onclienthello = onclienthello.bind(this);
this.ssl.onnewsession = onnewsession.bind(this);
this.ssl.onhandshakestart = () => onhandshakestart.call(this);
this.ssl.onhandshakedone = () => onhandshakedone.call(this);
this.ssl.onclienthello = (hello) => onclienthello.call(this, hello);
this.ssl.onnewsession =
(key, session) => onnewsession.call(this, key, session);
this.ssl.lastHandshakeTime = 0;
this.ssl.handshakes = 0;
} else {
this.ssl.onocspresponse = onocspresponse.bind(this);
this.ssl.onocspresponse = (resp) => onocspresponse.call(this, resp);
}

if (process.features.tls_sni) {
Expand Down
14 changes: 7 additions & 7 deletions lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,11 @@ TLSSocket.prototype._init = function(socket, wrap) {
ssl.setVerifyMode(requestCert, rejectUnauthorized);

if (options.isServer) {
ssl.onhandshakestart = onhandshakestart.bind(this);
ssl.onhandshakedone = onhandshakedone.bind(this);
ssl.onclienthello = onclienthello.bind(this);
ssl.oncertcb = oncertcb.bind(this);
ssl.onnewsession = onnewsession.bind(this);
ssl.onhandshakestart = () => onhandshakestart.call(this);
ssl.onhandshakedone = () => onhandshakedone.call(this);
ssl.onclienthello = (hello) => onclienthello.call(this, hello);
ssl.oncertcb = (info) => oncertcb.call(this, info);
ssl.onnewsession = (key, session) => onnewsession.call(this, key, session);
ssl.lastHandshakeTime = 0;
ssl.handshakes = 0;

Expand All @@ -425,8 +425,8 @@ TLSSocket.prototype._init = function(socket, wrap) {
}
} else {
ssl.onhandshakestart = function() {};
ssl.onhandshakedone = this._finishInit.bind(this);
ssl.onocspresponse = onocspresponse.bind(this);
ssl.onhandshakedone = () => this._finishInit();
ssl.onocspresponse = (resp) => onocspresponse.call(this, resp);

if (options.session)
ssl.setSession(options.session);
Expand Down
12 changes: 9 additions & 3 deletions lib/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ function Worker(options) {

if (options.process) {
this.process = options.process;
this.process.on('error', this.emit.bind(this, 'error'));
this.process.on('message', this.emit.bind(this, 'message'));
this.process.on('error', (code, signal) =>
this.emit('error', code, signal)
);
this.process.on('message', (message, handle) =>
this.emit('message', message, handle)
);
}
}
util.inherits(Worker, EventEmitter);
Expand Down Expand Up @@ -337,7 +341,9 @@ function masterInit() {
process: workerProcess
});

worker.on('message', this.emit.bind(this, 'message'));
worker.on('message', (message, handle) =>
this.emit('message', message, handle)
);

worker.process.once('exit', function(exitCode, signalCode) {
/*
Expand Down
2 changes: 1 addition & 1 deletion lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1842,7 +1842,7 @@ ReadStream.prototype.close = function(cb) {
this.once('open', close);
return;
}
return process.nextTick(this.emit.bind(this, 'close'));
return process.nextTick(() => this.emit('close'));
}
this.closed = true;
close();
Expand Down
6 changes: 3 additions & 3 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ Socket.prototype._onTimeout = function() {
Socket.prototype.setNoDelay = function(enable) {
if (!this._handle) {
this.once('connect',
enable ? this.setNoDelay : this.setNoDelay.bind(this, enable));
enable ? this.setNoDelay : () => this.setNoDelay(enable));
return this;
}

Expand All @@ -336,7 +336,7 @@ Socket.prototype.setNoDelay = function(enable) {

Socket.prototype.setKeepAlive = function(setting, msecs) {
if (!this._handle) {
this.once('connect', this.setKeepAlive.bind(this, setting, msecs));
this.once('connect', () => this.setKeepAlive(setting, msecs));
return this;
}

Expand Down Expand Up @@ -384,7 +384,7 @@ Socket.prototype._read = function(n) {

if (this._connecting || !this._handle) {
debug('_read wait for connection');
this.once('connect', this._read.bind(this, n));
this.once('connect', () => this._read(n));
} else if (!this._handle.reading) {
// not already reading, start the flow
debug('Socket._read readStart');
Expand Down