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

Side by Side Diff: test/mjsunit/math-min-max.js

Issue 10034015: Merged r10755, r11237 into 3.8 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.8
Patch Set: Created 8 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 | « src/version.cc ('k') | test/mjsunit/regress/regress-2056.js » ('j') | 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 assertEquals(v2, Math.max(v1++, v2++)); 139 assertEquals(v2, Math.max(v1++, v2++));
140 assertEquals(v1, Math.min(v1++, v2++)); 140 assertEquals(v1, Math.min(v1++, v2++));
141 // Tagged representation. 141 // Tagged representation.
142 assertEquals(v4, Math.max(v3, v4)); 142 assertEquals(v4, Math.max(v3, v4));
143 assertEquals(v3, Math.min(v3, v4)); 143 assertEquals(v3, Math.min(v3, v4));
144 assertEquals(v6, Math.max(v5, v6)); 144 assertEquals(v6, Math.max(v5, v6));
145 assertEquals(v5, Math.min(v5, v6)); 145 assertEquals(v5, Math.min(v5, v6));
146 // Double representation. 146 // Double representation.
147 assertEquals(v0, Math.max(v0++, v9++)); 147 assertEquals(v0, Math.max(v0++, v9++));
148 assertEquals(v9, Math.min(v0++, v9++)); 148 assertEquals(v9, Math.min(v0++, v9++));
149 // Mixed representation.
150 assertEquals(v1, Math.min(v1++, v9++)); // int32, double
151 assertEquals(v0, Math.max(v0++, v2++)); // double, int32
152 assertEquals(v1, Math.min(v1++, v6)); // int32, tagged
153 assertEquals(v2, Math.max(v5, v2++)); // tagged, int32
154 assertEquals(v6, Math.min(v6, v9++)); // tagged, double
155 assertEquals(v0, Math.max(v0++, v5)); // double, tagged
156
149 // Minus zero. 157 // Minus zero.
150 assertEquals(Infinity, 1/Math.max(v7, v8)); 158 assertEquals(Infinity, 1/Math.max(v7, v8));
151 assertEquals(-Infinity, 1/Math.min(v7, v8)); 159 assertEquals(-Infinity, 1/Math.min(v7, v8));
152 // NaN. 160 // NaN.
153 assertEquals(NaN, Math.max(NaN, v8)); 161 assertEquals(NaN, Math.max(NaN, v8));
154 assertEquals(NaN, Math.min(NaN, v9)); 162 assertEquals(NaN, Math.min(NaN, v9));
155 assertEquals(NaN, Math.max(v8, NaN)); 163 assertEquals(NaN, Math.max(v8, NaN));
156 assertEquals(NaN, Math.min(v9, NaN)); 164 assertEquals(NaN, Math.min(v9, NaN));
157 // Minus zero as Integer32. 165 // Minus zero as Integer32.
158 assertEquals((arg === -0) ? -Infinity : 1, 1/Math.min(arg, v2)); 166 assertEquals((arg === -0) ? -Infinity : 1, 1/Math.min(arg, v2));
(...skipping 13 matching lines...) Expand all
172 // Test overriding Math.min and Math.max 180 // Test overriding Math.min and Math.max
173 Math.min = function(a, b) { return a + b; } 181 Math.min = function(a, b) { return a + b; }
174 Math.max = function(a, b) { return a - b; } 182 Math.max = function(a, b) { return a - b; }
175 183
176 function crankshaft_test_3() { 184 function crankshaft_test_3() {
177 assertEquals(8, Math.min(3, 5)); 185 assertEquals(8, Math.min(3, 5));
178 assertEquals(3, Math.max(5, 2)); 186 assertEquals(3, Math.max(5, 2));
179 } 187 }
180 188
181 run(crankshaft_test_3); 189 run(crankshaft_test_3);
OLDNEW
« no previous file with comments | « src/version.cc ('k') | test/mjsunit/regress/regress-2056.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698