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

Side by Side Diff: test/mjsunit/optimized-foreach.js

Issue 2803853005: Inline Array.prototype.forEach in TurboFan (Closed)
Patch Set: fix v8heapconst.py Created 3 years, 7 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
(Empty)
1 // Copyright 2017 the V8 project authors. All rights reserved.
Michael Starzinger 2017/05/24 13:54:59 We should add test coverage for the following: - C
danno 2017/06/06 12:04:53 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --allow-natives-syntax --expose-gc
6
7 var a = [0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,0,0];
8 var b = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
9 var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
10
11 (function() {
12 var result = 0;
13 var eagerDeoptInCalled = function(deopt) {
14 var sum = function(v,i,o) {
15 result += v;
16 if (i == 13 && deopt) {
17 a.length = 25;
18 }
19 }
20 a.forEach(sum);
21 }
22 eagerDeoptInCalled();
23 eagerDeoptInCalled();
24 %OptimizeFunctionOnNextCall(eagerDeoptInCalled);
25 eagerDeoptInCalled();
26 eagerDeoptInCalled(true);
27 eagerDeoptInCalled();
28 assertEquals(1500, result);
29 })();
30
31 (function() {
32 var result = 0;
33 var lazyDeopt = function(deopt) {
34 var sum = function(v,i,o) {
35 result += i;
36 if (i == 13 && deopt) {
37 %DeoptimizeNow();
38 }
39 }
40 b.forEach(sum);
41 }
42 lazyDeopt();
43 lazyDeopt();
44 %OptimizeFunctionOnNextCall(lazyDeopt);
45 lazyDeopt();
46 lazyDeopt(true);
47 lazyDeopt();
48 assertEquals(1500, result);
49 })();
50
51 (function() {
52 var result = 0;
53 var lazyDeopt = function(deopt) {
54 var sum = function(v,i,o) {
55 result += i;
56 if (i == 13 && deopt) {
57 %DeoptimizeNow();
58 gc();
59 gc();
60 gc();
61 }
62 }
63 c.forEach(sum);
64 }
65 lazyDeopt();
66 lazyDeopt();
67 %OptimizeFunctionOnNextCall(lazyDeopt);
68 lazyDeopt();
69 lazyDeopt(true);
70 lazyDeopt();
71 assertEquals(1500, result);
72 })();
OLDNEW
« src/flag-definitions.h ('K') | « src/utils.h ('k') | tools/v8heapconst.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698