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

Side by Side Diff: test/mjsunit/regress/regress-1246.js

Issue 2029413005: [builtins] Migrate Math.log to TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typo. Created 4 years, 6 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
OLDNEW
(Empty)
1 // Copyright 2011 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 // This regression tests the behaviour of the parseInt function when
29 // the given radix is not a SMI.
30
31 // Flags: --allow-natives-syntax
32
33 var nonSmi10 = Math.log(Math.exp(10));
34 var nonSmi16 = Math.log(Math.exp(16));
Yang 2016/06/03 09:41:43 Is there a way to create heap numbers so that we c
Benedikt Meurer 2016/06/03 09:45:03 As discussed offline, this is not relevant anymore
35
36 assertTrue(!%_IsSmi(nonSmi10) && nonSmi10 == 10);
37 assertTrue(!%_IsSmi(nonSmi16) && nonSmi16 == 16);
38
39 // Giving these values as the radix argument triggers radix detection.
40 var radix_detect = [0, -0, NaN, Infinity, -Infinity, undefined, null,
41 "0", "-0", "a"];
42
43 // These values will result in an integer radix outside of the valid range.
44 var radix_invalid = [1, 37, -2, "-2", "37"];
45
46 // These values will trigger decimal parsing.
47 var radix10 = [10, 10.1, "10", "10.1", nonSmi10];
48
49 // These values will trigger hexadecimal parsing.
50 var radix16 = [16, 16.1, 0x10, "0X10", nonSmi16];
51
52 for (var i = 0; i < radix_detect.length; i++) {
53 var radix = radix_detect[i];
54 assertEquals(NaN, parseInt("", radix));
55 assertEquals(23, parseInt("23", radix));
56 assertEquals(0xaf, parseInt("0xaf", radix));
57 assertEquals(NaN, parseInt("af", radix));
58 }
59
60 for (var i = 0; i < radix_invalid.length; i++) {
61 var radix = radix_invalid[i];
62 assertEquals(NaN, parseInt("", radix));
63 assertEquals(NaN, parseInt("23", radix));
64 assertEquals(NaN, parseInt("0xaf", radix));
65 assertEquals(NaN, parseInt("af", radix));
66 }
67
68 for (var i = 0; i < radix10.length; i++) {
69 var radix = radix10[i];
70 assertEquals(NaN, parseInt("", radix));
71 assertEquals(23, parseInt("23", radix));
72 assertEquals(0, parseInt("0xaf", radix));
73 assertEquals(NaN, parseInt("af", radix));
74 }
75
76 for (var i = 0; i < radix16.length; i++) {
77 var radix = radix16[i];
78 assertEquals(NaN, parseInt("", radix));
79 assertEquals(0x23, parseInt("23", radix));
80 assertEquals(0xaf, parseInt("0xaf", radix));
81 assertEquals(0xaf, parseInt("af", radix));
82 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698