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

Side by Side Diff: src/ia32/debug-ia32.cc

Issue 193057: Cleaned up some debugger stuff on ia32 and x64 (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/debug.cc ('k') | src/ia32/macro-assembler-ia32.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 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 18 matching lines...) Expand all
29 29
30 #include "codegen-inl.h" 30 #include "codegen-inl.h"
31 #include "debug.h" 31 #include "debug.h"
32 32
33 33
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace internal {
36 36
37 #ifdef ENABLE_DEBUGGER_SUPPORT 37 #ifdef ENABLE_DEBUGGER_SUPPORT
38 38
39 // A debug break in the frame exit code is identified by a call instruction.
40 bool BreakLocationIterator::IsDebugBreakAtReturn() { 39 bool BreakLocationIterator::IsDebugBreakAtReturn() {
41 // Opcode E8 is call.
42 return Debug::IsDebugBreakAtReturn(rinfo()); 40 return Debug::IsDebugBreakAtReturn(rinfo());
43 } 41 }
44 42
45 43
46 // Patch the JS frame exit code with a debug break call. See 44 // Patch the JS frame exit code with a debug break call. See
47 // CodeGenerator::VisitReturnStatement and VirtualFrame::Exit in codegen-ia32.cc 45 // CodeGenerator::VisitReturnStatement and VirtualFrame::Exit in codegen-ia32.cc
48 // for the precise return instructions sequence. 46 // for the precise return instructions sequence.
49 void BreakLocationIterator::SetDebugBreakAtReturn() { 47 void BreakLocationIterator::SetDebugBreakAtReturn() {
50 ASSERT(Debug::kIa32JSReturnSequenceLength >= 48 ASSERT(Debug::kIa32JSReturnSequenceLength >=
51 Debug::kIa32CallInstructionLength); 49 Debug::kIa32CallInstructionLength);
52 rinfo()->PatchCodeWithCall(Debug::debug_break_return_entry()->entry(), 50 rinfo()->PatchCodeWithCall(Debug::debug_break_return()->entry(),
53 Debug::kIa32JSReturnSequenceLength - Debug::kIa32CallInstructionLength); 51 Debug::kIa32JSReturnSequenceLength - Debug::kIa32CallInstructionLength);
54 } 52 }
55 53
56 54
57 // Restore the JS frame exit code. 55 // Restore the JS frame exit code.
58 void BreakLocationIterator::ClearDebugBreakAtReturn() { 56 void BreakLocationIterator::ClearDebugBreakAtReturn() {
59 rinfo()->PatchCode(original_rinfo()->pc(), 57 rinfo()->PatchCode(original_rinfo()->pc(),
60 Debug::kIa32JSReturnSequenceLength); 58 Debug::kIa32JSReturnSequenceLength);
61 } 59 }
62 60
63 61
64 // Check whether the JS frame exit code has been patched with a debug break. 62 // A debug break in the frame exit code is identified by the JS frame exit code
63 // having been patched with a call instruction.
65 bool Debug::IsDebugBreakAtReturn(RelocInfo* rinfo) { 64 bool Debug::IsDebugBreakAtReturn(RelocInfo* rinfo) {
66 ASSERT(RelocInfo::IsJSReturn(rinfo->rmode())); 65 ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()));
67 // Opcode E8 is call. 66 return rinfo->IsCallInstruction();
68 return (*(rinfo->pc()) == 0xE8);
69 } 67 }
70 68
71 69
72 #define __ ACCESS_MASM(masm) 70 #define __ ACCESS_MASM(masm)
73 71
74 72
75 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, 73 static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
76 RegList pointer_regs, 74 RegList pointer_regs,
77 bool convert_call_to_jmp) { 75 bool convert_call_to_jmp) {
78 // Save the content of all general purpose registers in memory. This copy in 76 // Save the content of all general purpose registers in memory. This copy in
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 185
188 void Debug::GenerateReturnDebugBreak(MacroAssembler* masm) { 186 void Debug::GenerateReturnDebugBreak(MacroAssembler* masm) {
189 // Register state just before return from JS function (from codegen-ia32.cc). 187 // Register state just before return from JS function (from codegen-ia32.cc).
190 // ----------- S t a t e ------------- 188 // ----------- S t a t e -------------
191 // -- eax: return value 189 // -- eax: return value
192 // ----------------------------------- 190 // -----------------------------------
193 Generate_DebugBreakCallHelper(masm, eax.bit(), true); 191 Generate_DebugBreakCallHelper(masm, eax.bit(), true);
194 } 192 }
195 193
196 194
197 void Debug::GenerateReturnDebugBreakEntry(MacroAssembler* masm) {
198 // OK to clobber ebx as we are returning from a JS function through the code
199 // generated by CodeGenerator::GenerateReturnSequence()
200 ExternalReference debug_break_return =
201 ExternalReference(Debug_Address::DebugBreakReturn());
202 __ mov(ebx, Operand::StaticVariable(debug_break_return));
203 __ add(Operand(ebx), Immediate(Code::kHeaderSize - kHeapObjectTag));
204 __ jmp(Operand(ebx));
205 }
206
207
208 void Debug::GenerateStubNoRegistersDebugBreak(MacroAssembler* masm) { 195 void Debug::GenerateStubNoRegistersDebugBreak(MacroAssembler* masm) {
209 // Register state for stub CallFunction (from CallFunctionStub in ic-ia32.cc). 196 // Register state for stub CallFunction (from CallFunctionStub in ic-ia32.cc).
210 // ----------- S t a t e ------------- 197 // ----------- S t a t e -------------
211 // No registers used on entry. 198 // No registers used on entry.
212 // ----------------------------------- 199 // -----------------------------------
213 Generate_DebugBreakCallHelper(masm, 0, false); 200 Generate_DebugBreakCallHelper(masm, 0, false);
214 } 201 }
215 202
216 203
217 #undef __ 204 #undef __
218 205
219 #endif // ENABLE_DEBUGGER_SUPPORT 206 #endif // ENABLE_DEBUGGER_SUPPORT
220 207
221 } } // namespace v8::internal 208 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698