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 __ EnterInternalFrame(); | 103 { |
| 104 FrameScope scope(masm, StackFrame::INTERNAL); |
104 | 105 |
105 // Store the registers containing live values on the expression stack to | 106 // Store the registers containing live values on the expression stack to |
106 // make sure that these are correctly updated during GC. Non object values | 107 // make sure that these are correctly updated during GC. Non object values |
107 // are stored as as two smis causing it to be untouched by GC. | 108 // are stored as as two smis causing it to be untouched by GC. |
108 ASSERT((object_regs & ~kJSCallerSaved) == 0); | 109 ASSERT((object_regs & ~kJSCallerSaved) == 0); |
109 ASSERT((non_object_regs & ~kJSCallerSaved) == 0); | 110 ASSERT((non_object_regs & ~kJSCallerSaved) == 0); |
110 ASSERT((object_regs & non_object_regs) == 0); | 111 ASSERT((object_regs & non_object_regs) == 0); |
111 for (int i = 0; i < kNumJSCallerSaved; i++) { | 112 for (int i = 0; i < kNumJSCallerSaved; i++) { |
112 int r = JSCallerSavedCode(i); | 113 int r = JSCallerSavedCode(i); |
113 Register reg = { r }; | 114 Register reg = { r }; |
114 ASSERT(!reg.is(kScratchRegister)); | 115 ASSERT(!reg.is(kScratchRegister)); |
115 if ((object_regs & (1 << r)) != 0) { | 116 if ((object_regs & (1 << r)) != 0) { |
116 __ push(reg); | 117 __ push(reg); |
| 118 } |
| 119 // Store the 64-bit value as two smis. |
| 120 if ((non_object_regs & (1 << r)) != 0) { |
| 121 __ movq(kScratchRegister, reg); |
| 122 __ Integer32ToSmi(reg, reg); |
| 123 __ push(reg); |
| 124 __ sar(kScratchRegister, Immediate(32)); |
| 125 __ Integer32ToSmi(kScratchRegister, kScratchRegister); |
| 126 __ push(kScratchRegister); |
| 127 } |
117 } | 128 } |
118 // Store the 64-bit value as two smis. | |
119 if ((non_object_regs & (1 << r)) != 0) { | |
120 __ movq(kScratchRegister, reg); | |
121 __ Integer32ToSmi(reg, reg); | |
122 __ push(reg); | |
123 __ sar(kScratchRegister, Immediate(32)); | |
124 __ Integer32ToSmi(kScratchRegister, kScratchRegister); | |
125 __ push(kScratchRegister); | |
126 } | |
127 } | |
128 | 129 |
129 #ifdef DEBUG | 130 #ifdef DEBUG |
130 __ RecordComment("// Calling from debug break to runtime - come in - over"); | 131 __ RecordComment("// Calling from debug break to runtime - come in - over"); |
131 #endif | 132 #endif |
132 __ Set(rax, 0); // No arguments (argc == 0). | 133 __ Set(rax, 0); // No arguments (argc == 0). |
133 __ movq(rbx, ExternalReference::debug_break(masm->isolate())); | 134 __ movq(rbx, ExternalReference::debug_break(masm->isolate())); |
134 | 135 |
135 CEntryStub ceb(1); | 136 CEntryStub ceb(1); |
136 __ CallStub(&ceb); | 137 __ CallStub(&ceb); |
137 | 138 |
138 // Restore the register values from the expression stack. | 139 // Restore the register values from the expression stack. |
139 for (int i = kNumJSCallerSaved - 1; i >= 0; i--) { | 140 for (int i = kNumJSCallerSaved - 1; i >= 0; i--) { |
140 int r = JSCallerSavedCode(i); | 141 int r = JSCallerSavedCode(i); |
141 Register reg = { r }; | 142 Register reg = { r }; |
142 if (FLAG_debug_code) { | 143 if (FLAG_debug_code) { |
143 __ Set(reg, kDebugZapValue); | 144 __ Set(reg, kDebugZapValue); |
| 145 } |
| 146 if ((object_regs & (1 << r)) != 0) { |
| 147 __ pop(reg); |
| 148 } |
| 149 // Reconstruct the 64-bit value from two smis. |
| 150 if ((non_object_regs & (1 << r)) != 0) { |
| 151 __ pop(kScratchRegister); |
| 152 __ SmiToInteger32(kScratchRegister, kScratchRegister); |
| 153 __ shl(kScratchRegister, Immediate(32)); |
| 154 __ pop(reg); |
| 155 __ SmiToInteger32(reg, reg); |
| 156 __ or_(reg, kScratchRegister); |
| 157 } |
144 } | 158 } |
145 if ((object_regs & (1 << r)) != 0) { | 159 |
146 __ pop(reg); | 160 // Get rid of the internal frame. |
147 } | |
148 // Reconstruct the 64-bit value from two smis. | |
149 if ((non_object_regs & (1 << r)) != 0) { | |
150 __ pop(kScratchRegister); | |
151 __ SmiToInteger32(kScratchRegister, kScratchRegister); | |
152 __ shl(kScratchRegister, Immediate(32)); | |
153 __ pop(reg); | |
154 __ SmiToInteger32(reg, reg); | |
155 __ or_(reg, kScratchRegister); | |
156 } | |
157 } | 161 } |
158 | 162 |
159 // Get rid of the internal frame. | |
160 __ LeaveInternalFrame(); | |
161 | |
162 // If this call did not replace a call but patched other code then there will | 163 // If this call did not replace a call but patched other code then there will |
163 // be an unwanted return address left on the stack. Here we get rid of that. | 164 // be an unwanted return address left on the stack. Here we get rid of that. |
164 if (convert_call_to_jmp) { | 165 if (convert_call_to_jmp) { |
165 __ addq(rsp, Immediate(kPointerSize)); | 166 __ addq(rsp, Immediate(kPointerSize)); |
166 } | 167 } |
167 | 168 |
168 // Now that the break point has been handled, resume normal execution by | 169 // Now that the break point has been handled, resume normal execution by |
169 // jumping to the target address intended by the caller and that was | 170 // jumping to the target address intended by the caller and that was |
170 // overwritten by the address of DebugBreakXXX. | 171 // overwritten by the address of DebugBreakXXX. |
171 ExternalReference after_break_target = | 172 ExternalReference after_break_target = |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 311 |
311 const bool Debug::kFrameDropperSupported = true; | 312 const bool Debug::kFrameDropperSupported = true; |
312 | 313 |
313 #undef __ | 314 #undef __ |
314 | 315 |
315 #endif // ENABLE_DEBUGGER_SUPPORT | 316 #endif // ENABLE_DEBUGGER_SUPPORT |
316 | 317 |
317 } } // namespace v8::internal | 318 } } // namespace v8::internal |
318 | 319 |
319 #endif // V8_TARGET_ARCH_X64 | 320 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |