OLD | NEW |
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 --ignition --ignition-osr --turbo-from-bytecode | 5 // Flags: --allow-natives-syntax --ignition --ignition-osr |
6 | 6 |
7 (function TestNonLoopyLoop() { | 7 (function TestNonLoopyLoop() { |
8 function f() { | 8 function f() { |
9 do { | 9 do { |
10 %OptimizeOsr(); | 10 %OptimizeOsr(); |
11 return 23; | 11 return 23; |
12 } while(false) | 12 } while(false) |
13 } | 13 } |
14 assertEquals(23, f()); | 14 assertEquals(23, f()); |
15 assertEquals(23, f()); | 15 assertEquals(23, f()); |
16 })(); | 16 })(); |
17 | 17 |
18 (function TestNonLoopyGenerator() { | 18 (function TestNonLoopyGenerator() { |
19 function* g() { | 19 function* g() { |
20 do { | 20 do { |
21 %OptimizeOsr(); | 21 %OptimizeOsr(); |
22 yield 23; | 22 yield 23; |
23 yield 42; | 23 yield 42; |
24 } while(false) | 24 } while(false) |
25 return 999; | 25 return 999; |
26 } | 26 } |
27 var gen = g(); | 27 var gen = g(); |
28 assertEquals({ value:23, done:false }, gen.next()); | 28 assertEquals({ value:23, done:false }, gen.next()); |
29 assertEquals({ value:42, done:false }, gen.next()); | 29 assertEquals({ value:42, done:false }, gen.next()); |
30 assertEquals({ value:999, done:true }, gen.next()); | 30 assertEquals({ value:999, done:true }, gen.next()); |
31 })(); | 31 })(); |
OLD | NEW |