1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 // Flags: --simd_object --allow-natives-syntax --use-escape-analysis
30 function testArgumentsObjectwithFloat32x4Field() {
32 var forceDeopt = { deopt:false };
33 function inner(a,b,c,d,e,f,g,h,i,j,k) {
36 assertSame(11, args.length);
37 assertSame(a, args[0]);
38 assertSame(b, args[1]);
39 assertSame(c, args[2]);
40 assertSame(d, args[3]);
41 assertSame(e, args[4]);
42 assertSame(f, args[5]);
43 assertSame(g, args[6]);
44 assertSame(h, args[7]);
45 assertSame(i, args[8]);
46 assertSame(j, args[9]);
47 assertEquals(1, args[10].x);
48 assertEquals(2, args[10].y);
49 assertEquals(3, args[10].z);
50 assertEquals(4, args[10].w);
58 a - 0.3, // double in double register
59 b + 2.3, // integer in double register
60 c + 321, // integer in general register
61 c - 456, // integer in stack slot
62 a + 0.1, a + 0.2, a + 0.3, a + 0.4, a + 0.5,
63 a + 0.6, // double in stack slot
64 SIMD.float32x4(1, 2, 3, 4)
70 %OptimizeFunctionOnNextCall(outer);
72 delete forceDeopt.deopt;
76 testArgumentsObjectwithFloat32x4Field();
78 function testArgumentsObjectwithInt32x4Field() {
80 var forceDeopt = { deopt:false };
81 function inner(a,b,c,d,e,f,g,h,i,j,k) {
84 assertSame(11, args.length);
85 assertSame(a, args[0]);
86 assertSame(b, args[1]);
87 assertSame(c, args[2]);
88 assertSame(d, args[3]);
89 assertSame(e, args[4]);
90 assertSame(f, args[5]);
91 assertSame(g, args[6]);
92 assertSame(h, args[7]);
93 assertSame(i, args[8]);
94 assertSame(j, args[9]);
95 assertEquals(1, args[10].x);
96 assertEquals(2, args[10].y);
97 assertEquals(3, args[10].z);
98 assertEquals(4, args[10].w);
106 a - 0.3, // double in double register
107 b + 2.3, // integer in double register
108 c + 321, // integer in general register
109 c - 456, // integer in stack slot
110 a + 0.1, a + 0.2, a + 0.3, a + 0.4, a + 0.5,
111 a + 0.6, // double in stack slot
112 SIMD.int32x4(1, 2, 3, 4)
118 %OptimizeFunctionOnNextCall(outer);
120 delete forceDeopt.deopt;
124 testArgumentsObjectwithInt32x4Field();