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 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 Assembler* assembler() const { return assembler_; } | 44 Assembler* assembler() const { return assembler_; } |
45 | 45 |
46 Label* AddDeoptStub(intptr_t deopt_id, | 46 Label* AddDeoptStub(intptr_t deopt_id, |
47 intptr_t deopt_token_index, | 47 intptr_t deopt_token_index, |
48 intptr_t try_index_, | 48 intptr_t try_index_, |
49 DeoptReasonId reason, | 49 DeoptReasonId reason, |
50 Register reg1, | 50 Register reg1, |
51 Register reg2); | 51 Register reg2); |
52 | 52 |
| 53 bool is_optimizing() const { return is_optimizing_; } |
| 54 const ParsedFunction& parsed_function() const { return parsed_function_; } |
| 55 |
| 56 void GenerateCallRuntime(intptr_t cid, |
| 57 intptr_t token_index, |
| 58 intptr_t try_index, |
| 59 const RuntimeEntry& entry); |
| 60 void AddCurrentDescriptor(PcDescriptors::Kind kind, |
| 61 intptr_t cid, |
| 62 intptr_t token_index, |
| 63 intptr_t try_index); |
| 64 |
53 private: | 65 private: |
54 friend class DeoptimizationStub; | 66 friend class DeoptimizationStub; |
55 | 67 |
56 // TODO(fschneider): Clean up friend-class declarations once all code | 68 // TODO(fschneider): Clean up friend-class declarations once all code |
57 // generator templates have been moved to intermediate_language_x64.cc. | 69 // generator templates have been moved to intermediate_language_x64.cc. |
58 #define DECLARE_FRIEND(ShortName, ClassName) friend class ClassName; | 70 #define DECLARE_FRIEND(ShortName, ClassName) friend class ClassName; |
59 FOR_EACH_COMPUTATION(DECLARE_FRIEND) | 71 FOR_EACH_COMPUTATION(DECLARE_FRIEND) |
60 #undef DECLARE_FRIEND | 72 #undef DECLARE_FRIEND |
61 | 73 |
62 static const int kLocalsOffsetFromFP = (-1 * kWordSize); | 74 static const int kLocalsOffsetFromFP = (-1 * kWordSize); |
63 | 75 |
64 // Constructor is lighweight, major initialization work should occur here. | 76 // Constructor is lighweight, major initialization work should occur here. |
65 // This makes it easier to measure time spent in the compiler. | 77 // This makes it easier to measure time spent in the compiler. |
66 void InitCompiler(); | 78 void InitCompiler(); |
67 | 79 |
68 struct BlockInfo : public ZoneAllocated { | 80 struct BlockInfo : public ZoneAllocated { |
69 public: | 81 public: |
70 BlockInfo() : label() { } | 82 BlockInfo() : label() { } |
71 | 83 |
72 Label label; | 84 Label label; |
73 }; | 85 }; |
74 | 86 |
75 BlockEntryInstr* current_block() const { return current_block_; } | 87 BlockEntryInstr* current_block() const { return current_block_; } |
76 | 88 |
77 bool is_optimizing() const { return is_optimizing_; } | |
78 | |
79 // Bail out of the flow graph compiler. Does not return to the caller. | 89 // Bail out of the flow graph compiler. Does not return to the caller. |
80 void Bailout(const char* reason); | 90 void Bailout(const char* reason); |
81 | 91 |
82 virtual void VisitBlocks(); | 92 virtual void VisitBlocks(); |
83 | 93 |
84 // Emit code to perform a computation, leaving its value in RAX. | 94 // Emit code to perform a computation, leaving its value in RAX. |
85 #define DECLARE_VISIT_COMPUTATION(ShortName, ClassName) \ | 95 #define DECLARE_VISIT_COMPUTATION(ShortName, ClassName) \ |
86 virtual void Visit##ShortName(ClassName* comp); | 96 virtual void Visit##ShortName(ClassName* comp); |
87 | 97 |
88 // Each visit function compiles a type of instruction. | 98 // Each visit function compiles a type of instruction. |
(...skipping 27 matching lines...) Expand all Loading... |
116 intptr_t try_index, | 126 intptr_t try_index, |
117 const Function& function, | 127 const Function& function, |
118 intptr_t argument_count, | 128 intptr_t argument_count, |
119 const Array& argument_names); | 129 const Array& argument_names); |
120 | 130 |
121 // Infrastructure copied from class CodeGenerator. | 131 // Infrastructure copied from class CodeGenerator. |
122 void GenerateCall(intptr_t token_index, | 132 void GenerateCall(intptr_t token_index, |
123 intptr_t try_index, | 133 intptr_t try_index, |
124 const ExternalLabel* label, | 134 const ExternalLabel* label, |
125 PcDescriptors::Kind kind); | 135 PcDescriptors::Kind kind); |
126 void GenerateCallRuntime(intptr_t cid, | |
127 intptr_t token_index, | |
128 intptr_t try_index, | |
129 const RuntimeEntry& entry); | |
130 void AddCurrentDescriptor(PcDescriptors::Kind kind, | |
131 intptr_t cid, | |
132 intptr_t token_index, | |
133 intptr_t try_index); | |
134 | 136 |
135 // Type checking helper methods. | 137 // Type checking helper methods. |
136 void CheckClasses(const GrowableArray<const Class*>& classes, | 138 void CheckClasses(const GrowableArray<const Class*>& classes, |
137 Label* is_instance_lbl, | 139 Label* is_instance_lbl, |
138 Label* is_not_instance_lbl); | 140 Label* is_not_instance_lbl); |
139 RawSubtypeTestCache* GenerateInlineInstanceof(intptr_t cid, | 141 RawSubtypeTestCache* GenerateInlineInstanceof(intptr_t cid, |
140 intptr_t token_index, | 142 intptr_t token_index, |
141 const AbstractType& type, | 143 const AbstractType& type, |
142 Label* is_instance, | 144 Label* is_instance, |
143 Label* is_not_instance); | 145 Label* is_not_instance); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 ExceptionHandlerList* exception_handlers_list_; | 207 ExceptionHandlerList* exception_handlers_list_; |
206 GrowableArray<DeoptimizationStub*> deopt_stubs_; | 208 GrowableArray<DeoptimizationStub*> deopt_stubs_; |
207 const bool is_optimizing_; | 209 const bool is_optimizing_; |
208 | 210 |
209 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 211 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
210 }; | 212 }; |
211 | 213 |
212 } // namespace dart | 214 } // namespace dart |
213 | 215 |
214 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ | 216 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ |
OLD | NEW |