| 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 | 620 |
| 621 __ pop(MemOperand(esp, 0)); // Ignore state offset | 621 __ pop(MemOperand(esp, 0)); // Ignore state offset |
| 622 __ ret(0); // Return to IC Miss stub, continuation still on stack. | 622 __ ret(0); // Return to IC Miss stub, continuation still on stack. |
| 623 } | 623 } |
| 624 | 624 |
| 625 | 625 |
| 626 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, | 626 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, |
| 627 Deoptimizer::BailoutType type) { | 627 Deoptimizer::BailoutType type) { |
| 628 { | 628 { |
| 629 FrameScope scope(masm, StackFrame::INTERNAL); | 629 FrameScope scope(masm, StackFrame::INTERNAL); |
| 630 | 630 // Registers set in the output frame that need to be preserved. |
| 631 if (type == Deoptimizer::LAZY) { |
| 632 __ push(eax); // Exception when throwing to optimized code. |
| 633 } |
| 631 // Pass deoptimization type to the runtime system. | 634 // Pass deoptimization type to the runtime system. |
| 632 __ push(Immediate(Smi::FromInt(static_cast<int>(type)))); | 635 __ push(Immediate(Smi::FromInt(static_cast<int>(type)))); |
| 633 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); | 636 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); |
| 634 | 637 |
| 638 if (type == Deoptimizer::LAZY) { |
| 639 __ pop(eax); |
| 640 } |
| 635 // Tear down internal frame. | 641 // Tear down internal frame. |
| 636 } | 642 } |
| 637 | 643 |
| 638 // Get the full codegen state from the stack and untag it. | |
| 639 __ mov(ecx, Operand(esp, 1 * kPointerSize)); | |
| 640 __ SmiUntag(ecx); | |
| 641 | |
| 642 // Switch on the state. | 644 // Switch on the state. |
| 643 Label not_no_registers, not_tos_eax; | 645 Label not_no_registers; |
| 644 __ cmp(ecx, FullCodeGenerator::NO_REGISTERS); | 646 __ cmp(Operand(esp, 1 * kPointerSize), |
| 647 Immediate(Smi::FromInt(FullCodeGenerator::NO_REGISTERS))); |
| 645 __ j(not_equal, ¬_no_registers, Label::kNear); | 648 __ j(not_equal, ¬_no_registers, Label::kNear); |
| 646 __ ret(1 * kPointerSize); // Remove state. | 649 __ ret(1 * kPointerSize); // Remove state. |
| 647 | 650 |
| 648 __ bind(¬_no_registers); | 651 __ bind(¬_no_registers); |
| 649 __ mov(eax, Operand(esp, 2 * kPointerSize)); | 652 __ mov(eax, Operand(esp, 2 * kPointerSize)); |
| 650 __ cmp(ecx, FullCodeGenerator::TOS_REG); | 653 if (masm->emit_debug_code()) { |
| 651 __ j(not_equal, ¬_tos_eax, Label::kNear); | 654 __ cmp(Operand(esp, 1 * kPointerSize), |
| 655 Immediate(Smi::FromInt(FullCodeGenerator::TOS_REG))); |
| 656 __ Assert(equal, "Invalid deoptimization state."); |
| 657 } |
| 652 __ ret(2 * kPointerSize); // Remove state, eax. | 658 __ ret(2 * kPointerSize); // Remove state, eax. |
| 653 | |
| 654 __ bind(¬_tos_eax); | |
| 655 __ Abort("no cases left"); | |
| 656 } | 659 } |
| 657 | 660 |
| 658 | 661 |
| 659 void Builtins::Generate_NotifyDeoptimized(MacroAssembler* masm) { | 662 void Builtins::Generate_NotifyDeoptimized(MacroAssembler* masm) { |
| 660 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); | 663 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); |
| 661 } | 664 } |
| 662 | 665 |
| 663 | 666 |
| 664 void Builtins::Generate_NotifySoftDeoptimized(MacroAssembler* masm) { | 667 void Builtins::Generate_NotifySoftDeoptimized(MacroAssembler* masm) { |
| 665 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); | 668 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); |
| (...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1830 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1833 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1831 generator.Generate(); | 1834 generator.Generate(); |
| 1832 } | 1835 } |
| 1833 | 1836 |
| 1834 | 1837 |
| 1835 #undef __ | 1838 #undef __ |
| 1836 } | 1839 } |
| 1837 } // namespace v8::internal | 1840 } // namespace v8::internal |
| 1838 | 1841 |
| 1839 #endif // V8_TARGET_ARCH_IA32 | 1842 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |