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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 | 94 |
95 #define __ ACCESS_MASM(masm) | 95 #define __ ACCESS_MASM(masm) |
96 | 96 |
97 | 97 |
98 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, | 98 static void Generate_DebugBreakCallHelper(MacroAssembler* masm, |
99 RegList object_regs, | 99 RegList object_regs, |
100 RegList non_object_regs, | 100 RegList non_object_regs, |
101 bool convert_call_to_jmp) { | 101 bool convert_call_to_jmp) { |
102 // Enter an internal frame. | 102 // Enter an internal frame. |
103 { | 103 __ EnterInternalFrame(); |
104 FrameScope scope(masm, StackFrame::INTERNAL); | |
105 | 104 |
106 // Store the registers containing live values on the expression stack to | 105 // Store the registers containing live values on the expression stack to |
107 // make sure that these are correctly updated during GC. Non object values | 106 // 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. | 107 // are stored as a smi causing it to be untouched by GC. |
109 ASSERT((object_regs & ~kJSCallerSaved) == 0); | 108 ASSERT((object_regs & ~kJSCallerSaved) == 0); |
110 ASSERT((non_object_regs & ~kJSCallerSaved) == 0); | 109 ASSERT((non_object_regs & ~kJSCallerSaved) == 0); |
111 ASSERT((object_regs & non_object_regs) == 0); | 110 ASSERT((object_regs & non_object_regs) == 0); |
112 for (int i = 0; i < kNumJSCallerSaved; i++) { | 111 for (int i = 0; i < kNumJSCallerSaved; i++) { |
113 int r = JSCallerSavedCode(i); | 112 int r = JSCallerSavedCode(i); |
114 Register reg = { r }; | 113 Register reg = { r }; |
115 if ((object_regs & (1 << r)) != 0) { | 114 if ((object_regs & (1 << r)) != 0) { |
116 __ push(reg); | 115 __ push(reg); |
| 116 } |
| 117 if ((non_object_regs & (1 << r)) != 0) { |
| 118 if (FLAG_debug_code) { |
| 119 __ test(reg, Immediate(0xc0000000)); |
| 120 __ Assert(zero, "Unable to encode value as smi"); |
117 } | 121 } |
118 if ((non_object_regs & (1 << r)) != 0) { | 122 __ SmiTag(reg); |
119 if (FLAG_debug_code) { | 123 __ push(reg); |
120 __ test(reg, Immediate(0xc0000000)); | |
121 __ Assert(zero, "Unable to encode value as smi"); | |
122 } | |
123 __ SmiTag(reg); | |
124 __ push(reg); | |
125 } | |
126 } | 124 } |
| 125 } |
127 | 126 |
128 #ifdef DEBUG | 127 #ifdef DEBUG |
129 __ RecordComment("// Calling from debug break to runtime - come in - over"); | 128 __ RecordComment("// Calling from debug break to runtime - come in - over"); |
130 #endif | 129 #endif |
131 __ Set(eax, Immediate(0)); // No arguments. | 130 __ Set(eax, Immediate(0)); // No arguments. |
132 __ mov(ebx, Immediate(ExternalReference::debug_break(masm->isolate()))); | 131 __ mov(ebx, Immediate(ExternalReference::debug_break(masm->isolate()))); |
133 | 132 |
134 CEntryStub ceb(1); | 133 CEntryStub ceb(1); |
135 __ CallStub(&ceb); | 134 __ CallStub(&ceb); |
136 | 135 |
137 // Restore the register values containing object pointers from the | 136 // Restore the register values containing object pointers from the expression |
138 // expression stack. | 137 // stack. |
139 for (int i = kNumJSCallerSaved; --i >= 0;) { | 138 for (int i = kNumJSCallerSaved; --i >= 0;) { |
140 int r = JSCallerSavedCode(i); | 139 int r = JSCallerSavedCode(i); |
141 Register reg = { r }; | 140 Register reg = { r }; |
142 if (FLAG_debug_code) { | 141 if (FLAG_debug_code) { |
143 __ Set(reg, Immediate(kDebugZapValue)); | 142 __ Set(reg, Immediate(kDebugZapValue)); |
144 } | |
145 if ((object_regs & (1 << r)) != 0) { | |
146 __ pop(reg); | |
147 } | |
148 if ((non_object_regs & (1 << r)) != 0) { | |
149 __ pop(reg); | |
150 __ SmiUntag(reg); | |
151 } | |
152 } | 143 } |
| 144 if ((object_regs & (1 << r)) != 0) { |
| 145 __ pop(reg); |
| 146 } |
| 147 if ((non_object_regs & (1 << r)) != 0) { |
| 148 __ pop(reg); |
| 149 __ SmiUntag(reg); |
| 150 } |
| 151 } |
153 | 152 |
154 // Get rid of the internal frame. | 153 // Get rid of the internal frame. |
155 } | 154 __ LeaveInternalFrame(); |
156 | 155 |
157 // If this call did not replace a call but patched other code then there will | 156 // 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. | 157 // be an unwanted return address left on the stack. Here we get rid of that. |
159 if (convert_call_to_jmp) { | 158 if (convert_call_to_jmp) { |
160 __ add(Operand(esp), Immediate(kPointerSize)); | 159 __ add(Operand(esp), Immediate(kPointerSize)); |
161 } | 160 } |
162 | 161 |
163 // Now that the break point has been handled, resume normal execution by | 162 // Now that the break point has been handled, resume normal execution by |
164 // jumping to the target address intended by the caller and that was | 163 // jumping to the target address intended by the caller and that was |
165 // overwritten by the address of DebugBreakXXX. | 164 // overwritten by the address of DebugBreakXXX. |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 | 303 |
305 const bool Debug::kFrameDropperSupported = true; | 304 const bool Debug::kFrameDropperSupported = true; |
306 | 305 |
307 #undef __ | 306 #undef __ |
308 | 307 |
309 #endif // ENABLE_DEBUGGER_SUPPORT | 308 #endif // ENABLE_DEBUGGER_SUPPORT |
310 | 309 |
311 } } // namespace v8::internal | 310 } } // namespace v8::internal |
312 | 311 |
313 #endif // V8_TARGET_ARCH_IA32 | 312 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |