Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3107)

Unified Diff: src/mips/deoptimizer-mips.cc

Issue 477623002: MIPS: Fix deoptimization entry table when branch cannot reach. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/deoptimizer-mips.cc
diff --git a/src/mips/deoptimizer-mips.cc b/src/mips/deoptimizer-mips.cc
index 1e88e62b213fdde4af6cabe0d4e9ca8429809cc1..2327dd25c340ca7d70451ff797ee7075d7d4219c 100644
--- a/src/mips/deoptimizer-mips.cc
+++ b/src/mips/deoptimizer-mips.cc
@@ -324,22 +324,59 @@ void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
// 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.
-
- DCHECK_EQ(table_entry_size_, masm()->SizeOfCodeGeneratedSince(&start));
- }
+ 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(masm()->SizeOfCodeGeneratedSince(&table_start),
- count() * table_entry_size_);
- __ bind(&done);
- __ Push(at);
+ DCHECK_EQ(masm()->SizeOfCodeGeneratedSince(&table_start),
+ count() * table_entry_size_);
+ __ bind(&done_special);
+ __ addiu(at, at, kMaxEntriesBranchReach);
+ __ bind(&done);
+ __ Push(at);
+ }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698