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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 T.CheckCall(T.true_value(), T.Val(12), T.Val(14)); | 492 T.CheckCall(T.true_value(), T.Val(12), T.Val(14)); |
493 } | 493 } |
494 | 494 |
495 | 495 |
496 TEST(InlineBuiltin) { | 496 TEST(InlineBuiltin) { |
497 FLAG_turbo_deoptimization = true; | 497 FLAG_turbo_deoptimization = true; |
498 FunctionTester T( | 498 FunctionTester T( |
499 "(function () {" | 499 "(function () {" |
500 " function foo(s,t,u) { AssertInlineCount(2); return true; }" | 500 " function foo(s,t,u) { AssertInlineCount(2); return true; }" |
501 " function bar() { return foo(); };" | 501 " function bar() { return foo(); };" |
502 " %SetInlineBuiltinFlag(foo);" | 502 " %SetForceInlineFlag(foo);" |
503 " return bar;" | 503 " return bar;" |
504 "})();", | 504 "})();", |
505 kBuiltinInlineFlags); | 505 kBuiltinInlineFlags); |
506 | 506 |
507 InstallAssertInlineCountHelper(CcTest::isolate()); | 507 InstallAssertInlineCountHelper(CcTest::isolate()); |
508 T.CheckCall(T.true_value()); | 508 T.CheckCall(T.true_value()); |
509 } | 509 } |
510 | 510 |
511 | 511 |
512 TEST(InlineNestedBuiltin) { | 512 TEST(InlineNestedBuiltin) { |
513 FLAG_turbo_deoptimization = true; | 513 FLAG_turbo_deoptimization = true; |
514 FunctionTester T( | 514 FunctionTester T( |
515 "(function () {" | 515 "(function () {" |
516 " function foo(s,t,u) { AssertInlineCount(3); return true; }" | 516 " function foo(s,t,u) { AssertInlineCount(3); return true; }" |
517 " function baz(s,t,u) { return foo(s,t,u); }" | 517 " function baz(s,t,u) { return foo(s,t,u); }" |
518 " function bar() { return baz(); };" | 518 " function bar() { return baz(); };" |
519 " %SetInlineBuiltinFlag(foo);" | 519 " %SetForceInlineFlag(foo);" |
520 " %SetInlineBuiltinFlag(baz);" | 520 " %SetForceInlineFlag(baz);" |
521 " return bar;" | 521 " return bar;" |
522 "})();", | 522 "})();", |
523 kBuiltinInlineFlags); | 523 kBuiltinInlineFlags); |
524 | 524 |
525 InstallAssertInlineCountHelper(CcTest::isolate()); | 525 InstallAssertInlineCountHelper(CcTest::isolate()); |
526 T.CheckCall(T.true_value()); | 526 T.CheckCall(T.true_value()); |
527 } | 527 } |
528 | 528 |
529 | 529 |
530 TEST(StrongModeArity) { | 530 TEST(StrongModeArity) { |
(...skipping 17 matching lines...) Expand all Loading... |
548 "(function () {" | 548 "(function () {" |
549 " 'use strong';" | 549 " 'use strong';" |
550 " function foo(x, y) { return x; }" | 550 " function foo(x, y) { return x; }" |
551 " function bar(x, y) { return foo(x); }" | 551 " function bar(x, y) { return foo(x); }" |
552 " return bar;" | 552 " return bar;" |
553 "})();", | 553 "})();", |
554 kInlineFlags); | 554 kInlineFlags); |
555 T.CheckThrows(T.undefined(), T.undefined()); | 555 T.CheckThrows(T.undefined(), T.undefined()); |
556 } | 556 } |
557 #endif // V8_TURBOFAN_TARGET | 557 #endif // V8_TURBOFAN_TARGET |
OLD | NEW |