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/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/address-map.h" | 7 #include "src/address-map.h" |
8 #include "src/base/adapters.h" | 8 #include "src/base/adapters.h" |
9 #include "src/compiler/code-generator-impl.h" | 9 #include "src/compiler/code-generator-impl.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 handlers_(code->zone()), | 48 handlers_(code->zone()), |
49 deoptimization_exits_(code->zone()), | 49 deoptimization_exits_(code->zone()), |
50 deoptimization_states_(code->zone()), | 50 deoptimization_states_(code->zone()), |
51 deoptimization_literals_(code->zone()), | 51 deoptimization_literals_(code->zone()), |
52 inlined_function_count_(0), | 52 inlined_function_count_(0), |
53 translations_(code->zone()), | 53 translations_(code->zone()), |
54 last_lazy_deopt_pc_(0), | 54 last_lazy_deopt_pc_(0), |
55 jump_tables_(nullptr), | 55 jump_tables_(nullptr), |
56 ools_(nullptr), | 56 ools_(nullptr), |
57 osr_pc_offset_(-1), | 57 osr_pc_offset_(-1), |
58 source_position_table_builder_(info->isolate(), code->zone(), | 58 source_position_table_builder_(code->zone(), |
59 info->SourcePositionRecordingMode()) { | 59 info->SourcePositionRecordingMode()) { |
60 for (int i = 0; i < code->InstructionBlockCount(); ++i) { | 60 for (int i = 0; i < code->InstructionBlockCount(); ++i) { |
61 new (&labels_[i]) Label; | 61 new (&labels_[i]) Label; |
62 } | 62 } |
63 CreateFrameAccessState(frame); | 63 CreateFrameAccessState(frame); |
64 } | 64 } |
65 | 65 |
66 void CodeGenerator::CreateFrameAccessState(Frame* frame) { | 66 void CodeGenerator::CreateFrameAccessState(Frame* frame) { |
67 FinishFrame(frame); | 67 FinishFrame(frame); |
68 frame_access_state_ = new (code()->zone()) FrameAccessState(frame); | 68 frame_access_state_ = new (code()->zone()) FrameAccessState(frame); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 safepoints()->Emit(masm(), frame()->GetTotalFrameSlotCount()); | 210 safepoints()->Emit(masm(), frame()->GetTotalFrameSlotCount()); |
211 | 211 |
212 unwinding_info_writer_.Finish(masm()->pc_offset()); | 212 unwinding_info_writer_.Finish(masm()->pc_offset()); |
213 | 213 |
214 Handle<Code> result = v8::internal::CodeGenerator::MakeCodeEpilogue( | 214 Handle<Code> result = v8::internal::CodeGenerator::MakeCodeEpilogue( |
215 masm(), unwinding_info_writer_.eh_frame_writer(), info, Handle<Object>()); | 215 masm(), unwinding_info_writer_.eh_frame_writer(), info, Handle<Object>()); |
216 result->set_is_turbofanned(true); | 216 result->set_is_turbofanned(true); |
217 result->set_stack_slots(frame()->GetTotalFrameSlotCount()); | 217 result->set_stack_slots(frame()->GetTotalFrameSlotCount()); |
218 result->set_safepoint_table_offset(safepoints()->GetCodeOffset()); | 218 result->set_safepoint_table_offset(safepoints()->GetCodeOffset()); |
219 Handle<ByteArray> source_positions = | 219 Handle<ByteArray> source_positions = |
220 source_position_table_builder_.ToSourcePositionTable(); | 220 source_position_table_builder_.ToSourcePositionTable( |
| 221 isolate(), Handle<AbstractCode>::cast(result)); |
221 result->set_source_position_table(*source_positions); | 222 result->set_source_position_table(*source_positions); |
222 source_position_table_builder_.EndJitLogging(AbstractCode::cast(*result)); | |
223 | 223 |
224 // Emit exception handler table. | 224 // Emit exception handler table. |
225 if (!handlers_.empty()) { | 225 if (!handlers_.empty()) { |
226 Handle<HandlerTable> table = | 226 Handle<HandlerTable> table = |
227 Handle<HandlerTable>::cast(isolate()->factory()->NewFixedArray( | 227 Handle<HandlerTable>::cast(isolate()->factory()->NewFixedArray( |
228 HandlerTable::LengthForReturn(static_cast<int>(handlers_.size())), | 228 HandlerTable::LengthForReturn(static_cast<int>(handlers_.size())), |
229 TENURED)); | 229 TENURED)); |
230 for (size_t i = 0; i < handlers_.size(); ++i) { | 230 for (size_t i = 0; i < handlers_.size(); ++i) { |
231 table->SetReturnOffset(static_cast<int>(i), handlers_[i].pc_offset); | 231 table->SetReturnOffset(static_cast<int>(i), handlers_[i].pc_offset); |
232 table->SetReturnHandler(static_cast<int>(i), handlers_[i].handler->pos()); | 232 table->SetReturnHandler(static_cast<int>(i), handlers_[i].handler->pos()); |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { | 936 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { |
937 gen->ools_ = this; | 937 gen->ools_ = this; |
938 } | 938 } |
939 | 939 |
940 | 940 |
941 OutOfLineCode::~OutOfLineCode() {} | 941 OutOfLineCode::~OutOfLineCode() {} |
942 | 942 |
943 } // namespace compiler | 943 } // namespace compiler |
944 } // namespace internal | 944 } // namespace internal |
945 } // namespace v8 | 945 } // namespace v8 |
OLD | NEW |