| 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 a smi causing it to be untouched by GC. | 108     // are stored as a smi 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     if ((object_regs & (1 << r)) != 0) { | 115       if ((object_regs & (1 << r)) != 0) { | 
| 115       __ push(reg); | 116         __ push(reg); | 
|  | 117       } | 
|  | 118       if ((non_object_regs & (1 << r)) != 0) { | 
|  | 119         if (FLAG_debug_code) { | 
|  | 120           __ test(reg, Immediate(0xc0000000)); | 
|  | 121           __ Assert(zero, "Unable to encode value as smi"); | 
|  | 122         } | 
|  | 123         __ SmiTag(reg); | 
|  | 124         __ push(reg); | 
|  | 125       } | 
| 116     } | 126     } | 
| 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"); |  | 
| 121       } |  | 
| 122       __ SmiTag(reg); |  | 
| 123       __ push(reg); |  | 
| 124     } |  | 
| 125   } |  | 
| 126 | 127 | 
| 127 #ifdef DEBUG | 128 #ifdef DEBUG | 
| 128   __ RecordComment("// Calling from debug break to runtime - come in - over"); | 129     __ RecordComment("// Calling from debug break to runtime - come in - over"); | 
| 129 #endif | 130 #endif | 
| 130   __ Set(eax, Immediate(0));  // No arguments. | 131     __ Set(eax, Immediate(0));  // No arguments. | 
| 131   __ mov(ebx, Immediate(ExternalReference::debug_break(masm->isolate()))); | 132     __ mov(ebx, Immediate(ExternalReference::debug_break(masm->isolate()))); | 
| 132 | 133 | 
| 133   CEntryStub ceb(1); | 134     CEntryStub ceb(1); | 
| 134   __ CallStub(&ceb); | 135     __ CallStub(&ceb); | 
| 135 | 136 | 
| 136   // Restore the register values containing object pointers from the expression | 137     // Restore the register values containing object pointers from the | 
| 137   // stack. | 138     // expression stack. | 
| 138   for (int i = kNumJSCallerSaved; --i >= 0;) { | 139     for (int i = kNumJSCallerSaved; --i >= 0;) { | 
| 139     int r = JSCallerSavedCode(i); | 140       int r = JSCallerSavedCode(i); | 
| 140     Register reg = { r }; | 141       Register reg = { r }; | 
| 141     if (FLAG_debug_code) { | 142       if (FLAG_debug_code) { | 
| 142       __ Set(reg, Immediate(kDebugZapValue)); | 143         __ 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       } | 
| 143     } | 152     } | 
| 144     if ((object_regs & (1 << r)) != 0) { | 153 | 
| 145       __ pop(reg); | 154     // Get rid of the internal frame. | 
| 146     } |  | 
| 147     if ((non_object_regs & (1 << r)) != 0) { |  | 
| 148       __ pop(reg); |  | 
| 149       __ SmiUntag(reg); |  | 
| 150     } |  | 
| 151   } | 155   } | 
| 152 | 156 | 
| 153   // Get rid of the internal frame. |  | 
| 154   __ LeaveInternalFrame(); |  | 
| 155 |  | 
| 156   // If this call did not replace a call but patched other code then there will | 157   // If this call did not replace a call but patched other code then there will | 
| 157   // be an unwanted return address left on the stack. Here we get rid of that. | 158   // be an unwanted return address left on the stack. Here we get rid of that. | 
| 158   if (convert_call_to_jmp) { | 159   if (convert_call_to_jmp) { | 
| 159     __ add(Operand(esp), Immediate(kPointerSize)); | 160     __ add(esp, Immediate(kPointerSize)); | 
| 160   } | 161   } | 
| 161 | 162 | 
| 162   // Now that the break point has been handled, resume normal execution by | 163   // Now that the break point has been handled, resume normal execution by | 
| 163   // jumping to the target address intended by the caller and that was | 164   // jumping to the target address intended by the caller and that was | 
| 164   // overwritten by the address of DebugBreakXXX. | 165   // overwritten by the address of DebugBreakXXX. | 
| 165   ExternalReference after_break_target = | 166   ExternalReference after_break_target = | 
| 166       ExternalReference(Debug_Address::AfterBreakTarget(), masm->isolate()); | 167       ExternalReference(Debug_Address::AfterBreakTarget(), masm->isolate()); | 
| 167   __ jmp(Operand::StaticVariable(after_break_target)); | 168   __ jmp(Operand::StaticVariable(after_break_target)); | 
| 168 } | 169 } | 
| 169 | 170 | 
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 291 | 292 | 
| 292   // Load context from the function. | 293   // Load context from the function. | 
| 293   __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 294   __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 
| 294 | 295 | 
| 295   // Get function code. | 296   // Get function code. | 
| 296   __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 297   __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 
| 297   __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset)); | 298   __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset)); | 
| 298   __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); | 299   __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); | 
| 299 | 300 | 
| 300   // Re-run JSFunction, edi is function, esi is context. | 301   // Re-run JSFunction, edi is function, esi is context. | 
| 301   __ jmp(Operand(edx)); | 302   __ jmp(edx); | 
| 302 } | 303 } | 
| 303 | 304 | 
| 304 const bool Debug::kFrameDropperSupported = true; | 305 const bool Debug::kFrameDropperSupported = true; | 
| 305 | 306 | 
| 306 #undef __ | 307 #undef __ | 
| 307 | 308 | 
| 308 #endif  // ENABLE_DEBUGGER_SUPPORT | 309 #endif  // ENABLE_DEBUGGER_SUPPORT | 
| 309 | 310 | 
| 310 } }  // namespace v8::internal | 311 } }  // namespace v8::internal | 
| 311 | 312 | 
| 312 #endif  // V8_TARGET_ARCH_IA32 | 313 #endif  // V8_TARGET_ARCH_IA32 | 
| OLD | NEW | 
|---|