Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: test/message/type-profile/collect-type-profile.js

Issue 2755973002: [type profile] Collect return types. (Closed)
Patch Set: Rebase. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | test/message/type-profile/collect-type-profile.out » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 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 %PrintTypeProfile(test); 17 %PrintTypeProfile(testFunction);
13 18
14 test({}); 19 testFunction({});
15 test(123); 20 testFunction(123, true);
16 test('hello'); 21 testFunction('hello');
17 test(123); 22 testFunction(123);
18 %PrintTypeProfile(test); 23 %PrintTypeProfile(testFunction);
19 24
20 test(undefined); 25 testFunction(undefined);
21 test('hello'); 26 testFunction('hello', true);
22 test({x: 12}); 27 testFunction({x: 12}, true);
23 test({x: 12}); 28 testFunction({x: 12});
24 29
25 %PrintTypeProfile(test); 30 %PrintTypeProfile(testFunction);
26 31
27 class MyClass { 32 class MyClass {
28 constructor() {} 33 constructor() {}
29 } 34 }
30 35
31 36
32 function testConstructorNames(param) { 37 function testConstructorNames(param) {
33 var my_var = param; 38 var my_var = param;
34 } 39 }
35 40
36 testConstructorNames(new MyClass()); 41 testConstructorNames(new MyClass());
37 testConstructorNames({}); 42 testConstructorNames({});
38 testConstructorNames(2); 43 testConstructorNames(2);
39 44
45 function testReturnOfNonVariable() {
46 return 32;
47 }
48
49 testReturnOfNonVariable();
50
40 throw "throw otherwise test fails with --stress-opt"; 51 throw "throw otherwise test fails with --stress-opt";
OLDNEW
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | test/message/type-profile/collect-type-profile.out » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698