summaryrefslogtreecommitdiff
path: root/lib/_tls_wrap.js
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2017-02-13 13:26:42 -0800
committerJames M Snell <jasnell@gmail.com>2017-02-15 10:11:49 -0800
commit0000d71dc607a6e1a620542e91ea00e385f3efca (patch)
tree81ba7e9a75710c4aa21e8774311a4293500a551f /lib/_tls_wrap.js
parente36d0d3974d563a3d40b56e9f11c467d51820c89 (diff)
downloadandroid-node-v8-0000d71dc607a6e1a620542e91ea00e385f3efca.tar.gz
android-node-v8-0000d71dc607a6e1a620542e91ea00e385f3efca.tar.bz2
android-node-v8-0000d71dc607a6e1a620542e91ea00e385f3efca.zip
tls: avoid potentially deoptimizing use of arguments
Replace use of arguments with `...args` ``` tls/tls-connect.js dur=5 concurrency=1 -9.43 % 0.172136744 tls/tls-connect.js dur=5 concurrency=10 29.05 % ** 0.001108115 ``` PR-URL: https://github.com/nodejs/node/pull/11357 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'lib/_tls_wrap.js')
-rw-r--r--lib/_tls_wrap.js10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js
index 83a0f10993..b2d30fb25a 100644
--- a/lib/_tls_wrap.js
+++ b/lib/_tls_wrap.js
@@ -294,9 +294,9 @@ var proxiedMethods = [
// Proxy HandleWrap, PipeWrap and TCPWrap methods
proxiedMethods.forEach(function(name) {
- tls_wrap.TLSWrap.prototype[name] = function methodProxy() {
+ tls_wrap.TLSWrap.prototype[name] = function methodProxy(...args) {
if (this._parent[name])
- return this._parent[name].apply(this._parent, arguments);
+ return this._parent[name].apply(this._parent, args);
};
});
@@ -986,11 +986,7 @@ function normalizeConnectArgs(listArgs) {
return (cb) ? [options, cb] : [options];
}
-exports.connect = function(/* [port,] [host,] [options,] [cb] */) {
- const argsLen = arguments.length;
- var args = new Array(argsLen);
- for (var i = 0; i < argsLen; i++)
- args[i] = arguments[i];
+exports.connect = function(...args /* [port,] [host,] [options,] [cb] */) {
args = normalizeConnectArgs(args);
var options = args[0];
var cb = args[1];