| 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 | 5 // Flags: --type-profile --turbo |
| 6 | 6 |
| 7 function test(param) { | 7 function testFunction(param, flag) { |
| 8 var my_var1 = param; | 8 // We want to test 2 different return positions in one function. |
| 9 var my_var2 = 17; | 9 if (flag) { |
| 10 var first_var = param; |
| 11 return first_var; |
| 12 } |
| 13 var second_var = param; |
| 14 return second_var; |
| 10 } | 15 } |
| 11 | 16 |
| 12 test({}); | 17 testFunction({}); |
| 13 test(123); | 18 testFunction(123); |
| 14 test('hello'); | 19 testFunction('hello', true); |
| 15 test(123); | 20 testFunction(undefined); |
| 16 test(undefined); | 21 testFunction({x: 12}, true); |
| 17 test('hello'); | |
| 18 test({x: 12}); | |
| 19 test({x: 12}); | |
| 20 | 22 |
| 21 class MyClass { | 23 class MyClass { |
| 22 constructor() {} | 24 constructor() {} |
| 23 } | 25 } |
| 24 | 26 |
| 25 | 27 |
| 26 function testConstructorNames(param) { | 28 function testConstructorNames(param) { |
| 27 var my_var = param; | 29 var my_var = param; |
| 28 } | 30 } |
| 29 | 31 |
| 30 testConstructorNames(new MyClass()); | 32 testConstructorNames(new MyClass()); |
| 31 testConstructorNames({}); | 33 testConstructorNames({}); |
| 32 testConstructorNames(2); | 34 testConstructorNames(2); |
| 33 | 35 |
| 36 function testReturnOfNonVariable() { |
| 37 return 32; |
| 38 } |
| 39 |
| 40 testReturnOfNonVariable(); |
| 41 |
| 34 throw "throw otherwise test fails with --stress-opt"; | 42 throw "throw otherwise test fails with --stress-opt"; |
| OLD | NEW |