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 as two smis causing it to be untouched by GC. | 107 // are stored as as two smis 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 ASSERT(!reg.is(kScratchRegister)); | 114 ASSERT(!reg.is(kScratchRegister)); |
116 if ((object_regs & (1 << r)) != 0) { | 115 if ((object_regs & (1 << r)) != 0) { |
117 __ push(reg); | 116 __ 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 } | |
128 } | 117 } |
| 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 } |
129 | 128 |
130 #ifdef DEBUG | 129 #ifdef DEBUG |
131 __ RecordComment("// Calling from debug break to runtime - come in - over"); | 130 __ RecordComment("// Calling from debug break to runtime - come in - over"); |
132 #endif | 131 #endif |
133 __ Set(rax, 0); // No arguments (argc == 0). | 132 __ Set(rax, 0); // No arguments (argc == 0). |
134 __ movq(rbx, ExternalReference::debug_break(masm->isolate())); | 133 __ movq(rbx, ExternalReference::debug_break(masm->isolate())); |
135 | 134 |
136 CEntryStub ceb(1); | 135 CEntryStub ceb(1); |
137 __ CallStub(&ceb); | 136 __ CallStub(&ceb); |
138 | 137 |
139 // Restore the register values from the expression stack. | 138 // Restore the register values from the expression stack. |
140 for (int i = kNumJSCallerSaved - 1; i >= 0; i--) { | 139 for (int i = kNumJSCallerSaved - 1; i >= 0; i--) { |
141 int r = JSCallerSavedCode(i); | 140 int r = JSCallerSavedCode(i); |
142 Register reg = { r }; | 141 Register reg = { r }; |
143 if (FLAG_debug_code) { | 142 if (FLAG_debug_code) { |
144 __ Set(reg, kDebugZapValue); | 143 __ 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 } | |
158 } | 144 } |
| 145 if ((object_regs & (1 << r)) != 0) { |
| 146 __ pop(reg); |
| 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 } |
159 | 158 |
160 // Get rid of the internal frame. | 159 // Get rid of the internal frame. |
161 } | 160 __ LeaveInternalFrame(); |
162 | 161 |
163 // If this call did not replace a call but patched other code then there will | 162 // If this call did not replace a call but patched other code then there will |
164 // be an unwanted return address left on the stack. Here we get rid of that. | 163 // be an unwanted return address left on the stack. Here we get rid of that. |
165 if (convert_call_to_jmp) { | 164 if (convert_call_to_jmp) { |
166 __ addq(rsp, Immediate(kPointerSize)); | 165 __ addq(rsp, Immediate(kPointerSize)); |
167 } | 166 } |
168 | 167 |
169 // Now that the break point has been handled, resume normal execution by | 168 // Now that the break point has been handled, resume normal execution by |
170 // jumping to the target address intended by the caller and that was | 169 // jumping to the target address intended by the caller and that was |
171 // overwritten by the address of DebugBreakXXX. | 170 // overwritten by the address of DebugBreakXXX. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 310 |
312 const bool Debug::kFrameDropperSupported = true; | 311 const bool Debug::kFrameDropperSupported = true; |
313 | 312 |
314 #undef __ | 313 #undef __ |
315 | 314 |
316 #endif // ENABLE_DEBUGGER_SUPPORT | 315 #endif // ENABLE_DEBUGGER_SUPPORT |
317 | 316 |
318 } } // namespace v8::internal | 317 } } // namespace v8::internal |
319 | 318 |
320 #endif // V8_TARGET_ARCH_X64 | 319 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |