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

Side by Side Diff: test/mjsunit/ignition/osr-from-generator.js

Issue 2185973004: [interpreter] Extend test for OSR from within generators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 5 // Flags: --allow-natives-syntax
6 6
7 (function TestGeneratorOSRSimple() { 7 (function TestGeneratorOSRSimple() {
8 function* gen1() { 8 function* gen1() {
9 for (var i = 0; i < 3; ++i) { 9 for (var i = 0; i < 3; ++i) {
10 if (i == 1) %OptimizeOsr(); 10 if (i == 1) %OptimizeOsr();
11 } 11 }
12 return 23; 12 return 23;
13 } 13 }
14 var g = gen1(); 14 var g = gen1();
15 assertEquals({ value:23, done:true }, g.next()); 15 assertEquals({ value:23, done:true }, g.next());
16 })(); 16 })();
17 17
18 (function TestGeneratorOSRYield() { 18 (function TestGeneratorOSRYieldAfterArming() {
19 function* gen2() { 19 function* gen2() {
20 for (var i = 0; i < 3; ++i) { 20 for (var i = 0; i < 3; ++i) {
21 if (i == 1) %OptimizeOsr(); 21 if (i == 1) %OptimizeOsr();
22 yield i; 22 yield i;
23 } 23 }
24 return 23; 24 return 23;
25 } 25 }
26 var g = gen2(); 26 var g = gen2();
27 assertEquals({ value:0, done:false }, g.next()); 27 assertEquals({ value:0, done:false }, g.next());
28 assertEquals({ value:1, done:false }, g.next()); 28 assertEquals({ value:1, done:false }, g.next());
29 assertEquals({ value:2, done:false }, g.next()); 29 assertEquals({ value:2, done:false }, g.next());
30 assertEquals({ value:23, done:true }, g.next()); 30 assertEquals({ value:23, done:true }, g.next());
31 })(); 31 })();
32 32
33 (function TestGeneratorOSRYieldBeforeArming() {
34 function* gen3() {
35 for (var i = 0; i < 3; ++i) {
36 yield i;
37 if (i == 1) %OptimizeOsr();
38 }
39 return 23;
40 }
41 var g = gen3();
42 assertEquals({ value:0, done:false }, g.next());
43 assertEquals({ value:1, done:false }, g.next());
44 assertEquals({ value:2, done:false }, g.next());
45 assertEquals({ value:23, done:true }, g.next());
46 })();
47
33 (function TestGeneratorOSRNested() { 48 (function TestGeneratorOSRNested() {
34 function* gen3() { 49 function* gen4() {
35 for (var i = 0; i < 3; ++i) { 50 for (var i = 0; i < 3; ++i) {
36 for (var j = 0; j < 3; ++j) { 51 for (var j = 0; j < 3; ++j) {
37 for (var k = 0; k < 10; ++k) { 52 for (var k = 0; k < 10; ++k) {
38 if (k == 5) %OptimizeOsr(); 53 if (k == 5) %OptimizeOsr();
39 } 54 }
40 } 55 }
41 yield i; 56 yield i;
42 } 57 }
43 return 23; 58 return 23;
44 } 59 }
45 var g = gen3(); 60 var g = gen4();
46 assertEquals({ value:0, done:false }, g.next()); 61 assertEquals({ value:0, done:false }, g.next());
47 assertEquals({ value:1, done:false }, g.next()); 62 assertEquals({ value:1, done:false }, g.next());
48 assertEquals({ value:2, done:false }, g.next()); 63 assertEquals({ value:2, done:false }, g.next());
49 assertEquals({ value:23, done:true }, g.next()); 64 assertEquals({ value:23, done:true }, g.next());
50 })(); 65 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698