js/src/jit-test/tests/parallel/ic-getproperty.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.

     1 load(libdir + "parallelarray-helpers.js");
     3 function testICProto() {
     4   function C() {}
     5   C.prototype.foo = "foo";
     6   var c = new C;
     7   assertArraySeqParResultsEq(
     8     range(0, minItemsTestingThreshold),
     9     "map",
    10     function() { return c.foo; });
    11 }
    13 function f(o) {
    14   assertArraySeqParResultsEq(
    15     range(0, minItemsTestingThreshold),
    16     "map",
    17     function() { return o.foo; });
    18 }
    20 function g(o) {
    21   assertArraySeqParResultsEq(
    22     range(0, minItemsTestingThreshold),
    23     "map",
    24     function() { return o.length; });
    25 }
    27 function testICMultiple() {
    28   var o1 = { foo: 0 };
    29   var o2 = { foo: 0, bar: '' };
    30   var o3 = { foo: 0, bar: '', baz: function () { } };
    31   var o4 = { foo: { } };
    32   f(o1); f(o2); f(o3); f(o2); f(o1); f(o4);
    33 }
    35 function testICSameShapeDifferentProto() {
    36   function A () { this.bar = 1; }
    37   A.prototype.foo = "a";
    38   A.prototype.a = true;
    39   var x = new A;
    40   function B () { this.bar = 2; }
    41   B.prototype.foo = "b";
    42   A.prototype.b = true;
    43   var y = new B;
    45   f(x);
    46   f(y);
    47 }
    49 function testICArrayLength() {
    50   var o1 = { length: 42 };
    51   var o2 = [1,2,3,4];
    52   g(o1); g(o2);
    53 }
    55 function testICTypedArrayLength() {
    56   var o1 = { length: 42 };
    57   var o2 = new Int8Array(128);
    58   var o3 = new Uint8Array(128);
    59   var o4 = new Uint8ClampedArray(128);
    60   var o5 = new Int16Array(128);
    61   var o6 = new Uint16Array(128);
    62   var o7 = new Int32Array(128);
    63   var o8 = new Uint32Array(128);
    64   var o9 = new Float32Array(128);
    65   var o0 = new Float64Array(128);
    66   g(o1); g(o2); g(o3); g(o4); g(o5); g(o6); g(o7); g(o8); g(o9); g(o0);
    67 }
    69 if (getBuildConfiguration().parallelJS) {
    70   testICProto();
    71   testICMultiple();
    72   testICSameShapeDifferentProto();
    73   testICArrayLength();
    74   testICTypedArrayLength();
    75 }

mercurial