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_X64_H_ | 5 #ifndef VM_FLOW_GRAPH_COMPILER_X64_H_ |
6 #define VM_FLOW_GRAPH_COMPILER_X64_H_ | 6 #define VM_FLOW_GRAPH_COMPILER_X64_H_ |
7 | 7 |
8 #ifndef VM_FLOW_GRAPH_COMPILER_H_ | 8 #ifndef VM_FLOW_GRAPH_COMPILER_H_ |
9 #error Include flow_graph_compiler.h instead of flow_graph_compiler_x64.h. | 9 #error Include flow_graph_compiler.h instead of flow_graph_compiler_x64.h. |
10 #endif | 10 #endif |
11 | 11 |
12 #include "vm/assembler.h" | 12 #include "vm/assembler.h" |
13 #include "vm/assembler_macros.h" | 13 #include "vm/assembler_macros.h" |
14 #include "vm/code_descriptors.h" | 14 #include "vm/code_descriptors.h" |
15 #include "vm/code_generator.h" | 15 #include "vm/code_generator.h" |
16 #include "vm/intermediate_language.h" | 16 #include "vm/intermediate_language.h" |
17 | 17 |
18 namespace dart { | 18 namespace dart { |
19 | 19 |
20 class Code; | 20 class Code; |
| 21 class DeoptimizationStub; |
21 class ExceptionHandlerList; | 22 class ExceptionHandlerList; |
22 template <typename T> class GrowableArray; | 23 template <typename T> class GrowableArray; |
23 class ParsedFunction; | 24 class ParsedFunction; |
24 | 25 |
25 class FlowGraphCompiler : public FlowGraphVisitor { | 26 class FlowGraphCompiler : public FlowGraphVisitor { |
26 public: | 27 public: |
27 FlowGraphCompiler(Assembler* assembler, | 28 FlowGraphCompiler(Assembler* assembler, |
28 const ParsedFunction& parsed_function, | 29 const ParsedFunction& parsed_function, |
29 const GrowableArray<BlockEntryInstr*>& block_order, | 30 const GrowableArray<BlockEntryInstr*>& block_order, |
30 bool is_optimizing); | 31 bool is_optimizing); |
31 | 32 |
32 virtual ~FlowGraphCompiler(); | 33 virtual ~FlowGraphCompiler(); |
33 | 34 |
34 void CompileGraph(); | 35 void CompileGraph(); |
35 | 36 |
36 // Infrastructure copied from class CodeGenerator or stubbed out. | 37 // Infrastructure copied from class CodeGenerator or stubbed out. |
37 void FinalizePcDescriptors(const Code& code); | 38 void FinalizePcDescriptors(const Code& code); |
38 void FinalizeStackmaps(const Code& code); | 39 void FinalizeStackmaps(const Code& code); |
39 void FinalizeVarDescriptors(const Code& code); | 40 void FinalizeVarDescriptors(const Code& code); |
40 void FinalizeExceptionHandlers(const Code& code); | 41 void FinalizeExceptionHandlers(const Code& code); |
41 void FinalizeComments(const Code& code); | 42 void FinalizeComments(const Code& code); |
42 | 43 |
43 Assembler* assembler() const { return assembler_; } | 44 Assembler* assembler() const { return assembler_; } |
44 | 45 |
| 46 Label* AddDeoptStub(intptr_t deopt_id, |
| 47 intptr_t deopt_token_index, |
| 48 intptr_t try_index_, |
| 49 DeoptReasonId reason, |
| 50 Register reg1, |
| 51 Register reg2); |
| 52 |
45 private: | 53 private: |
| 54 friend class DeoptimizationStub; |
| 55 |
46 // TODO(fschneider): Clean up friend-class declarations once all code | 56 // TODO(fschneider): Clean up friend-class declarations once all code |
47 // generator templates have been moved to intermediate_language_x64.cc. | 57 // generator templates have been moved to intermediate_language_x64.cc. |
48 #define DECLARE_FRIEND(ShortName, ClassName) friend class ClassName; | 58 #define DECLARE_FRIEND(ShortName, ClassName) friend class ClassName; |
49 FOR_EACH_COMPUTATION(DECLARE_FRIEND) | 59 FOR_EACH_COMPUTATION(DECLARE_FRIEND) |
50 #undef DECLARE_FRIEND | 60 #undef DECLARE_FRIEND |
51 | 61 |
52 static const int kLocalsOffsetFromFP = (-1 * kWordSize); | 62 static const int kLocalsOffsetFromFP = (-1 * kWordSize); |
53 | 63 |
54 // Constructor is lighweight, major initialization work should occur here. | 64 // Constructor is lighweight, major initialization work should occur here. |
55 // This makes it easier to measure time spent in the compiler. | 65 // This makes it easier to measure time spent in the compiler. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 183 |
174 void CopyParameters(); | 184 void CopyParameters(); |
175 | 185 |
176 intptr_t StackSize() const; | 186 intptr_t StackSize() const; |
177 | 187 |
178 bool TryIntrinsify(); | 188 bool TryIntrinsify(); |
179 void IntrinsifyGetter(); | 189 void IntrinsifyGetter(); |
180 void IntrinsifySetter(); | 190 void IntrinsifySetter(); |
181 static bool CanOptimize(); | 191 static bool CanOptimize(); |
182 | 192 |
| 193 void GenerateDeferredCode(); |
| 194 |
183 Assembler* assembler_; | 195 Assembler* assembler_; |
184 const ParsedFunction& parsed_function_; | 196 const ParsedFunction& parsed_function_; |
185 | 197 |
186 // Compiler specific per-block state. Indexed by postorder block number | 198 // Compiler specific per-block state. Indexed by postorder block number |
187 // for convenience. This is not the block's index in the block order, | 199 // for convenience. This is not the block's index in the block order, |
188 // which is reverse postorder. | 200 // which is reverse postorder. |
189 GrowableArray<BlockInfo*> block_info_; | 201 GrowableArray<BlockInfo*> block_info_; |
190 BlockEntryInstr* current_block_; | 202 BlockEntryInstr* current_block_; |
191 DescriptorList* pc_descriptors_list_; | 203 DescriptorList* pc_descriptors_list_; |
192 ExceptionHandlerList* exception_handlers_list_; | 204 ExceptionHandlerList* exception_handlers_list_; |
| 205 GrowableArray<DeoptimizationStub*> deopt_stubs_; |
193 const bool is_optimizing_; | 206 const bool is_optimizing_; |
194 | 207 |
195 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 208 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
196 }; | 209 }; |
197 | 210 |
198 } // namespace dart | 211 } // namespace dart |
199 | 212 |
200 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ | 213 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ |
OLD | NEW |