OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "test/cctest/compiler/function-tester.h" | 7 #include "test/cctest/compiler/function-tester.h" |
8 | 8 |
9 #if V8_TURBOFAN_TARGET | 9 #if V8_TURBOFAN_TARGET |
10 | 10 |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 "(function () {" | 534 "(function () {" |
535 " 'use strong';" | 535 " 'use strong';" |
536 " function foo(x, y) { return x; }" | 536 " function foo(x, y) { return x; }" |
537 " function bar(x, y) { return foo(x); }" | 537 " function bar(x, y) { return foo(x); }" |
538 " return bar;" | 538 " return bar;" |
539 "})();", | 539 "})();", |
540 kInlineFlags); | 540 kInlineFlags); |
541 T.CheckThrows(T.undefined(), T.undefined()); | 541 T.CheckThrows(T.undefined(), T.undefined()); |
542 } | 542 } |
543 | 543 |
| 544 |
| 545 TEST(InlineSelfRecursive) { |
| 546 FunctionTester T( |
| 547 "(function () {" |
| 548 " function foo(x) { " |
| 549 " AssertInlineCount(1);" |
| 550 " if (x == 1) return foo(12);" |
| 551 " return x;" |
| 552 " }" |
| 553 " return foo;" |
| 554 "})();", |
| 555 kInlineFlags); |
| 556 |
| 557 InstallAssertInlineCountHelper(CcTest::isolate()); |
| 558 T.CheckCall(T.Val(12), T.Val(1)); |
| 559 } |
| 560 |
| 561 |
| 562 TEST(InlineMutuallyRecursive) { |
| 563 FunctionTester T( |
| 564 "(function () {" |
| 565 " function bar(x) { AssertInlineCount(2); return foo(x); }" |
| 566 " function foo(x) { " |
| 567 " if (x == 1) return bar(42);" |
| 568 " return x;" |
| 569 " }" |
| 570 " return foo;" |
| 571 "})();", |
| 572 kInlineFlags); |
| 573 |
| 574 InstallAssertInlineCountHelper(CcTest::isolate()); |
| 575 T.CheckCall(T.Val(42), T.Val(1)); |
| 576 } |
| 577 |
544 #endif // V8_TURBOFAN_TARGET | 578 #endif // V8_TURBOFAN_TARGET |
OLD | NEW |