OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef V8_COMPILER_CODE_GENERATOR_H_ | 5 #ifndef V8_COMPILER_CODE_GENERATOR_H_ |
6 #define V8_COMPILER_CODE_GENERATOR_H_ | 6 #define V8_COMPILER_CODE_GENERATOR_H_ |
7 | 7 |
8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
9 #include "src/compiler/instruction.h" | 9 #include "src/compiler/instruction.h" |
10 #include "src/compiler/unwinding-info-writer.h" | 10 #include "src/compiler/unwinding-info-writer.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 private: | 46 private: |
47 Instruction* instr_; | 47 Instruction* instr_; |
48 size_t pos_; | 48 size_t pos_; |
49 }; | 49 }; |
50 | 50 |
51 | 51 |
52 // Generates native code for a sequence of instructions. | 52 // Generates native code for a sequence of instructions. |
53 class CodeGenerator final : public GapResolver::Assembler { | 53 class CodeGenerator final : public GapResolver::Assembler { |
54 public: | 54 public: |
55 explicit CodeGenerator(Frame* frame, Linkage* linkage, | 55 explicit CodeGenerator(Frame* frame, Linkage* linkage, |
56 InstructionSequence* code, CompilationInfo* info, | 56 InstructionSequence* code, CompilationInfo* info); |
57 ZoneVector<trap_handler::ProtectedInstructionData>* | |
58 protected_instructions = nullptr); | |
59 | 57 |
60 // Generate native code. | 58 // Generate native code. |
61 Handle<Code> GenerateCode(); | 59 Handle<Code> GenerateCode(); |
62 | 60 |
63 InstructionSequence* code() const { return code_; } | 61 InstructionSequence* code() const { return code_; } |
64 FrameAccessState* frame_access_state() const { return frame_access_state_; } | 62 FrameAccessState* frame_access_state() const { return frame_access_state_; } |
65 const Frame* frame() const { return frame_access_state_->frame(); } | 63 const Frame* frame() const { return frame_access_state_->frame(); } |
66 Isolate* isolate() const; | 64 Isolate* isolate() const; |
67 Linkage* linkage() const { return linkage_; } | 65 Linkage* linkage() const { return linkage_; } |
68 | 66 |
69 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; } | 67 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; } |
70 | 68 |
71 void AddProtectedInstruction(int instr_offset, int landing_offset); | |
72 | |
73 void AssembleSourcePosition(Instruction* instr); | 69 void AssembleSourcePosition(Instruction* instr); |
74 | 70 |
75 void AssembleSourcePosition(SourcePosition source_position); | 71 void AssembleSourcePosition(SourcePosition source_position); |
76 | 72 |
77 // Record a safepoint with the given pointer map. | 73 // Record a safepoint with the given pointer map. |
78 void RecordSafepoint(ReferenceMap* references, Safepoint::Kind kind, | 74 void RecordSafepoint(ReferenceMap* references, Safepoint::Kind kind, |
79 int arguments, Safepoint::DeoptMode deopt_mode); | 75 int arguments, Safepoint::DeoptMode deopt_mode); |
80 | 76 |
81 private: | 77 private: |
82 MacroAssembler* masm() { return &masm_; } | 78 MacroAssembler* masm() { return &masm_; } |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 ZoneDeque<DeoptimizationState*> deoptimization_states_; | 280 ZoneDeque<DeoptimizationState*> deoptimization_states_; |
285 ZoneDeque<Handle<Object>> deoptimization_literals_; | 281 ZoneDeque<Handle<Object>> deoptimization_literals_; |
286 size_t inlined_function_count_; | 282 size_t inlined_function_count_; |
287 TranslationBuffer translations_; | 283 TranslationBuffer translations_; |
288 int last_lazy_deopt_pc_; | 284 int last_lazy_deopt_pc_; |
289 JumpTable* jump_tables_; | 285 JumpTable* jump_tables_; |
290 OutOfLineCode* ools_; | 286 OutOfLineCode* ools_; |
291 int osr_pc_offset_; | 287 int osr_pc_offset_; |
292 int optimized_out_literal_id_; | 288 int optimized_out_literal_id_; |
293 SourcePositionTableBuilder source_position_table_builder_; | 289 SourcePositionTableBuilder source_position_table_builder_; |
294 ZoneVector<trap_handler::ProtectedInstructionData>* protected_instructions_; | |
295 }; | 290 }; |
296 | 291 |
297 } // namespace compiler | 292 } // namespace compiler |
298 } // namespace internal | 293 } // namespace internal |
299 } // namespace v8 | 294 } // namespace v8 |
300 | 295 |
301 #endif // V8_COMPILER_CODE_GENERATOR_H | 296 #endif // V8_COMPILER_CODE_GENERATOR_H |
OLD | NEW |