| 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. | |
| 155 obj = fastliteralcase([2, 6, 3], 2); | 151 obj = fastliteralcase([2, 6, 3], 2); |
| 156 assertKind(elements_kind.fast_double, obj); | 152 assertKind(elements_kind.fast_smi_only, obj); |
| 157 } | 153 } |
| 158 | 154 |
| 159 // Verify that we will not pretransition the double->fast path. | 155 // Verify that we will not pretransition the double->fast path. |
| 160 obj = fastliteralcase(get_standard_literal(), "elliot"); | 156 obj = fastliteralcase(get_standard_literal(), "elliot"); |
| 161 assertKind(elements_kind.fast, obj); | 157 assertKind(elements_kind.fast, obj); |
| 162 obj = fastliteralcase(get_standard_literal(), 3); | 158 obj = fastliteralcase(get_standard_literal(), 3); |
| 163 assertKind(elements_kind.fast, obj); | 159 assertKind(elements_kind.fast, obj); |
| 164 | 160 |
| 165 // Make sure this works in crankshafted code too. | 161 // Make sure this works in crankshafted code too. |
| 166 %OptimizeFunctionOnNextCall(get_standard_literal); | 162 %OptimizeFunctionOnNextCall(get_standard_literal); |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 obj[0][0] = 3.5; | 483 obj[0][0] = 3.5; |
| 488 obj[1][0][0] = "goodbye"; | 484 obj[1][0][0] = "goodbye"; |
| 489 assertKind(elements_kind.fast_double, obj[0]); | 485 assertKind(elements_kind.fast_double, obj[0]); |
| 490 assertKind(elements_kind.fast, obj[1][0]); | 486 assertKind(elements_kind.fast, obj[1][0]); |
| 491 | 487 |
| 492 obj = get_deep_nested_literal(); | 488 obj = get_deep_nested_literal(); |
| 493 assertKind(elements_kind.fast_double, obj[0]); | 489 assertKind(elements_kind.fast_double, obj[0]); |
| 494 assertKind(elements_kind.fast, obj[1][0]); | 490 assertKind(elements_kind.fast, obj[1][0]); |
| 495 })(); | 491 })(); |
| 496 } | 492 } |
| OLD | NEW |