Skip to content

Commit 31874a7

Browse files
mscdexevanlucas
authored andcommitted
net: fix permanent deoptimizations
PR-URL: #12456 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 15bfec2 commit 31874a7

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

‎lib/net.js‎

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ function createServer(options, connectionListener){
6060
// connect(path, [cb]);
6161
//
6262
functionconnect(){
63-
constargs=newArray(arguments.length);
63+
varargs=newArray(arguments.length);
6464
for(vari=0;i<arguments.length;i++)
6565
args[i]=arguments[i];
6666
// TODO(joyeecheung): use destructuring when V8 is fast enough
67-
constnormalized=normalizeArgs(args);
68-
constoptions=normalized[0];
69-
constcb=normalized[1];
67+
varnormalized=normalizeArgs(args);
68+
varoptions=normalized[0];
69+
varcb=normalized[1];
7070
debug('createConnection',normalized);
71-
constsocket=newSocket(options);
71+
varsocket=newSocket(options);
7272

7373
if(options.timeout){
7474
socket.setTimeout(options.timeout);
@@ -893,13 +893,13 @@ function internalConnect(
893893

894894

895895
Socket.prototype.connect=function(){
896-
constargs=newArray(arguments.length);
896+
varargs=newArray(arguments.length);
897897
for(vari=0;i<arguments.length;i++)
898898
args[i]=arguments[i];
899899
// TODO(joyeecheung): use destructuring when V8 is fast enough
900-
constnormalized=normalizeArgs(args);
901-
constoptions=normalized[0];
902-
constcb=normalized[1];
900+
varnormalized=normalizeArgs(args);
901+
varoptions=normalized[0];
902+
varcb=normalized[1];
903903
returnrealConnect.call(this,options,cb);
904904
};
905905

@@ -1350,19 +1350,19 @@ function listenInCluster(server, address, port, addressType,
13501350

13511351

13521352
Server.prototype.listen=function(){
1353-
constargs=newArray(arguments.length);
1353+
varargs=newArray(arguments.length);
13541354
for(vari=0;i<arguments.length;i++)
13551355
args[i]=arguments[i];
13561356
// TODO(joyeecheung): use destructuring when V8 is fast enough
1357-
constnormalized=normalizeArgs(args);
1357+
varnormalized=normalizeArgs(args);
13581358
varoptions=normalized[0];
1359-
constcb=normalized[1];
1359+
varcb=normalized[1];
13601360

13611361
varhasCallback=(cb!==null);
13621362
if(hasCallback){
13631363
this.once('listening',cb);
13641364
}
1365-
constbacklogFromArgs=
1365+
varbacklogFromArgs=
13661366
// (handle, backlog) or (path, backlog) or (port, backlog)
13671367
toNumber(args.length>1&&args[1])||
13681368
toNumber(args.length>2&&args[2]);// (port, host, backlog)
@@ -1391,11 +1391,12 @@ Server.prototype.listen = function(){
13911391
// ([port][, host][, backlog][, cb]) where port is specified
13921392
// or (options[, cb]) where options.port is specified
13931393
// or if options.port is normalized as 0 before
1394+
varbacklog;
13941395
if(typeofoptions.port==='number'||typeofoptions.port==='string'){
13951396
if(!isLegalPort(options.port)){
13961397
thrownewRangeError('"port" argument must be >= 0 and < 65536');
13971398
}
1398-
constbacklog=options.backlog||backlogFromArgs;
1399+
backlog=options.backlog||backlogFromArgs;
13991400
// start TCP server listening on host:port
14001401
if(options.host){
14011402
lookupAndListen(this,options.port|0,options.host,backlog,
@@ -1411,8 +1412,8 @@ Server.prototype.listen = function(){
14111412
// (path[, backlog][, cb]) or (options[, cb])
14121413
// where path or options.path is a UNIX domain socket or Windows pipe
14131414
if(options.path&&isPipeName(options.path)){
1414-
constpipeName=this._pipeName=options.path;
1415-
constbacklog=options.backlog||backlogFromArgs;
1415+
varpipeName=this._pipeName=options.path;
1416+
backlog=options.backlog||backlogFromArgs;
14161417
listenInCluster(this,pipeName,-1,-1,
14171418
backlog,undefined,options.exclusive);
14181419
returnthis;

0 commit comments

Comments
(0)