| 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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 GenerateMakeCodeYoungAgainCommon(masm); \ | 620 GenerateMakeCodeYoungAgainCommon(masm); \ |
| 621 } \ | 621 } \ |
| 622 void Builtins::Generate_Make##C##CodeYoungAgainOddMarking( \ | 622 void Builtins::Generate_Make##C##CodeYoungAgainOddMarking( \ |
| 623 MacroAssembler* masm) { \ | 623 MacroAssembler* masm) { \ |
| 624 GenerateMakeCodeYoungAgainCommon(masm); \ | 624 GenerateMakeCodeYoungAgainCommon(masm); \ |
| 625 } | 625 } |
| 626 CODE_AGE_LIST(DEFINE_CODE_AGE_BUILTIN_GENERATOR) | 626 CODE_AGE_LIST(DEFINE_CODE_AGE_BUILTIN_GENERATOR) |
| 627 #undef DEFINE_CODE_AGE_BUILTIN_GENERATOR | 627 #undef DEFINE_CODE_AGE_BUILTIN_GENERATOR |
| 628 | 628 |
| 629 | 629 |
| 630 void Builtins::Generate_MarkCodeAsExecutedOnce(MacroAssembler* masm) { |
| 631 // For now, as in GenerateMakeCodeYoungAgainCommon, we are relying on the fact |
| 632 // that make_code_young doesn't do any garbage collection which allows us to |
| 633 // save/restore the registers without worrying about which of them contain |
| 634 // pointers. |
| 635 __ Pushad(); |
| 636 __ movq(arg_reg_2, ExternalReference::isolate_address(masm->isolate())); |
| 637 __ movq(arg_reg_1, Operand(rsp, kNumSafepointRegisters * kPointerSize)); |
| 638 __ subq(arg_reg_1, Immediate(Assembler::kShortCallInstructionLength)); |
| 639 { // NOLINT |
| 640 FrameScope scope(masm, StackFrame::MANUAL); |
| 641 __ PrepareCallCFunction(1); |
| 642 __ CallCFunction( |
| 643 ExternalReference::get_mark_code_as_executed_function(masm->isolate()), |
| 644 1); |
| 645 } |
| 646 __ Popad(); |
| 647 |
| 648 // Perform prologue operations usually performed by the young code stub. |
| 649 __ PopReturnAddressTo(kScratchRegister); |
| 650 __ push(rbp); // Caller's frame pointer. |
| 651 __ movq(rbp, rsp); |
| 652 __ push(rsi); // Callee's context. |
| 653 __ push(rdi); // Callee's JS Function. |
| 654 __ PushReturnAddressFrom(kScratchRegister); |
| 655 |
| 656 // Jump to point after the code-age stub. |
| 657 __ ret(0); |
| 658 } |
| 659 |
| 660 |
| 661 void Builtins::Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm) { |
| 662 GenerateMakeCodeYoungAgainCommon(masm); |
| 663 } |
| 664 |
| 665 |
| 630 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { | 666 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { |
| 631 // Enter an internal frame. | 667 // Enter an internal frame. |
| 632 { | 668 { |
| 633 FrameScope scope(masm, StackFrame::INTERNAL); | 669 FrameScope scope(masm, StackFrame::INTERNAL); |
| 634 | 670 |
| 635 // Preserve registers across notification, this is important for compiled | 671 // Preserve registers across notification, this is important for compiled |
| 636 // stubs that tail call the runtime on deopts passing their parameters in | 672 // stubs that tail call the runtime on deopts passing their parameters in |
| 637 // registers. | 673 // registers. |
| 638 __ Pushad(); | 674 __ Pushad(); |
| 639 __ CallRuntime(Runtime::kNotifyStubFailure, 0); | 675 __ CallRuntime(Runtime::kNotifyStubFailure, 0); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 653 FrameScope scope(masm, StackFrame::INTERNAL); | 689 FrameScope scope(masm, StackFrame::INTERNAL); |
| 654 | 690 |
| 655 // Pass the deoptimization type to the runtime system. | 691 // Pass the deoptimization type to the runtime system. |
| 656 __ Push(Smi::FromInt(static_cast<int>(type))); | 692 __ Push(Smi::FromInt(static_cast<int>(type))); |
| 657 | 693 |
| 658 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); | 694 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); |
| 659 // Tear down internal frame. | 695 // Tear down internal frame. |
| 660 } | 696 } |
| 661 | 697 |
| 662 // Get the full codegen state from the stack and untag it. | 698 // Get the full codegen state from the stack and untag it. |
| 663 __ SmiToInteger32(r10, Operand(rsp, kPCOnStackSize)); | 699 __ SmiToInteger32(kScratchRegister, Operand(rsp, kPCOnStackSize)); |
| 664 | 700 |
| 665 // Switch on the state. | 701 // Switch on the state. |
| 666 Label not_no_registers, not_tos_rax; | 702 Label not_no_registers, not_tos_rax; |
| 667 __ cmpq(r10, Immediate(FullCodeGenerator::NO_REGISTERS)); | 703 __ cmpq(kScratchRegister, Immediate(FullCodeGenerator::NO_REGISTERS)); |
| 668 __ j(not_equal, ¬_no_registers, Label::kNear); | 704 __ j(not_equal, ¬_no_registers, Label::kNear); |
| 669 __ ret(1 * kPointerSize); // Remove state. | 705 __ ret(1 * kPointerSize); // Remove state. |
| 670 | 706 |
| 671 __ bind(¬_no_registers); | 707 __ bind(¬_no_registers); |
| 672 __ movq(rax, Operand(rsp, kPCOnStackSize + kPointerSize)); | 708 __ movq(rax, Operand(rsp, kPCOnStackSize + kPointerSize)); |
| 673 __ cmpq(r10, Immediate(FullCodeGenerator::TOS_REG)); | 709 __ cmpq(kScratchRegister, Immediate(FullCodeGenerator::TOS_REG)); |
| 674 __ j(not_equal, ¬_tos_rax, Label::kNear); | 710 __ j(not_equal, ¬_tos_rax, Label::kNear); |
| 675 __ ret(2 * kPointerSize); // Remove state, rax. | 711 __ ret(2 * kPointerSize); // Remove state, rax. |
| 676 | 712 |
| 677 __ bind(¬_tos_rax); | 713 __ bind(¬_tos_rax); |
| 678 __ Abort(kNoCasesLeft); | 714 __ Abort(kNoCasesLeft); |
| 679 } | 715 } |
| 680 | 716 |
| 681 | 717 |
| 682 void Builtins::Generate_NotifyDeoptimized(MacroAssembler* masm) { | 718 void Builtins::Generate_NotifyDeoptimized(MacroAssembler* masm) { |
| 683 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); | 719 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1401 __ bind(&ok); | 1437 __ bind(&ok); |
| 1402 __ ret(0); | 1438 __ ret(0); |
| 1403 } | 1439 } |
| 1404 | 1440 |
| 1405 | 1441 |
| 1406 #undef __ | 1442 #undef __ |
| 1407 | 1443 |
| 1408 } } // namespace v8::internal | 1444 } } // namespace v8::internal |
| 1409 | 1445 |
| 1410 #endif // V8_TARGET_ARCH_X64 | 1446 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |