Reviewers: danno, Jakob, Paul Lind, palfia, kisg, rmcilroy,

Description:
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

Please review this at https://codereview.chromium.org/60793002/

SVN Base: https://github.com/v8/v8.git@gbl

Affected files (+13, -2 lines):
  M src/mips/assembler-mips.h
  M src/mips/assembler-mips.cc
  M src/mips/codegen-mips.cc
  M src/mips/macro-assembler-mips.cc


Index: src/mips/assembler-mips.cc
diff --git a/src/mips/assembler-mips.cc b/src/mips/assembler-mips.cc
index 0972a8295cbe40ab049649d9035c783f3cf42e8d..d84315abf452a907319c9ed5043f13a6bf444970 100644
--- a/src/mips/assembler-mips.cc
+++ b/src/mips/assembler-mips.cc
@@ -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) {
   // We do not try to reuse pool constants.
   RelocInfo rinfo(pc_, rmode, data, NULL);
Index: src/mips/assembler-mips.h
diff --git a/src/mips/assembler-mips.h b/src/mips/assembler-mips.h
index 2468c3c340c7b8a9ec5dfe331b0b3ae0d2f6a941..49cce621efa2a48b89dd7250504a73a0fd304880 100644
--- a/src/mips/assembler-mips.h
+++ b/src/mips/assembler-mips.h
@@ -896,6 +896,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_; }

// Postpone the generation of the trampoline pool for the specified number of
Index: src/mips/codegen-mips.cc
diff --git a/src/mips/codegen-mips.cc b/src/mips/codegen-mips.cc
index ec6649533fc73eaed5b91b0fa89b2aeb18a2e4e3..904a37df267d514f1499d685d9d6605cba477fcb 100644
--- a/src/mips/codegen-mips.cc
+++ b/src/mips/codegen-mips.cc
@@ -671,7 +671,7 @@ void Code::PatchPlatformCodeAge(Isolate* isolate,
         Operand(reinterpret_cast<uint32_t>(stub->instruction_start())));
     patcher.masm()->Call(t9);
     // 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);
   }
 }

Index: src/mips/macro-assembler-mips.cc
diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc index 0d9747b726c25675c5f3475eb3307dc68d27460f..9a19f34a0c9d53f6f2109b31faae4663739baa12 100644
--- a/src/mips/macro-assembler-mips.cc
+++ b/src/mips/macro-assembler-mips.cc
@@ -4613,7 +4613,7 @@ void MacroAssembler::Prologue(PrologueFrameMode frame_mode) {
          Operand(reinterpret_cast<uint32_t>(stub->instruction_start())));
       Call(t9);
// Record the stub address in the empty space for GetCodeAgeAndParity()
-      dd(reinterpret_cast<uint32_t>(stub->instruction_start()));
+      emit_code_stub_address(stub);
     } else {
       Push(ra, fp, cp, a1);
       nop(Assembler::CODE_AGE_SEQUENCE_NOP);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to