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/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 class JumpTable; | 100 class JumpTable; |
101 // Adds a jump table that is emitted after the actual code. Returns label | 101 // Adds a jump table that is emitted after the actual code. Returns label |
102 // pointing to the beginning of the table. {targets} is assumed to be static | 102 // pointing to the beginning of the table. {targets} is assumed to be static |
103 // or zone allocated. | 103 // or zone allocated. |
104 Label* AddJumpTable(Label** targets, size_t target_count); | 104 Label* AddJumpTable(Label** targets, size_t target_count); |
105 // Emits a jump table. | 105 // Emits a jump table. |
106 void AssembleJumpTable(Label** targets, size_t target_count); | 106 void AssembleJumpTable(Label** targets, size_t target_count); |
107 | 107 |
108 // =========================================================================== | 108 // =========================================================================== |
109 // Deoptimization table construction | 109 // ================== Deoptimization table construction. ===================== |
110 void AddSafepointAndDeopt(Instruction* instr); | 110 // =========================================================================== |
| 111 |
| 112 void RecordCallPosition(Instruction* instr); |
111 void PopulateDeoptimizationData(Handle<Code> code); | 113 void PopulateDeoptimizationData(Handle<Code> code); |
112 int DefineDeoptimizationLiteral(Handle<Object> literal); | 114 int DefineDeoptimizationLiteral(Handle<Object> literal); |
113 FrameStateDescriptor* GetFrameStateDescriptor(Instruction* instr, | 115 FrameStateDescriptor* GetFrameStateDescriptor(Instruction* instr, |
114 size_t frame_state_offset); | 116 size_t frame_state_offset); |
115 int BuildTranslation(Instruction* instr, int pc_offset, | 117 int BuildTranslation(Instruction* instr, int pc_offset, |
116 size_t frame_state_offset, | 118 size_t frame_state_offset, |
117 OutputFrameStateCombine state_combine); | 119 OutputFrameStateCombine state_combine); |
118 void BuildTranslationForFrameStateDescriptor( | 120 void BuildTranslationForFrameStateDescriptor( |
119 FrameStateDescriptor* descriptor, Instruction* instr, | 121 FrameStateDescriptor* descriptor, Instruction* instr, |
120 Translation* translation, size_t frame_state_offset, | 122 Translation* translation, size_t frame_state_offset, |
121 OutputFrameStateCombine state_combine); | 123 OutputFrameStateCombine state_combine); |
122 void AddTranslationForOperand(Translation* translation, Instruction* instr, | 124 void AddTranslationForOperand(Translation* translation, Instruction* instr, |
123 InstructionOperand* op, MachineType type); | 125 InstructionOperand* op, MachineType type); |
124 void AddNopForSmiCodeInlining(); | 126 void AddNopForSmiCodeInlining(); |
125 void EnsureSpaceForLazyDeopt(); | 127 void EnsureSpaceForLazyDeopt(); |
126 void MarkLazyDeoptSite(); | 128 void MarkLazyDeoptSite(); |
127 | 129 |
128 // =========================================================================== | 130 // =========================================================================== |
| 131 |
129 struct DeoptimizationState : ZoneObject { | 132 struct DeoptimizationState : ZoneObject { |
130 public: | 133 public: |
131 BailoutId bailout_id() const { return bailout_id_; } | 134 BailoutId bailout_id() const { return bailout_id_; } |
132 int translation_id() const { return translation_id_; } | 135 int translation_id() const { return translation_id_; } |
133 int pc_offset() const { return pc_offset_; } | 136 int pc_offset() const { return pc_offset_; } |
134 | 137 |
135 DeoptimizationState(BailoutId bailout_id, int translation_id, int pc_offset) | 138 DeoptimizationState(BailoutId bailout_id, int translation_id, int pc_offset) |
136 : bailout_id_(bailout_id), | 139 : bailout_id_(bailout_id), |
137 translation_id_(translation_id), | 140 translation_id_(translation_id), |
138 pc_offset_(pc_offset) {} | 141 pc_offset_(pc_offset) {} |
139 | 142 |
140 private: | 143 private: |
141 BailoutId bailout_id_; | 144 BailoutId bailout_id_; |
142 int translation_id_; | 145 int translation_id_; |
143 int pc_offset_; | 146 int pc_offset_; |
144 }; | 147 }; |
145 | 148 |
| 149 struct HandlerInfo { |
| 150 Label* handler; |
| 151 int pc_offset; |
| 152 }; |
| 153 |
146 friend class OutOfLineCode; | 154 friend class OutOfLineCode; |
147 | 155 |
148 Frame* const frame_; | 156 Frame* const frame_; |
149 Linkage* const linkage_; | 157 Linkage* const linkage_; |
150 InstructionSequence* const code_; | 158 InstructionSequence* const code_; |
151 CompilationInfo* const info_; | 159 CompilationInfo* const info_; |
152 Label* const labels_; | 160 Label* const labels_; |
153 BasicBlock::RpoNumber current_block_; | 161 BasicBlock::RpoNumber current_block_; |
154 SourcePosition current_source_position_; | 162 SourcePosition current_source_position_; |
155 MacroAssembler masm_; | 163 MacroAssembler masm_; |
156 GapResolver resolver_; | 164 GapResolver resolver_; |
157 SafepointTableBuilder safepoints_; | 165 SafepointTableBuilder safepoints_; |
| 166 ZoneVector<HandlerInfo> handlers_; |
158 ZoneDeque<DeoptimizationState*> deoptimization_states_; | 167 ZoneDeque<DeoptimizationState*> deoptimization_states_; |
159 ZoneDeque<Handle<Object> > deoptimization_literals_; | 168 ZoneDeque<Handle<Object>> deoptimization_literals_; |
160 TranslationBuffer translations_; | 169 TranslationBuffer translations_; |
161 int last_lazy_deopt_pc_; | 170 int last_lazy_deopt_pc_; |
162 JumpTable* jump_tables_; | 171 JumpTable* jump_tables_; |
163 OutOfLineCode* ools_; | 172 OutOfLineCode* ools_; |
164 int osr_pc_offset_; | 173 int osr_pc_offset_; |
165 }; | 174 }; |
166 | 175 |
167 } // namespace compiler | 176 } // namespace compiler |
168 } // namespace internal | 177 } // namespace internal |
169 } // namespace v8 | 178 } // namespace v8 |
170 | 179 |
171 #endif // V8_COMPILER_CODE_GENERATOR_H | 180 #endif // V8_COMPILER_CODE_GENERATOR_H |
OLD | NEW |