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

Side by Side Diff: test/mjsunit/sin-cos.js

Issue 98893002: Make sin-cos test case compatible with --always-osr. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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 | « no previous file | 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 11 matching lines...) Expand all
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 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. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 // Test Math.sin and Math.cos. 28 // Test Math.sin and Math.cos.
29 29
30 // Flags: --allow-natives-syntax 30 // Flags: --allow-natives-syntax
31 31
32 assertEquals("-Infinity", String(1/Math.sin(-0)));
33 assertEquals(1, Math.cos(-0));
34 assertEquals("-Infinity", String(1/Math.tan(-0)));
35
36 // Assert that minus zero does not cause deopt.
37 function no_deopt_on_minus_zero(x) {
38 return Math.sin(x) + Math.cos(x) + Math.tan(x);
39 }
40
41 no_deopt_on_minus_zero(1);
42 no_deopt_on_minus_zero(1);
43 %OptimizeFunctionOnNextCall(no_deopt_on_minus_zero);
44 no_deopt_on_minus_zero(-0);
45 assertOptimized(no_deopt_on_minus_zero);
46
47
32 function sinTest() { 48 function sinTest() {
33 assertEquals(0, Math.sin(0)); 49 assertEquals(0, Math.sin(0));
34 assertEquals(1, Math.sin(Math.PI / 2)); 50 assertEquals(1, Math.sin(Math.PI / 2));
35 } 51 }
36 52
37 function cosTest() { 53 function cosTest() {
38 assertEquals(1, Math.cos(0)); 54 assertEquals(1, Math.cos(0));
39 assertEquals(-1, Math.cos(Math.PI)); 55 assertEquals(-1, Math.cos(Math.PI));
40 } 56 }
41 57
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 assertEqualsDelta(-0.6261681981330861, Math.cos(1e16), 1e-05); 178 assertEqualsDelta(-0.6261681981330861, Math.cos(1e16), 1e-05);
163 179
164 // Assert that remainder calculation terminates. 180 // Assert that remainder calculation terminates.
165 for (var i = -1024; i < 1024; i++) { 181 for (var i = -1024; i < 1024; i++) {
166 assertFalse(isNaN(Math.sin(Math.pow(2, i)))); 182 assertFalse(isNaN(Math.sin(Math.pow(2, i))));
167 } 183 }
168 184
169 assertFalse(isNaN(Math.cos(1.57079632679489700))); 185 assertFalse(isNaN(Math.cos(1.57079632679489700)));
170 assertFalse(isNaN(Math.cos(-1e-100))); 186 assertFalse(isNaN(Math.cos(-1e-100)));
171 assertFalse(isNaN(Math.cos(-1e-323))); 187 assertFalse(isNaN(Math.cos(-1e-323)));
172
173
174 function no_deopt_on_minus_zero(x) {
175 return Math.sin(x) + Math.cos(x) + Math.tan(x);
176 }
177
178 no_deopt_on_minus_zero(1);
179 no_deopt_on_minus_zero(1);
180 %OptimizeFunctionOnNextCall(no_deopt_on_minus_zero);
181 no_deopt_on_minus_zero(-0);
182 assertOptimized(no_deopt_on_minus_zero);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698