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

Side by Side Diff: test/mjsunit/smi-ops.js

Issue 67163: Avoid a call to the runtime system when doing binary fp ops on ARM... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/number-limits.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 assertEquals(ONE - SMI_MIN, Sub1Reversed(SMI_MIN)); // overflow 93 assertEquals(ONE - SMI_MIN, Sub1Reversed(SMI_MIN)); // overflow
94 assertEquals(42 - ONE, Sub1(OBJ_42)); // non-smi 94 assertEquals(42 - ONE, Sub1(OBJ_42)); // non-smi
95 assertEquals(ONE - 42, Sub1Reversed(OBJ_42)); // non-smi 95 assertEquals(ONE - 42, Sub1Reversed(OBJ_42)); // non-smi
96 96
97 assertEquals(0, Sub100(100)); // fast case 97 assertEquals(0, Sub100(100)); // fast case
98 assertEquals(1, Sub100Reversed(99)); // fast case 98 assertEquals(1, Sub100Reversed(99)); // fast case
99 assertEquals(SMI_MIN - ONE_HUNDRED, Sub100(SMI_MIN)); // overflow 99 assertEquals(SMI_MIN - ONE_HUNDRED, Sub100(SMI_MIN)); // overflow
100 assertEquals(ONE_HUNDRED - SMI_MIN, Sub100Reversed(SMI_MIN)); // overflow 100 assertEquals(ONE_HUNDRED - SMI_MIN, Sub100Reversed(SMI_MIN)); // overflow
101 assertEquals(42 - ONE_HUNDRED, Sub100(OBJ_42)); // non-smi 101 assertEquals(42 - ONE_HUNDRED, Sub100(OBJ_42)); // non-smi
102 assertEquals(ONE_HUNDRED - 42, Sub100Reversed(OBJ_42)); // non-smi 102 assertEquals(ONE_HUNDRED - 42, Sub100Reversed(OBJ_42)); // non-smi
103
104
105 function Shr1(x) {
106 return x >>> 1;
107 }
108
109 function Shr100(x) {
110 return x >>> 100;
111 }
112
113 function Shr1Reversed(x) {
114 return 1 >>> x;
115 }
116
117 function Shr100Reversed(x) {
118 return 100 >>> x;
119 }
120
121 function Sar1(x) {
122 return x >> 1;
123 }
124
125 function Sar100(x) {
126 return x >> 100;
127 }
128
129 function Sar1Reversed(x) {
130 return 1 >> x;
131 }
132
133 function Sar100Reversed(x) {
134 return 100 >> x;
135 }
136
137
138 assertEquals(0, Shr1(1));
139 assertEquals(0, Sar1(1));
140 assertEquals(0, Shr1Reversed(2));
141 assertEquals(0, Sar1Reversed(2));
142 assertEquals(1610612736, Shr1(SMI_MIN));
143 assertEquals(-536870912, Sar1(SMI_MIN));
144 assertEquals(1, Shr1Reversed(SMI_MIN));
145 assertEquals(1, Sar1Reversed(SMI_MIN));
146 assertEquals(21, Shr1(OBJ_42));
147 assertEquals(21, Sar1(OBJ_42));
148 assertEquals(0, Shr1Reversed(OBJ_42));
149 assertEquals(0, Sar1Reversed(OBJ_42));
150
151 assertEquals(6, Shr100(100));
152 assertEquals(6, Sar100(100));
153 assertEquals(12, Shr100Reversed(99));
154 assertEquals(12, Sar100Reversed(99));
155 assertEquals(201326592, Shr100(SMI_MIN));
156 assertEquals(-67108864, Sar100(SMI_MIN));
157 assertEquals(100, Shr100Reversed(SMI_MIN));
158 assertEquals(100, Sar100Reversed(SMI_MIN));
159 assertEquals(2, Shr100(OBJ_42));
160 assertEquals(2, Sar100(OBJ_42));
161 assertEquals(0, Shr100Reversed(OBJ_42));
162 assertEquals(0, Sar100Reversed(OBJ_42));
163
164
165 function Xor1(x) {
166 return x ^ 1;
167 }
168
169 function Xor100(x) {
170 return x ^ 100;
171 }
172
173 function Xor1Reversed(x) {
174 return 1 ^ x;
175 }
176
177 function Xor100Reversed(x) {
178 return 100 ^ x;
179 }
180
181
182 assertEquals(0, Xor1(1));
183 assertEquals(3, Xor1Reversed(2));
184 assertEquals(SMI_MIN + 1, Xor1(SMI_MIN));
185 assertEquals(SMI_MIN + 1, Xor1Reversed(SMI_MIN));
186 assertEquals(43, Xor1(OBJ_42));
187 assertEquals(43, Xor1Reversed(OBJ_42));
188
189 assertEquals(0, Xor100(100));
190 assertEquals(7, Xor100Reversed(99));
191 assertEquals(-1073741724, Xor100(SMI_MIN));
192 assertEquals(-1073741724, Xor100Reversed(SMI_MIN));
193 assertEquals(78, Xor100(OBJ_42));
194 assertEquals(78, Xor100Reversed(OBJ_42));
195
196 var x = 0x23; var y = 0x35;
197 assertEquals(0x16, x ^ y);
OLDNEW
« no previous file with comments | « test/mjsunit/number-limits.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698