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

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
R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/47743007

Patch from Ross McIlroy <rmcilroy@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17485 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a5ed9a71
......@@ -3184,6 +3184,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,
UseConstantPoolMode mode) {
// We do not try to reuse pool constants.
......
......@@ -1393,6 +1393,9 @@ class Assembler : public AssemblerBase {
void db(uint8_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_; }
// Read/patch instructions
......
......@@ -896,7 +896,7 @@ void Code::PatchPlatformCodeAge(Isolate* isolate,
CodePatcher patcher(sequence, young_length / Assembler::kInstrSize);
patcher.masm()->add(r0, pc, Operand(-8));
patcher.masm()->ldr(pc, MemOperand(pc, -4));
patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start()));
patcher.masm()->emit_code_stub_address(stub);
}
}
......
......@@ -932,7 +932,7 @@ void MacroAssembler::Prologue(PrologueFrameMode frame_mode) {
Code* stub = Code::GetPreAgedCodeAgeStub(isolate());
add(r0, pc, Operand(-8));
ldr(pc, MemOperand(pc, -4));
dd(reinterpret_cast<uint32_t>(stub->instruction_start()));
emit_code_stub_address(stub);
} else {
stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit());
nop(ip.code());
......
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