diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2015-06-19 13:23:56 +0200 |
---|---|---|
committer | Rod Vagg <rod@vagg.org> | 2015-08-04 11:56:14 -0700 |
commit | 70d1f32f5605465a1a630a64f6f0d35f96c7709d (patch) | |
tree | 0a349040a686eafcb0a09943ebc733477dce2781 /test | |
parent | 4643b8b6671607a7aff60cbbd0b384dcf2f6959e (diff) | |
download | android-node-v8-70d1f32f5605465a1a630a64f6f0d35f96c7709d.tar.gz android-node-v8-70d1f32f5605465a1a630a64f6f0d35f96c7709d.tar.bz2 android-node-v8-70d1f32f5605465a1a630a64f6f0d35f96c7709d.zip |
deps: update v8 to 4.4.63.9
Upgrade the bundled V8 and update code in src/ and lib/ to the new API.
Notable backwards incompatible changes are the removal of the smalloc
module and dropped support for CESU-8 decoding. CESU-8 support can be
brought back if necessary by doing UTF-8 decoding ourselves.
This commit includes https://codereview.chromium.org/1192973004 to fix
a build error on python 2.6 systems. The original commit log follows:
Use optparse in js2c.py for python compatibility
Without this change, V8 won't build on RHEL/CentOS 6 because the
distro python is too old to know about the argparse module.
PR-URL: https://github.com/nodejs/io.js/pull/2022
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/addons/heap-profiler/binding.cc | 2 | ||||
-rw-r--r-- | test/message/error_exit.out | 2 | ||||
-rw-r--r-- | test/message/eval_messages.out | 4 | ||||
-rw-r--r-- | test/message/stdin_messages.out | 4 | ||||
-rw-r--r-- | test/message/throw_undefined.out | 2 | ||||
-rw-r--r-- | test/message/vm_display_runtime_error.out | 2 | ||||
-rw-r--r-- | test/message/vm_display_syntax_error.out | 2 | ||||
-rw-r--r-- | test/message/vm_dont_display_runtime_error.out | 2 | ||||
-rw-r--r-- | test/message/vm_dont_display_syntax_error.out | 2 | ||||
-rw-r--r-- | test/parallel/test-buffer.js | 1 | ||||
-rw-r--r-- | test/parallel/test-smalloc.js | 331 | ||||
-rw-r--r-- | test/parallel/test-string-decoder.js | 3 | ||||
-rw-r--r-- | test/pummel/test-smalloc-alloc-segfault.js | 36 | ||||
-rw-r--r-- | test/pummel/test-smalloc-dispose-segfault.js | 30 | ||||
-rw-r--r-- | test/pummel/test-smalloc-sliceonto-segfault.js | 39 |
15 files changed, 11 insertions, 451 deletions
diff --git a/test/addons/heap-profiler/binding.cc b/test/addons/heap-profiler/binding.cc index 846d53a9c6..0830aae1be 100644 --- a/test/addons/heap-profiler/binding.cc +++ b/test/addons/heap-profiler/binding.cc @@ -7,7 +7,7 @@ namespace { inline void Test(const v8::FunctionCallbackInfo<v8::Value>& args) { v8::Isolate* const isolate = args.GetIsolate(); const v8::HeapSnapshot* const heap_snapshot = - isolate->GetHeapProfiler()->TakeHeapSnapshot(v8::String::Empty(isolate)); + isolate->GetHeapProfiler()->TakeHeapSnapshot(); struct : public v8::OutputStream { WriteResult WriteAsciiChunk(char*, int) override { return kContinue; } void EndOfStream() override {} diff --git a/test/message/error_exit.out b/test/message/error_exit.out index 11ea76fd72..71690ba3d0 100644 --- a/test/message/error_exit.out +++ b/test/message/error_exit.out @@ -2,7 +2,7 @@ Exiting with code=1 assert.js:* throw new assert.AssertionError({ - ^ + ^ AssertionError: 1 == 2 at Object.<anonymous> (*test*message*error_exit.js:*:*) at Module._compile (module.js:*:*) diff --git a/test/message/eval_messages.out b/test/message/eval_messages.out index be2120ce79..b02da9b280 100644 --- a/test/message/eval_messages.out +++ b/test/message/eval_messages.out @@ -13,7 +13,7 @@ SyntaxError: Strict mode code may not include a with statement 42 [eval]:1 throw new Error("hello") - ^ +^ Error: hello at [eval]:1:7 at Object.exports.runInThisContext (vm.js:*) @@ -24,7 +24,7 @@ Error: hello at process._tickCallback (node.js:*:*) [eval]:1 throw new Error("hello") - ^ +^ Error: hello at [eval]:1:7 at Object.exports.runInThisContext (vm.js:*) diff --git a/test/message/stdin_messages.out b/test/message/stdin_messages.out index 9dc6451d1c..94a55c79ab 100644 --- a/test/message/stdin_messages.out +++ b/test/message/stdin_messages.out @@ -15,7 +15,7 @@ SyntaxError: Strict mode code may not include a with statement [stdin]:1 throw new Error("hello") - ^ +^ Error: hello at [stdin]:1:* at Object.exports.runInThisContext (vm.js:*) @@ -27,7 +27,7 @@ Error: hello [stdin]:1 throw new Error("hello") - ^ +^ Error: hello at [stdin]:1:* at Object.exports.runInThisContext (vm.js:*) diff --git a/test/message/throw_undefined.out b/test/message/throw_undefined.out index 27aedd9ee4..c23dac051f 100644 --- a/test/message/throw_undefined.out +++ b/test/message/throw_undefined.out @@ -1,5 +1,5 @@ *test*message*throw_undefined.js:5 throw undefined; - ^ +^ undefined diff --git a/test/message/vm_display_runtime_error.out b/test/message/vm_display_runtime_error.out index 6c3314de0d..f9d8354703 100644 --- a/test/message/vm_display_runtime_error.out +++ b/test/message/vm_display_runtime_error.out @@ -2,7 +2,7 @@ beginning test.vm:1 throw new Error("boo!") - ^ +^ Error: boo! at test.vm:1:7 at Object.exports.runInThisContext (vm.js:*) diff --git a/test/message/vm_display_syntax_error.out b/test/message/vm_display_syntax_error.out index 0869448702..1b124e2378 100644 --- a/test/message/vm_display_syntax_error.out +++ b/test/message/vm_display_syntax_error.out @@ -2,7 +2,7 @@ beginning test.vm:1 var 5; - ^ +^^^ SyntaxError: Unexpected number at Object.exports.runInThisContext (vm.js:*) at Object.<anonymous> (*test*message*vm_display_syntax_error.js:*) diff --git a/test/message/vm_dont_display_runtime_error.out b/test/message/vm_dont_display_runtime_error.out index e3aa0e17f1..ae8cf71142 100644 --- a/test/message/vm_dont_display_runtime_error.out +++ b/test/message/vm_dont_display_runtime_error.out @@ -2,7 +2,7 @@ beginning middle test.vm:1 throw new Error("boo!") - ^ +^ Error: boo! at test.vm:1:7 at Object.exports.runInThisContext (vm.js:*) diff --git a/test/message/vm_dont_display_syntax_error.out b/test/message/vm_dont_display_syntax_error.out index f2e4a94952..242bc8c100 100644 --- a/test/message/vm_dont_display_syntax_error.out +++ b/test/message/vm_dont_display_syntax_error.out @@ -2,7 +2,7 @@ beginning middle test.vm:1 var 5; - ^ +^^^ SyntaxError: Unexpected number at Object.exports.runInThisContext (vm.js:*) at Object.<anonymous> (*test*message*vm_dont_display_syntax_error.js:*) diff --git a/test/parallel/test-buffer.js b/test/parallel/test-buffer.js index 443da05560..3daa02eac7 100644 --- a/test/parallel/test-buffer.js +++ b/test/parallel/test-buffer.js @@ -4,7 +4,6 @@ var assert = require('assert'); var Buffer = require('buffer').Buffer; var SlowBuffer = require('buffer').SlowBuffer; -var smalloc = require('smalloc'); // counter to ensure unique value is always copied var cntr = 0; diff --git a/test/parallel/test-smalloc.js b/test/parallel/test-smalloc.js deleted file mode 100644 index 68d2c23fa4..0000000000 --- a/test/parallel/test-smalloc.js +++ /dev/null @@ -1,331 +0,0 @@ -'use strict'; -var common = require('../common'); -var assert = require('assert'); -var os = require('os'); - -// first grab js api's -var smalloc = require('smalloc'); -var alloc = smalloc.alloc; -var dispose = smalloc.dispose; -var copyOnto = smalloc.copyOnto; -var kMaxLength = smalloc.kMaxLength; -var Types = smalloc.Types; -// sliceOnto is volatile and cannot be exposed to users. -var sliceOnto = process.binding('smalloc').sliceOnto; - - -// verify allocation - -var b = alloc(5, {}); -assert.ok(typeof b === 'object'); -for (var i = 0; i < 5; i++) - assert.ok(b[i] !== undefined); - - -var b = {}; -var c = alloc(5, b); -assert.equal(b, c); -assert.deepEqual(b, c); - - -var b = alloc(5, {}); -var c = {}; -c._data = sliceOnto(b, c, 0, 5); -assert.ok(typeof c._data === 'object'); -assert.equal(b, c._data); -assert.deepEqual(b, c._data); - - -// verify writes - -var b = alloc(5, {}); -for (var i = 0; i < 5; i++) - b[i] = i; -for (var i = 0; i < 5; i++) - assert.equal(b[i], i); - - -var b = alloc(1, Types.Uint8); -b[0] = 256; -assert.equal(b[0], 0); -assert.equal(b[1], undefined); - - -var b = alloc(1, Types.Int8); -b[0] = 128; -assert.equal(b[0], -128); -assert.equal(b[1], undefined); - - -var b = alloc(1, Types.Uint16); -b[0] = 65536; -assert.equal(b[0], 0); -assert.equal(b[1], undefined); - - -var b = alloc(1, Types.Int16); -b[0] = 32768; -assert.equal(b[0], -32768); -assert.equal(b[1], undefined); - - -var b = alloc(1, Types.Uint32); -b[0] = 4294967296; -assert.equal(b[0], 0); -assert.equal(b[1], undefined); - - -var b = alloc(1, Types.Int32); -b[0] = 2147483648; -assert.equal(b[0], -2147483648); -assert.equal(b[1], undefined); - - -var b = alloc(1, Types.Float); -b[0] = 0.1111111111111111; -assert.equal(b[0], 0.1111111119389534); -assert.equal(b[1], undefined); - - -var b = alloc(1, Types.Double); -b[0] = 0.1111111111111111; -assert.equal(b[0], 0.1111111111111111); -assert.equal(b[1], undefined); - - -var b = alloc(1, Types.Uint8Clamped); -b[0] = 300; -assert.equal(b[0], 255); -assert.equal(b[1], undefined); - - -var b = alloc(6, {}); -var c0 = {}; -var c1 = {}; -c0._data = sliceOnto(b, c0, 0, 3); -c1._data = sliceOnto(b, c1, 3, 6); -for (var i = 0; i < 3; i++) { - c0[i] = i; - c1[i] = i + 3; -} -for (var i = 0; i < 3; i++) - assert.equal(b[i], i); -for (var i = 3; i < 6; i++) - assert.equal(b[i], i); - - -var a = alloc(6, {}); -var b = alloc(6, {}); -var c = alloc(12, {}); -for (var i = 0; i < 6; i++) { - a[i] = i; - b[i] = i * 2; -} -copyOnto(a, 0, c, 0, 6); -copyOnto(b, 0, c, 6, 6); -for (var i = 0; i < 6; i++) { - assert.equal(c[i], i); - assert.equal(c[i + 6], i * 2); -} - - -var b = alloc(1, Types.Double); -var c = alloc(2, Types.Uint32); -if (os.endianness() === 'LE') { - c[0] = 2576980378; - c[1] = 1069128089; -} else { - c[0] = 1069128089; - c[1] = 2576980378; -} -copyOnto(c, 0, b, 0, 2); -assert.equal(b[0], 0.1); - -var b = alloc(1, Types.Uint16); -var c = alloc(2, Types.Uint8); -c[0] = c[1] = 0xff; -copyOnto(c, 0, b, 0, 2); -assert.equal(b[0], 0xffff); - -var b = alloc(2, Types.Uint8); -var c = alloc(1, Types.Uint16); -c[0] = 0xffff; -copyOnto(c, 0, b, 0, 1); -assert.equal(b[0], 0xff); -assert.equal(b[1], 0xff); - - -// verify checking external if has external memory - -// check objects -var b = {}; -assert.ok(!smalloc.hasExternalData(b)); -alloc(1, b); -assert.ok(smalloc.hasExternalData(b)); -var f = function() { }; -alloc(1, f); -assert.ok(smalloc.hasExternalData(f)); - -// and non-objects -assert.ok(!smalloc.hasExternalData(true)); -assert.ok(!smalloc.hasExternalData(1)); -assert.ok(!smalloc.hasExternalData('string')); -assert.ok(!smalloc.hasExternalData(null)); -assert.ok(!smalloc.hasExternalData()); - - -// verify alloc throws properly - -// arrays are not supported -assert.throws(function() { - alloc(0, []); -}, TypeError); - - -// no allocations larger than kMaxLength -assert.throws(function() { - alloc(kMaxLength + 1); -}, RangeError); - - -// properly convert to uint32 before checking overflow -assert.throws(function() { - alloc(-1); -}, RangeError); - - -// no allocating on what's been allocated -assert.throws(function() { - alloc(1, alloc(1)); -}, TypeError); - - -// throw for values passed that are not objects -assert.throws(function() { - alloc(1, 'a'); -}, TypeError); -assert.throws(function() { - alloc(1, true); -}, TypeError); -assert.throws(function() { - alloc(1, null); -}, TypeError); - - -// should not throw allocating to most objects -alloc(1, function() { }); -alloc(1, /abc/); -alloc(1, new Date()); - - -// range check on external array enumeration -assert.throws(function() { - alloc(1, 0); -}, TypeError); -assert.throws(function() { - alloc(1, 10); -}, TypeError); - -// very copyOnto throws properly - -// source must have data -assert.throws(function() { - copyOnto({}, 0, alloc(1), 0, 0); -}, Error); - - -// dest must have data -assert.throws(function() { - copyOnto(alloc(1), 0, {}, 0, 0); -}, Error); - - -// copyLength <= sourceLength -assert.throws(function() { - copyOnto(alloc(1), 0, alloc(3), 0, 2); -}, RangeError); - - -// copyLength <= destLength -assert.throws(function() { - copyOnto(alloc(3), 0, alloc(1), 0, 2); -}, RangeError); - - -// sourceStart <= sourceLength -assert.throws(function() { - copyOnto(alloc(1), 3, alloc(1), 0, 1); -}, RangeError); - - -// destStart <= destLength -assert.throws(function() { - copyOnto(alloc(1), 0, alloc(1), 3, 1); -}, RangeError); - - -// sourceStart + copyLength <= sourceLength -assert.throws(function() { - copyOnto(alloc(3), 1, alloc(3), 0, 3); -}, RangeError); - - -// destStart + copyLength <= destLength -assert.throws(function() { - copyOnto(alloc(3), 0, alloc(3), 1, 3); -}, RangeError); - - -// copy_length * array_size <= dest_length -assert.throws(function() { - copyOnto(alloc(2, Types.Double), 0, alloc(2, Types.Uint32), 0, 2); -}, RangeError); - - -// test disposal -var b = alloc(5, {}); -dispose(b); -for (var i = 0; i < 5; i++) - assert.equal(b[i], undefined); - - -// verify dispose throws properly - -// only allow object to be passed to dispose -assert.throws(function() { - smalloc.dispose(null); -}); - - -// can't dispose a Buffer -assert.throws(function() { - smalloc.dispose(new Buffer()); -}); - -assert.throws(function() { - smalloc.dispose(new Uint8Array(new ArrayBuffer(1))); -}); - -assert.throws(function() { - smalloc.dispose({}); -}); - - -// Types should be immutable -assert.deepStrictEqual(Object.getOwnPropertyDescriptor(smalloc, 'Types'), { - value: smalloc.Types, - writable: false, - enumerable: true, - configurable: false -}); - -var types = Object.keys(smalloc.Types); -var Types = smalloc.Types; - -for (var i = 0; i < types.length; i++) - assert.deepStrictEqual(Object.getOwnPropertyDescriptor(Types, types[i]), { - value: Types[types[i]], - writable: false, - enumerable: true, - configurable: false - }); diff --git a/test/parallel/test-string-decoder.js b/test/parallel/test-string-decoder.js index c540ecfacd..0b22d3dd04 100644 --- a/test/parallel/test-string-decoder.js +++ b/test/parallel/test-string-decoder.js @@ -23,9 +23,6 @@ test( '\u02e4\u0064\u12e4\u0030\u3045' ); -// CESU-8 -test('utf-8', new Buffer('EDA0BDEDB18D', 'hex'), '\ud83d\udc4d'); // thumbs up - // UCS-2 test('ucs2', new Buffer('ababc', 'ucs2'), 'ababc'); diff --git a/test/pummel/test-smalloc-alloc-segfault.js b/test/pummel/test-smalloc-alloc-segfault.js deleted file mode 100644 index d41ccaee09..0000000000 --- a/test/pummel/test-smalloc-alloc-segfault.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict'; -var common = require('../common'); -var assert = require('assert'); - -var spawn = require('child_process').spawn; -var alloc = process.binding('smalloc').alloc; - - -// child -if (process.argv[2] === 'child') { - - // test that many allocations won't cause early ones to free prematurely - // note: if memory frees prematurely then reading out the values will cause - // it to seg fault - var arr = []; - for (var i = 0; i < 1e4; i++) { - arr.push(alloc({}, 1)); - alloc({}, 1024); - if (i % 10 === 0) gc(); - } - var sum = 0; - for (var i = 0; i < 1e4; i++) { - sum += arr[i][0]; - arr[i][0] = sum; - } - -} else { - // test case - var child = spawn(process.execPath, - ['--expose_gc', __filename, 'child']); - - child.on('exit', function(code, signal) { - assert.equal(code, 0, signal); - console.log('alloc didn\'t segfault'); - }); -} diff --git a/test/pummel/test-smalloc-dispose-segfault.js b/test/pummel/test-smalloc-dispose-segfault.js deleted file mode 100644 index 9364cca344..0000000000 --- a/test/pummel/test-smalloc-dispose-segfault.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; -var common = require('../common'); -var assert = require('assert'); - -var spawn = require('child_process').spawn; -var smalloc = process.binding('smalloc'); -var alloc = smalloc.alloc; -var dispose = smalloc.dispose; - - -// child -if (process.argv[2] === 'child') { - - // test that disposing an allocation won't cause the MakeWeakCallback to try - // and free invalid memory - for (var i = 0; i < 1e4; i++) { - dispose(alloc({}, 5)); - if (i % 10 === 0) gc(); - } - -} else { - // test case - var child = spawn(process.execPath, - ['--expose_gc', __filename, 'child']); - - child.on('exit', function(code, signal) { - assert.equal(code, 0, signal); - console.log('dispose didn\'t segfault'); - }); -} diff --git a/test/pummel/test-smalloc-sliceonto-segfault.js b/test/pummel/test-smalloc-sliceonto-segfault.js deleted file mode 100644 index e9e00979ff..0000000000 --- a/test/pummel/test-smalloc-sliceonto-segfault.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; -var common = require('../common'); -var assert = require('assert'); - -var spawn = require('child_process').spawn; -var alloc = process.binding('smalloc').alloc; -var sliceOnto = process.binding('smalloc').sliceOnto; - - -// child -if (process.argv[2] === 'child') { - - // test that many slices won't cause early ones to free prematurely - // note: if this fails then it will cause v8 to seg fault - var arr = []; - for (var i = 0; i < 1e4; i++) { - var a = alloc({}, 256); - var b = {}; - b._data = sliceOnto(a, b, 0, 1); - if (i % 2 === 0) - arr.push(b); - if (i % 10 === 0) gc(); - } - var sum = 0; - for (var i = 0; i < 5e3; i++) { - sum += arr[i][0]; - arr[i][0] = sum; - } - -} else { - // test case - var child = spawn(process.execPath, - ['--expose_gc', __filename, 'child']); - - child.on('exit', function(code, signal) { - assert.equal(code, 0, signal); - console.log('sliceOnto didn\'t segfault'); - }); -} |