js/src/jit-test/tests/parallel/surfaces-1.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 load(libdir + "eqArrayHelper.js");
michael@0 2
michael@0 3 // ParallelArray surfaces
michael@0 4
michael@0 5 function test() {
michael@0 6 var desc = Object.getOwnPropertyDescriptor(this, "ParallelArray");
michael@0 7 assertEq(desc.enumerable, false);
michael@0 8 assertEq(desc.configurable, true);
michael@0 9 assertEq(desc.writable, true);
michael@0 10
michael@0 11 assertEq(typeof ParallelArray, 'function');
michael@0 12 assertEq(Object.keys(ParallelArray).length, 0);
michael@0 13 assertEq(ParallelArray.length, 0);
michael@0 14 assertEq(ParallelArray.name, "ParallelArray");
michael@0 15
michael@0 16 assertEq(Object.getPrototypeOf(ParallelArray.prototype), Object.prototype);
michael@0 17 assertEq(Object.prototype.toString.call(ParallelArray.prototype), "[object ParallelArray]");
michael@0 18 assertEq(Object.prototype.toString.call(new ParallelArray), "[object ParallelArray]");
michael@0 19 assertEq(Object.prototype.toString.call(ParallelArray()), "[object ParallelArray]");
michael@0 20 assertEq(Object.keys(ParallelArray.prototype).join(), "");
michael@0 21 assertEq(ParallelArray.prototype.constructor, ParallelArray);
michael@0 22
michael@0 23 function checkMethod(name, arity) {
michael@0 24 var desc = Object.getOwnPropertyDescriptor(ParallelArray.prototype, name);
michael@0 25 assertEq(desc.enumerable, false);
michael@0 26 assertEq(desc.configurable, true);
michael@0 27 assertEq(desc.writable, true);
michael@0 28 assertEq(typeof desc.value, 'function');
michael@0 29 assertEq(desc.value.name, name);
michael@0 30 assertEq(desc.value.length, arity);
michael@0 31 }
michael@0 32
michael@0 33 checkMethod("map", 1);
michael@0 34 checkMethod("reduce", 1);
michael@0 35 checkMethod("scan", 1);
michael@0 36 checkMethod("scatter", 1);
michael@0 37 checkMethod("filter", 1);
michael@0 38 checkMethod("flatten", 0);
michael@0 39 checkMethod("partition", 1);
michael@0 40 checkMethod("get", 1);
michael@0 41
michael@0 42 function checkAccessor(name) {
michael@0 43 var desc = Object.getOwnPropertyDescriptor(ParallelArray.prototype, name);
michael@0 44 assertEq(desc.enumerable, false);
michael@0 45 assertEq(desc.configurable, false);
michael@0 46 assertEq(typeof desc.get, 'function');
michael@0 47 assertEq(desc.set, undefined);
michael@0 48 }
michael@0 49
michael@0 50 checkAccessor("length");
michael@0 51 checkAccessor("shape");
michael@0 52 }
michael@0 53
michael@0 54 // FIXME(bug 844882) self-hosted object not array-like, exposes internal properties
michael@0 55 // if (getBuildConfiguration().parallelJS) test();

mercurial