diff options
Diffstat (limited to 'deps/v8/src/mips/deoptimizer-mips.cc')
-rw-r--r-- | deps/v8/src/mips/deoptimizer-mips.cc | 75 |
1 files changed, 34 insertions, 41 deletions
diff --git a/deps/v8/src/mips/deoptimizer-mips.cc b/deps/v8/src/mips/deoptimizer-mips.cc index c96eb67724..0c2d2c7544 100644 --- a/deps/v8/src/mips/deoptimizer-mips.cc +++ b/deps/v8/src/mips/deoptimizer-mips.cc @@ -30,25 +30,22 @@ void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) { // code patching below, and is not needed any more. code->InvalidateRelocation(); - if (FLAG_zap_code_space) { - // Fail hard and early if we enter this code object again. - byte* pointer = code->FindCodeAgeSequence(); - if (pointer != NULL) { - pointer += kNoCodeAgeSequenceLength; - } else { - pointer = code->instruction_start(); - } - CodePatcher patcher(isolate, pointer, 1); - patcher.masm()->break_(0xCC); - - DeoptimizationInputData* data = - DeoptimizationInputData::cast(code->deoptimization_data()); - int osr_offset = data->OsrPcOffset()->value(); - if (osr_offset > 0) { - CodePatcher osr_patcher(isolate, code->instruction_start() + osr_offset, - 1); - osr_patcher.masm()->break_(0xCC); - } + // Fail hard and early if we enter this code object again. + byte* pointer = code->FindCodeAgeSequence(); + if (pointer != NULL) { + pointer += kNoCodeAgeSequenceLength; + } else { + pointer = code->instruction_start(); + } + CodePatcher patcher(isolate, pointer, 1); + patcher.masm()->break_(0xCC); + + DeoptimizationInputData* data = + DeoptimizationInputData::cast(code->deoptimization_data()); + int osr_offset = data->OsrPcOffset()->value(); + if (osr_offset > 0) { + CodePatcher osr_patcher(isolate, code_start_address + osr_offset, 1); + osr_patcher.masm()->break_(0xCC); } DeoptimizationInputData* deopt_data = @@ -326,14 +323,14 @@ void Deoptimizer::TableEntryGenerator::Generate() { // Maximum size of a table entry generated below. -const int Deoptimizer::table_entry_size_ = 2 * Assembler::kInstrSize; +const int Deoptimizer::table_entry_size_ = 3 * Assembler::kInstrSize; void Deoptimizer::TableEntryGenerator::GeneratePrologue() { Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm()); // Create a sequence of deoptimization entries. // Note that registers are still live when jumping to an entry. - Label table_start, done, done_special, trampoline_jump; + Label table_start, done, trampoline_jump; __ bind(&table_start); int kMaxEntriesBranchReach = (1 << (kImm16Bits - 2))/ (table_entry_size_ / Assembler::kInstrSize); @@ -346,6 +343,7 @@ void Deoptimizer::TableEntryGenerator::GeneratePrologue() { DCHECK(is_int16(i)); __ BranchShort(USE_DELAY_SLOT, &done); // Expose delay slot. __ li(at, i); // In the delay slot. + __ nop(); DCHECK_EQ(table_entry_size_, masm()->SizeOfCodeGeneratedSince(&start)); } @@ -356,34 +354,29 @@ void Deoptimizer::TableEntryGenerator::GeneratePrologue() { __ 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--) { + // Create mini trampoline to reach the end of the table + for (int i = 0, j = 0; i < count(); i++, j++) { Label start; __ bind(&start); DCHECK(is_int16(i)); - __ BranchShort(USE_DELAY_SLOT, &trampoline_jump); // Expose delay slot. - __ li(at, - i); // In the delay slot. + if (j >= kMaxEntriesBranchReach) { + j = 0; + __ li(at, i); + __ bind(&trampoline_jump); + trampoline_jump = Label(); + __ BranchShort(USE_DELAY_SLOT, &trampoline_jump); + __ nop(); + } else { + __ BranchShort(USE_DELAY_SLOT, &trampoline_jump); // Expose delay slot. + __ li(at, i); // In the delay slot. + __ nop(); + } DCHECK_EQ(table_entry_size_, masm()->SizeOfCodeGeneratedSince(&start)); } - // Entry with id == kMaxEntriesBranchReach - 1. - __ bind(&trampoline_jump); - __ BranchShort(USE_DELAY_SLOT, &done_special); - __ li(at, -1); - - for (int i = kMaxEntriesBranchReach ; i < count(); i++) { - Label start; - __ bind(&start); - DCHECK(is_int16(i)); - __ BranchShort(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_special); - __ addiu(at, at, kMaxEntriesBranchReach); - __ bind(&done); + __ bind(&trampoline_jump); __ Push(at); } } |