Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: src/x64/assembler-x64.h

Issue 1234833003: Debugger: use debug break slots to break at function exit. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix for arm Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | src/x64/assembler-x64-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 ICacheFlushMode icache_flush_mode = 549 ICacheFlushMode icache_flush_mode =
550 FLUSH_ICACHE_IF_NEEDED) { 550 FLUSH_ICACHE_IF_NEEDED) {
551 Address constant_pool = code ? code->constant_pool() : NULL; 551 Address constant_pool = code ? code->constant_pool() : NULL;
552 set_target_address_at(pc, constant_pool, target, icache_flush_mode); 552 set_target_address_at(pc, constant_pool, target, icache_flush_mode);
553 } 553 }
554 554
555 // Return the code target address at a call site from the return address 555 // Return the code target address at a call site from the return address
556 // of that call in the instruction stream. 556 // of that call in the instruction stream.
557 static inline Address target_address_from_return_address(Address pc); 557 static inline Address target_address_from_return_address(Address pc);
558 558
559 // Return the code target address of the patch debug break slot
560 inline static Address break_address_from_return_address(Address pc);
561
562 // This sets the branch destination (which is in the instruction on x64). 559 // This sets the branch destination (which is in the instruction on x64).
563 // This is for calls and branches within generated code. 560 // This is for calls and branches within generated code.
564 inline static void deserialization_set_special_target_at( 561 inline static void deserialization_set_special_target_at(
565 Address instruction_payload, Code* code, Address target) { 562 Address instruction_payload, Code* code, Address target) {
566 set_target_address_at(instruction_payload, code, target); 563 set_target_address_at(instruction_payload, code, target);
567 } 564 }
568 565
569 // This sets the internal reference at the pc. 566 // This sets the internal reference at the pc.
570 inline static void deserialization_set_target_internal_reference_at( 567 inline static void deserialization_set_target_internal_reference_at(
571 Address pc, Address target, 568 Address pc, Address target,
(...skipping 20 matching lines...) Expand all
592 // The length of call(Immediate32). 589 // The length of call(Immediate32).
593 static const int kShortCallInstructionLength = 5; 590 static const int kShortCallInstructionLength = 5;
594 // The length of movq(kScratchRegister, address). 591 // The length of movq(kScratchRegister, address).
595 static const int kMoveAddressIntoScratchRegisterInstructionLength = 592 static const int kMoveAddressIntoScratchRegisterInstructionLength =
596 2 + kPointerSize; 593 2 + kPointerSize;
597 // The length of movq(kScratchRegister, address) and call(kScratchRegister). 594 // The length of movq(kScratchRegister, address) and call(kScratchRegister).
598 static const int kCallSequenceLength = 595 static const int kCallSequenceLength =
599 kMoveAddressIntoScratchRegisterInstructionLength + 596 kMoveAddressIntoScratchRegisterInstructionLength +
600 kCallScratchRegisterInstructionLength; 597 kCallScratchRegisterInstructionLength;
601 598
602 // The js return and debug break slot must be able to contain an indirect 599 // The debug break slot must be able to contain an indirect call sequence.
603 // call sequence, some x64 JS code is padded with int3 to make it large
604 // enough to hold an instruction when the debugger patches it.
605 static const int kJSReturnSequenceLength = kCallSequenceLength;
606 static const int kDebugBreakSlotLength = kCallSequenceLength; 600 static const int kDebugBreakSlotLength = kCallSequenceLength;
607 static const int kPatchDebugBreakSlotReturnOffset = kCallTargetAddressOffset; 601 // Distance between start of patched debug break slot and the emitted address
608 // Distance between the start of the JS return sequence and where the 602 // to jump to.
609 // 32-bit displacement of a short call would be. The short call is from
610 // SetDebugBreakAtIC from debug-x64.cc.
611 static const int kPatchReturnSequenceAddressOffset =
612 kJSReturnSequenceLength - kPatchDebugBreakSlotReturnOffset;
613 // Distance between the start of the JS return sequence and where the
614 // 32-bit displacement of a short call would be. The short call is from
615 // SetDebugBreakAtIC from debug-x64.cc.
616 static const int kPatchDebugBreakSlotAddressOffset = 603 static const int kPatchDebugBreakSlotAddressOffset =
617 kDebugBreakSlotLength - kPatchDebugBreakSlotReturnOffset;
618 static const int kRealPatchReturnSequenceAddressOffset =
619 kMoveAddressIntoScratchRegisterInstructionLength - kPointerSize; 604 kMoveAddressIntoScratchRegisterInstructionLength - kPointerSize;
620 605
621 // One byte opcode for test eax,0xXXXXXXXX. 606 // One byte opcode for test eax,0xXXXXXXXX.
622 static const byte kTestEaxByte = 0xA9; 607 static const byte kTestEaxByte = 0xA9;
623 // One byte opcode for test al, 0xXX. 608 // One byte opcode for test al, 0xXX.
624 static const byte kTestAlByte = 0xA8; 609 static const byte kTestAlByte = 0xA8;
625 // One byte opcode for nop. 610 // One byte opcode for nop.
626 static const byte kNopByte = 0x90; 611 static const byte kNopByte = 0x90;
627 612
628 // One byte prefix for a short conditional jump. 613 // One byte prefix for a short conditional jump.
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 void vpd(byte op, XMMRegister dst, XMMRegister src1, const Operand& src2); 1592 void vpd(byte op, XMMRegister dst, XMMRegister src1, const Operand& src2);
1608 1593
1609 // Debugging 1594 // Debugging
1610 void Print(); 1595 void Print();
1611 1596
1612 // Check the code size generated from label to here. 1597 // Check the code size generated from label to here.
1613 int SizeOfCodeGeneratedSince(Label* label) { 1598 int SizeOfCodeGeneratedSince(Label* label) {
1614 return pc_offset() - label->pos(); 1599 return pc_offset() - label->pos();
1615 } 1600 }
1616 1601
1617 // Mark address of the ExitJSFrame code.
1618 void RecordJSReturn();
1619
1620 // Mark generator continuation. 1602 // Mark generator continuation.
1621 void RecordGeneratorContinuation(); 1603 void RecordGeneratorContinuation();
1622 1604
1623 // Mark address of a debug break slot. 1605 // Mark address of a debug break slot.
1624 void RecordDebugBreakSlot(); 1606 void RecordDebugBreakSlot(RelocInfo::Mode mode, int argc = 0);
1625 void RecordDebugBreakSlotForCall(int argc);
1626 void RecordDebugBreakSlotForConstructCall();
1627 1607
1628 // Record a comment relocation entry that can be used by a disassembler. 1608 // Record a comment relocation entry that can be used by a disassembler.
1629 // Use --code-comments to enable. 1609 // Use --code-comments to enable.
1630 void RecordComment(const char* msg); 1610 void RecordComment(const char* msg);
1631 1611
1632 // Record a deoptimization reason that can be used by a log or cpu profiler. 1612 // Record a deoptimization reason that can be used by a log or cpu profiler.
1633 // Use --trace-deopt to enable. 1613 // Use --trace-deopt to enable.
1634 void RecordDeoptReason(const int reason, const SourcePosition position); 1614 void RecordDeoptReason(const int reason, const SourcePosition position);
1635 1615
1636 void PatchConstantPoolAccessInstruction(int pc_offset, int offset, 1616 void PatchConstantPoolAccessInstruction(int pc_offset, int offset,
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 private: 2144 private:
2165 Assembler* assembler_; 2145 Assembler* assembler_;
2166 #ifdef DEBUG 2146 #ifdef DEBUG
2167 int space_before_; 2147 int space_before_;
2168 #endif 2148 #endif
2169 }; 2149 };
2170 2150
2171 } } // namespace v8::internal 2151 } } // namespace v8::internal
2172 2152
2173 #endif // V8_X64_ASSEMBLER_X64_H_ 2153 #endif // V8_X64_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | src/x64/assembler-x64-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698