Index: test/cctest/compiler/test-run-inlining.cc |
diff --git a/test/cctest/compiler/test-run-inlining.cc b/test/cctest/compiler/test-run-inlining.cc |
index 76cd4a8eb6335ba4b1c4a2b5c28a423f1d793d36..7f8ae256198d4a017d507ad25e262814f90a8ca3 100644 |
--- a/test/cctest/compiler/test-run-inlining.cc |
+++ b/test/cctest/compiler/test-run-inlining.cc |
@@ -541,4 +541,38 @@ TEST(StrongModeArityOuter) { |
T.CheckThrows(T.undefined(), T.undefined()); |
} |
+ |
+TEST(InlineSelfRecursive) { |
+ FunctionTester T( |
+ "(function () {" |
+ " function foo(x) { " |
+ " AssertInlineCount(1);" |
+ " if (x == 1) return foo(12);" |
+ " return x;" |
+ " }" |
+ " return foo;" |
+ "})();", |
+ kInlineFlags); |
+ |
+ InstallAssertInlineCountHelper(CcTest::isolate()); |
+ T.CheckCall(T.Val(12), T.Val(1)); |
+} |
+ |
+ |
+TEST(InlineMutuallyRecursive) { |
+ FunctionTester T( |
+ "(function () {" |
+ " function bar(x) { AssertInlineCount(2); return foo(x); }" |
+ " function foo(x) { " |
+ " if (x == 1) return bar(42);" |
+ " return x;" |
+ " }" |
+ " return foo;" |
+ "})();", |
+ kInlineFlags); |
+ |
+ InstallAssertInlineCountHelper(CcTest::isolate()); |
+ T.CheckCall(T.Val(42), T.Val(1)); |
+} |
+ |
#endif // V8_TURBOFAN_TARGET |