Chromium Code Reviews| Index: src/x64/lithium-codegen-x64.cc |
| diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
| index eb21b98be09fc97750c66e684523cc6de7d28ce8..9b98535f19232937fcb0bd90b1994cc769b41e7f 100644 |
| --- a/src/x64/lithium-codegen-x64.cc |
| +++ b/src/x64/lithium-codegen-x64.cc |
| @@ -91,8 +91,51 @@ void LCodeGen::Comment(const char* format, ...) { |
| bool LCodeGen::GeneratePrologue() { |
| - Abort("Unimplemented: %s", "GeneratePrologue"); |
| - return false; |
| + ASSERT(is_generating()); |
| + |
| +#ifdef DEBUG |
| + if (strlen(FLAG_stop_at) > 0 && |
| + info_->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { |
| + __ int3(); |
| + } |
| +#endif |
| + |
| + __ push(rbp); // Caller's frame pointer. |
| + __ movq(rbp, rsp); |
| + __ push(rsi); // Callee's context. |
| + __ push(rdi); // Callee's JS function. |
| + |
| + // Reserve space for the stack slots needed by the code. |
| + int slots = StackSlotCount(); |
| + if (slots > 0) { |
| + if (FLAG_debug_code) { |
| + __ movl(rax, Immediate(slots)); |
| + __ movq(kScratchRegister, kSlotsZapValue, RelocInfo::NONE); |
| + Label loop; |
| + __ bind(&loop); |
| + __ push(kScratchRegister); |
| + __ decl(rax); |
| + __ j(not_zero, &loop); |
| + } else { |
| + __ subq(rsp, Immediate(slots * kPointerSize)); |
| +#ifdef _MSC_VER |
|
Rico
2011/01/14 12:57:02
We might need to do this on ia32 as well?
Lasse Reichstein
2011/01/14 13:12:30
Will do it there as well.
|
| + // On windows, you may not access the stack more than one page below |
| + // the most recently mapped page. To make the allocated area randomly |
| + // accessible, we write to each page in turn (the value is irrelevant). |
| + for (int offset = slots * kPointerSize - 4 * KB; |
|
Rico
2011/01/14 12:57:02
Do we have a kPageSize constant somewhere?
Lasse Reichstein
2011/01/14 13:12:30
Sadly not, but I'll define a local constant.
It's
|
| + offset > 0; |
| + offset -= 4 * KB) { |
| + __ moveq(Operand(rsp, offset), rax); |
| + } |
| +#endif |
| + } |
| + } |
| + |
| + // Trace the call. |
| + if (FLAG_trace) { |
| + __ CallRuntime(Runtime::kTraceEnter, 0); |
| + } |
| + return !is_aborted(); |
| } |