Reviewers: danno, Paul Lind, kisg, palfia, dusmil, Cosmin Truta,

Description:
MIPS: Reduce the stack requirements of GetNoCodeAgeSequence.

Port r18815 (f93582a)

Original commit message:
Allocate the patcher object on the heap, to avoid occasional stack
overflows on QNX/ARM when entering GetNoCodeAgeSequence.

BUG=v8:3111
LOG=y

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

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

Affected files (+9, -5 lines):
  M src/mips/codegen-mips.cc


Index: src/mips/codegen-mips.cc
diff --git a/src/mips/codegen-mips.cc b/src/mips/codegen-mips.cc
index ff5658a190f3cedf76b7f3322171e8df373cb9cf..e5338dbcc15adbcc69b05e77681260ec13c937e2 100644
--- a/src/mips/codegen-mips.cc
+++ b/src/mips/codegen-mips.cc
@@ -1048,11 +1048,15 @@ static byte* GetNoCodeAgeSequence(uint32_t* length) {
   byte* byte_sequence = reinterpret_cast<byte*>(sequence);
   *length = kNoCodeAgeSequenceLength * Assembler::kInstrSize;
   if (!initialized) {
-    CodePatcher patcher(byte_sequence, kNoCodeAgeSequenceLength);
-    patcher.masm()->Push(ra, fp, cp, a1);
-    patcher.masm()->nop(Assembler::CODE_AGE_SEQUENCE_NOP);
-    patcher.masm()->Addu(fp, sp,
-        Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
+ // Since patcher is a large object, allocate it dynamically when needed,
+    // to avoid overloading the stack in stress conditions.
+    SmartPointer<CodePatcher>
+        patcher(new CodePatcher(byte_sequence, kNoCodeAgeSequenceLength));
+    PredictableCodeSizeScope scope(patcher->masm(), *length);
+    patcher->masm()->Push(ra, fp, cp, a1);
+    patcher->masm()->nop(Assembler::CODE_AGE_SEQUENCE_NOP);
+    patcher->masm()->Addu(
+        fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
     initialized = true;
   }
   return byte_sequence;


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