OLD | NEW |
---|---|
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 if (i == length - 8 && test_double) { | 44 if (i == length - 8 && test_double) { |
45 set(array_1, i, 0.5); | 45 set(array_1, i, 0.5); |
46 set(array_2, i, 0.5); | 46 set(array_2, i, 0.5); |
47 assertTrue(%HasFastDoubleElements(array_1)); | 47 assertTrue(%HasFastDoubleElements(array_1)); |
48 assertTrue(%HasFastDoubleElements(array_2)); | 48 assertTrue(%HasFastDoubleElements(array_2)); |
49 } else if (i == length - 5 && test_object) { | 49 } else if (i == length - 5 && test_object) { |
50 set(array_1, i, 'object'); | 50 set(array_1, i, 'object'); |
51 set(array_2, i, 'object'); | 51 set(array_2, i, 'object'); |
52 assertTrue(%HasFastElements(array_1)); | 52 assertTrue(%HasFastElements(array_1)); |
53 assertTrue(%HasFastElements(array_2)); | 53 assertTrue(%HasFastElements(array_2)); |
54 } else { | 54 } else if (i != length - 3) { |
Sven Panne
2011/10/19 06:16:11
Some comments what each if-branch is supposed to t
| |
55 set(array_1, i, 2*i+1); | 55 set(array_1, i, 2*i+1); |
56 set(array_2, i, 2*i+1); | 56 set(array_2, i, 2*i+1); |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 for (var i = 0; i < length; i++) { | 60 for (var i = 0; i < length; i++) { |
61 if (i == length - 8 && test_double) { | 61 if (i == length - 8 && test_double) { |
62 assertEquals(0.5, array_1[i]); | 62 assertEquals(0.5, array_1[i]); |
63 assertEquals(0.5, array_2[i]); | 63 assertEquals(0.5, array_2[i]); |
64 } else if (i == length - 5 && test_object) { | 64 } else if (i == length - 5 && test_object) { |
65 assertEquals('object', array_1[i]); | 65 assertEquals('object', array_1[i]); |
66 assertEquals('object', array_2[i]); | 66 assertEquals('object', array_2[i]); |
67 } else { | 67 } else if (i != length - 3) { |
68 assertEquals(2*i+1, array_1[i]); | 68 assertEquals(2*i+1, array_1[i]); |
69 assertEquals(2*i+1, array_2[i]); | 69 assertEquals(2*i+1, array_2[i]); |
70 } else { | |
71 assertEquals(undefined, array_1[i]); | |
72 assertEquals(undefined, array_2[i]); | |
70 } | 73 } |
71 } | 74 } |
72 | 75 |
73 assertEquals(length, array_1.length); | 76 assertEquals(length, array_1.length); |
74 assertEquals(length, array_2.length); | 77 assertEquals(length, array_2.length); |
75 } | 78 } |
76 | 79 |
77 test(false, false, function(a,i,v){ a[i] = v; }, 100); | 80 test(false, false, function(a,i,v){ a[i] = v; }, 20); |
78 test(true, false, function(a,i,v){ a[i] = v; }, 100); | 81 test(true, false, function(a,i,v){ a[i] = v; }, 20); |
79 test(false, true, function(a,i,v){ a[i] = v; }, 100); | 82 test(false, true, function(a,i,v){ a[i] = v; }, 20); |
80 test(true, true, function(a,i,v){ a[i] = v; }, 100); | 83 test(true, true, function(a,i,v){ a[i] = v; }, 20); |
81 | 84 |
82 test(false, false, function(a,i,v){ a[i] = v; }, 10000); | 85 test(false, false, function(a,i,v){ a[i] = v; }, 10000); |
83 test(true, false, function(a,i,v){ a[i] = v; }, 10000); | 86 test(true, false, function(a,i,v){ a[i] = v; }, 10000); |
84 test(false, true, function(a,i,v){ a[i] = v; }, 10000); | 87 test(false, true, function(a,i,v){ a[i] = v; }, 10000); |
85 test(true, true, function(a,i,v){ a[i] = v; }, 10000); | 88 test(true, true, function(a,i,v){ a[i] = v; }, 10000); |
86 } else { | 89 } else { |
87 print("Test skipped because smi only arrays are not supported."); | 90 print("Test skipped because smi only arrays are not supported."); |
88 } | 91 } |
OLD | NEW |