summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/harmony
diff options
context:
space:
mode:
authorFedor Indutny <fedor.indutny@gmail.com>2014-03-18 00:33:01 +0400
committerFedor Indutny <fedor.indutny@gmail.com>2014-03-18 00:33:01 +0400
commit4d140746f0978da2a6493b92d3b6de4b18f3394d (patch)
tree69d76bb397ca1dde203a5d7535ecc33c58c85f25 /deps/v8/test/mjsunit/harmony
parentee4b9b552dee37ed5844da6c261e4d28a33d3c13 (diff)
downloadnode-new-4d140746f0978da2a6493b92d3b6de4b18f3394d.tar.gz
deps: update v8 to 3.24.35.17
Diffstat (limited to 'deps/v8/test/mjsunit/harmony')
-rw-r--r--deps/v8/test/mjsunit/harmony/math-clz32.js28
-rw-r--r--deps/v8/test/mjsunit/harmony/math-fround.js99
-rw-r--r--deps/v8/test/mjsunit/harmony/math-hyperbolic.js8
-rw-r--r--deps/v8/test/mjsunit/harmony/microtask-delivery.js168
-rw-r--r--deps/v8/test/mjsunit/harmony/proxies.js6
5 files changed, 2 insertions, 307 deletions
diff --git a/deps/v8/test/mjsunit/harmony/math-clz32.js b/deps/v8/test/mjsunit/harmony/math-clz32.js
deleted file mode 100644
index bc15ad2569..0000000000
--- a/deps/v8/test/mjsunit/harmony/math-clz32.js
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Flags: --harmony-maths
-
-[NaN, Infinity, -Infinity, 0, -0, "abc", "Infinity", "-Infinity", {}].forEach(
- function(x) {
- assertEquals(32, Math.clz32(x));
- }
-);
-
-function testclz(x) {
- for (var i = 0; i < 33; i++) {
- if (x & 0x80000000) return i;
- x <<= 1;
- }
- return 32;
-}
-
-var max = Math.pow(2, 40);
-for (var x = 0; x < max; x = x * 1.01 + 1) {
- assertEquals(testclz(x), Math.clz32(x));
- assertEquals(testclz(-x), Math.clz32(-x));
- assertEquals(testclz(x), Math.clz32({ valueOf: function() { return x; } }));
- assertEquals(testclz(-x),
- Math.clz32({ toString: function() { return -x; } }));
-}
diff --git a/deps/v8/test/mjsunit/harmony/math-fround.js b/deps/v8/test/mjsunit/harmony/math-fround.js
deleted file mode 100644
index ea432ea2de..0000000000
--- a/deps/v8/test/mjsunit/harmony/math-fround.js
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Flags: --harmony-maths
-
-// Monkey-patch Float32Array.
-Float32Array = function(x) { this[0] = 0; };
-
-assertTrue(isNaN(Math.fround(NaN)));
-assertTrue(isNaN(Math.fround(function() {})));
-assertTrue(isNaN(Math.fround({ toString: function() { return NaN; } })));
-assertTrue(isNaN(Math.fround({ valueOf: function() { return "abc"; } })));
-assertEquals("Infinity", String(1/Math.fround(0)));
-assertEquals("-Infinity", String(1/Math.fround(-0)));
-assertEquals("Infinity", String(Math.fround(Infinity)));
-assertEquals("-Infinity", String(Math.fround(-Infinity)));
-
-assertEquals("Infinity", String(Math.fround(1E200)));
-assertEquals("-Infinity", String(Math.fround(-1E200)));
-assertEquals("Infinity", String(1/Math.fround(1E-300)));
-assertEquals("-Infinity", String(1/Math.fround(-1E-300)));
-
-mantissa_23_shift = Math.pow(2, -23);
-mantissa_29_shift = Math.pow(2, -23-29);
-
-// Javascript implementation of IEEE 754 to test double to single conversion.
-function ieee754float(sign_bit,
- exponent_bits,
- mantissa_23_bits,
- mantissa_29_bits) {
- this.sign_bit = sign_bit & 1;
- this.exponent_bits = exponent_bits & ((1 << 11) - 1);
- this.mantissa_23_bits = mantissa_23_bits & ((1 << 23) - 1);
- this.mantissa_29_bits = mantissa_29_bits & ((1 << 29) - 1);
-}
-
-ieee754float.prototype.returnSpecial = function() {
- if (mantissa_23_bits == 0 && mantissa_29_bits == 0) return sign * Infinity;
- return NaN;
-}
-
-ieee754float.prototype.toDouble = function() {
- var sign = this.sign_bit ? -1 : 1;
- var exponent = this.exponent_bits - 1023;
- if (exponent == -1023) returnSpecial();
- var mantissa = 1 + this.mantissa_23_bits * mantissa_23_shift +
- this.mantissa_29_bits * mantissa_29_shift;
- return sign * Math.pow(2, exponent) * mantissa;
-}
-
-ieee754float.prototype.toSingle = function() {
- var sign = this.sign_bit ? -1 : 1;
- var exponent = this.exponent_bits - 1023;
- if (exponent == -1023) returnSpecial();
- if (exponent > 127) return sign * Infinity;
- if (exponent < -126) return this.toSingleSubnormal(sign, exponent);
- var round = this.mantissa_29_bits >> 28;
- var mantissa = 1 + (this.mantissa_23_bits + round) * mantissa_23_shift;
- return sign * Math.pow(2, exponent) * mantissa;
-}
-
-ieee754float.prototype.toSingleSubnormal = function(sign, exponent) {
- var shift = -126 - exponent;
- if (shift > 24) return sign * 0;
- var round_mask = 1 << (shift - 1);
- var mantissa_23_bits = this.mantissa_23_bits + (1 << 23);
- var round = ((mantissa_23_bits & round_mask) != 0) | 0;
- if (round) { // Round to even if tied.
- var tied_mask = round_mask - 1;
- var result_last_bit_mask = 1 << shift;
- var tied = this.mantissa_29_bits == 0 &&
- (mantissa_23_bits & tied_mask ) == 0;
- var result_already_even = (mantissa_23_bits & result_last_bit_mask) == 0;
- if (tied && result_already_even) round = 0;
- }
- mantissa_23_bits >>= shift;
- var mantissa = (mantissa_23_bits + round) * mantissa_23_shift;
- return sign * Math.pow(2, -126) * mantissa;
-}
-
-
-var pi = new ieee754float(0, 0x400, 0x490fda, 0x14442d18);
-assertEquals(pi.toSingle(), Math.fround(pi.toDouble()));
-
-function fuzz_mantissa(sign, exp, m1inc, m2inc) {
- for (var m1 = 0; m1 < (1 << 23); m1 += m1inc) {
- for (var m2 = 0; m2 < (1 << 29); m2 += m2inc) {
- var float = new ieee754float(sign, exp, m1, m2);
- assertEquals(float.toSingle(), Math.fround(float.toDouble()));
- }
- }
-}
-
-for (var sign = 0; sign < 2; sign++) {
- for (var exp = 1024 - 170; exp < 1024 + 170; exp++) {
- fuzz_mantissa(sign, exp, 1337 * exp - sign, 127913 * exp - sign);
- }
-}
diff --git a/deps/v8/test/mjsunit/harmony/math-hyperbolic.js b/deps/v8/test/mjsunit/harmony/math-hyperbolic.js
index c45a19c526..604448d89a 100644
--- a/deps/v8/test/mjsunit/harmony/math-hyperbolic.js
+++ b/deps/v8/test/mjsunit/harmony/math-hyperbolic.js
@@ -60,7 +60,7 @@ function test_id(fun, rev, value) {
});
-[Math.sinh, Math.asinh].forEach(function(fun) {
+[Math.sinh, Math.asinh, Math.cosh].forEach(function(fun) {
assertEquals("-Infinity", String(fun(-Infinity)));
assertEquals("Infinity", String(fun(Infinity)));
assertEquals("-Infinity", String(fun("-Infinity")));
@@ -68,12 +68,6 @@ function test_id(fun, rev, value) {
});
-assertEquals("Infinity", String(Math.cosh(-Infinity)));
-assertEquals("Infinity", String(Math.cosh(Infinity)));
-assertEquals("Infinity", String(Math.cosh("-Infinity")));
-assertEquals("Infinity", String(Math.cosh("Infinity")));
-
-
assertEquals("-Infinity", String(Math.atanh(-1)));
assertEquals("Infinity", String(Math.atanh(1)));
diff --git a/deps/v8/test/mjsunit/harmony/microtask-delivery.js b/deps/v8/test/mjsunit/harmony/microtask-delivery.js
deleted file mode 100644
index 566a39d03e..0000000000
--- a/deps/v8/test/mjsunit/harmony/microtask-delivery.js
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright 2012 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Flags: --harmony-observation --harmony-promises --allow-natives-syntax
-
-var ordering = [];
-function reset() {
- ordering = [];
-}
-
-function assertArrayValues(expected, actual) {
- assertEquals(expected.length, actual.length);
- for (var i = 0; i < expected.length; i++) {
- assertEquals(expected[i], actual[i]);
- }
-}
-
-function assertOrdering(expected) {
- %RunMicrotasks();
- assertArrayValues(expected, ordering);
-}
-
-function newPromise(id, fn) {
- var r;
- var t = 1;
- var promise = new Promise(function(resolve) {
- r = resolve;
- if (fn) fn();
- });
-
- var next = promise.then(function(value) {
- ordering.push('p' + id);
- return value;
- });
-
- return {
- resolve: r,
- then: function(fn) {
- next = next.then(function(value) {
- ordering.push('p' + id + ':' + t++);
- return fn ? fn(value) : value;
- });
-
- return this;
- }
- };
-}
-
-function newObserver(id, fn, obj) {
- var observer = {
- value: 1,
- recordCounts: []
- };
-
- Object.observe(observer, function(records) {
- ordering.push('o' + id);
- observer.recordCounts.push(records.length);
- if (fn) fn();
- });
-
- return observer;
-}
-
-
-(function PromiseThens() {
- reset();
-
- var p1 = newPromise(1).then();
- var p2 = newPromise(2).then();
-
- p1.resolve();
- p2.resolve();
-
- assertOrdering(['p1', 'p2', 'p1:1', 'p2:1']);
-})();
-
-
-(function ObserversBatch() {
- reset();
-
- var p1 = newPromise(1);
- var p2 = newPromise(2);
- var p3 = newPromise(3);
-
- var ob1 = newObserver(1);
- var ob2 = newObserver(2, function() {
- ob3.value++;
- p3.resolve();
- ob1.value++;
- });
- var ob3 = newObserver(3);
-
- p1.resolve();
- ob1.value++;
- p2.resolve();
- ob2.value++;
-
- assertOrdering(['p1', 'o1', 'o2', 'p2', 'o1', 'o3', 'p3']);
- assertArrayValues([1, 1], ob1.recordCounts);
- assertArrayValues([1], ob2.recordCounts);
- assertArrayValues([1], ob3.recordCounts);
-})();
-
-
-(function ObserversGetAllRecords() {
- reset();
-
- var p1 = newPromise(1);
- var p2 = newPromise(2);
- var ob1 = newObserver(1, function() {
- ob2.value++;
- });
- var ob2 = newObserver(2);
-
- p1.resolve();
- ob1.value++;
- p2.resolve();
- ob2.value++;
-
- assertOrdering(['p1', 'o1', 'o2', 'p2']);
- assertArrayValues([1], ob1.recordCounts);
- assertArrayValues([2], ob2.recordCounts);
-})();
-
-
-(function NewObserverDeliveryGetsNewMicrotask() {
- reset();
-
- var p1 = newPromise(1);
- var p2 = newPromise(2);
- var ob1 = newObserver(1);
- var ob2 = newObserver(2, function() {
- ob1.value++;
- });
-
- p1.resolve();
- ob1.value++;
- p2.resolve();
- ob2.value++;
-
- assertOrdering(['p1', 'o1', 'o2', 'p2', 'o1']);
- assertArrayValues([1, 1], ob1.recordCounts);
- assertArrayValues([1], ob2.recordCounts);
-})();
diff --git a/deps/v8/test/mjsunit/harmony/proxies.js b/deps/v8/test/mjsunit/harmony/proxies.js
index d26ce1d149..f68e3bd157 100644
--- a/deps/v8/test/mjsunit/harmony/proxies.js
+++ b/deps/v8/test/mjsunit/harmony/proxies.js
@@ -25,11 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// We change the stack size for the A64 simulator because at one point this test
-// enters an infinite recursion which goes through the runtime and we overflow
-// the system stack before the simulator stack.
-
-// Flags: --harmony-proxies --sim-stack-size=500
+// Flags: --harmony-proxies
// Helper.