Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 | 284 |
| 285 // Drop the execution stack down to the frame pointer and restore | 285 // Drop the execution stack down to the frame pointer and restore |
| 286 // the caller frame pointer and return address. | 286 // the caller frame pointer and return address. |
| 287 mov(sp, fp); | 287 mov(sp, fp); |
| 288 ldm(ia_w, sp, fp.bit() | lr.bit()); | 288 ldm(ia_w, sp, fp.bit() | lr.bit()); |
| 289 } | 289 } |
| 290 | 290 |
| 291 | 291 |
| 292 void MacroAssembler::EnterExitFrame(StackFrame::Type type) { | 292 void MacroAssembler::EnterExitFrame(StackFrame::Type type) { |
| 293 ASSERT(type == StackFrame::EXIT || type == StackFrame::EXIT_DEBUG); | 293 ASSERT(type == StackFrame::EXIT || type == StackFrame::EXIT_DEBUG); |
| 294 | |
| 295 // Compute the argv pointer and keep it in a callee-saved register. | |
| 296 // r0 is argc. | |
| 297 add(r6, sp, Operand(r0, LSL, kPointerSizeLog2)); | |
| 298 sub(r6, r6, Operand(kPointerSize)); | |
| 299 | |
| 294 // Compute parameter pointer before making changes and save it as ip | 300 // Compute parameter pointer before making changes and save it as ip |
| 295 // register so that it is restored as sp register on exit, thereby | 301 // register so that it is restored as sp register on exit, thereby |
| 296 // popping the args. | 302 // popping the args. |
| 297 | 303 |
| 298 // ip = sp + kPointerSize * #args; | 304 // ip = sp + kPointerSize * #args; |
| 299 add(ip, sp, Operand(r0, LSL, kPointerSizeLog2)); | 305 add(ip, sp, Operand(r0, LSL, kPointerSizeLog2)); |
|
Mark Lam
2009/05/21 22:55:36
This "add" instruction is functionally equivalent
| |
| 300 | 306 |
| 307 // Align the stack at this point. After this point we have 5 pushes, | |
| 308 // so in fact we have to unalign here! See also the assert on the | |
| 309 // alignment immediately below. | |
| 310 if (OS::ActivationFrameAlignment() != kPointerSize) { | |
| 311 // This code needs to be made more general if this assert doesn't hold. | |
| 312 ASSERT(OS::ActivationFrameAlignment() == 2 * kPointerSize); | |
| 313 mov(r7, Operand(Smi::FromInt(0))); | |
| 314 tst(sp, Operand(OS::ActivationFrameAlignment() - 1)); | |
| 315 push(r7, eq); // Conditional push instruction. | |
| 316 } | |
| 317 | |
| 301 // Push in reverse order: caller_fp, sp_on_exit, and caller_pc. | 318 // Push in reverse order: caller_fp, sp_on_exit, and caller_pc. |
| 302 stm(db_w, sp, fp.bit() | ip.bit() | lr.bit()); | 319 stm(db_w, sp, fp.bit() | ip.bit() | lr.bit()); |
| 303 mov(fp, Operand(sp)); // setup new frame pointer | 320 mov(fp, Operand(sp)); // setup new frame pointer |
| 304 | 321 |
| 305 // Push debug marker. | 322 // Push debug marker. |
| 306 mov(ip, Operand(type == StackFrame::EXIT_DEBUG ? 1 : 0)); | 323 mov(ip, Operand(type == StackFrame::EXIT_DEBUG ? 1 : 0)); |
| 307 push(ip); | 324 push(ip); |
| 308 | 325 |
| 309 // Save the frame pointer and the context in top. | 326 // Save the frame pointer and the context in top. |
| 310 mov(ip, Operand(ExternalReference(Top::k_c_entry_fp_address))); | 327 mov(ip, Operand(ExternalReference(Top::k_c_entry_fp_address))); |
| 311 str(fp, MemOperand(ip)); | 328 str(fp, MemOperand(ip)); |
| 312 mov(ip, Operand(ExternalReference(Top::k_context_address))); | 329 mov(ip, Operand(ExternalReference(Top::k_context_address))); |
| 313 str(cp, MemOperand(ip)); | 330 str(cp, MemOperand(ip)); |
| 314 | 331 |
| 315 // Setup argc and the builtin function in callee-saved registers. | 332 // Setup argc and the builtin function in callee-saved registers. |
| 316 mov(r4, Operand(r0)); | 333 mov(r4, Operand(r0)); |
| 317 mov(r5, Operand(r1)); | 334 mov(r5, Operand(r1)); |
| 318 | 335 |
| 319 // Compute the argv pointer and keep it in a callee-saved register. | |
| 320 add(r6, fp, Operand(r4, LSL, kPointerSizeLog2)); | |
| 321 add(r6, r6, Operand(ExitFrameConstants::kPPDisplacement - kPointerSize)); | |
| 322 | 336 |
| 323 #ifdef ENABLE_DEBUGGER_SUPPORT | 337 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 324 // Save the state of all registers to the stack from the memory | 338 // Save the state of all registers to the stack from the memory |
| 325 // location. This is needed to allow nested break points. | 339 // location. This is needed to allow nested break points. |
| 326 if (type == StackFrame::EXIT_DEBUG) { | 340 if (type == StackFrame::EXIT_DEBUG) { |
| 327 // Use sp as base to push. | 341 // Use sp as base to push. |
| 328 CopyRegistersFromMemoryToStack(sp, kJSCallerSaved); | 342 CopyRegistersFromMemoryToStack(sp, kJSCallerSaved); |
| 329 } | 343 } |
| 330 #endif | 344 #endif |
| 331 } | 345 } |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 932 #endif | 946 #endif |
| 933 mov(r0, Operand(p0)); | 947 mov(r0, Operand(p0)); |
| 934 push(r0); | 948 push(r0); |
| 935 mov(r0, Operand(Smi::FromInt(p1 - p0))); | 949 mov(r0, Operand(Smi::FromInt(p1 - p0))); |
| 936 push(r0); | 950 push(r0); |
| 937 CallRuntime(Runtime::kAbort, 2); | 951 CallRuntime(Runtime::kAbort, 2); |
| 938 // will not return here | 952 // will not return here |
| 939 } | 953 } |
| 940 | 954 |
| 941 } } // namespace v8::internal | 955 } } // namespace v8::internal |
| OLD | NEW |