Commit b45bb175 authored by plind44@gmail.com's avatar plind44@gmail.com

MIPS: Avoid using dd() in Prologue when --optimize-for-size.

Port: r17485 (0d82025)

Original commit message:
When --optimize-for-size is true, the prologue generation outputs the
pre-aging code stub address directly to the instruction stream. Previously
this was done using dd() which failed if there was any pending constant
pool entries left to be written. This CL introduces an emit_code_stub_address()
for this purpose instead.

BUG=v8:2968

Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17508 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4e4169d5
...@@ -2031,6 +2031,14 @@ void Assembler::dd(uint32_t data) { ...@@ -2031,6 +2031,14 @@ void Assembler::dd(uint32_t data) {
} }
void Assembler::emit_code_stub_address(Code* stub) {
CheckBuffer();
*reinterpret_cast<uint32_t*>(pc_) =
reinterpret_cast<uint32_t>(stub->instruction_start());
pc_ += sizeof(uint32_t);
}
void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) {
// We do not try to reuse pool constants. // We do not try to reuse pool constants.
RelocInfo rinfo(pc_, rmode, data, NULL); RelocInfo rinfo(pc_, rmode, data, NULL);
......
...@@ -896,6 +896,9 @@ class Assembler : public AssemblerBase { ...@@ -896,6 +896,9 @@ class Assembler : public AssemblerBase {
void db(uint8_t data); void db(uint8_t data);
void dd(uint32_t data); void dd(uint32_t data);
// Emits the address of the code stub's first instruction.
void emit_code_stub_address(Code* stub);
PositionsRecorder* positions_recorder() { return &positions_recorder_; } PositionsRecorder* positions_recorder() { return &positions_recorder_; }
// Postpone the generation of the trampoline pool for the specified number of // Postpone the generation of the trampoline pool for the specified number of
......
...@@ -671,7 +671,7 @@ void Code::PatchPlatformCodeAge(Isolate* isolate, ...@@ -671,7 +671,7 @@ void Code::PatchPlatformCodeAge(Isolate* isolate,
Operand(reinterpret_cast<uint32_t>(stub->instruction_start()))); Operand(reinterpret_cast<uint32_t>(stub->instruction_start())));
patcher.masm()->Call(t9); patcher.masm()->Call(t9);
// Record the stub address in the empty space for GetCodeAgeAndParity() // Record the stub address in the empty space for GetCodeAgeAndParity()
patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); patcher.masm()->emit_code_stub_address(stub);
} }
} }
......
...@@ -4606,14 +4606,14 @@ void MacroAssembler::Prologue(PrologueFrameMode frame_mode) { ...@@ -4606,14 +4606,14 @@ void MacroAssembler::Prologue(PrologueFrameMode frame_mode) {
Code* stub = Code::GetPreAgedCodeAgeStub(isolate()); Code* stub = Code::GetPreAgedCodeAgeStub(isolate());
nop(Assembler::CODE_AGE_MARKER_NOP); nop(Assembler::CODE_AGE_MARKER_NOP);
// Save the function's original return address // Save the function's original return address
// (it will be clobbered by Call(t9)) // (it will be clobbered by Call(t9)).
mov(at, ra); mov(at, ra);
// Load the stub address to t9 and call it // Load the stub address to t9 and call it.
li(t9, li(t9,
Operand(reinterpret_cast<uint32_t>(stub->instruction_start()))); Operand(reinterpret_cast<uint32_t>(stub->instruction_start())));
Call(t9); Call(t9);
// Record the stub address in the empty space for GetCodeAgeAndParity() // Record the stub address in the empty space for GetCodeAgeAndParity().
dd(reinterpret_cast<uint32_t>(stub->instruction_start())); emit_code_stub_address(stub);
} else { } else {
Push(ra, fp, cp, a1); Push(ra, fp, cp, a1);
nop(Assembler::CODE_AGE_SEQUENCE_NOP); nop(Assembler::CODE_AGE_SEQUENCE_NOP);
......
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