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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 252 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); |
253 mov(ip, Operand(Smi::FromInt(type))); | 253 mov(ip, Operand(Smi::FromInt(type))); |
254 push(ip); | 254 push(ip); |
255 mov(ip, Operand(0)); | 255 mov(ip, Operand(0)); |
256 push(ip); // Push an empty code cache slot. | 256 push(ip); // Push an empty code cache slot. |
257 add(fp, sp, Operand(3 * kPointerSize)); // Adjust FP to point to saved FP. | 257 add(fp, sp, Operand(3 * kPointerSize)); // Adjust FP to point to saved FP. |
258 } | 258 } |
259 | 259 |
260 | 260 |
261 void MacroAssembler::ExitInternalFrame() { | 261 void MacroAssembler::LeaveInternalFrame() { |
262 // r0: preserved | 262 // r0: preserved |
263 // r1: preserved | 263 // r1: preserved |
264 // r2: preserved | 264 // r2: preserved |
265 | 265 |
266 // Drop the execution stack down to the frame pointer and restore the caller | 266 // Drop the execution stack down to the frame pointer and restore the caller |
267 // frame pointer and return address. | 267 // frame pointer and return address. |
268 mov(sp, fp); | 268 mov(sp, fp); |
269 ldm(ia_w, sp, fp.bit() | lr.bit()); | 269 ldm(ia_w, sp, fp.bit() | lr.bit()); |
270 } | 270 } |
271 | 271 |
272 | 272 |
| 273 void MacroAssembler::EnterExitFrame(StackFrame::Type type) { |
| 274 ASSERT(type == StackFrame::EXIT || type == StackFrame::EXIT_DEBUG); |
| 275 // Compute parameter pointer before making changes and save it as ip |
| 276 // register so that it is restored as sp register on exit, thereby |
| 277 // popping the args. |
| 278 |
| 279 // ip = sp + kPointerSize * #args; |
| 280 add(ip, sp, Operand(r0, LSL, kPointerSizeLog2)); |
| 281 |
| 282 // Push in reverse order: caller_fp, sp_on_exit, and caller_pc. |
| 283 stm(db_w, sp, fp.bit() | ip.bit() | lr.bit()); |
| 284 mov(fp, Operand(sp)); // setup new frame pointer |
| 285 |
| 286 // Push debug marker. |
| 287 mov(ip, Operand(type == StackFrame::EXIT_DEBUG ? 1 : 0)); |
| 288 push(ip); |
| 289 |
| 290 // Save the frame pointer and the context in top. |
| 291 mov(ip, Operand(ExternalReference(Top::k_c_entry_fp_address))); |
| 292 str(fp, MemOperand(ip)); |
| 293 mov(ip, Operand(ExternalReference(Top::k_context_address))); |
| 294 str(cp, MemOperand(ip)); |
| 295 |
| 296 // Setup argc and the builtin function in callee-saved registers. |
| 297 mov(r4, Operand(r0)); |
| 298 mov(r5, Operand(r1)); |
| 299 |
| 300 // Compute the argv pointer and keep it in a callee-saved register. |
| 301 add(r6, fp, Operand(r4, LSL, kPointerSizeLog2)); |
| 302 add(r6, r6, Operand(ExitFrameConstants::kPPDisplacement - kPointerSize)); |
| 303 } |
| 304 |
| 305 |
| 306 void MacroAssembler::LeaveExitFrame() { |
| 307 // Clear top frame. |
| 308 mov(r3, Operand(0)); |
| 309 mov(ip, Operand(ExternalReference(Top::k_c_entry_fp_address))); |
| 310 str(r3, MemOperand(ip)); |
| 311 |
| 312 // Restore current context from top and clear it in debug mode. |
| 313 mov(ip, Operand(ExternalReference(Top::k_context_address))); |
| 314 ldr(cp, MemOperand(ip)); |
| 315 if (kDebug) { |
| 316 str(r3, MemOperand(ip)); |
| 317 } |
| 318 |
| 319 // Pop the arguments, restore registers, and return. |
| 320 mov(sp, Operand(fp)); // respect ABI stack constraint |
| 321 ldm(ia, sp, fp.bit() | sp.bit() | pc.bit()); |
| 322 } |
| 323 |
| 324 |
273 void MacroAssembler::InvokePrologue(const ParameterCount& expected, | 325 void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
274 const ParameterCount& actual, | 326 const ParameterCount& actual, |
275 Handle<Code> code_constant, | 327 Handle<Code> code_constant, |
276 Register code_reg, | 328 Register code_reg, |
277 Label* done, | 329 Label* done, |
278 InvokeFlag flag) { | 330 InvokeFlag flag) { |
279 bool definitely_matches = false; | 331 bool definitely_matches = false; |
280 Label regular_invoke; | 332 Label regular_invoke; |
281 | 333 |
282 // Check whether the expected and actual arguments count match. If not, | 334 // Check whether the expected and actual arguments count match. If not, |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 #endif | 800 #endif |
749 mov(r0, Operand(p0)); | 801 mov(r0, Operand(p0)); |
750 push(r0); | 802 push(r0); |
751 mov(r0, Operand(Smi::FromInt(p1 - p0))); | 803 mov(r0, Operand(Smi::FromInt(p1 - p0))); |
752 push(r0); | 804 push(r0); |
753 CallRuntime(Runtime::kAbort, 2); | 805 CallRuntime(Runtime::kAbort, 2); |
754 // will not return here | 806 // will not return here |
755 } | 807 } |
756 | 808 |
757 } } // namespace v8::internal | 809 } } // namespace v8::internal |
OLD | NEW |