| 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/frames-inl.h" | 5 #include "src/frames-inl.h" |
| 6 #include "test/cctest/compiler/function-tester.h" | 6 #include "test/cctest/compiler/function-tester.h" |
| 7 | 7 |
| 8 namespace v8 { | 8 namespace v8 { |
| 9 namespace internal { | 9 namespace internal { |
| 10 namespace compiler { | 10 namespace compiler { |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 " %SetForceInlineFlag(baz);" | 535 " %SetForceInlineFlag(baz);" |
| 536 " return bar;" | 536 " return bar;" |
| 537 "})();", | 537 "})();", |
| 538 kRestrictedInliningFlags); | 538 kRestrictedInliningFlags); |
| 539 | 539 |
| 540 InstallAssertInlineCountHelper(CcTest::isolate()); | 540 InstallAssertInlineCountHelper(CcTest::isolate()); |
| 541 T.CheckCall(T.true_value()); | 541 T.CheckCall(T.true_value()); |
| 542 } | 542 } |
| 543 | 543 |
| 544 | 544 |
| 545 TEST(StrongModeArity) { | |
| 546 FLAG_strong_mode = true; | |
| 547 FunctionTester T( | |
| 548 "(function () {" | |
| 549 " function foo(x, y) { 'use strong'; return x; }" | |
| 550 " function bar(x, y) { return foo(x); }" | |
| 551 " return bar;" | |
| 552 "})();", | |
| 553 kInlineFlags); | |
| 554 T.CheckThrows(T.undefined(), T.undefined()); | |
| 555 } | |
| 556 | |
| 557 | |
| 558 TEST(StrongModeArityOuter) { | |
| 559 FLAG_strong_mode = true; | |
| 560 FunctionTester T( | |
| 561 "(function () {" | |
| 562 " 'use strong';" | |
| 563 " function foo(x, y) { return x; }" | |
| 564 " function bar(x, y) { return foo(x); }" | |
| 565 " return bar;" | |
| 566 "})();", | |
| 567 kInlineFlags); | |
| 568 T.CheckThrows(T.undefined(), T.undefined()); | |
| 569 } | |
| 570 | |
| 571 | |
| 572 TEST(InlineSelfRecursive) { | 545 TEST(InlineSelfRecursive) { |
| 573 FunctionTester T( | 546 FunctionTester T( |
| 574 "(function () {" | 547 "(function () {" |
| 575 " function foo(x) { " | 548 " function foo(x) { " |
| 576 " AssertInlineCount(1);" | 549 " AssertInlineCount(1);" |
| 577 " if (x == 1) return foo(12);" | 550 " if (x == 1) return foo(12);" |
| 578 " return x;" | 551 " return x;" |
| 579 " }" | 552 " }" |
| 580 " return foo;" | 553 " return foo;" |
| 581 "})();", | 554 "})();", |
| (...skipping 16 matching lines...) Expand all Loading... |
| 598 "})();", | 571 "})();", |
| 599 kInlineFlags); | 572 kInlineFlags); |
| 600 | 573 |
| 601 InstallAssertInlineCountHelper(CcTest::isolate()); | 574 InstallAssertInlineCountHelper(CcTest::isolate()); |
| 602 T.CheckCall(T.Val(42), T.Val(1)); | 575 T.CheckCall(T.Val(42), T.Val(1)); |
| 603 } | 576 } |
| 604 | 577 |
| 605 } // namespace compiler | 578 } // namespace compiler |
| 606 } // namespace internal | 579 } // namespace internal |
| 607 } // namespace v8 | 580 } // namespace v8 |
| OLD | NEW |