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 // Flags: --crankshaft --no-always-opt | 6 // Flags: --crankshaft --no-always-opt |
7 | 7 |
8 // --noverify-heap and --noenable-slow-asserts are set because the test is too | 8 // --noverify-heap and --noenable-slow-asserts are set because the test is too |
9 // slow with it on. | 9 // slow with it on. |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 foo2(a, 10); | 58 foo2(a, 10); |
59 foo2(a, 12); | 59 foo2(a, 12); |
60 foo2(a, 31); | 60 foo2(a, 31); |
61 %OptimizeFunctionOnNextCall(foo2); | 61 %OptimizeFunctionOnNextCall(foo2); |
62 foo2(a, 40); | 62 foo2(a, 40); |
63 | 63 |
64 assertOptimized(foo2); | 64 assertOptimized(foo2); |
65 assertTrue(%HasFastSmiElements(a)); | 65 assertTrue(%HasFastSmiElements(a)); |
66 | 66 |
67 // Grow a large array into large object space through the keyed store | 67 // Grow a large array into large object space through the keyed store |
68 // without deoptimizing. Grow by 10s. If we set elements too sparsely, the | 68 // without deoptimizing. Grow by 9s. If we set elements too sparsely, the |
69 // array will convert to dictionary mode. | 69 // array will convert to dictionary mode. |
70 a = new Array(99999); | 70 a = new Array(99999); |
71 assertTrue(%HasFastSmiElements(a)); | 71 assertTrue(%HasFastSmiElements(a)); |
72 for (var i = 0; i < 263000; i += 10) { | 72 for (var i = 0; i < 263000; i += 9) { |
73 foo2(a, i); | 73 foo2(a, i); |
74 } | 74 } |
75 | 75 |
76 // Verify that we are over 1 page in size, and foo2 remains optimized. | 76 // Verify that we are over 1 page in size, and foo2 remains optimized. |
77 // This means we've smoothly transitioned to allocating in large object | 77 // This means we've smoothly transitioned to allocating in large object |
78 // space. | 78 // space. |
79 assertTrue(%HasFastSmiElements(a)); | 79 assertTrue(%HasFastSmiElements(a)); |
80 assertTrue(a.length * 4 > (1024 * 1024)); | 80 assertTrue(a.length * 4 > (1024 * 1024)); |
81 assertOptimized(foo2); | 81 assertOptimized(foo2); |
82 | 82 |
83 %ClearFunctionFeedback(foo2); | 83 %ClearFunctionFeedback(foo2); |
84 })(); | 84 })(); |
OLD | NEW |