Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: test/mjsunit/compiler/regress-gap.js

Issue 6529055: [Isolates] Merge crankshaft (r5922 from bleeding_edge). (Closed)
Patch Set: Win32 port Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/compiler/regress-funcaller.js ('k') | test/mjsunit/compiler/regress-gvn.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2010 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
4 // met:
5 //
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.
15 //
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.
27
28 // Regression test that stresses the register allocator gap instruction.
29
30 function small_select(n, v1, v2) {
31 for (var i = 0; i < n; ++i) {
32 var tmp = v1;
33 v1 = v2;
34 v2 = tmp;
35 }
36 return v1;
37 }
38
39 function select(n, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) {
40 for (var i = 0; i < n; ++i) {
41 var tmp = v1;
42 v1 = v2;
43 v2 = v3;
44 v3 = v4;
45 v4 = v5;
46 v5 = v6;
47 v6 = v7;
48 v7 = v8;
49 v8 = v9;
50 v9 = v10;
51 v10 = tmp;
52 }
53 return v1;
54 }
55
56 function select_while(n, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) {
57 var i = 0;
58 while (i < n) {
59 var tmp = v1;
60 v1 = v2;
61 v2 = v3;
62 v3 = v4;
63 v4 = v5;
64 v5 = v6;
65 v6 = v7;
66 v7 = v8;
67 v8 = v9;
68 v9 = v10;
69 v10 = tmp;
70 i++;
71 }
72 return v1;
73 }
74
75 function two_cycles(n, v1, v2, v3, v4, v5, x1, x2, x3, x4, x5) {
76 for (var i = 0; i < n; ++i) {
77 var tmp = v1;
78 v1 = v2;
79 v2 = v3;
80 v3 = v4;
81 v4 = v5;
82 v5 = tmp;
83 tmp = x1;
84 x1 = x2;
85 x2 = x3;
86 x3 = x4;
87 x4 = x5;
88 x5 = tmp;
89 }
90 return v1 + x1;
91 }
92
93 function two_cycles_while(n, v1, v2, v3, v4, v5, x1, x2, x3, x4, x5) {
94 var i = 0;
95 while (i < n) {
96 var tmp = v1;
97 v1 = v2;
98 v2 = v3;
99 v3 = v4;
100 v4 = v5;
101 v5 = tmp;
102 tmp = x1;
103 x1 = x2;
104 x2 = x3;
105 x3 = x4;
106 x4 = x5;
107 x5 = tmp;
108 i++;
109 }
110 return v1 + x1;
111 }
112 assertEquals(1, small_select(0, 1, 2));
113 assertEquals(2, small_select(1, 1, 2));
114 assertEquals(1, small_select(10, 1, 2));
115
116 assertEquals(1, select(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
117 assertEquals(4, select(3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
118 assertEquals(10, select(9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
119
120 assertEquals(1 + 6, two_cycles(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
121 assertEquals(4 + 9, two_cycles(3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
122 assertEquals(5 + 10, two_cycles(9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
123
124 assertEquals(1, select_while(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
125 assertEquals(4, select_while(3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
126 assertEquals(10, select_while(9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
127
128 assertEquals(1 + 6, two_cycles_while(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
129 assertEquals(4 + 9, two_cycles_while(3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
130 assertEquals(5 + 10, two_cycles_while(9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
OLDNEW
« no previous file with comments | « test/mjsunit/compiler/regress-funcaller.js ('k') | test/mjsunit/compiler/regress-gvn.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698