]>
Commit | Line | Data |
---|---|---|
ed1e77d3 A |
1 | function insertNaNWhileFilling() |
2 | { | |
3 | var array = new Array(6); | |
4 | for (var i = 0; i < 4; ++i) | |
5 | array[i] = i; | |
6 | array[5] = NaN; | |
7 | return array; | |
8 | } | |
9 | noInline(insertNaNWhileFilling); | |
10 | ||
11 | function testInsertNaNWhileFilling() | |
12 | { | |
13 | var array = insertNaNWhileFilling(); | |
14 | for (var i = 0; i < 4; ++i) { | |
15 | var value = array[i]; | |
16 | if (value !== i) { | |
17 | throw "Failed testInsertNaNWhileFilling, value = " + value + " instead of " + i; | |
18 | } | |
19 | } | |
20 | var nan = array[5]; | |
21 | if (!Number.isNaN(nan)) | |
22 | throw "Failed testInsertNaNWhileFilling, array[5] is " + nan + " instead of NaN"; | |
23 | } | |
24 | noInline(testInsertNaNWhileFilling); | |
25 | ||
26 | for (var i = 0; i < 1e4; ++i) { | |
27 | testInsertNaNWhileFilling(); | |
28 | } | |
29 | ||
30 | ||
31 | function insertNaNAfterFilling() | |
32 | { | |
33 | var array = new Array(6); | |
34 | for (var i = 0; i < 5; ++i) | |
35 | array[i] = i; | |
36 | array[5] = NaN; | |
37 | return array; | |
38 | } | |
39 | noInline(insertNaNAfterFilling); | |
40 | ||
41 | function testInsertNaNAfterFilling() | |
42 | { | |
43 | var array = insertNaNAfterFilling(); | |
44 | for (var i = 0; i < 4; ++i) { | |
45 | var value = array[i]; | |
46 | if (value !== i) { | |
47 | throw "Failed testInsertNaNAfterFilling, value = " + value + " instead of " + i; | |
48 | } | |
49 | } | |
50 | var nan = array[5]; | |
51 | if (!Number.isNaN(nan)) | |
52 | throw "Failed testInsertNaNAfterFilling, array[5] is " + nan + " instead of NaN"; | |
53 | } | |
54 | noInline(testInsertNaNAfterFilling); | |
55 | ||
56 | for (var i = 0; i < 1e4; ++i) { | |
57 | testInsertNaNAfterFilling(); | |
58 | } | |
59 | ||
60 | ||
61 | function pushNaNWhileFilling() | |
62 | { | |
63 | var array = []; | |
64 | for (var i = 0; i < 5; ++i) | |
65 | array.push(i); | |
66 | array.push(NaN); | |
67 | return array; | |
68 | } | |
69 | noInline(pushNaNWhileFilling); | |
70 | ||
71 | function testPushNaNWhileFilling() | |
72 | { | |
73 | var array = pushNaNWhileFilling(); | |
74 | for (var i = 0; i < 4; ++i) { | |
75 | var value = array[i]; | |
76 | if (value !== i) { | |
77 | throw "Failed testPushNaNWhileFilling, value = " + value + " instead of " + i; | |
78 | } | |
79 | } | |
80 | var nan = array[5]; | |
81 | if (!Number.isNaN(nan)) | |
82 | throw "Failed testPushNaNWhileFilling, array[5] is " + nan + " instead of NaN"; | |
83 | } | |
84 | noInline(testPushNaNWhileFilling); | |
85 | ||
86 | for (var i = 0; i < 1e4; ++i) { | |
87 | testPushNaNWhileFilling(); | |
88 | } |