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