OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --allow-natives-syntax --noverify-heap --noenable-slow-asserts | 5 // Flags: --allow-natives-syntax --noverify-heap --noenable-slow-asserts |
6 | 6 |
7 // --noverify-heap and --noenable-slow-asserts are set because the test is too | 7 // --noverify-heap and --noenable-slow-asserts are set because the test is too |
8 // slow with it on. | 8 // slow with it on. |
9 | 9 |
10 // Ensure that keyed stores work, and optimized functions learn if the | 10 // Ensure that keyed stores work, and optimized functions learn if the |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 } | 54 } |
55 | 55 |
56 // The KeyedStoreIC will learn GROW_MODE. | 56 // The KeyedStoreIC will learn GROW_MODE. |
57 foo2(a, 10); | 57 foo2(a, 10); |
58 foo2(a, 12); | 58 foo2(a, 12); |
59 foo2(a, 31); | 59 foo2(a, 31); |
60 %OptimizeFunctionOnNextCall(foo2); | 60 %OptimizeFunctionOnNextCall(foo2); |
61 foo2(a, 40); | 61 foo2(a, 40); |
62 | 62 |
63 // This test is way too slow without crankshaft. | 63 // This test is way too slow without crankshaft. |
64 if (4 != %GetOptimizationStatus(foo2)) { | 64 var opt_status = %GetOptimizationStatus(foo2); |
| 65 if ((opt_status & V8OptimizationStatus.kNeverOptimize) === 0) { |
65 assertOptimized(foo2); | 66 assertOptimized(foo2); |
66 assertTrue(%HasFastSmiElements(a)); | 67 assertTrue(%HasFastSmiElements(a)); |
67 | 68 |
68 // Grow a large array into large object space through the keyed store | 69 // Grow a large array into large object space through the keyed store |
69 // without deoptimizing. Grow by 10s. If we set elements too sparsely, the | 70 // without deoptimizing. Grow by 10s. If we set elements too sparsely, the |
70 // array will convert to dictionary mode. | 71 // array will convert to dictionary mode. |
71 a = new Array(99999); | 72 a = new Array(99999); |
72 assertTrue(%HasFastSmiElements(a)); | 73 assertTrue(%HasFastSmiElements(a)); |
73 for (var i = 0; i < 263000; i += 10) { | 74 for (var i = 0; i < 263000; i += 10) { |
74 foo2(a, i); | 75 foo2(a, i); |
75 } | 76 } |
76 | 77 |
77 // Verify that we are over 1 page in size, and foo2 remains optimized. | 78 // Verify that we are over 1 page in size, and foo2 remains optimized. |
78 // This means we've smoothly transitioned to allocating in large object | 79 // This means we've smoothly transitioned to allocating in large object |
79 // space. | 80 // space. |
80 assertTrue(%HasFastSmiElements(a)); | 81 assertTrue(%HasFastSmiElements(a)); |
81 assertTrue(a.length * 4 > (1024 * 1024)); | 82 assertTrue(a.length * 4 > (1024 * 1024)); |
82 assertOptimized(foo2); | 83 assertOptimized(foo2); |
83 } | 84 } |
84 | 85 |
85 %ClearFunctionTypeFeedback(foo2); | 86 %ClearFunctionTypeFeedback(foo2); |
86 })(); | 87 })(); |
OLD | NEW |