| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // r1: preserved | 267 // r1: preserved |
| 268 // r2: preserved | 268 // r2: preserved |
| 269 | 269 |
| 270 // Drop the execution stack down to the frame pointer and restore | 270 // Drop the execution stack down to the frame pointer and restore |
| 271 // the caller frame pointer and return address. | 271 // the caller frame pointer and return address. |
| 272 mov(sp, fp); | 272 mov(sp, fp); |
| 273 ldm(ia_w, sp, fp.bit() | lr.bit()); | 273 ldm(ia_w, sp, fp.bit() | lr.bit()); |
| 274 } | 274 } |
| 275 | 275 |
| 276 | 276 |
| 277 void MacroAssembler::EnterExitFrame(StackFrame::Type type) { | 277 void MacroAssembler::EnterExitFrame(ExitFrame::Mode mode) { |
| 278 ASSERT(type == StackFrame::EXIT || type == StackFrame::EXIT_DEBUG); | |
| 279 | |
| 280 // Compute the argv pointer and keep it in a callee-saved register. | 278 // Compute the argv pointer and keep it in a callee-saved register. |
| 281 // r0 is argc. | 279 // r0 is argc. |
| 282 add(r6, sp, Operand(r0, LSL, kPointerSizeLog2)); | 280 add(r6, sp, Operand(r0, LSL, kPointerSizeLog2)); |
| 283 sub(r6, r6, Operand(kPointerSize)); | 281 sub(r6, r6, Operand(kPointerSize)); |
| 284 | 282 |
| 285 // Compute callee's stack pointer before making changes and save it as | 283 // Compute callee's stack pointer before making changes and save it as |
| 286 // ip register so that it is restored as sp register on exit, thereby | 284 // ip register so that it is restored as sp register on exit, thereby |
| 287 // popping the args. | 285 // popping the args. |
| 288 | 286 |
| 289 // ip = sp + kPointerSize * #args; | 287 // ip = sp + kPointerSize * #args; |
| 290 add(ip, sp, Operand(r0, LSL, kPointerSizeLog2)); | 288 add(ip, sp, Operand(r0, LSL, kPointerSizeLog2)); |
| 291 | 289 |
| 292 // Align the stack at this point. After this point we have 5 pushes, | 290 // Align the stack at this point. After this point we have 5 pushes, |
| 293 // so in fact we have to unalign here! See also the assert on the | 291 // so in fact we have to unalign here! See also the assert on the |
| 294 // alignment in AlignStack. | 292 // alignment in AlignStack. |
| 295 AlignStack(1); | 293 AlignStack(1); |
| 296 | 294 |
| 297 // Push in reverse order: caller_fp, sp_on_exit, and caller_pc. | 295 // Push in reverse order: caller_fp, sp_on_exit, and caller_pc. |
| 298 stm(db_w, sp, fp.bit() | ip.bit() | lr.bit()); | 296 stm(db_w, sp, fp.bit() | ip.bit() | lr.bit()); |
| 299 mov(fp, Operand(sp)); // setup new frame pointer | 297 mov(fp, Operand(sp)); // setup new frame pointer |
| 300 | 298 |
| 301 // Push debug marker. | 299 if (mode == ExitFrame::MODE_DEBUG) { |
| 302 mov(ip, Operand(type == StackFrame::EXIT_DEBUG ? 1 : 0)); | 300 mov(ip, Operand(Smi::FromInt(0))); |
| 301 } else { |
| 302 mov(ip, Operand(CodeObject())); |
| 303 } |
| 303 push(ip); | 304 push(ip); |
| 304 | 305 |
| 305 // Save the frame pointer and the context in top. | 306 // Save the frame pointer and the context in top. |
| 306 mov(ip, Operand(ExternalReference(Top::k_c_entry_fp_address))); | 307 mov(ip, Operand(ExternalReference(Top::k_c_entry_fp_address))); |
| 307 str(fp, MemOperand(ip)); | 308 str(fp, MemOperand(ip)); |
| 308 mov(ip, Operand(ExternalReference(Top::k_context_address))); | 309 mov(ip, Operand(ExternalReference(Top::k_context_address))); |
| 309 str(cp, MemOperand(ip)); | 310 str(cp, MemOperand(ip)); |
| 310 | 311 |
| 311 // Setup argc and the builtin function in callee-saved registers. | 312 // Setup argc and the builtin function in callee-saved registers. |
| 312 mov(r4, Operand(r0)); | 313 mov(r4, Operand(r0)); |
| 313 mov(r5, Operand(r1)); | 314 mov(r5, Operand(r1)); |
| 314 | 315 |
| 315 | 316 |
| 316 #ifdef ENABLE_DEBUGGER_SUPPORT | 317 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 317 // Save the state of all registers to the stack from the memory | 318 // Save the state of all registers to the stack from the memory |
| 318 // location. This is needed to allow nested break points. | 319 // location. This is needed to allow nested break points. |
| 319 if (type == StackFrame::EXIT_DEBUG) { | 320 if (mode == ExitFrame::MODE_DEBUG) { |
| 320 // Use sp as base to push. | 321 // Use sp as base to push. |
| 321 CopyRegistersFromMemoryToStack(sp, kJSCallerSaved); | 322 CopyRegistersFromMemoryToStack(sp, kJSCallerSaved); |
| 322 } | 323 } |
| 323 #endif | 324 #endif |
| 324 } | 325 } |
| 325 | 326 |
| 326 | 327 |
| 327 void MacroAssembler::AlignStack(int offset) { | 328 void MacroAssembler::AlignStack(int offset) { |
| 328 #if defined(V8_HOST_ARCH_ARM) | 329 #if defined(V8_HOST_ARCH_ARM) |
| 329 // Running on the real platform. Use the alignment as mandated by the local | 330 // Running on the real platform. Use the alignment as mandated by the local |
| (...skipping 11 matching lines...) Expand all Loading... |
| 341 if (activation_frame_alignment != kPointerSize) { | 342 if (activation_frame_alignment != kPointerSize) { |
| 342 // This code needs to be made more general if this assert doesn't hold. | 343 // This code needs to be made more general if this assert doesn't hold. |
| 343 ASSERT(activation_frame_alignment == 2 * kPointerSize); | 344 ASSERT(activation_frame_alignment == 2 * kPointerSize); |
| 344 mov(r7, Operand(Smi::FromInt(0))); | 345 mov(r7, Operand(Smi::FromInt(0))); |
| 345 tst(sp, Operand(activation_frame_alignment - offset)); | 346 tst(sp, Operand(activation_frame_alignment - offset)); |
| 346 push(r7, eq); // Conditional push instruction. | 347 push(r7, eq); // Conditional push instruction. |
| 347 } | 348 } |
| 348 } | 349 } |
| 349 | 350 |
| 350 | 351 |
| 351 void MacroAssembler::LeaveExitFrame(StackFrame::Type type) { | 352 void MacroAssembler::LeaveExitFrame(ExitFrame::Mode mode) { |
| 352 #ifdef ENABLE_DEBUGGER_SUPPORT | 353 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 353 // Restore the memory copy of the registers by digging them out from | 354 // Restore the memory copy of the registers by digging them out from |
| 354 // the stack. This is needed to allow nested break points. | 355 // the stack. This is needed to allow nested break points. |
| 355 if (type == StackFrame::EXIT_DEBUG) { | 356 if (mode == ExitFrame::MODE_DEBUG) { |
| 356 // This code intentionally clobbers r2 and r3. | 357 // This code intentionally clobbers r2 and r3. |
| 357 const int kCallerSavedSize = kNumJSCallerSaved * kPointerSize; | 358 const int kCallerSavedSize = kNumJSCallerSaved * kPointerSize; |
| 358 const int kOffset = ExitFrameConstants::kDebugMarkOffset - kCallerSavedSize; | 359 const int kOffset = ExitFrameConstants::kCodeOffset - kCallerSavedSize; |
| 359 add(r3, fp, Operand(kOffset)); | 360 add(r3, fp, Operand(kOffset)); |
| 360 CopyRegistersFromStackToMemory(r3, r2, kJSCallerSaved); | 361 CopyRegistersFromStackToMemory(r3, r2, kJSCallerSaved); |
| 361 } | 362 } |
| 362 #endif | 363 #endif |
| 363 | 364 |
| 364 // Clear top frame. | 365 // Clear top frame. |
| 365 mov(r3, Operand(0)); | 366 mov(r3, Operand(0)); |
| 366 mov(ip, Operand(ExternalReference(Top::k_c_entry_fp_address))); | 367 mov(ip, Operand(ExternalReference(Top::k_c_entry_fp_address))); |
| 367 str(r3, MemOperand(ip)); | 368 str(r3, MemOperand(ip)); |
| 368 | 369 |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 } | 1179 } |
| 1179 | 1180 |
| 1180 | 1181 |
| 1181 void CodePatcher::Emit(Address addr) { | 1182 void CodePatcher::Emit(Address addr) { |
| 1182 masm()->emit(reinterpret_cast<Instr>(addr)); | 1183 masm()->emit(reinterpret_cast<Instr>(addr)); |
| 1183 } | 1184 } |
| 1184 #endif // ENABLE_DEBUGGER_SUPPORT | 1185 #endif // ENABLE_DEBUGGER_SUPPORT |
| 1185 | 1186 |
| 1186 | 1187 |
| 1187 } } // namespace v8::internal | 1188 } } // namespace v8::internal |
| OLD | NEW |