Revision: 23131
Author: dusan.milosavlje...@imgtec.com
Date: Thu Aug 14 15:23:01 2014 UTC
Log: MIPS: Fix deoptimization entry table when branch cannot reach.
This fixes failures when table has more than 8192 entries, and preserves
optimization to have 2 instructions per entry.
TEST=mozilla/regress-398085-01
BUG=
R=paul.l...@imgtec.com
Review URL: https://codereview.chromium.org/477623002
http://code.google.com/p/v8/source/detail?r=23131
Modified:
/branches/bleeding_edge/src/mips/deoptimizer-mips.cc
=======================================
--- /branches/bleeding_edge/src/mips/deoptimizer-mips.cc Mon Aug 4
11:34:54 2014 UTC
+++ /branches/bleeding_edge/src/mips/deoptimizer-mips.cc Thu Aug 14
15:23:01 2014 UTC
@@ -324,22 +324,59 @@
// Create a sequence of deoptimization entries.
// Note that registers are still live when jumping to an entry.
- Label table_start, done;
+ Label table_start, done, done_special, trampoline_jump;
__ bind(&table_start);
- for (int i = 0; i < count(); i++) {
- Label start;
- __ bind(&start);
- DCHECK(is_int16(i));
- __ Branch(USE_DELAY_SLOT, &done); // Expose delay slot.
- __ li(at, i); // In the delay slot.
+ int kMaxEntriesBranchReach = (1 << (kImm16Bits - 2))/
+ (table_entry_size_ / Assembler::kInstrSize);
+
+ if (count() <= kMaxEntriesBranchReach) {
+ // Common case.
+ for (int i = 0; i < count(); i++) {
+ Label start;
+ __ bind(&start);
+ DCHECK(is_int16(i));
+ __ Branch(USE_DELAY_SLOT, &done); // Expose delay slot.
+ __ li(at, i); // In the delay slot.
+
+ DCHECK_EQ(table_entry_size_,
masm()->SizeOfCodeGeneratedSince(&start));
+ }
+
+ DCHECK_EQ(masm()->SizeOfCodeGeneratedSince(&table_start),
+ count() * table_entry_size_);
+ __ bind(&done);
+ __ Push(at);
+ } else {
+ // Uncommon case, the branch cannot reach.
+ // Create mini trampoline and adjust id constants to get proper value
at
+ // the end of table.
+ for (int i = kMaxEntriesBranchReach; i > 1; i--) {
+ Label start;
+ __ bind(&start);
+ DCHECK(is_int16(i));
+ __ Branch(USE_DELAY_SLOT, &trampoline_jump); // Expose delay slot.
+ __ li(at, - i); // In the delay slot.
+ DCHECK_EQ(table_entry_size_,
masm()->SizeOfCodeGeneratedSince(&start));
+ }
+ // Entry with id == kMaxEntriesBranchReach - 1.
+ __ bind(&trampoline_jump);
+ __ Branch(USE_DELAY_SLOT, &done_special);
+ __ li(at, -1);
+
+ for (int i = kMaxEntriesBranchReach ; i < count(); i++) {
+ Label start;
+ __ bind(&start);
+ DCHECK(is_int16(i));
+ __ Branch(USE_DELAY_SLOT, &done); // Expose delay slot.
+ __ li(at, i); // In the delay slot.
+ }
- DCHECK_EQ(table_entry_size_, masm()->SizeOfCodeGeneratedSince(&start));
+ DCHECK_EQ(masm()->SizeOfCodeGeneratedSince(&table_start),
+ count() * table_entry_size_);
+ __ bind(&done_special);
+ __ addiu(at, at, kMaxEntriesBranchReach);
+ __ bind(&done);
+ __ Push(at);
}
-
- DCHECK_EQ(masm()->SizeOfCodeGeneratedSince(&table_start),
- count() * table_entry_size_);
- __ bind(&done);
- __ Push(at);
}
--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.