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