Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: test/mjsunit/ensure-growing-store-learns.js

Issue 2654733004: [tests] Make assertOptimized()/assertUnoptimized() great again. (Closed)
Patch Set: Update debugger.status Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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: --no-always-opt --crankshaft
6 7
7 // --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
8 // slow with it on. 9 // slow with it on.
9 10
10 // Ensure that keyed stores work, and optimized functions learn if the 11 assertFalse(isNeverOptimize());
11 // store required change to dictionary mode. Verify that stores that grow 12 assertFalse(isAlwaysOptimize());
12 // the array into large object space don't cause a deopt. 13
14 // Ensure that keyed stores work, and optimized functions learn if the
15 // store required change to dictionary mode. Verify that stores that grow
16 // the array into large object space don't cause a deopt.
13 (function() { 17 (function() {
14 var a = []; 18 var a = [];
15 19
16 function foo(a, i) { 20 function foo(a, i) {
17 a[i] = 5.3; 21 a[i] = 5.3;
18 } 22 }
19 23
20 foo(a, 1); 24 foo(a, 1);
21 foo(a, 2); 25 foo(a, 2);
22 foo(a, 3); 26 foo(a, 3);
(...skipping 30 matching lines...) Expand all
53 a[i] = 50; 57 a[i] = 50;
54 } 58 }
55 59
56 // The KeyedStoreIC will learn GROW_MODE. 60 // The KeyedStoreIC will learn GROW_MODE.
57 foo2(a, 10); 61 foo2(a, 10);
58 foo2(a, 12); 62 foo2(a, 12);
59 foo2(a, 31); 63 foo2(a, 31);
60 %OptimizeFunctionOnNextCall(foo2); 64 %OptimizeFunctionOnNextCall(foo2);
61 foo2(a, 40); 65 foo2(a, 40);
62 66
63 // This test is way too slow without crankshaft. 67 assertOptimized(foo2);
64 if (4 != %GetOptimizationStatus(foo2)) { 68 assertTrue(%HasFastSmiElements(a));
65 assertOptimized(foo2);
66 assertTrue(%HasFastSmiElements(a));
67 69
68 // Grow a large array into large object space through the keyed store 70 // 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 71 // without deoptimizing. Grow by 10s. If we set elements too sparsely, the
70 // array will convert to dictionary mode. 72 // array will convert to dictionary mode.
71 a = new Array(99999); 73 a = new Array(99999);
72 assertTrue(%HasFastSmiElements(a)); 74 assertTrue(%HasFastSmiElements(a));
73 for (var i = 0; i < 263000; i += 10) { 75 for (var i = 0; i < 263000; i += 10) {
74 foo2(a, i); 76 foo2(a, i);
75 } 77 }
76 78
77 // Verify that we are over 1 page in size, and foo2 remains optimized. 79 // 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 80 // This means we've smoothly transitioned to allocating in large object
79 // space. 81 // space.
80 assertTrue(%HasFastSmiElements(a)); 82 assertTrue(%HasFastSmiElements(a));
81 assertTrue(a.length * 4 > (1024 * 1024)); 83 assertTrue(a.length * 4 > (1024 * 1024));
82 assertOptimized(foo2); 84 assertOptimized(foo2);
83 }
84 85
85 %ClearFunctionTypeFeedback(foo2); 86 %ClearFunctionTypeFeedback(foo2);
86 })(); 87 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698