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

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

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

Powered by Google App Engine
This is Rietveld 408576698