| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, | 656 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, |
| 657 RegList pointer_regs) { | 657 RegList pointer_regs) { |
| 658 // Save the content of all general purpose registers in memory. This copy in | 658 // Save the content of all general purpose registers in memory. This copy in |
| 659 // memory is later pushed onto the JS expression stack for the fake JS frame | 659 // memory is later pushed onto the JS expression stack for the fake JS frame |
| 660 // generated and also to the C frame generated on top of that. In the JS | 660 // generated and also to the C frame generated on top of that. In the JS |
| 661 // frame ONLY the registers containing pointers will be pushed on the | 661 // frame ONLY the registers containing pointers will be pushed on the |
| 662 // expression stack. This causes the GC to update these pointers so that | 662 // expression stack. This causes the GC to update these pointers so that |
| 663 // they will have the correct value when returning from the debugger. | 663 // they will have the correct value when returning from the debugger. |
| 664 __ SaveRegistersToMemory(kJSCallerSaved); | 664 __ SaveRegistersToMemory(kJSCallerSaved); |
| 665 | 665 |
| 666 // This is a direct call from a debug breakpoint. To build a fake JS frame | 666 __ EnterInternalFrame(); |
| 667 // with no parameters push a function and a receiver, keep the current | |
| 668 // return address in lr, and set r0 to zero. | |
| 669 __ mov(ip, Operand(ExternalReference::the_hole_value_location())); | |
| 670 __ ldr(r3, MemOperand(ip)); | |
| 671 __ mov(r0, Operand(0)); // Null receiver and zero arguments. | |
| 672 __ stm(db_w, sp, r0.bit() | r3.bit()); // push function and receiver | |
| 673 | |
| 674 // r0: number of arguments. | |
| 675 // What follows is an inlined version of EnterJSFrame(0, 0). | |
| 676 // It needs to be kept in sync if any calling conventions are changed. | |
| 677 | |
| 678 // Compute parameter pointer before making changes | |
| 679 // ip = sp + kPointerSize*(args_len+1); // +1 for receiver, args_len == 0 | |
| 680 __ add(ip, sp, Operand(kPointerSize)); | |
| 681 | |
| 682 __ mov(r3, Operand(0)); // args_len to be saved | |
| 683 __ mov(r2, Operand(cp)); // context to be saved | |
| 684 | |
| 685 // push in reverse order: context (r2), args_len (r3), caller_pp, caller_fp, | |
| 686 // sp_on_exit (ip == pp), return address | |
| 687 __ stm(db_w, sp, r2.bit() | r3.bit() | pp.bit() | fp.bit() | | |
| 688 ip.bit() | lr.bit()); | |
| 689 // Setup new frame pointer. | |
| 690 __ add(fp, sp, Operand(-StandardFrameConstants::kContextOffset)); | |
| 691 __ mov(pp, Operand(ip)); // setup new parameter pointer | |
| 692 // r0 is already set to 0 as spare slot to store caller code object during GC | |
| 693 __ push(r0); // code pointer | |
| 694 | |
| 695 // Inlined EnterJSFrame ends here. | |
| 696 | 667 |
| 697 // Store the registers containing object pointers on the expression stack to | 668 // Store the registers containing object pointers on the expression stack to |
| 698 // make sure that these are correctly updated during GC. | 669 // make sure that these are correctly updated during GC. |
| 699 // Use sp as base to push. | 670 // Use sp as base to push. |
| 700 __ CopyRegistersFromMemoryToStack(sp, pointer_regs); | 671 __ CopyRegistersFromMemoryToStack(sp, pointer_regs); |
| 701 | 672 |
| 702 #ifdef DEBUG | 673 #ifdef DEBUG |
| 703 __ RecordComment("// Calling from debug break to runtime - come in - over"); | 674 __ RecordComment("// Calling from debug break to runtime - come in - over"); |
| 704 #endif | 675 #endif |
| 705 // r0 is already 0, no arguments | 676 // r0 is already 0, no arguments |
| 706 __ mov(r1, Operand(ExternalReference::debug_break())); | 677 __ mov(r1, Operand(ExternalReference::debug_break())); |
| 707 | 678 |
| 708 CEntryDebugBreakStub ceb; | 679 CEntryDebugBreakStub ceb; |
| 709 __ CallStub(&ceb); | 680 __ CallStub(&ceb); |
| 710 | 681 |
| 711 // Restore the register values containing object pointers from the expression | 682 // Restore the register values containing object pointers from the expression |
| 712 // stack in the reverse order as they where pushed. | 683 // stack in the reverse order as they where pushed. |
| 713 // Use sp as base to pop. | 684 // Use sp as base to pop. |
| 714 __ CopyRegistersFromStackToMemory(sp, r3, pointer_regs); | 685 __ CopyRegistersFromStackToMemory(sp, r3, pointer_regs); |
| 715 | 686 |
| 716 // What follows is an inlined version of ExitJSFrame(0). | 687 __ LeaveInternalFrame(); |
| 717 // It needs to be kept in sync if any calling conventions are changed. | |
| 718 // NOTE: loading the return address to lr and discarding the (fake) function | |
| 719 // is an addition to this inlined copy. | |
| 720 | |
| 721 __ mov(sp, Operand(fp)); // respect ABI stack constraint | |
| 722 __ ldm(ia, sp, pp.bit() | fp.bit() | sp.bit() | lr.bit()); | |
| 723 __ pop(); // discard fake function | |
| 724 | 688 |
| 725 // Inlined ExitJSFrame ends here. | 689 // Inlined ExitJSFrame ends here. |
| 726 | 690 |
| 727 // Finally restore all registers. | 691 // Finally restore all registers. |
| 728 __ RestoreRegistersFromMemory(kJSCallerSaved); | 692 __ RestoreRegistersFromMemory(kJSCallerSaved); |
| 729 | 693 |
| 730 // Now that the break point has been handled, resume normal execution by | 694 // Now that the break point has been handled, resume normal execution by |
| 731 // jumping to the target address intended by the caller and that was | 695 // jumping to the target address intended by the caller and that was |
| 732 // overwritten by the address of DebugBreakXXX. | 696 // overwritten by the address of DebugBreakXXX. |
| 733 __ mov(ip, Operand(ExternalReference(Debug_Address::AfterBreakTarget()))); | 697 __ mov(ip, Operand(ExternalReference(Debug_Address::AfterBreakTarget()))); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 } | 776 } |
| 813 | 777 |
| 814 void Builtins::Generate_StubNoRegisters_DebugBreak(MacroAssembler* masm) { | 778 void Builtins::Generate_StubNoRegisters_DebugBreak(MacroAssembler* masm) { |
| 815 // Generate nothing as CodeStub CallFunction is not used on ARM. | 779 // Generate nothing as CodeStub CallFunction is not used on ARM. |
| 816 } | 780 } |
| 817 | 781 |
| 818 | 782 |
| 819 #undef __ | 783 #undef __ |
| 820 | 784 |
| 821 } } // namespace v8::internal | 785 } } // namespace v8::internal |
| OLD | NEW |