OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/cpu-profiler.h" | 9 #include "src/cpu-profiler.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 2763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2774 } | 2774 } |
2775 | 2775 |
2776 | 2776 |
2777 void Deoptimizer::AddDoubleValue(intptr_t slot_address, double value) { | 2777 void Deoptimizer::AddDoubleValue(intptr_t slot_address, double value) { |
2778 HeapNumberMaterializationDescriptor<Address> value_desc( | 2778 HeapNumberMaterializationDescriptor<Address> value_desc( |
2779 reinterpret_cast<Address>(slot_address), value); | 2779 reinterpret_cast<Address>(slot_address), value); |
2780 deferred_heap_numbers_.Add(value_desc); | 2780 deferred_heap_numbers_.Add(value_desc); |
2781 } | 2781 } |
2782 | 2782 |
2783 | 2783 |
2784 void Deoptimizer::EnsureCodeForDeoptimizationEntry(Isolate* isolate, | 2784 void Deoptimizer::EnsureCodeForDeoptimizationEntry(Isolate* isolate, |
Michael Starzinger
2015/04/16 15:32:23
As mentioned offline: I am not entirely sure that
Erik Corry Chromium.org
2015/04/16 16:39:10
Nice catch. Removed the GC, now just report the O
| |
2785 BailoutType type, | 2785 BailoutType type, |
2786 int max_entry_id) { | 2786 int max_entry_id) { |
2787 // We cannot run this if the serializer is enabled because this will | 2787 // We cannot run this if the serializer is enabled because this will |
2788 // cause us to emit relocation information for the external | 2788 // cause us to emit relocation information for the external |
2789 // references. This is fine because the deoptimizer's code section | 2789 // references. This is fine because the deoptimizer's code section |
2790 // isn't meant to be serialized at all. | 2790 // isn't meant to be serialized at all. |
2791 CHECK(type == EAGER || type == SOFT || type == LAZY); | 2791 CHECK(type == EAGER || type == SOFT || type == LAZY); |
2792 DeoptimizerData* data = isolate->deoptimizer_data(); | 2792 DeoptimizerData* data = isolate->deoptimizer_data(); |
2793 int entry_count = data->deopt_entry_code_entries_[type]; | 2793 int entry_count = data->deopt_entry_code_entries_[type]; |
2794 if (max_entry_id < entry_count) return; | 2794 if (max_entry_id < entry_count) return; |
2795 entry_count = Max(entry_count, Deoptimizer::kMinNumberOfEntries); | 2795 entry_count = Max(entry_count, Deoptimizer::kMinNumberOfEntries); |
2796 while (max_entry_id >= entry_count) entry_count *= 2; | 2796 while (max_entry_id >= entry_count) entry_count *= 2; |
2797 CHECK(entry_count <= Deoptimizer::kMaxNumberOfEntries); | 2797 CHECK(entry_count <= Deoptimizer::kMaxNumberOfEntries); |
2798 | 2798 |
2799 MacroAssembler masm(isolate, NULL, 16 * KB); | 2799 MacroAssembler masm(isolate, NULL, 16 * KB); |
2800 masm.set_emit_debug_code(false); | 2800 masm.set_emit_debug_code(false); |
2801 GenerateDeoptimizationEntries(&masm, entry_count, type); | 2801 GenerateDeoptimizationEntries(&masm, entry_count, type); |
2802 CodeDesc desc; | 2802 CodeDesc desc; |
2803 masm.GetCode(&desc); | 2803 masm.GetCode(&desc); |
2804 DCHECK(!RelocInfo::RequiresRelocation(desc)); | 2804 DCHECK(!RelocInfo::RequiresRelocation(desc)); |
2805 | 2805 |
2806 MemoryChunk* chunk = data->deopt_entry_code_[type]; | 2806 MemoryChunk* chunk = data->deopt_entry_code_[type]; |
2807 CHECK(static_cast<int>(Deoptimizer::GetMaxDeoptTableSize()) >= | 2807 CHECK(static_cast<int>(Deoptimizer::GetMaxDeoptTableSize()) >= |
2808 desc.instr_size); | 2808 desc.instr_size); |
2809 chunk->CommitArea(desc.instr_size); | 2809 if (!chunk->CommitArea(desc.instr_size)) { |
2810 isolate->heap()->CollectAllAvailableGarbage( | |
2811 "Allocation for deoptimizer failed"); | |
2812 if (!chunk->CommitArea(desc.instr_size)) { | |
2813 V8::FatalProcessOutOfMemory( | |
Michael Starzinger
2015/04/16 15:32:23
I like that we are properly reporting the allocati
| |
2814 "Deoptimizer::EnsureCodeForDeoptimizationEntry"); | |
2815 } | |
2816 } | |
2810 CopyBytes(chunk->area_start(), desc.buffer, | 2817 CopyBytes(chunk->area_start(), desc.buffer, |
2811 static_cast<size_t>(desc.instr_size)); | 2818 static_cast<size_t>(desc.instr_size)); |
2812 CpuFeatures::FlushICache(chunk->area_start(), desc.instr_size); | 2819 CpuFeatures::FlushICache(chunk->area_start(), desc.instr_size); |
2813 | 2820 |
2814 data->deopt_entry_code_entries_[type] = entry_count; | 2821 data->deopt_entry_code_entries_[type] = entry_count; |
2815 } | 2822 } |
2816 | 2823 |
2817 | 2824 |
2818 FrameDescription::FrameDescription(uint32_t frame_size, | 2825 FrameDescription::FrameDescription(uint32_t frame_size, |
2819 JSFunction* function) | 2826 JSFunction* function) |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3660 int raw_position = static_cast<int>(info->data()); | 3667 int raw_position = static_cast<int>(info->data()); |
3661 last_position = raw_position ? SourcePosition::FromRaw(raw_position) | 3668 last_position = raw_position ? SourcePosition::FromRaw(raw_position) |
3662 : SourcePosition::Unknown(); | 3669 : SourcePosition::Unknown(); |
3663 } else if (info->rmode() == RelocInfo::DEOPT_REASON) { | 3670 } else if (info->rmode() == RelocInfo::DEOPT_REASON) { |
3664 last_reason = static_cast<Deoptimizer::DeoptReason>(info->data()); | 3671 last_reason = static_cast<Deoptimizer::DeoptReason>(info->data()); |
3665 } | 3672 } |
3666 } | 3673 } |
3667 return DeoptInfo(SourcePosition::Unknown(), NULL, Deoptimizer::kNoReason); | 3674 return DeoptInfo(SourcePosition::Unknown(), NULL, Deoptimizer::kNoReason); |
3668 } | 3675 } |
3669 } } // namespace v8::internal | 3676 } } // namespace v8::internal |
OLD | NEW |