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

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

Issue 10263002: Fix issue 825 (LiveEdit vs. function with no locals) in core and for ia32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase Created 8 years, 7 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/frames.h ('k') | src/liveedit.cc » ('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 2011 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
11 // with the distribution. 11 // with the distribution.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 isolate->debug()->debug_break_slot()->entry(), 84 isolate->debug()->debug_break_slot()->entry(),
85 Assembler::kDebugBreakSlotLength - Assembler::kCallInstructionLength); 85 Assembler::kDebugBreakSlotLength - Assembler::kCallInstructionLength);
86 } 86 }
87 87
88 88
89 void BreakLocationIterator::ClearDebugBreakAtSlot() { 89 void BreakLocationIterator::ClearDebugBreakAtSlot() {
90 ASSERT(IsDebugBreakSlot()); 90 ASSERT(IsDebugBreakSlot());
91 rinfo()->PatchCode(original_rinfo()->pc(), Assembler::kDebugBreakSlotLength); 91 rinfo()->PatchCode(original_rinfo()->pc(), Assembler::kDebugBreakSlotLength);
92 } 92 }
93 93
94 // All debug break stubs support padding for LiveEdit.
95 const bool Debug::FramePaddingLayout::kIsSupported = true;
96
94 97
95 #define __ ACCESS_MASM(masm) 98 #define __ ACCESS_MASM(masm)
96 99
97
98 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, 100 static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
99 RegList object_regs, 101 RegList object_regs,
100 RegList non_object_regs, 102 RegList non_object_regs,
101 bool convert_call_to_jmp) { 103 bool convert_call_to_jmp) {
102 // Enter an internal frame. 104 // Enter an internal frame.
103 { 105 {
104 FrameScope scope(masm, StackFrame::INTERNAL); 106 FrameScope scope(masm, StackFrame::INTERNAL);
105 107
108 // Load padding words on stack.
109 for (int i = 0; i < Debug::FramePaddingLayout::kInitialSize; i++) {
110 __ push(Immediate(Smi::FromInt(
111 Debug::FramePaddingLayout::kPaddingValue)));
112 }
113 __ push(Immediate(Smi::FromInt(Debug::FramePaddingLayout::kInitialSize)));
114
106 // Store the registers containing live values on the expression stack to 115 // Store the registers containing live values on the expression stack to
107 // make sure that these are correctly updated during GC. Non object values 116 // make sure that these are correctly updated during GC. Non object values
108 // are stored as a smi causing it to be untouched by GC. 117 // are stored as a smi causing it to be untouched by GC.
109 ASSERT((object_regs & ~kJSCallerSaved) == 0); 118 ASSERT((object_regs & ~kJSCallerSaved) == 0);
110 ASSERT((non_object_regs & ~kJSCallerSaved) == 0); 119 ASSERT((non_object_regs & ~kJSCallerSaved) == 0);
111 ASSERT((object_regs & non_object_regs) == 0); 120 ASSERT((object_regs & non_object_regs) == 0);
112 for (int i = 0; i < kNumJSCallerSaved; i++) { 121 for (int i = 0; i < kNumJSCallerSaved; i++) {
113 int r = JSCallerSavedCode(i); 122 int r = JSCallerSavedCode(i);
114 Register reg = { r }; 123 Register reg = { r };
115 if ((object_regs & (1 << r)) != 0) { 124 if ((object_regs & (1 << r)) != 0) {
(...skipping 11 matching lines...) Expand all
127 136
128 #ifdef DEBUG 137 #ifdef DEBUG
129 __ RecordComment("// Calling from debug break to runtime - come in - over"); 138 __ RecordComment("// Calling from debug break to runtime - come in - over");
130 #endif 139 #endif
131 __ Set(eax, Immediate(0)); // No arguments. 140 __ Set(eax, Immediate(0)); // No arguments.
132 __ mov(ebx, Immediate(ExternalReference::debug_break(masm->isolate()))); 141 __ mov(ebx, Immediate(ExternalReference::debug_break(masm->isolate())));
133 142
134 CEntryStub ceb(1); 143 CEntryStub ceb(1);
135 __ CallStub(&ceb); 144 __ CallStub(&ceb);
136 145
146 // Automatically find register that could be used after register restore.
147 // We need one register for padding skip instructions.
148 Register unused_reg = { -1 };
149
137 // Restore the register values containing object pointers from the 150 // Restore the register values containing object pointers from the
138 // expression stack. 151 // expression stack.
139 for (int i = kNumJSCallerSaved; --i >= 0;) { 152 for (int i = kNumJSCallerSaved; --i >= 0;) {
140 int r = JSCallerSavedCode(i); 153 int r = JSCallerSavedCode(i);
141 Register reg = { r }; 154 Register reg = { r };
142 if (FLAG_debug_code) { 155 if (FLAG_debug_code) {
143 __ Set(reg, Immediate(kDebugZapValue)); 156 __ Set(reg, Immediate(kDebugZapValue));
144 } 157 }
158 bool taken = reg.code() == esi.code();
145 if ((object_regs & (1 << r)) != 0) { 159 if ((object_regs & (1 << r)) != 0) {
146 __ pop(reg); 160 __ pop(reg);
161 taken = true;
147 } 162 }
148 if ((non_object_regs & (1 << r)) != 0) { 163 if ((non_object_regs & (1 << r)) != 0) {
149 __ pop(reg); 164 __ pop(reg);
150 __ SmiUntag(reg); 165 __ SmiUntag(reg);
166 taken = true;
167 }
168 if (!taken) {
169 unused_reg = reg;
151 } 170 }
152 } 171 }
153 172
173 ASSERT(unused_reg.code() != -1);
174
175 // Read current padding counter and skip corresponding number of words.
176 __ pop(unused_reg);
177 // We divide stored value by 2 (untagging) and multiply it by word's size.
178 STATIC_ASSERT(kSmiTagSize == 1);
179 __ lea(esp, Operand(esp, unused_reg, times_half_pointer_size, 0));
180
154 // Get rid of the internal frame. 181 // Get rid of the internal frame.
155 } 182 }
156 183
157 // If this call did not replace a call but patched other code then there will 184 // If this call did not replace a call but patched other code then there will
158 // be an unwanted return address left on the stack. Here we get rid of that. 185 // be an unwanted return address left on the stack. Here we get rid of that.
159 if (convert_call_to_jmp) { 186 if (convert_call_to_jmp) {
160 __ add(esp, Immediate(kPointerSize)); 187 __ add(esp, Immediate(kPointerSize));
161 } 188 }
162 189
163 // Now that the break point has been handled, resume normal execution by 190 // Now that the break point has been handled, resume normal execution by
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 353
327 const bool Debug::kFrameDropperSupported = true; 354 const bool Debug::kFrameDropperSupported = true;
328 355
329 #undef __ 356 #undef __
330 357
331 #endif // ENABLE_DEBUGGER_SUPPORT 358 #endif // ENABLE_DEBUGGER_SUPPORT
332 359
333 } } // namespace v8::internal 360 } } // namespace v8::internal
334 361
335 #endif // V8_TARGET_ARCH_IA32 362 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/frames.h ('k') | src/liveedit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698