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

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

Issue 2655223003: Revert of [tests] Make assertOptimized()/assertUnoptimized() great again. (Closed)
Patch Set: 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
« no previous file with comments | « test/mjsunit/deopt-with-fp-regs.js ('k') | test/mjsunit/es6/array-iterator-turbo.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
7 6
8 // --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
9 // slow with it on. 8 // slow with it on.
10 9
11 assertFalse(isNeverOptimize()); 10 // Ensure that keyed stores work, and optimized functions learn if the
12 assertFalse(isAlwaysOptimize()); 11 // store required change to dictionary mode. Verify that stores that grow
13 12 // the array into large object space don't cause a deopt.
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.
17 (function() { 13 (function() {
18 var a = []; 14 var a = [];
19 15
20 function foo(a, i) { 16 function foo(a, i) {
21 a[i] = 5.3; 17 a[i] = 5.3;
22 } 18 }
23 19
24 foo(a, 1); 20 foo(a, 1);
25 foo(a, 2); 21 foo(a, 2);
26 foo(a, 3); 22 foo(a, 3);
(...skipping 30 matching lines...) Expand all
57 a[i] = 50; 53 a[i] = 50;
58 } 54 }
59 55
60 // The KeyedStoreIC will learn GROW_MODE. 56 // The KeyedStoreIC will learn GROW_MODE.
61 foo2(a, 10); 57 foo2(a, 10);
62 foo2(a, 12); 58 foo2(a, 12);
63 foo2(a, 31); 59 foo2(a, 31);
64 %OptimizeFunctionOnNextCall(foo2); 60 %OptimizeFunctionOnNextCall(foo2);
65 foo2(a, 40); 61 foo2(a, 40);
66 62
67 assertOptimized(foo2); 63 // This test is way too slow without crankshaft.
68 assertTrue(%HasFastSmiElements(a)); 64 if (4 != %GetOptimizationStatus(foo2)) {
65 assertOptimized(foo2);
66 assertTrue(%HasFastSmiElements(a));
69 67
70 // Grow a large array into large object space through the keyed store 68 // Grow a large array into large object space through the keyed store
71 // without deoptimizing. Grow by 10s. If we set elements too sparsely, the 69 // without deoptimizing. Grow by 10s. If we set elements too sparsely, the
72 // array will convert to dictionary mode. 70 // array will convert to dictionary mode.
73 a = new Array(99999); 71 a = new Array(99999);
74 assertTrue(%HasFastSmiElements(a)); 72 assertTrue(%HasFastSmiElements(a));
75 for (var i = 0; i < 263000; i += 10) { 73 for (var i = 0; i < 263000; i += 10) {
76 foo2(a, i); 74 foo2(a, i);
75 }
76
77 // 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 // space.
80 assertTrue(%HasFastSmiElements(a));
81 assertTrue(a.length * 4 > (1024 * 1024));
82 assertOptimized(foo2);
77 } 83 }
78 84
79 // Verify that we are over 1 page in size, and foo2 remains optimized.
80 // This means we've smoothly transitioned to allocating in large object
81 // space.
82 assertTrue(%HasFastSmiElements(a));
83 assertTrue(a.length * 4 > (1024 * 1024));
84 assertOptimized(foo2);
85
86 %ClearFunctionTypeFeedback(foo2); 85 %ClearFunctionTypeFeedback(foo2);
87 })(); 86 })();
OLDNEW
« no previous file with comments | « test/mjsunit/deopt-with-fp-regs.js ('k') | test/mjsunit/es6/array-iterator-turbo.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698