| 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: --type-profile --turbo --allow-natives-syntax | 5 // Flags: --type-profile --turbo --allow-natives-syntax |
| 6 | 6 |
| 7 function testFunction(param, flag) { | 7 function testFunction(param, flag) { |
| 8 // We want to test 2 different return positions in one function. | 8 // We want to test 2 different return positions in one function. |
| 9 if (flag) { | 9 if (flag) { |
| 10 var first_var = param; | 10 var first_var = param; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 testFunction({x: 12}); | 32 testFunction({x: 12}); |
| 33 testFunction(new MyClass()); | 33 testFunction(new MyClass()); |
| 34 | 34 |
| 35 %PrintTypeProfile(testFunction); | 35 %PrintTypeProfile(testFunction); |
| 36 | 36 |
| 37 function testReturnOfNonVariable() { | 37 function testReturnOfNonVariable() { |
| 38 return 32; | 38 return 32; |
| 39 } | 39 } |
| 40 | 40 |
| 41 // Return statement is reached but its expression is never really returned. | 41 // Return statement is reached but its expression is never really returned. |
| 42 // TODO(franzih): The only return type should be 'string'. | |
| 43 function try_finally() { | 42 function try_finally() { |
| 44 try { | 43 try { |
| 45 return 23; | 44 return 23; |
| 46 } finally { | 45 } finally { |
| 47 return "nope, string is better" | 46 return "nope, string is better" |
| 48 } | 47 } |
| 49 } | 48 } |
| 50 try_finally(); | 49 try_finally(); |
| 51 %PrintTypeProfile(try_finally); | 50 %PrintTypeProfile(try_finally); |
| 52 | 51 |
| 53 // TODO(franzih): 'undefined' should be the return type. | |
| 54 function fall_off() { | 52 function fall_off() { |
| 55 //nothing | 53 //nothing |
| 56 } | 54 } |
| 57 fall_off(); | 55 fall_off(); |
| 58 %PrintTypeProfile(fall_off); | 56 %PrintTypeProfile(fall_off); |
| 59 | 57 |
| 60 | 58 |
| 61 | 59 |
| 62 | 60 |
| 63 testReturnOfNonVariable(); | 61 testReturnOfNonVariable(); |
| 64 | 62 |
| 65 throw "throw otherwise test fails with --stress-opt"; | 63 throw "throw otherwise test fails with --stress-opt"; |
| OLD | NEW |