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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 uint32_t pc_value = reinterpret_cast<uint32_t>(start + pc_offset); | 652 uint32_t pc_value = reinterpret_cast<uint32_t>(start + pc_offset); |
653 output_frame->SetPc(pc_value); | 653 output_frame->SetPc(pc_value); |
654 | 654 |
655 FullCodeGenerator::State state = | 655 FullCodeGenerator::State state = |
656 FullCodeGenerator::StateField::decode(pc_and_state); | 656 FullCodeGenerator::StateField::decode(pc_and_state); |
657 output_frame->SetState(Smi::FromInt(state)); | 657 output_frame->SetState(Smi::FromInt(state)); |
658 | 658 |
659 // Set the continuation for the topmost frame. | 659 // Set the continuation for the topmost frame. |
660 if (is_topmost && bailout_type_ != DEBUGGER) { | 660 if (is_topmost && bailout_type_ != DEBUGGER) { |
661 Builtins* builtins = isolate_->builtins(); | 661 Builtins* builtins = isolate_->builtins(); |
662 Code* continuation = (bailout_type_ == EAGER) | 662 Code* continuation = builtins->builtin(Builtins::kNotifyDeoptimized); |
663 ? builtins->builtin(Builtins::kNotifyDeoptimized) | 663 if (bailout_type_ == LAZY) { |
664 : builtins->builtin(Builtins::kNotifyLazyDeoptimized); | 664 continuation = builtins->builtin(Builtins::kNotifyLazyDeoptimized); |
| 665 } else if (bailout_type_ == SOFT) { |
| 666 continuation = builtins->builtin(Builtins::kNotifySoftDeoptimized); |
| 667 } else { |
| 668 ASSERT(bailout_type_ == EAGER); |
| 669 } |
665 output_frame->SetContinuation( | 670 output_frame->SetContinuation( |
666 reinterpret_cast<uint32_t>(continuation->entry())); | 671 reinterpret_cast<uint32_t>(continuation->entry())); |
667 } | 672 } |
668 } | 673 } |
669 | 674 |
670 | 675 |
671 void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) { | 676 void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) { |
672 // Set the register values. The values are not important as there are no | 677 // Set the register values. The values are not important as there are no |
673 // callee saved registers in JavaScript frames, so all registers are | 678 // callee saved registers in JavaScript frames, so all registers are |
674 // spilled. Registers ebp and esp are set to the correct values though. | 679 // spilled. Registers ebp and esp are set to the correct values though. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 __ pushad(); | 738 __ pushad(); |
734 | 739 |
735 const int kSavedRegistersAreaSize = kNumberOfRegisters * kPointerSize + | 740 const int kSavedRegistersAreaSize = kNumberOfRegisters * kPointerSize + |
736 kDoubleRegsSize; | 741 kDoubleRegsSize; |
737 | 742 |
738 // Get the bailout id from the stack. | 743 // Get the bailout id from the stack. |
739 __ mov(ebx, Operand(esp, kSavedRegistersAreaSize)); | 744 __ mov(ebx, Operand(esp, kSavedRegistersAreaSize)); |
740 | 745 |
741 // Get the address of the location in the code object if possible | 746 // Get the address of the location in the code object if possible |
742 // and compute the fp-to-sp delta in register edx. | 747 // and compute the fp-to-sp delta in register edx. |
743 if (type() == EAGER) { | 748 if (type() == EAGER || type() == SOFT) { |
744 __ Set(ecx, Immediate(0)); | 749 __ Set(ecx, Immediate(0)); |
745 __ lea(edx, Operand(esp, kSavedRegistersAreaSize + 1 * kPointerSize)); | 750 __ lea(edx, Operand(esp, kSavedRegistersAreaSize + 1 * kPointerSize)); |
746 } else { | 751 } else { |
747 __ mov(ecx, Operand(esp, kSavedRegistersAreaSize + 1 * kPointerSize)); | 752 __ mov(ecx, Operand(esp, kSavedRegistersAreaSize + 1 * kPointerSize)); |
748 __ lea(edx, Operand(esp, kSavedRegistersAreaSize + 2 * kPointerSize)); | 753 __ lea(edx, Operand(esp, kSavedRegistersAreaSize + 2 * kPointerSize)); |
749 } | 754 } |
750 __ sub(edx, ebp); | 755 __ sub(edx, ebp); |
751 __ neg(edx); | 756 __ neg(edx); |
752 | 757 |
753 // Allocate a new deoptimizer object. | 758 // Allocate a new deoptimizer object. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 __ movdbl(Operand(ebx, dst_offset), xmm0); | 791 __ movdbl(Operand(ebx, dst_offset), xmm0); |
787 } | 792 } |
788 } | 793 } |
789 | 794 |
790 // Clear FPU all exceptions. | 795 // Clear FPU all exceptions. |
791 // TODO(ulan): Find out why the TOP register is not zero here in some cases, | 796 // TODO(ulan): Find out why the TOP register is not zero here in some cases, |
792 // and check that the generated code never deoptimizes with unbalanced stack. | 797 // and check that the generated code never deoptimizes with unbalanced stack. |
793 __ fnclex(); | 798 __ fnclex(); |
794 | 799 |
795 // Remove the bailout id and the double registers from the stack. | 800 // Remove the bailout id and the double registers from the stack. |
796 if (type() == EAGER) { | 801 if (type() == EAGER || type() == SOFT) { |
797 __ add(esp, Immediate(kDoubleRegsSize + kPointerSize)); | 802 __ add(esp, Immediate(kDoubleRegsSize + kPointerSize)); |
798 } else { | 803 } else { |
799 __ add(esp, Immediate(kDoubleRegsSize + 2 * kPointerSize)); | 804 __ add(esp, Immediate(kDoubleRegsSize + 2 * kPointerSize)); |
800 } | 805 } |
801 | 806 |
802 // Compute a pointer to the unwinding limit in register ecx; that is | 807 // Compute a pointer to the unwinding limit in register ecx; that is |
803 // the first stack slot not part of the input frame. | 808 // the first stack slot not part of the input frame. |
804 __ mov(ecx, Operand(ebx, FrameDescription::frame_size_offset())); | 809 __ mov(ecx, Operand(ebx, FrameDescription::frame_size_offset())); |
805 __ add(ecx, esp); | 810 __ add(ecx, esp); |
806 | 811 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 } | 925 } |
921 __ bind(&done); | 926 __ bind(&done); |
922 } | 927 } |
923 | 928 |
924 #undef __ | 929 #undef __ |
925 | 930 |
926 | 931 |
927 } } // namespace v8::internal | 932 } } // namespace v8::internal |
928 | 933 |
929 #endif // V8_TARGET_ARCH_IA32 | 934 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |