OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 return new Array(len); | 123 return new Array(len); |
124 } | 124 } |
125 a = bar(10); | 125 a = bar(10); |
126 a[0] = "a string"; | 126 a[0] = "a string"; |
127 a = bar(10); | 127 a = bar(10); |
128 assertKind(elements_kind.fast, a); | 128 assertKind(elements_kind.fast, a); |
129 %OptimizeFunctionOnNextCall(bar); | 129 %OptimizeFunctionOnNextCall(bar); |
130 a = bar(10); | 130 a = bar(10); |
131 assertKind(elements_kind.fast, a); | 131 assertKind(elements_kind.fast, a); |
132 assertOptimized(bar); | 132 assertOptimized(bar); |
133 a = bar(100000); | 133 bar(100000); |
134 assertKind(elements_kind.dictionary, a); | |
135 assertOptimized(bar); | 134 assertOptimized(bar); |
136 | 135 |
137 // If the argument isn't a smi, things should still work. | 136 // If the argument isn't a smi, things should still work. |
138 a = bar("oops"); | 137 a = bar("oops"); |
139 assertOptimized(bar); | 138 assertOptimized(bar); |
140 assertKind(elements_kind.fast, a); | 139 assertKind(elements_kind.fast, a); |
141 | 140 |
142 function barn(one, two, three) { | 141 function barn(one, two, three) { |
143 return new Array(one, two, three); | 142 return new Array(one, two, three); |
144 } | 143 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 a = bar(100); | 210 a = bar(100); |
212 assertTrue(isHoley(a)); | 211 assertTrue(isHoley(a)); |
213 a = bar(0); | 212 a = bar(0); |
214 assertOptimized(bar); | 213 assertOptimized(bar); |
215 // Crankshafted functions don't use mementos, so feedback still | 214 // Crankshafted functions don't use mementos, so feedback still |
216 // indicates a packed array is desired. (unless --nocrankshaft is in use). | 215 // indicates a packed array is desired. (unless --nocrankshaft is in use). |
217 if (4 != %GetOptimizationStatus(bar)) { | 216 if (4 != %GetOptimizationStatus(bar)) { |
218 assertFalse(isHoley(a)); | 217 assertFalse(isHoley(a)); |
219 } | 218 } |
220 })(); | 219 })(); |
OLD | NEW |