| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 assertKind(elements_kind.fast_double, obj); | 141 assertKind(elements_kind.fast_double, obj); |
| 142 | 142 |
| 143 // The test below is in a loop because arrays that live | 143 // The test below is in a loop because arrays that live |
| 144 // at global scope without the chance of being recreated | 144 // at global scope without the chance of being recreated |
| 145 // don't have allocation site information attached. | 145 // don't have allocation site information attached. |
| 146 for (i = 0; i < 2; i++) { | 146 for (i = 0; i < 2; i++) { |
| 147 obj = fastliteralcase([5, 3, 2], 1.5); | 147 obj = fastliteralcase([5, 3, 2], 1.5); |
| 148 assertKind(elements_kind.fast_double, obj); | 148 assertKind(elements_kind.fast_double, obj); |
| 149 obj = fastliteralcase([3, 6, 2], 1.5); | 149 obj = fastliteralcase([3, 6, 2], 1.5); |
| 150 assertKind(elements_kind.fast_double, obj); | 150 assertKind(elements_kind.fast_double, obj); |
| 151 |
| 152 // Note: thanks to pessimistic transition store stubs, we'll attempt |
| 153 // to transition to the most general elements kind seen at a particular |
| 154 // store site. So, the elements kind will be double. |
| 151 obj = fastliteralcase([2, 6, 3], 2); | 155 obj = fastliteralcase([2, 6, 3], 2); |
| 152 assertKind(elements_kind.fast_smi_only, obj); | 156 assertKind(elements_kind.fast_double, obj); |
| 153 } | 157 } |
| 154 | 158 |
| 155 // Verify that we will not pretransition the double->fast path. | 159 // Verify that we will not pretransition the double->fast path. |
| 156 obj = fastliteralcase(get_standard_literal(), "elliot"); | 160 obj = fastliteralcase(get_standard_literal(), "elliot"); |
| 157 assertKind(elements_kind.fast, obj); | 161 assertKind(elements_kind.fast, obj); |
| 158 obj = fastliteralcase(get_standard_literal(), 3); | 162 obj = fastliteralcase(get_standard_literal(), 3); |
| 159 assertKind(elements_kind.fast, obj); | 163 assertKind(elements_kind.fast, obj); |
| 160 | 164 |
| 161 // Make sure this works in crankshafted code too. | 165 // Make sure this works in crankshafted code too. |
| 162 %OptimizeFunctionOnNextCall(get_standard_literal); | 166 %OptimizeFunctionOnNextCall(get_standard_literal); |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 obj[0][0] = 3.5; | 487 obj[0][0] = 3.5; |
| 484 obj[1][0][0] = "goodbye"; | 488 obj[1][0][0] = "goodbye"; |
| 485 assertKind(elements_kind.fast_double, obj[0]); | 489 assertKind(elements_kind.fast_double, obj[0]); |
| 486 assertKind(elements_kind.fast, obj[1][0]); | 490 assertKind(elements_kind.fast, obj[1][0]); |
| 487 | 491 |
| 488 obj = get_deep_nested_literal(); | 492 obj = get_deep_nested_literal(); |
| 489 assertKind(elements_kind.fast_double, obj[0]); | 493 assertKind(elements_kind.fast_double, obj[0]); |
| 490 assertKind(elements_kind.fast, obj[1][0]); | 494 assertKind(elements_kind.fast, obj[1][0]); |
| 491 })(); | 495 })(); |
| 492 } | 496 } |
| OLD | NEW |