OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 | 599 |
600 // Tear down internal frame. | 600 // Tear down internal frame. |
601 } | 601 } |
602 | 602 |
603 // Do a tail-call of the compiled function. | 603 // Do a tail-call of the compiled function. |
604 __ lea(rax, FieldOperand(rax, Code::kHeaderSize)); | 604 __ lea(rax, FieldOperand(rax, Code::kHeaderSize)); |
605 __ jmp(rax); | 605 __ jmp(rax); |
606 } | 606 } |
607 | 607 |
608 | 608 |
| 609 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { |
| 610 // For now, we are relying on the fact that make_code_young doesn't do any |
| 611 // garbage collection which allows us to save/restore the registers without |
| 612 // worrying about which of them contain pointers. We also don't build an |
| 613 // internal frame to make the code faster, since we shouldn't have to do stack |
| 614 // crawls in MakeCodeYoung. This seems a bit fragile. |
| 615 |
| 616 // Re-execute the code that was patched back to the young age when |
| 617 // the stub returns. |
| 618 __ subq(Operand(rsp, 0), Immediate(5)); |
| 619 __ Pushad(); |
| 620 #ifdef _WIN64 |
| 621 __ movq(rcx, Operand(rsp, kNumSafepointRegisters * kPointerSize)); |
| 622 #else |
| 623 __ movq(rdi, Operand(rsp, kNumSafepointRegisters * kPointerSize)); |
| 624 #endif |
| 625 { // NOLINT |
| 626 FrameScope scope(masm, StackFrame::MANUAL); |
| 627 __ PrepareCallCFunction(1); |
| 628 __ CallCFunction( |
| 629 ExternalReference::get_make_code_young_function(masm->isolate()), 1); |
| 630 } |
| 631 __ Popad(); |
| 632 __ ret(0); |
| 633 } |
| 634 |
| 635 |
| 636 #define DEFINE_CODE_AGE_BUILTIN_GENERATOR(C) \ |
| 637 void Builtins::Generate_Make##C##CodeYoungAgainEvenMarking( \ |
| 638 MacroAssembler* masm) { \ |
| 639 GenerateMakeCodeYoungAgainCommon(masm); \ |
| 640 } \ |
| 641 void Builtins::Generate_Make##C##CodeYoungAgainOddMarking( \ |
| 642 MacroAssembler* masm) { \ |
| 643 GenerateMakeCodeYoungAgainCommon(masm); \ |
| 644 } |
| 645 CODE_AGE_LIST(DEFINE_CODE_AGE_BUILTIN_GENERATOR) |
| 646 #undef DEFINE_CODE_AGE_BUILTIN_GENERATOR |
| 647 |
| 648 |
609 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, | 649 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, |
610 Deoptimizer::BailoutType type) { | 650 Deoptimizer::BailoutType type) { |
611 // Enter an internal frame. | 651 // Enter an internal frame. |
612 { | 652 { |
613 FrameScope scope(masm, StackFrame::INTERNAL); | 653 FrameScope scope(masm, StackFrame::INTERNAL); |
614 | 654 |
615 // Pass the deoptimization type to the runtime system. | 655 // Pass the deoptimization type to the runtime system. |
616 __ Push(Smi::FromInt(static_cast<int>(type))); | 656 __ Push(Smi::FromInt(static_cast<int>(type))); |
617 | 657 |
618 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); | 658 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); |
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1776 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1816 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
1777 generator.Generate(); | 1817 generator.Generate(); |
1778 } | 1818 } |
1779 | 1819 |
1780 | 1820 |
1781 #undef __ | 1821 #undef __ |
1782 | 1822 |
1783 } } // namespace v8::internal | 1823 } } // namespace v8::internal |
1784 | 1824 |
1785 #endif // V8_TARGET_ARCH_X64 | 1825 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |