OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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(Debug::FramePaddingLayout::kPaddingValue)); | |
111 } | |
112 __ push(Immediate(2 * Debug::FramePaddingLayout::kInitialSize)); | |
Yang
2012/05/02 11:38:34
I assume multiplying by 2 is for Smi-tagging? Use
Peter Rybin
2012/05/02 23:46:33
Done.
| |
113 | |
106 // Store the registers containing live values on the expression stack to | 114 // Store the registers containing live values on the expression stack to |
107 // make sure that these are correctly updated during GC. Non object values | 115 // 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. | 116 // are stored as a smi causing it to be untouched by GC. |
109 ASSERT((object_regs & ~kJSCallerSaved) == 0); | 117 ASSERT((object_regs & ~kJSCallerSaved) == 0); |
110 ASSERT((non_object_regs & ~kJSCallerSaved) == 0); | 118 ASSERT((non_object_regs & ~kJSCallerSaved) == 0); |
111 ASSERT((object_regs & non_object_regs) == 0); | 119 ASSERT((object_regs & non_object_regs) == 0); |
112 for (int i = 0; i < kNumJSCallerSaved; i++) { | 120 for (int i = 0; i < kNumJSCallerSaved; i++) { |
113 int r = JSCallerSavedCode(i); | 121 int r = JSCallerSavedCode(i); |
114 Register reg = { r }; | 122 Register reg = { r }; |
115 if ((object_regs & (1 << r)) != 0) { | 123 if ((object_regs & (1 << r)) != 0) { |
(...skipping 11 matching lines...) Expand all Loading... | |
127 | 135 |
128 #ifdef DEBUG | 136 #ifdef DEBUG |
129 __ RecordComment("// Calling from debug break to runtime - come in - over"); | 137 __ RecordComment("// Calling from debug break to runtime - come in - over"); |
130 #endif | 138 #endif |
131 __ Set(eax, Immediate(0)); // No arguments. | 139 __ Set(eax, Immediate(0)); // No arguments. |
132 __ mov(ebx, Immediate(ExternalReference::debug_break(masm->isolate()))); | 140 __ mov(ebx, Immediate(ExternalReference::debug_break(masm->isolate()))); |
133 | 141 |
134 CEntryStub ceb(1); | 142 CEntryStub ceb(1); |
135 __ CallStub(&ceb); | 143 __ CallStub(&ceb); |
136 | 144 |
145 // Automatically find register that could be used after register restore. | |
146 // We need one register for padding skip instructions. | |
147 Register unused_reg = { -1 }; | |
148 | |
137 // Restore the register values containing object pointers from the | 149 // Restore the register values containing object pointers from the |
138 // expression stack. | 150 // expression stack. |
139 for (int i = kNumJSCallerSaved; --i >= 0;) { | 151 for (int i = kNumJSCallerSaved; --i >= 0;) { |
140 int r = JSCallerSavedCode(i); | 152 int r = JSCallerSavedCode(i); |
141 Register reg = { r }; | 153 Register reg = { r }; |
142 if (FLAG_debug_code) { | 154 if (FLAG_debug_code) { |
143 __ Set(reg, Immediate(kDebugZapValue)); | 155 __ Set(reg, Immediate(kDebugZapValue)); |
144 } | 156 } |
157 bool taken = reg.code() == esi.code(); | |
145 if ((object_regs & (1 << r)) != 0) { | 158 if ((object_regs & (1 << r)) != 0) { |
146 __ pop(reg); | 159 __ pop(reg); |
160 taken = true; | |
147 } | 161 } |
148 if ((non_object_regs & (1 << r)) != 0) { | 162 if ((non_object_regs & (1 << r)) != 0) { |
149 __ pop(reg); | 163 __ pop(reg); |
150 __ SmiUntag(reg); | 164 __ SmiUntag(reg); |
165 taken = true; | |
166 } | |
167 if (!taken) { | |
168 unused_reg = reg; | |
151 } | 169 } |
152 } | 170 } |
153 | 171 |
172 ASSERT(unused_reg.code() != -1); | |
173 | |
174 // Read current padding counter and skip corresponding number of words. | |
175 __ pop(unused_reg); | |
176 __ lea(esp, Operand(esp, unused_reg, times_half_pointer_size, 0)); | |
Yang
2012/05/02 11:38:34
This is based on the implication that Smis are rep
Peter Rybin
2012/05/02 23:46:33
Done.
| |
177 | |
154 // Get rid of the internal frame. | 178 // Get rid of the internal frame. |
155 } | 179 } |
156 | 180 |
157 // If this call did not replace a call but patched other code then there will | 181 // 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. | 182 // be an unwanted return address left on the stack. Here we get rid of that. |
159 if (convert_call_to_jmp) { | 183 if (convert_call_to_jmp) { |
160 __ add(esp, Immediate(kPointerSize)); | 184 __ add(esp, Immediate(kPointerSize)); |
161 } | 185 } |
162 | 186 |
163 // Now that the break point has been handled, resume normal execution by | 187 // Now that the break point has been handled, resume normal execution by |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 | 350 |
327 const bool Debug::kFrameDropperSupported = true; | 351 const bool Debug::kFrameDropperSupported = true; |
328 | 352 |
329 #undef __ | 353 #undef __ |
330 | 354 |
331 #endif // ENABLE_DEBUGGER_SUPPORT | 355 #endif // ENABLE_DEBUGGER_SUPPORT |
332 | 356 |
333 } } // namespace v8::internal | 357 } } // namespace v8::internal |
334 | 358 |
335 #endif // V8_TARGET_ARCH_IA32 | 359 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |