OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_FLOW_GRAPH_COMPILER_SHARED_H_ | 5 #ifndef VM_FLOW_GRAPH_COMPILER_SHARED_H_ |
6 #define VM_FLOW_GRAPH_COMPILER_SHARED_H_ | 6 #define VM_FLOW_GRAPH_COMPILER_SHARED_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/code_descriptors.h" | 10 #include "vm/code_descriptors.h" |
11 #include "vm/code_generator.h" | 11 #include "vm/code_generator.h" |
12 #include "vm/growable_array.h" | 12 #include "vm/growable_array.h" |
13 | 13 |
14 namespace dart { | 14 namespace dart { |
15 | 15 |
16 class BlockEntryInstr; | 16 class BlockEntryInstr; |
17 class ExceptionHandlerList; | 17 class ExceptionHandlerList; |
18 class FlowGraphCompilerShared; | 18 class FlowGraphCompilerShared; |
19 class Instruction; | |
19 class ParsedFunction; | 20 class ParsedFunction; |
20 class TargetEntryInstr; | 21 class TargetEntryInstr; |
21 | 22 |
22 class DeoptimizationStub : public ZoneAllocated { | 23 class DeoptimizationStub : public ZoneAllocated { |
23 public: | 24 public: |
24 DeoptimizationStub(intptr_t deopt_id, | 25 DeoptimizationStub(intptr_t deopt_id, |
25 intptr_t deopt_token_index, | 26 intptr_t deopt_token_index, |
26 intptr_t try_index, | 27 intptr_t try_index, |
27 DeoptReasonId reason) | 28 DeoptReasonId reason) |
28 : deopt_id_(deopt_id), | 29 : deopt_id_(deopt_id), |
(...skipping 27 matching lines...) Expand all Loading... | |
56 const ParsedFunction& parsed_function, | 57 const ParsedFunction& parsed_function, |
57 const GrowableArray<BlockEntryInstr*>& block_order, | 58 const GrowableArray<BlockEntryInstr*>& block_order, |
58 bool is_optimizing); | 59 bool is_optimizing); |
59 | 60 |
60 virtual ~FlowGraphCompilerShared(); | 61 virtual ~FlowGraphCompilerShared(); |
61 | 62 |
62 // Constructor is lighweight, major initialization work should occur here. | 63 // Constructor is lighweight, major initialization work should occur here. |
63 // This makes it easier to measure time spent in the compiler. | 64 // This makes it easier to measure time spent in the compiler. |
64 void InitCompiler(); | 65 void InitCompiler(); |
65 | 66 |
67 void VisitBlocks(); | |
68 | |
66 Assembler* assembler() const { return assembler_; } | 69 Assembler* assembler() const { return assembler_; } |
67 const ParsedFunction& parsed_function() const { return parsed_function_; } | 70 const ParsedFunction& parsed_function() const { return parsed_function_; } |
68 const GrowableArray<BlockEntryInstr*>& block_order() const { | 71 const GrowableArray<BlockEntryInstr*>& block_order() const { |
69 return block_order_; | 72 return block_order_; |
70 } | 73 } |
71 DescriptorList* pc_descriptors_list() const { | 74 DescriptorList* pc_descriptors_list() const { |
72 return pc_descriptors_list_; | 75 return pc_descriptors_list_; |
73 } | 76 } |
74 BlockEntryInstr* current_block() const { return current_block_; } | 77 BlockEntryInstr* current_block() const { return current_block_; } |
75 void set_current_block(BlockEntryInstr* value) { | 78 void set_current_block(BlockEntryInstr* value) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 intptr_t argument_count) = 0; | 147 intptr_t argument_count) = 0; |
145 // Returns pc-offset (in bytes) of the pc after the call, can be used to emit | 148 // Returns pc-offset (in bytes) of the pc after the call, can be used to emit |
146 // pc-descriptor information. | 149 // pc-descriptor information. |
147 virtual intptr_t EmitStaticCall(const Function& function, | 150 virtual intptr_t EmitStaticCall(const Function& function, |
148 const Array& arguments_descriptor, | 151 const Array& arguments_descriptor, |
149 intptr_t argument_count) = 0; | 152 intptr_t argument_count) = 0; |
150 virtual void CheckClassIds(Register class_id_reg, | 153 virtual void CheckClassIds(Register class_id_reg, |
151 const GrowableArray<intptr_t>& class_ids, | 154 const GrowableArray<intptr_t>& class_ids, |
152 Label* is_equal_lbl, | 155 Label* is_equal_lbl, |
153 Label* is_not_equal_lbl) = 0; | 156 Label* is_not_equal_lbl) = 0; |
157 virtual void EmitInstructionPrologue(Instruction* instr) = 0; | |
Florian Schneider
2012/06/07 10:41:48
Somehow it feels wrong to make those pure virtual
srdjan
2012/06/07 16:34:45
Excellent idea, will do that and then submit.
| |
158 virtual void GenerateCallRuntime(intptr_t cid, | |
159 intptr_t token_index, | |
160 intptr_t try_index, | |
161 const RuntimeEntry& entry) = 0; | |
162 virtual void GenerateCall(intptr_t token_index, | |
163 intptr_t try_index, | |
164 const ExternalLabel* label, | |
165 PcDescriptors::Kind kind) = 0; | |
166 virtual void GenerateAssertAssignable(intptr_t cid, | |
167 intptr_t token_index, | |
168 intptr_t try_index, | |
169 const AbstractType& dst_type, | |
170 const String& dst_name) = 0; | |
171 virtual void GenerateInstanceOf(intptr_t cid, | |
172 intptr_t token_index, | |
173 intptr_t try_index, | |
174 const AbstractType& type, | |
175 bool negate_result) = 0; | |
154 | 176 |
177 void EmitComment(Instruction* instr); | |
155 | 178 |
156 struct BlockInfo : public ZoneAllocated { | 179 struct BlockInfo : public ZoneAllocated { |
157 public: | 180 public: |
158 BlockInfo() : label() { } | 181 BlockInfo() : label() { } |
159 | 182 |
160 Label label; | 183 Label label; |
161 }; | 184 }; |
162 | 185 |
163 const GrowableArray<BlockInfo*>& block_info() const { return block_info_; } | 186 const GrowableArray<BlockInfo*>& block_info() const { return block_info_; } |
164 | 187 |
(...skipping 24 matching lines...) Expand all Loading... | |
189 const bool is_optimizing_; | 212 const bool is_optimizing_; |
190 | 213 |
191 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompilerShared); | 214 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompilerShared); |
192 }; | 215 }; |
193 | 216 |
194 | 217 |
195 } // namespace dart | 218 } // namespace dart |
196 | 219 |
197 | 220 |
198 #endif // VM_FLOW_GRAPH_COMPILER_SHARED_H_ | 221 #endif // VM_FLOW_GRAPH_COMPILER_SHARED_H_ |
OLD | NEW |