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

Unified Diff: test/message/type-profile/collect-type-profile.js

Issue 2755973002: [type profile] Collect return types. (Closed)
Patch Set: Clean up. 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
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 45572af20c3d3ee3988942804d572871b87069d1..e0d8442161960e83d0b671ac3967fff64d0d66d7 100644
--- a/test/message/type-profile/collect-type-profile.js
+++ b/test/message/type-profile/collect-type-profile.js
@@ -4,19 +4,21 @@
// Flags: --type-profile --turbo
-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;
}
-test({});
-test(123);
-test('hello');
-test(123);
-test(undefined);
-test('hello');
-test({x: 12});
-test({x: 12});
+testFunction({});
+testFunction(123);
+testFunction('hello', true);
+testFunction(undefined);
+testFunction({x: 12}, true);
class MyClass {
constructor() {}
@@ -31,4 +33,10 @@ testConstructorNames(new MyClass());
testConstructorNames({});
testConstructorNames(2);
+function testReturnOfNonVariable() {
+ return 32;
+}
+
+testReturnOfNonVariable();
+
throw "throw otherwise test fails with --stress-opt";

Powered by Google App Engine
This is Rietveld 408576698