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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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";
« 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