| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 var literal = [1, 2, 3]; | 126 var literal = [1, 2, 3]; |
| 127 return literal; | 127 return literal; |
| 128 } | 128 } |
| 129 | 129 |
| 130 // Case: [1,2,3] as allocation site | 130 // Case: [1,2,3] as allocation site |
| 131 obj = fastliteralcase(get_standard_literal(), 1); | 131 obj = fastliteralcase(get_standard_literal(), 1); |
| 132 assertKind(elements_kind.fast_smi_only, obj); | 132 assertKind(elements_kind.fast_smi_only, obj); |
| 133 obj = fastliteralcase(get_standard_literal(), 1.5); | 133 obj = fastliteralcase(get_standard_literal(), 1.5); |
| 134 assertKind(elements_kind.fast_double, obj); | 134 assertKind(elements_kind.fast_double, obj); |
| 135 obj = fastliteralcase(get_standard_literal(), 2); | 135 obj = fastliteralcase(get_standard_literal(), 2); |
| 136 // TODO(hpayer): bring the following assert back as soon as allocation | 136 assertKind(elements_kind.fast_double, obj); |
| 137 // sites work again for fast literals | |
| 138 //assertKind(elements_kind.fast_double, obj); | |
| 139 | 137 |
| 140 // The test below is in a loop because arrays that live | 138 // The test below is in a loop because arrays that live |
| 141 // at global scope without the chance of being recreated | 139 // at global scope without the chance of being recreated |
| 142 // don't have allocation site information attached. | 140 // don't have allocation site information attached. |
| 143 for (i = 0; i < 2; i++) { | 141 for (i = 0; i < 2; i++) { |
| 144 obj = fastliteralcase([5, 3, 2], 1.5); | 142 obj = fastliteralcase([5, 3, 2], 1.5); |
| 145 assertKind(elements_kind.fast_double, obj); | 143 assertKind(elements_kind.fast_double, obj); |
| 146 obj = fastliteralcase([3, 6, 2], 1.5); | 144 obj = fastliteralcase([3, 6, 2], 1.5); |
| 147 assertKind(elements_kind.fast_double, obj); | 145 assertKind(elements_kind.fast_double, obj); |
| 148 obj = fastliteralcase([2, 6, 3], 2); | 146 obj = fastliteralcase([2, 6, 3], 2); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 168 var literal = [1, 2, 3, 4]; | 166 var literal = [1, 2, 3, 4]; |
| 169 literal[0] = value; | 167 literal[0] = value; |
| 170 return literal; | 168 return literal; |
| 171 } | 169 } |
| 172 | 170 |
| 173 obj = fastliteralcase_smifast(1); | 171 obj = fastliteralcase_smifast(1); |
| 174 assertKind(elements_kind.fast_smi_only, obj); | 172 assertKind(elements_kind.fast_smi_only, obj); |
| 175 obj = fastliteralcase_smifast("carter"); | 173 obj = fastliteralcase_smifast("carter"); |
| 176 assertKind(elements_kind.fast, obj); | 174 assertKind(elements_kind.fast, obj); |
| 177 obj = fastliteralcase_smifast(2); | 175 obj = fastliteralcase_smifast(2); |
| 178 // TODO(hpayer): bring the following assert back as soon as allocation | 176 assertKind(elements_kind.fast, obj); |
| 179 // sites work again for fast literals | |
| 180 //assertKind(elements_kind.fast, obj); | |
| 181 | 177 |
| 182 function newarraycase_smidouble(value) { | 178 function newarraycase_smidouble(value) { |
| 183 var a = new Array(); | 179 var a = new Array(); |
| 184 a[0] = value; | 180 a[0] = value; |
| 185 return a; | 181 return a; |
| 186 } | 182 } |
| 187 | 183 |
| 188 // Case: new Array() as allocation site, smi->double | 184 // Case: new Array() as allocation site, smi->double |
| 189 obj = newarraycase_smidouble(1); | 185 obj = newarraycase_smidouble(1); |
| 190 assertKind(elements_kind.fast_smi_only, obj); | 186 assertKind(elements_kind.fast_smi_only, obj); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 %ClearFunctionTypeFeedback(instanceof_check); | 316 %ClearFunctionTypeFeedback(instanceof_check); |
| 321 instanceof_check(Array); | 317 instanceof_check(Array); |
| 322 instanceof_check(Array); | 318 instanceof_check(Array); |
| 323 %OptimizeFunctionOnNextCall(instanceof_check); | 319 %OptimizeFunctionOnNextCall(instanceof_check); |
| 324 instanceof_check(Array); | 320 instanceof_check(Array); |
| 325 assertTrue(2 != %GetOptimizationStatus(instanceof_check)); | 321 assertTrue(2 != %GetOptimizationStatus(instanceof_check)); |
| 326 | 322 |
| 327 instanceof_check(realmBArray); | 323 instanceof_check(realmBArray); |
| 328 assertTrue(1 != %GetOptimizationStatus(instanceof_check)); | 324 assertTrue(1 != %GetOptimizationStatus(instanceof_check)); |
| 329 } | 325 } |
| OLD | NEW |