OLD | NEW |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // runtime system. After a while the binary op IC settles down and we get | 48 // runtime system. After a while the binary op IC settles down and we get |
49 // a non-Smi from the generated code. | 49 // a non-Smi from the generated code. |
50 for (var i = 0; i < 10; i++) { | 50 for (var i = 0; i < 10; i++) { |
51 z = returnsNonSmi() - returnsNonSmi(); | 51 z = returnsNonSmi() - returnsNonSmi(); |
52 } | 52 } |
53 return z; | 53 return z; |
54 })(); | 54 })(); |
55 assertEquals(0, ZERO); | 55 assertEquals(0, ZERO); |
56 assertEquals(Infinity, 1/ZERO); | 56 assertEquals(Infinity, 1/ZERO); |
57 assertEquals(-Infinity, 1/-ZERO); | 57 assertEquals(-Infinity, 1/-ZERO); |
58 assertFalse(%_IsSmi(ZERO)); | 58 // Here we would like to have assertFalse(%_IsSmi(ZERO)); This is, however, |
| 59 // unreliable, since a new space exhaustion at a critical moment could send |
| 60 // us into the runtime system, which would quite legitimately put a Smi zero |
| 61 // here. |
59 assertFalse(%_IsSmi(-ZERO)); | 62 assertFalse(%_IsSmi(-ZERO)); |
60 | 63 |
61 var o = {}; | 64 var o = {}; |
62 o.valueOf = function() { return 1; }; | 65 o.valueOf = function() { return 1; }; |
63 assertEquals(1, Math.min(2, 3, '1')); | 66 assertEquals(1, Math.min(2, 3, '1')); |
64 assertEquals(1, Math.min(3, o, 2)); | 67 assertEquals(1, Math.min(3, o, 2)); |
65 assertEquals(1, Math.min(o, 2)); | 68 assertEquals(1, Math.min(o, 2)); |
66 assertEquals(-Infinity, Infinity / Math.min(-0, +0)); | 69 assertEquals(-Infinity, Infinity / Math.min(-0, +0)); |
67 assertEquals(-Infinity, Infinity / Math.min(+0, -0)); | 70 assertEquals(-Infinity, Infinity / Math.min(+0, -0)); |
68 assertEquals(-Infinity, Infinity / Math.min(+0, -0, 1)); | 71 assertEquals(-Infinity, Infinity / Math.min(+0, -0, 1)); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 assertEquals(1, Math.max(+0, -0, +1)); | 108 assertEquals(1, Math.max(+0, -0, +1)); |
106 assertEquals(1, Math.max(+1, +0, -0)); | 109 assertEquals(1, Math.max(+1, +0, -0)); |
107 assertEquals(1, Math.max(+0, +1, -0)); | 110 assertEquals(1, Math.max(+0, +1, -0)); |
108 assertEquals(1, Math.max(-0, +1, +0)); | 111 assertEquals(1, Math.max(-0, +1, +0)); |
109 assertNaN(Math.max('oxen')); | 112 assertNaN(Math.max('oxen')); |
110 assertNaN(Math.max('oxen', 1)); | 113 assertNaN(Math.max('oxen', 1)); |
111 assertNaN(Math.max(1, 'oxen')); | 114 assertNaN(Math.max(1, 'oxen')); |
112 | 115 |
113 assertEquals(Infinity, 1/Math.max(ZERO, -0)); | 116 assertEquals(Infinity, 1/Math.max(ZERO, -0)); |
114 assertEquals(Infinity, 1/Math.max(-0, ZERO)); | 117 assertEquals(Infinity, 1/Math.max(-0, ZERO)); |
OLD | NEW |