| Index: test/message/type-profile/collect-type-profile.js
|
| diff --git a/test/message/type-profile/collect-type-profile.js b/test/message/type-profile/collect-type-profile.js
|
| index e08d6caf1cc1a4f532e247da5934e61cf0e2a128..cecd221a9d36edd055de909ecb70ec062072e0bb 100644
|
| --- a/test/message/type-profile/collect-type-profile.js
|
| +++ b/test/message/type-profile/collect-type-profile.js
|
| @@ -4,25 +4,30 @@
|
|
|
| // Flags: --type-profile --turbo --allow-natives-syntax
|
|
|
| -function test(param) {
|
| - var my_var1 = param;
|
| - var my_var2 = 17;
|
| +function testFunction(param, flag) {
|
| + // We want to test 2 different return positions in one function.
|
| + if (flag) {
|
| + var first_var = param;
|
| + return first_var;
|
| + }
|
| + var second_var = param;
|
| + return second_var;
|
| }
|
|
|
| -%PrintTypeProfile(test);
|
| +%PrintTypeProfile(testFunction);
|
|
|
| -test({});
|
| -test(123);
|
| -test('hello');
|
| -test(123);
|
| -%PrintTypeProfile(test);
|
| +testFunction({});
|
| +testFunction(123, true);
|
| +testFunction('hello');
|
| +testFunction(123);
|
| +%PrintTypeProfile(testFunction);
|
|
|
| -test(undefined);
|
| -test('hello');
|
| -test({x: 12});
|
| -test({x: 12});
|
| +testFunction(undefined);
|
| +testFunction('hello', true);
|
| +testFunction({x: 12}, true);
|
| +testFunction({x: 12});
|
|
|
| -%PrintTypeProfile(test);
|
| +%PrintTypeProfile(testFunction);
|
|
|
| class MyClass {
|
| constructor() {}
|
| @@ -37,4 +42,10 @@ testConstructorNames(new MyClass());
|
| testConstructorNames({});
|
| testConstructorNames(2);
|
|
|
| +function testReturnOfNonVariable() {
|
| + return 32;
|
| +}
|
| +
|
| +testReturnOfNonVariable();
|
| +
|
| throw "throw otherwise test fails with --stress-opt";
|
|
|