| OLD | NEW |
| 1 // Copyright 2012 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 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // make sure that these are correctly updated during GC. Non object values | 114 // make sure that these are correctly updated during GC. Non object values |
| 115 // are stored as as two smis causing it to be untouched by GC. | 115 // are stored as as two smis causing it to be untouched by GC. |
| 116 ASSERT((object_regs & ~kJSCallerSaved) == 0); | 116 ASSERT((object_regs & ~kJSCallerSaved) == 0); |
| 117 ASSERT((non_object_regs & ~kJSCallerSaved) == 0); | 117 ASSERT((non_object_regs & ~kJSCallerSaved) == 0); |
| 118 ASSERT((object_regs & non_object_regs) == 0); | 118 ASSERT((object_regs & non_object_regs) == 0); |
| 119 for (int i = 0; i < kNumJSCallerSaved; i++) { | 119 for (int i = 0; i < kNumJSCallerSaved; i++) { |
| 120 int r = JSCallerSavedCode(i); | 120 int r = JSCallerSavedCode(i); |
| 121 Register reg = { r }; | 121 Register reg = { r }; |
| 122 ASSERT(!reg.is(kScratchRegister)); | 122 ASSERT(!reg.is(kScratchRegister)); |
| 123 if ((object_regs & (1 << r)) != 0) { | 123 if ((object_regs & (1 << r)) != 0) { |
| 124 __ push(reg); | 124 __ Push(reg); |
| 125 } | 125 } |
| 126 if ((non_object_regs & (1 << r)) != 0) { | 126 if ((non_object_regs & (1 << r)) != 0) { |
| 127 __ PushInt64AsTwoSmis(reg); | 127 __ PushInt64AsTwoSmis(reg); |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 | 130 |
| 131 #ifdef DEBUG | 131 #ifdef DEBUG |
| 132 __ RecordComment("// Calling from debug break to runtime - come in - over"); | 132 __ RecordComment("// Calling from debug break to runtime - come in - over"); |
| 133 #endif | 133 #endif |
| 134 __ Set(rax, 0); // No arguments (argc == 0). | 134 __ Set(rax, 0); // No arguments (argc == 0). |
| 135 __ Move(rbx, ExternalReference::debug_break(masm->isolate())); | 135 __ Move(rbx, ExternalReference::debug_break(masm->isolate())); |
| 136 | 136 |
| 137 CEntryStub ceb(1); | 137 CEntryStub ceb(1); |
| 138 __ CallStub(&ceb); | 138 __ CallStub(&ceb); |
| 139 | 139 |
| 140 // Restore the register values from the expression stack. | 140 // Restore the register values from the expression stack. |
| 141 for (int i = kNumJSCallerSaved - 1; i >= 0; i--) { | 141 for (int i = kNumJSCallerSaved - 1; i >= 0; i--) { |
| 142 int r = JSCallerSavedCode(i); | 142 int r = JSCallerSavedCode(i); |
| 143 Register reg = { r }; | 143 Register reg = { r }; |
| 144 if (FLAG_debug_code) { | 144 if (FLAG_debug_code) { |
| 145 __ Set(reg, kDebugZapValue); | 145 __ Set(reg, kDebugZapValue); |
| 146 } | 146 } |
| 147 if ((object_regs & (1 << r)) != 0) { | 147 if ((object_regs & (1 << r)) != 0) { |
| 148 __ pop(reg); | 148 __ Pop(reg); |
| 149 } | 149 } |
| 150 // Reconstruct the 64-bit value from two smis. | 150 // Reconstruct the 64-bit value from two smis. |
| 151 if ((non_object_regs & (1 << r)) != 0) { | 151 if ((non_object_regs & (1 << r)) != 0) { |
| 152 __ PopInt64AsTwoSmis(reg); | 152 __ PopInt64AsTwoSmis(reg); |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 // Read current padding counter and skip corresponding number of words. | 156 // Read current padding counter and skip corresponding number of words. |
| 157 __ pop(kScratchRegister); | 157 __ Pop(kScratchRegister); |
| 158 __ SmiToInteger32(kScratchRegister, kScratchRegister); | 158 __ SmiToInteger32(kScratchRegister, kScratchRegister); |
| 159 __ lea(rsp, Operand(rsp, kScratchRegister, times_pointer_size, 0)); | 159 __ lea(rsp, Operand(rsp, kScratchRegister, times_pointer_size, 0)); |
| 160 | 160 |
| 161 // Get rid of the internal frame. | 161 // Get rid of the internal frame. |
| 162 } | 162 } |
| 163 | 163 |
| 164 // If this call did not replace a call but patched other code then there will | 164 // If this call did not replace a call but patched other code then there will |
| 165 // be an unwanted return address left on the stack. Here we get rid of that. | 165 // be an unwanted return address left on the stack. Here we get rid of that. |
| 166 if (convert_call_to_jmp) { | 166 if (convert_call_to_jmp) { |
| 167 __ addq(rsp, Immediate(kPCOnStackSize)); | 167 __ addq(rsp, Immediate(kPCOnStackSize)); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 void Debug::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { | 322 void Debug::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { |
| 323 ExternalReference restarter_frame_function_slot = | 323 ExternalReference restarter_frame_function_slot = |
| 324 ExternalReference(Debug_Address::RestarterFrameFunctionPointer(), | 324 ExternalReference(Debug_Address::RestarterFrameFunctionPointer(), |
| 325 masm->isolate()); | 325 masm->isolate()); |
| 326 __ Move(rax, restarter_frame_function_slot); | 326 __ Move(rax, restarter_frame_function_slot); |
| 327 __ movp(Operand(rax, 0), Immediate(0)); | 327 __ movp(Operand(rax, 0), Immediate(0)); |
| 328 | 328 |
| 329 // We do not know our frame height, but set rsp based on rbp. | 329 // We do not know our frame height, but set rsp based on rbp. |
| 330 __ lea(rsp, Operand(rbp, -1 * kPointerSize)); | 330 __ lea(rsp, Operand(rbp, -1 * kPointerSize)); |
| 331 | 331 |
| 332 __ pop(rdi); // Function. | 332 __ Pop(rdi); // Function. |
| 333 __ pop(rbp); | 333 __ popq(rbp); |
| 334 | 334 |
| 335 // Load context from the function. | 335 // Load context from the function. |
| 336 __ movp(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 336 __ movp(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
| 337 | 337 |
| 338 // Get function code. | 338 // Get function code. |
| 339 __ movp(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 339 __ movp(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
| 340 __ movp(rdx, FieldOperand(rdx, SharedFunctionInfo::kCodeOffset)); | 340 __ movp(rdx, FieldOperand(rdx, SharedFunctionInfo::kCodeOffset)); |
| 341 __ lea(rdx, FieldOperand(rdx, Code::kHeaderSize)); | 341 __ lea(rdx, FieldOperand(rdx, Code::kHeaderSize)); |
| 342 | 342 |
| 343 // Re-run JSFunction, rdi is function, rsi is context. | 343 // Re-run JSFunction, rdi is function, rsi is context. |
| 344 __ jmp(rdx); | 344 __ jmp(rdx); |
| 345 } | 345 } |
| 346 | 346 |
| 347 const bool Debug::kFrameDropperSupported = true; | 347 const bool Debug::kFrameDropperSupported = true; |
| 348 | 348 |
| 349 #undef __ | 349 #undef __ |
| 350 | 350 |
| 351 #endif // ENABLE_DEBUGGER_SUPPORT | 351 #endif // ENABLE_DEBUGGER_SUPPORT |
| 352 | 352 |
| 353 } } // namespace v8::internal | 353 } } // namespace v8::internal |
| 354 | 354 |
| 355 #endif // V8_TARGET_ARCH_X64 | 355 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |