Commit 60659dd1 authored by ager@chromium.org's avatar ager@chromium.org

Landing for Martyn Capewell.

Replace some hard-coded return address calculations with Call. 

BUG=none 
TEST=none

Codereview URL: http://codereview.chromium.org/5158002/

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5843 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 010f35f4
...@@ -1892,18 +1892,15 @@ void CodeGenerator::CheckStack() { ...@@ -1892,18 +1892,15 @@ void CodeGenerator::CheckStack() {
frame_->SpillAll(); frame_->SpillAll();
Comment cmnt(masm_, "[ check stack"); Comment cmnt(masm_, "[ check stack");
__ LoadRoot(ip, Heap::kStackLimitRootIndex); __ LoadRoot(ip, Heap::kStackLimitRootIndex);
// Put the lr setup instruction in the delay slot. kInstrSize is added to
// the implicit 8 byte offset that always applies to operations with pc and
// gives a return address 12 bytes down.
masm_->add(lr, pc, Operand(Assembler::kInstrSize));
masm_->cmp(sp, Operand(ip)); masm_->cmp(sp, Operand(ip));
StackCheckStub stub; StackCheckStub stub;
// Call the stub if lower. // Call the stub if lower.
masm_->mov(pc, masm_->mov(ip,
Operand(reinterpret_cast<intptr_t>(stub.GetCode().location()), Operand(reinterpret_cast<intptr_t>(stub.GetCode().location()),
RelocInfo::CODE_TARGET), RelocInfo::CODE_TARGET),
LeaveCC, LeaveCC,
lo); lo);
masm_->Call(ip, lo);
} }
......
...@@ -172,19 +172,16 @@ void FullCodeGenerator::Generate(CompilationInfo* info) { ...@@ -172,19 +172,16 @@ void FullCodeGenerator::Generate(CompilationInfo* info) {
} }
// Check the stack for overflow or break request. // Check the stack for overflow or break request.
// Put the lr setup instruction in the delay slot. The kInstrSize is
// added to the implicit 8 byte offset that always applies to operations
// with pc and gives a return address 12 bytes down.
{ Comment cmnt(masm_, "[ Stack check"); { Comment cmnt(masm_, "[ Stack check");
__ LoadRoot(r2, Heap::kStackLimitRootIndex); __ LoadRoot(r2, Heap::kStackLimitRootIndex);
__ add(lr, pc, Operand(Assembler::kInstrSize));
__ cmp(sp, Operand(r2)); __ cmp(sp, Operand(r2));
StackCheckStub stub; StackCheckStub stub;
__ mov(pc, __ mov(ip,
Operand(reinterpret_cast<intptr_t>(stub.GetCode().location()), Operand(reinterpret_cast<intptr_t>(stub.GetCode().location()),
RelocInfo::CODE_TARGET), RelocInfo::CODE_TARGET),
LeaveCC, LeaveCC,
lo); lo);
__ Call(ip, lo);
} }
if (FLAG_trace) { if (FLAG_trace) {
......
...@@ -245,18 +245,15 @@ void VirtualFrame::AllocateStackSlots() { ...@@ -245,18 +245,15 @@ void VirtualFrame::AllocateStackSlots() {
__ LoadRoot(r2, Heap::kStackLimitRootIndex); __ LoadRoot(r2, Heap::kStackLimitRootIndex);
} }
// Check the stack for overflow or a break request. // Check the stack for overflow or a break request.
// Put the lr setup instruction in the delay slot. The kInstrSize is added
// to the implicit 8 byte offset that always applies to operations with pc
// and gives a return address 12 bytes down.
masm()->add(lr, pc, Operand(Assembler::kInstrSize));
masm()->cmp(sp, Operand(r2)); masm()->cmp(sp, Operand(r2));
StackCheckStub stub; StackCheckStub stub;
// Call the stub if lower. // Call the stub if lower.
masm()->mov(pc, masm()->mov(ip,
Operand(reinterpret_cast<intptr_t>(stub.GetCode().location()), Operand(reinterpret_cast<intptr_t>(stub.GetCode().location()),
RelocInfo::CODE_TARGET), RelocInfo::CODE_TARGET),
LeaveCC, LeaveCC,
lo); lo);
masm()->Call(ip, lo);
} }
......
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