diff options
Diffstat (limited to 'deps/v8/src/deoptimizer.cc')
-rw-r--r-- | deps/v8/src/deoptimizer.cc | 70 |
1 files changed, 16 insertions, 54 deletions
diff --git a/deps/v8/src/deoptimizer.cc b/deps/v8/src/deoptimizer.cc index b0522757eb..5feb73d739 100644 --- a/deps/v8/src/deoptimizer.cc +++ b/deps/v8/src/deoptimizer.cc @@ -52,13 +52,11 @@ DeoptimizerData::DeoptimizerData() { DeoptimizerData::~DeoptimizerData() { if (eager_deoptimization_entry_code_ != NULL) { - Isolate::Current()->memory_allocator()->Free( - eager_deoptimization_entry_code_); + eager_deoptimization_entry_code_->Free(EXECUTABLE); eager_deoptimization_entry_code_ = NULL; } if (lazy_deoptimization_entry_code_ != NULL) { - Isolate::Current()->memory_allocator()->Free( - lazy_deoptimization_entry_code_); + lazy_deoptimization_entry_code_->Free(EXECUTABLE); lazy_deoptimization_entry_code_ = NULL; } } @@ -73,8 +71,6 @@ void DeoptimizerData::Iterate(ObjectVisitor* v) { #endif -// We rely on this function not causing a GC. It is called from generated code -// without having a real stack frame in place. Deoptimizer* Deoptimizer::New(JSFunction* function, BailoutType type, unsigned bailout_id, @@ -323,8 +319,6 @@ Deoptimizer::Deoptimizer(Isolate* isolate, input_(NULL), output_count_(0), output_(NULL), - frame_alignment_marker_(isolate->heap()->frame_alignment_marker()), - has_alignment_padding_(0), deferred_heap_numbers_(0) { if (FLAG_trace_deopt && type != OSR) { if (type == DEBUGGER) { @@ -349,26 +343,6 @@ Deoptimizer::Deoptimizer(Isolate* isolate, if (type == EAGER) { ASSERT(from == NULL); optimized_code_ = function_->code(); - if (FLAG_trace_deopt && FLAG_code_comments) { - // Print instruction associated with this bailout. - const char* last_comment = NULL; - int mask = RelocInfo::ModeMask(RelocInfo::COMMENT) - | RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); - for (RelocIterator it(optimized_code_, mask); !it.done(); it.next()) { - RelocInfo* info = it.rinfo(); - if (info->rmode() == RelocInfo::COMMENT) { - last_comment = reinterpret_cast<const char*>(info->data()); - } - if (info->rmode() == RelocInfo::RUNTIME_ENTRY) { - unsigned id = Deoptimizer::GetDeoptimizationId( - info->target_address(), Deoptimizer::EAGER); - if (id == bailout_id && last_comment != NULL) { - PrintF(" %s\n", last_comment); - break; - } - } - } - } } else if (type == LAZY) { optimized_code_ = FindDeoptimizingCodeFromAddress(from); ASSERT(optimized_code_ != NULL); @@ -412,7 +386,7 @@ void Deoptimizer::DeleteFrameDescriptions() { Address Deoptimizer::GetDeoptimizationEntry(int id, BailoutType type) { ASSERT(id >= 0); if (id >= kNumberOfEntries) return NULL; - MemoryChunk* base = NULL; + LargeObjectChunk* base = NULL; DeoptimizerData* data = Isolate::Current()->deoptimizer_data(); if (type == EAGER) { if (data->eager_deoptimization_entry_code_ == NULL) { @@ -426,12 +400,12 @@ Address Deoptimizer::GetDeoptimizationEntry(int id, BailoutType type) { base = data->lazy_deoptimization_entry_code_; } return - static_cast<Address>(base->body()) + (id * table_entry_size_); + static_cast<Address>(base->GetStartAddress()) + (id * table_entry_size_); } int Deoptimizer::GetDeoptimizationId(Address addr, BailoutType type) { - MemoryChunk* base = NULL; + LargeObjectChunk* base = NULL; DeoptimizerData* data = Isolate::Current()->deoptimizer_data(); if (type == EAGER) { base = data->eager_deoptimization_entry_code_; @@ -439,14 +413,14 @@ int Deoptimizer::GetDeoptimizationId(Address addr, BailoutType type) { base = data->lazy_deoptimization_entry_code_; } if (base == NULL || - addr < base->body() || - addr >= base->body() + + addr < base->GetStartAddress() || + addr >= base->GetStartAddress() + (kNumberOfEntries * table_entry_size_)) { return kNotDeoptimizationEntry; } ASSERT_EQ(0, - static_cast<int>(addr - base->body()) % table_entry_size_); - return static_cast<int>(addr - base->body()) / table_entry_size_; + static_cast<int>(addr - base->GetStartAddress()) % table_entry_size_); + return static_cast<int>(addr - base->GetStartAddress()) / table_entry_size_; } @@ -488,8 +462,6 @@ int Deoptimizer::GetDeoptimizedCodeCount(Isolate* isolate) { } -// We rely on this function not causing a GC. It is called from generated code -// without having a real stack frame in place. void Deoptimizer::DoComputeOutputFrames() { if (bailout_type_ == OSR) { DoComputeOsrOutputFrame(); @@ -641,13 +613,11 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, intptr_t input_value = input_->GetRegister(input_reg); if (FLAG_trace_deopt) { PrintF( - " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; %s ", + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; %s\n", output_[frame_index]->GetTop() + output_offset, output_offset, input_value, converter.NameOfCPURegister(input_reg)); - reinterpret_cast<Object*>(input_value)->ShortPrint(); - PrintF("\n"); } output_[frame_index]->SetFrameSlot(output_offset, input_value); return; @@ -705,12 +675,10 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, if (FLAG_trace_deopt) { PrintF(" 0x%08" V8PRIxPTR ": ", output_[frame_index]->GetTop() + output_offset); - PrintF("[top + %d] <- 0x%08" V8PRIxPTR " ; [esp + %d] ", + PrintF("[top + %d] <- 0x%08" V8PRIxPTR " ; [esp + %d]\n", output_offset, input_value, input_offset); - reinterpret_cast<Object*>(input_value)->ShortPrint(); - PrintF("\n"); } output_[frame_index]->SetFrameSlot(output_offset, input_value); return; @@ -985,10 +953,7 @@ void Deoptimizer::PatchStackCheckCode(Code* unoptimized_code, for (uint32_t i = 0; i < table_length; ++i) { uint32_t pc_offset = Memory::uint32_at(stack_check_cursor + kIntSize); Address pc_after = unoptimized_code->instruction_start() + pc_offset; - PatchStackCheckCodeAt(unoptimized_code, - pc_after, - check_code, - replacement_code); + PatchStackCheckCodeAt(pc_after, check_code, replacement_code); stack_check_cursor += 2 * kIntSize; } } @@ -1074,7 +1039,7 @@ void Deoptimizer::AddDoubleValue(intptr_t slot_address, } -MemoryChunk* Deoptimizer::CreateCode(BailoutType type) { +LargeObjectChunk* Deoptimizer::CreateCode(BailoutType type) { // We cannot run this if the serializer is enabled because this will // cause us to emit relocation information for the external // references. This is fine because the deoptimizer's code section @@ -1088,15 +1053,12 @@ MemoryChunk* Deoptimizer::CreateCode(BailoutType type) { masm.GetCode(&desc); ASSERT(desc.reloc_size == 0); - MemoryChunk* chunk = - Isolate::Current()->memory_allocator()->AllocateChunk(desc.instr_size, - EXECUTABLE, - NULL); + LargeObjectChunk* chunk = LargeObjectChunk::New(desc.instr_size, EXECUTABLE); if (chunk == NULL) { V8::FatalProcessOutOfMemory("Not enough memory for deoptimization table"); } - memcpy(chunk->body(), desc.buffer, desc.instr_size); - CPU::FlushICache(chunk->body(), desc.instr_size); + memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size); + CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size); return chunk; } |