From 6029127ceae33dec541ef0457e650adb33d2763c Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 21 Dec 2011 12:38:07 -0800 Subject: [PATCH 01/10] Upgrade V8 to 3.6.6.15 --- deps/v8/src/objects.h | 2 +- deps/v8/src/version.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deps/v8/src/objects.h b/deps/v8/src/objects.h index d9c7a82276c..48a76d32f41 100644 --- a/deps/v8/src/objects.h +++ b/deps/v8/src/objects.h @@ -2172,7 +2172,7 @@ class FixedArray: public FixedArrayBase { // Maximal allowed size, in bytes, of a single FixedArray. // Prevents overflowing size computations, as well as extreme memory // consumption. - static const int kMaxSize = 512 * MB; + static const int kMaxSize = 128 * MB * kPointerSize; // Maximally allowed length of a FixedArray. static const int kMaxLength = (kMaxSize - kHeaderSize) / kPointerSize; diff --git a/deps/v8/src/version.cc b/deps/v8/src/version.cc index 399d7148d89..f09914b43a8 100644 --- a/deps/v8/src/version.cc +++ b/deps/v8/src/version.cc @@ -35,7 +35,7 @@ #define MAJOR_VERSION 3 #define MINOR_VERSION 6 #define BUILD_NUMBER 6 -#define PATCH_LEVEL 14 +#define PATCH_LEVEL 15 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) #define IS_CANDIDATE_VERSION 0 From ef659192a14fcd521801d33374b4feaf5dfaf105 Mon Sep 17 00:00:00 2001 From: Shannen Date: Tue, 20 Dec 2011 15:57:45 +1100 Subject: [PATCH 02/10] docs: use "Level 1" HTML5 features Since we're using an HTML doctype we might as well use "Level 1" HTML5 features. See more: http://mathiasbynens.be/notes/html5-levels#level-1 Fixes #2386. --- doc/about/index.html | 18 +++++++++--------- doc/community/index.html | 17 ++++++++--------- doc/index.html | 20 ++++++++++---------- doc/template.html | 12 ++++++------ 4 files changed, 33 insertions(+), 34 deletions(-) diff --git a/doc/about/index.html b/doc/about/index.html index 4e67c9e3364..f3a33554f48 100644 --- a/doc/about/index.html +++ b/doc/about/index.html @@ -1,7 +1,8 @@ - - - + + - node.js @@ -109,16 +109,16 @@ console.log('Server running at http://127.0.0.1:1337/'); is a trademark of Joyent, Inc. - - - + + + - - - - + + @@ -18,7 +18,6 @@ type="application/rss+xml" title="node blog" href="http://feeds.feedburner.com/nodejs/123123123"> - node.js @@ -148,16 +147,16 @@ is a trademark of Joyent, Inc. - - - - + + \ No newline at end of file diff --git a/doc/index.html b/doc/index.html index f687c1495c3..fab47811bbd 100644 --- a/doc/index.html +++ b/doc/index.html @@ -1,7 +1,8 @@ - + - - - + + - node.js @@ -200,16 +200,16 @@ server.listen(1337, "127.0.0.1"); is a trademark of Joyent, Inc. - - - + + + - - - - - + From 892ba87866b8b86e0cb2e2a5987bd37940c5f0de Mon Sep 17 00:00:00 2001 From: Seong-Rak Choi Date: Wed, 21 Dec 2011 13:25:56 +0900 Subject: [PATCH 03/10] docs: fix javascript error on document page `highlight()` is called twice. It causes following javascript error. > Uncaught Found
 element with class="sh_sourcecode",
> but no such language exists

Fixes #2393.
---
 doc/template.html | 1 -
 1 file changed, 1 deletion(-)

diff --git a/doc/template.html b/doc/template.html
index cb3c99c4fba..0f65b366f12 100644
--- a/doc/template.html
+++ b/doc/template.html
@@ -31,6 +31,5 @@
       var pageTracker = _gat._getTracker("UA-10874194-2");
       pageTracker._trackPageview();
       } catch(err) {}
-  
 
 

From d8c178bc16295b11c445b6f25432e549ef624e77 Mon Sep 17 00:00:00 2001
From: Ben Noordhuis 
Date: Thu, 22 Dec 2011 14:42:20 +0100
Subject: [PATCH 04/10] timers: fix performance regression

Fix a 5-7% performance regression in the http_simple benchmark that was
introduced by the following commits:

  348d8cd timers: remove _idleTimeout from item in .unenroll()
  f2f3028 timers: fix memory leak in setTimeout
  098fef6 timers: remember extra setTimeout() arguments when timeout==0

Fix suggested by Bert Belder.
---
 lib/timers.js | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/timers.js b/lib/timers.js
index 35085e0c15a..7a57d342776 100644
--- a/lib/timers.js
+++ b/lib/timers.js
@@ -108,8 +108,8 @@ var unenroll = exports.unenroll = function(item) {
     list.close();
     delete lists[item._idleTimeout];
   }
-  //if active is called later, then we want to make sure not to insert again
-  delete item._idleTimeout;
+  // if active is called later, then we want to make sure not to insert again
+  item._idleTimeout = -1;
 };
 
 
@@ -151,17 +151,18 @@ exports.setTimeout = function(callback, after) {
   if (after <= 0) {
     // Use the slow case for after == 0
     timer = new Timer();
+    timer._callback = callback;
 
     if (arguments.length <= 2) {
       timer._onTimeout = function() {
-        callback();
-        timer.close();
+        this._callback();
+        this.close();
       }
     } else {
       var args = Array.prototype.slice.call(arguments, 2);
       timer._onTimeout = function() {
-        callback.apply(timer, args);
-        timer.close();
+        this._callback.apply(timer, args);
+        this.close();
       }
     }
 

From 045bfe0da566d8c0b2ce998dbb38055ab783391c Mon Sep 17 00:00:00 2001
From: Dave Irvine 
Date: Thu, 22 Dec 2011 14:39:53 +0000
Subject: [PATCH 05/10] docs: document 'encoding' arg of hash.update()

---
 doc/api/crypto.markdown | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/doc/api/crypto.markdown b/doc/api/crypto.markdown
index d51b1fa0c09..6ca68d5c382 100644
--- a/doc/api/crypto.markdown
+++ b/doc/api/crypto.markdown
@@ -47,9 +47,10 @@ Example: this program that takes the sha1 sum of a file
       console.log(d + '  ' + filename);
     });
 
-### hash.update(data)
+### hash.update(data, input_encoding='binary')
 
-Updates the hash content with the given `data`.
+Updates the hash content with the given `data`, the encoding of which is given
+in `input_encoding` and can be `'utf8'`, `'ascii'` or `'binary'`.
 This can be called many times with new data as it is streamed.
 
 ### hash.digest(encoding='binary')
@@ -255,4 +256,4 @@ Generates cryptographically strong pseudo-random data. Usage:
       console.log('Have %d bytes of random data: %s', buf.length, buf);
     } catch (ex) {
       // handle error
-    }
\ No newline at end of file
+    }

From 5976d5879621730b28b611da82c7f12286fd5fba Mon Sep 17 00:00:00 2001
From: Ju-yeong Park 
Date: Thu, 22 Dec 2011 11:32:27 +0900
Subject: [PATCH 06/10] net: raise exception when the socket is closed

---
 lib/net.js                                |  2 ++
 test/simple/test-net-write-after-close.js | 43 +++++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 test/simple/test-net-write-after-close.js

diff --git a/lib/net.js b/lib/net.js
index d57d4c43e92..b6697136d2f 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -443,6 +443,8 @@ Socket.prototype.write = function(data, arg1, arg2) {
 Socket.prototype._write = function(data, encoding, cb) {
   timers.active(this);
 
+  if (!this._handle) throw new Error('This socket is closed.');
+
   // `encoding` is unused right now, `data` is always a buffer.
   var writeReq = this._handle.write(data);
 
diff --git a/test/simple/test-net-write-after-close.js b/test/simple/test-net-write-after-close.js
new file mode 100644
index 00000000000..2edb16d959a
--- /dev/null
+++ b/test/simple/test-net-write-after-close.js
@@ -0,0 +1,43 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+var common = require('../common');
+var assert = require('assert');
+var net = require('net');
+
+
+var server = net.createServer(function(socket) {
+  setTimeout(function() {
+    assert.throws(
+      function() {
+        socket.write('test');
+      },
+      /This socket is closed/
+    );
+    process.exit();
+  }, 250);
+});
+
+server.listen(common.PORT, function() {
+  var client = net.connect(common.PORT, function() {
+    client.end();
+  });
+});

From b261e37a342fbc9e1219cbb19bfe9730c98d1533 Mon Sep 17 00:00:00 2001
From: Ben Noordhuis 
Date: Thu, 22 Dec 2011 17:28:23 +0100
Subject: [PATCH 07/10] test: ensure callback is executed

---
 test/simple/test-net-write-after-close.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/test/simple/test-net-write-after-close.js b/test/simple/test-net-write-after-close.js
index 2edb16d959a..5b100b66265 100644
--- a/test/simple/test-net-write-after-close.js
+++ b/test/simple/test-net-write-after-close.js
@@ -23,6 +23,11 @@ var common = require('../common');
 var assert = require('assert');
 var net = require('net');
 
+var gotError = false;
+
+process.on('exit', function() {
+  assert(gotError);
+});
 
 var server = net.createServer(function(socket) {
   setTimeout(function() {
@@ -32,7 +37,8 @@ var server = net.createServer(function(socket) {
       },
       /This socket is closed/
     );
-    process.exit();
+    server.close();
+    gotError = true;
   }, 250);
 });
 

From cf2513e1aaf8034162664e402267768bdaa349c1 Mon Sep 17 00:00:00 2001
From: Phil Sung 
Date: Wed, 21 Dec 2011 17:38:12 -0800
Subject: [PATCH 08/10] buffer: don't pollute global namespace in
 buffer.readInt*

---
 lib/buffer.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/buffer.js b/lib/buffer.js
index ebeab7d5226..a0210b9b876 100644
--- a/lib/buffer.js
+++ b/lib/buffer.js
@@ -698,7 +698,7 @@ Buffer.prototype.readInt8 = function(offset, noAssert) {
 };
 
 function readInt16(buffer, offset, isBigEndian, noAssert) {
-  var neg;
+  var neg, val;
 
   if (!noAssert) {
     assert.ok(typeof (isBigEndian) === 'boolean',
@@ -729,7 +729,7 @@ Buffer.prototype.readInt16BE = function(offset, noAssert) {
 };
 
 function readInt32(buffer, offset, isBigEndian, noAssert) {
-  var neg;
+  var neg, val;
 
   if (!noAssert) {
     assert.ok(typeof (isBigEndian) === 'boolean',

From c6347dcfb43273214dc872e60c8cd94a93fee027 Mon Sep 17 00:00:00 2001
From: Bert Belder 
Date: Fri, 23 Dec 2011 03:09:36 +0100
Subject: [PATCH 09/10] Add another nextTick benchmark

It tests how many iterations the event loop can make per second.
---
 benchmark/next-tick-2.js | 41 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 benchmark/next-tick-2.js

diff --git a/benchmark/next-tick-2.js b/benchmark/next-tick-2.js
new file mode 100644
index 00000000000..44a2b41b543
--- /dev/null
+++ b/benchmark/next-tick-2.js
@@ -0,0 +1,41 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+var count = 2e6,
+    left = count,
+    start;
+
+function onNextTick() {
+  if (--left) {
+    process.nextTick(onNextTick);
+  } else {
+    finalize();
+  }  
+}
+
+function finalize() {
+  var duration = (new Date()).getTime() - start,
+      ticksPerSec = count / duration * 1000;
+  console.log("nextTick callbacks per second: " + Math.round(ticksPerSec));
+}
+
+start = (new Date()).getTime();
+process.nextTick(onNextTick);

From d85c85aac1e2e87c0dbac7feddeb38f23da6d700 Mon Sep 17 00:00:00 2001
From: Ryan Dahl 
Date: Fri, 23 Dec 2011 15:10:06 -0800
Subject: [PATCH 10/10] Change 'real example' in addon doc

---
 doc/api/addons.markdown | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/api/addons.markdown b/doc/api/addons.markdown
index b0040141265..6f99f8be48e 100644
--- a/doc/api/addons.markdown
+++ b/doc/api/addons.markdown
@@ -88,4 +88,4 @@ the recently built module:
     console.log(addon.hello()); // 'world'
 
 For the moment, that is all the documentation on addons. Please see
- for a real example.
+ for a real example.