Commit 7f273146 authored by kasperl@chromium.org's avatar kasperl@chromium.org

Fix stack alignment issue with the new fast Math.random() code

under Mac OS.
Review URL: http://codereview.chromium.org/125123

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2168 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c1d0401b
...@@ -4943,7 +4943,23 @@ void CodeGenerator::GenerateGetFramePointer(ZoneList<Expression*>* args) { ...@@ -4943,7 +4943,23 @@ void CodeGenerator::GenerateGetFramePointer(ZoneList<Expression*>* args) {
void CodeGenerator::GenerateRandomPositiveSmi(ZoneList<Expression*>* args) { void CodeGenerator::GenerateRandomPositiveSmi(ZoneList<Expression*>* args) {
ASSERT(args->length() == 0); ASSERT(args->length() == 0);
frame_->SpillAll(); frame_->SpillAll();
// Make sure the frame is aligned like the OS expects.
static const int kFrameAlignment = OS::ActivationFrameAlignment();
if (kFrameAlignment > 0) {
ASSERT(IsPowerOf2(kFrameAlignment));
__ mov(edi, Operand(esp)); // Save in callee-saved register.
__ and_(esp, -kFrameAlignment);
}
// Call V8::RandomPositiveSmi().
__ call(FUNCTION_ADDR(V8::RandomPositiveSmi), RelocInfo::RUNTIME_ENTRY); __ call(FUNCTION_ADDR(V8::RandomPositiveSmi), RelocInfo::RUNTIME_ENTRY);
// Restore stack pointer from callee-saved register edi.
if (kFrameAlignment > 0) {
__ mov(esp, Operand(edi));
}
Result result = allocator_->Allocate(eax); Result result = allocator_->Allocate(eax);
frame_->Push(&result); frame_->Push(&result);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment