diff options
Diffstat (limited to 'deps/v8/src/ia32/deoptimizer-ia32.cc')
-rw-r--r-- | deps/v8/src/ia32/deoptimizer-ia32.cc | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/deps/v8/src/ia32/deoptimizer-ia32.cc b/deps/v8/src/ia32/deoptimizer-ia32.cc index c644ffa60f..efe6476203 100644 --- a/deps/v8/src/ia32/deoptimizer-ia32.cc +++ b/deps/v8/src/ia32/deoptimizer-ia32.cc @@ -75,7 +75,7 @@ void Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(Handle<Code> code) { new_reloc->GetDataStartAddress() + padding, 0); intptr_t comment_string = reinterpret_cast<intptr_t>(RelocInfo::kFillerCommentString); - RelocInfo rinfo(0, RelocInfo::COMMENT, comment_string, NULL); + RelocInfo rinfo(isolate, 0, RelocInfo::COMMENT, comment_string, NULL); for (int i = 0; i < additional_comments; ++i) { #ifdef DEBUG byte* pos_before = reloc_info_writer.pos(); @@ -101,14 +101,15 @@ void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) { } else { pointer = code->instruction_start(); } - CodePatcher patcher(pointer, 1); + CodePatcher patcher(isolate, pointer, 1); patcher.masm()->int3(); DeoptimizationInputData* data = DeoptimizationInputData::cast(code->deoptimization_data()); int osr_offset = data->OsrPcOffset()->value(); if (osr_offset > 0) { - CodePatcher osr_patcher(code->instruction_start() + osr_offset, 1); + CodePatcher osr_patcher(isolate, code->instruction_start() + osr_offset, + 1); osr_patcher.masm()->int3(); } } @@ -137,14 +138,13 @@ void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) { if (deopt_data->Pc(i)->value() == -1) continue; // Patch lazy deoptimization entry. Address call_address = code_start_address + deopt_data->Pc(i)->value(); - CodePatcher patcher(call_address, patch_size()); + CodePatcher patcher(isolate, call_address, patch_size()); Address deopt_entry = GetDeoptimizationEntry(isolate, i, LAZY); patcher.masm()->call(deopt_entry, RelocInfo::NONE32); // We use RUNTIME_ENTRY for deoptimization bailouts. - RelocInfo rinfo(call_address + 1, // 1 after the call opcode. + RelocInfo rinfo(isolate, call_address + 1, // 1 after the call opcode. RelocInfo::RUNTIME_ENTRY, - reinterpret_cast<intptr_t>(deopt_entry), - NULL); + reinterpret_cast<intptr_t>(deopt_entry), NULL); reloc_info_writer.Write(&rinfo); DCHECK_GE(reloc_info_writer.pos(), reloc_info->address() + ByteArray::kHeaderSize); @@ -157,18 +157,15 @@ void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) { } // Move the relocation info to the beginning of the byte array. - int new_reloc_size = reloc_end_address - reloc_info_writer.pos(); - MemMove(code->relocation_start(), reloc_info_writer.pos(), new_reloc_size); - - // The relocation info is in place, update the size. - reloc_info->set_length(new_reloc_size); - - // Handle the junk part after the new relocation info. We will create - // a non-live object in the extra space at the end of the former reloc info. - Address junk_address = reloc_info->address() + reloc_info->Size(); - DCHECK(junk_address <= reloc_end_address); - isolate->heap()->CreateFillerObjectAt(junk_address, - reloc_end_address - junk_address); + const int new_reloc_length = reloc_end_address - reloc_info_writer.pos(); + MemMove(code->relocation_start(), reloc_info_writer.pos(), new_reloc_length); + + // Right trim the relocation info to free up remaining space. + const int delta = reloc_info->length() - new_reloc_length; + if (delta > 0) { + isolate->heap()->RightTrimFixedArray<Heap::SEQUENTIAL_TO_SWEEPER>( + reloc_info, delta); + } } |