| 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 } | 537 } |
| 538 | 538 |
| 539 FullCodeGenerator::State state = | 539 FullCodeGenerator::State state = |
| 540 FullCodeGenerator::StateField::decode(pc_and_state); | 540 FullCodeGenerator::StateField::decode(pc_and_state); |
| 541 output_frame->SetState(Smi::FromInt(state)); | 541 output_frame->SetState(Smi::FromInt(state)); |
| 542 | 542 |
| 543 | 543 |
| 544 // Set the continuation for the topmost frame. | 544 // Set the continuation for the topmost frame. |
| 545 if (is_topmost && bailout_type_ != DEBUGGER) { | 545 if (is_topmost && bailout_type_ != DEBUGGER) { |
| 546 Builtins* builtins = isolate_->builtins(); | 546 Builtins* builtins = isolate_->builtins(); |
| 547 Code* continuation = (bailout_type_ == EAGER) | 547 Code* continuation = builtins->builtin(Builtins::kNotifyDeoptimized); |
| 548 ? builtins->builtin(Builtins::kNotifyDeoptimized) | 548 if (bailout_type_ == LAZY) { |
| 549 : builtins->builtin(Builtins::kNotifyLazyDeoptimized); | 549 continuation = builtins->builtin(Builtins::kNotifyLazyDeoptimized); |
| 550 } else if (bailout_type_ == SOFT) { |
| 551 continuation = builtins->builtin(Builtins::kNotifySoftDeoptimized); |
| 552 } else { |
| 553 ASSERT(bailout_type_ == EAGER); |
| 554 } |
| 550 output_frame->SetContinuation( | 555 output_frame->SetContinuation( |
| 551 reinterpret_cast<uint32_t>(continuation->entry())); | 556 reinterpret_cast<uint32_t>(continuation->entry())); |
| 552 } | 557 } |
| 553 } | 558 } |
| 554 | 559 |
| 555 | 560 |
| 556 void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) { | 561 void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) { |
| 557 // Set the register values. The values are not important as there are no | 562 // Set the register values. The values are not important as there are no |
| 558 // callee saved registers in JavaScript frames, so all registers are | 563 // callee saved registers in JavaScript frames, so all registers are |
| 559 // spilled. Registers fp and sp are set to the correct values though. | 564 // spilled. Registers fp and sp are set to the correct values though. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 | 637 |
| 633 const int kSavedRegistersAreaSize = | 638 const int kSavedRegistersAreaSize = |
| 634 (kNumberOfRegisters * kPointerSize) + kDoubleRegsSize; | 639 (kNumberOfRegisters * kPointerSize) + kDoubleRegsSize; |
| 635 | 640 |
| 636 // Get the bailout id from the stack. | 641 // Get the bailout id from the stack. |
| 637 __ ldr(r2, MemOperand(sp, kSavedRegistersAreaSize)); | 642 __ ldr(r2, MemOperand(sp, kSavedRegistersAreaSize)); |
| 638 | 643 |
| 639 // Get the address of the location in the code object if possible (r3) (return | 644 // Get the address of the location in the code object if possible (r3) (return |
| 640 // address for lazy deoptimization) and compute the fp-to-sp delta in | 645 // address for lazy deoptimization) and compute the fp-to-sp delta in |
| 641 // register r4. | 646 // register r4. |
| 642 if (type() == EAGER) { | 647 if (type() == EAGER || type() == SOFT) { |
| 643 __ mov(r3, Operand::Zero()); | 648 __ mov(r3, Operand::Zero()); |
| 644 // Correct one word for bailout id. | 649 // Correct one word for bailout id. |
| 645 __ add(r4, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize))); | 650 __ add(r4, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize))); |
| 646 } else if (type() == OSR) { | 651 } else if (type() == OSR) { |
| 647 __ mov(r3, lr); | 652 __ mov(r3, lr); |
| 648 // Correct one word for bailout id. | 653 // Correct one word for bailout id. |
| 649 __ add(r4, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize))); | 654 __ add(r4, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize))); |
| 650 } else { | 655 } else { |
| 651 __ mov(r3, lr); | 656 __ mov(r3, lr); |
| 652 // Correct two words for bailout id and return address. | 657 // Correct two words for bailout id and return address. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 int double_regs_offset = FrameDescription::double_registers_offset(); | 692 int double_regs_offset = FrameDescription::double_registers_offset(); |
| 688 for (int i = 0; i < DwVfpRegister::kMaxNumAllocatableRegisters; ++i) { | 693 for (int i = 0; i < DwVfpRegister::kMaxNumAllocatableRegisters; ++i) { |
| 689 int dst_offset = i * kDoubleSize + double_regs_offset; | 694 int dst_offset = i * kDoubleSize + double_regs_offset; |
| 690 int src_offset = i * kDoubleSize + kNumberOfRegisters * kPointerSize; | 695 int src_offset = i * kDoubleSize + kNumberOfRegisters * kPointerSize; |
| 691 __ vldr(d0, sp, src_offset); | 696 __ vldr(d0, sp, src_offset); |
| 692 __ vstr(d0, r1, dst_offset); | 697 __ vstr(d0, r1, dst_offset); |
| 693 } | 698 } |
| 694 | 699 |
| 695 // Remove the bailout id, eventually return address, and the saved registers | 700 // Remove the bailout id, eventually return address, and the saved registers |
| 696 // from the stack. | 701 // from the stack. |
| 697 if (type() == EAGER || type() == OSR) { | 702 if (type() == EAGER || type() == SOFT || type() == OSR) { |
| 698 __ add(sp, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize))); | 703 __ add(sp, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize))); |
| 699 } else { | 704 } else { |
| 700 __ add(sp, sp, Operand(kSavedRegistersAreaSize + (2 * kPointerSize))); | 705 __ add(sp, sp, Operand(kSavedRegistersAreaSize + (2 * kPointerSize))); |
| 701 } | 706 } |
| 702 | 707 |
| 703 // Compute a pointer to the unwinding limit in register r2; that is | 708 // Compute a pointer to the unwinding limit in register r2; that is |
| 704 // the first stack slot not part of the input frame. | 709 // the first stack slot not part of the input frame. |
| 705 __ ldr(r2, MemOperand(r1, FrameDescription::frame_size_offset())); | 710 __ ldr(r2, MemOperand(r1, FrameDescription::frame_size_offset())); |
| 706 __ add(r2, r2, sp); | 711 __ add(r2, r2, sp); |
| 707 | 712 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 } | 811 } |
| 807 | 812 |
| 808 | 813 |
| 809 void Deoptimizer::TableEntryGenerator::GeneratePrologue() { | 814 void Deoptimizer::TableEntryGenerator::GeneratePrologue() { |
| 810 // Create a sequence of deoptimization entries. Note that any | 815 // Create a sequence of deoptimization entries. Note that any |
| 811 // registers may be still live. | 816 // registers may be still live. |
| 812 Label done; | 817 Label done; |
| 813 for (int i = 0; i < count(); i++) { | 818 for (int i = 0; i < count(); i++) { |
| 814 int start = masm()->pc_offset(); | 819 int start = masm()->pc_offset(); |
| 815 USE(start); | 820 USE(start); |
| 816 if (type() == EAGER) { | 821 if (type() == EAGER || type() == SOFT) { |
| 817 __ nop(); | 822 __ nop(); |
| 818 } else { | 823 } else { |
| 819 // Emulate ia32 like call by pushing return address to stack. | 824 // Emulate ia32 like call by pushing return address to stack. |
| 820 __ push(lr); | 825 __ push(lr); |
| 821 } | 826 } |
| 822 __ mov(ip, Operand(i)); | 827 __ mov(ip, Operand(i)); |
| 823 __ push(ip); | 828 __ push(ip); |
| 824 __ b(&done); | 829 __ b(&done); |
| 825 ASSERT(masm()->pc_offset() - start == table_entry_size_); | 830 ASSERT(masm()->pc_offset() - start == table_entry_size_); |
| 826 } | 831 } |
| 827 __ bind(&done); | 832 __ bind(&done); |
| 828 } | 833 } |
| 829 | 834 |
| 830 #undef __ | 835 #undef __ |
| 831 | 836 |
| 832 } } // namespace v8::internal | 837 } } // namespace v8::internal |
| OLD | NEW |