Commit 70489a1b authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[interpreter] Extend test for OSR from within generators.

R=rmcilroy@chromium.org
TEST=mjsunit/ignition/osr-from-generator
BUG=v8:4764

Review-Url: https://codereview.chromium.org/2185973004
Cr-Commit-Position: refs/heads/master@{#38144}
parent 8587c4ce
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
assertEquals({ value:23, done:true }, g.next()); assertEquals({ value:23, done:true }, g.next());
})(); })();
(function TestGeneratorOSRYield() { (function TestGeneratorOSRYieldAfterArming() {
function* gen2() { function* gen2() {
for (var i = 0; i < 3; ++i) { for (var i = 0; i < 3; ++i) {
if (i == 1) %OptimizeOsr(); if (i == 1) %OptimizeOsr();
...@@ -30,8 +30,23 @@ ...@@ -30,8 +30,23 @@
assertEquals({ value:23, done:true }, g.next()); assertEquals({ value:23, done:true }, g.next());
})(); })();
(function TestGeneratorOSRNested() { (function TestGeneratorOSRYieldBeforeArming() {
function* gen3() { function* gen3() {
for (var i = 0; i < 3; ++i) {
yield i;
if (i == 1) %OptimizeOsr();
}
return 23;
}
var g = gen3();
assertEquals({ value:0, done:false }, g.next());
assertEquals({ value:1, done:false }, g.next());
assertEquals({ value:2, done:false }, g.next());
assertEquals({ value:23, done:true }, g.next());
})();
(function TestGeneratorOSRNested() {
function* gen4() {
for (var i = 0; i < 3; ++i) { for (var i = 0; i < 3; ++i) {
for (var j = 0; j < 3; ++j) { for (var j = 0; j < 3; ++j) {
for (var k = 0; k < 10; ++k) { for (var k = 0; k < 10; ++k) {
...@@ -42,7 +57,7 @@ ...@@ -42,7 +57,7 @@
} }
return 23; return 23;
} }
var g = gen3(); var g = gen4();
assertEquals({ value:0, done:false }, g.next()); assertEquals({ value:0, done:false }, g.next());
assertEquals({ value:1, done:false }, g.next()); assertEquals({ value:1, done:false }, g.next());
assertEquals({ value:2, done:false }, g.next()); assertEquals({ value:2, done:false }, g.next());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment