Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: runtime/vm/flow_graph_compiler_x64.h

Issue 10832411: Remove support for non-ssa optimizing code generation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: disable optimizations on bailout Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11 matching lines...) Expand all
22 struct BlockInfo : public ZoneAllocated { 22 struct BlockInfo : public ZoneAllocated {
23 public: 23 public:
24 BlockInfo() : label() { } 24 BlockInfo() : label() { }
25 Label label; 25 Label label;
26 }; 26 };
27 27
28 public: 28 public:
29 FlowGraphCompiler(Assembler* assembler, 29 FlowGraphCompiler(Assembler* assembler,
30 const FlowGraph& flow_graph, 30 const FlowGraph& flow_graph,
31 bool is_optimizing, 31 bool is_optimizing,
32 bool is_ssa,
33 bool is_leaf); 32 bool is_leaf);
34 33
35 ~FlowGraphCompiler(); 34 ~FlowGraphCompiler();
36 35
37 // Accessors. 36 // Accessors.
38 Assembler* assembler() const { return assembler_; } 37 Assembler* assembler() const { return assembler_; }
39 const ParsedFunction& parsed_function() const { return parsed_function_; } 38 const ParsedFunction& parsed_function() const { return parsed_function_; }
40 const GrowableArray<BlockEntryInstr*>& block_order() const { 39 const GrowableArray<BlockEntryInstr*>& block_order() const {
41 return block_order_; 40 return block_order_;
42 } 41 }
43 DescriptorList* pc_descriptors_list() const { 42 DescriptorList* pc_descriptors_list() const {
44 return pc_descriptors_list_; 43 return pc_descriptors_list_;
45 } 44 }
46 const GrowableObjectArray& object_table() { 45 const GrowableObjectArray& object_table() {
47 return object_table_; 46 return object_table_;
48 } 47 }
49 BlockEntryInstr* current_block() const { return current_block_; } 48 BlockEntryInstr* current_block() const { return current_block_; }
50 void set_current_block(BlockEntryInstr* value) { 49 void set_current_block(BlockEntryInstr* value) {
51 current_block_ = value; 50 current_block_ = value;
52 } 51 }
53 static bool CanOptimize(); 52 static bool CanOptimize();
54 bool is_optimizing() const { return is_optimizing_; } 53 bool is_optimizing() const { return is_optimizing_; }
55 54
56 bool is_ssa() const { return is_ssa_; }
57
58 const GrowableArray<BlockInfo*>& block_info() const { return block_info_; } 55 const GrowableArray<BlockInfo*>& block_info() const { return block_info_; }
59 ParallelMoveResolver* parallel_move_resolver() { 56 ParallelMoveResolver* parallel_move_resolver() {
60 return &parallel_move_resolver_; 57 return &parallel_move_resolver_;
61 } 58 }
62 59
63 // Constructor is lighweight, major initialization work should occur here. 60 // Constructor is lighweight, major initialization work should occur here.
64 // This makes it easier to measure time spent in the compiler. 61 // This makes it easier to measure time spent in the compiler.
65 void InitCompiler(); 62 void InitCompiler();
66 63
67 void CompileGraph(); 64 void CompileGraph();
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // the block order and if it is the given block. 175 // the block order and if it is the given block.
179 bool IsNextBlock(BlockEntryInstr* block_entry) const; 176 bool IsNextBlock(BlockEntryInstr* block_entry) const;
180 177
181 void AddExceptionHandler(intptr_t try_index, intptr_t pc_offset); 178 void AddExceptionHandler(intptr_t try_index, intptr_t pc_offset);
182 void AddCurrentDescriptor(PcDescriptors::Kind kind, 179 void AddCurrentDescriptor(PcDescriptors::Kind kind,
183 intptr_t deopt_id, 180 intptr_t deopt_id,
184 intptr_t token_pos, 181 intptr_t token_pos,
185 intptr_t try_index); 182 intptr_t try_index);
186 Label* AddDeoptStub(intptr_t deopt_id, 183 Label* AddDeoptStub(intptr_t deopt_id,
187 intptr_t try_index_, 184 intptr_t try_index_,
188 DeoptReasonId reason, 185 DeoptReasonId reason);
189 Register reg1 = kNoRegister,
190 Register reg2 = kNoRegister,
191 Register reg3 = kNoRegister);
192 186
193 void AddSlowPathCode(SlowPathCode* slow_path); 187 void AddSlowPathCode(SlowPathCode* slow_path);
194 188
195 void FinalizeExceptionHandlers(const Code& code); 189 void FinalizeExceptionHandlers(const Code& code);
196 void FinalizePcDescriptors(const Code& code); 190 void FinalizePcDescriptors(const Code& code);
197 void FinalizeDeoptInfo(const Code& code); 191 void FinalizeDeoptInfo(const Code& code);
198 void FinalizeStackmaps(const Code& code); 192 void FinalizeStackmaps(const Code& code);
199 void FinalizeVarDescriptors(const Code& code); 193 void FinalizeVarDescriptors(const Code& code);
200 void FinalizeComments(const Code& code); 194 void FinalizeComments(const Code& code);
201 195
202 const Bool& bool_true() const { return bool_true_; } 196 const Bool& bool_true() const { return bool_true_; }
203 const Bool& bool_false() const { return bool_false_; } 197 const Bool& bool_false() const { return bool_false_; }
204 const Class& double_class() const { return double_class_; } 198 const Class& double_class() const { return double_class_; }
205 199
206 FrameRegisterAllocator* frame_register_allocator() {
207 return &frame_register_allocator_;
208 }
209
210 // Returns true if the compiled function has a finally clause. 200 // Returns true if the compiled function has a finally clause.
211 bool HasFinally() const; 201 bool HasFinally() const;
212 202
213 static const int kLocalsOffsetFromFP = (-1 * kWordSize); 203 static const int kLocalsOffsetFromFP = (-1 * kWordSize);
214 204
215 void SaveLiveRegisters(LocationSummary* locs); 205 void SaveLiveRegisters(LocationSummary* locs);
216 void RestoreLiveRegisters(LocationSummary* locs); 206 void RestoreLiveRegisters(LocationSummary* locs);
217 207
218 private: 208 private:
219 friend class DeoptimizationStub; 209 friend class DeoptimizationStub;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 void GenerateInlinedGetter(intptr_t offset); 275 void GenerateInlinedGetter(intptr_t offset);
286 void GenerateInlinedSetter(intptr_t offset); 276 void GenerateInlinedSetter(intptr_t offset);
287 277
288 // Map a block number in a forward iteration into the block number in the 278 // Map a block number in a forward iteration into the block number in the
289 // corresponding reverse iteration. Used to obtain an index into 279 // corresponding reverse iteration. Used to obtain an index into
290 // block_order for reverse iterations. 280 // block_order for reverse iterations.
291 intptr_t reverse_index(intptr_t index) const { 281 intptr_t reverse_index(intptr_t index) const {
292 return block_order_.length() - index - 1; 282 return block_order_.length() - index - 1;
293 } 283 }
294 284
285 // Perform a greedy local register allocation. Consider all registers free.
286 void AllocateRegistersLocally(Instruction* instr);
287
295 // Returns true if the generated code does not call other Dart code or 288 // Returns true if the generated code does not call other Dart code or
296 // runtime. Only deoptimization is allowed to occur. Closures are not leaf. 289 // runtime. Only deoptimization is allowed to occur. Closures are not leaf.
297 bool IsLeaf() const; 290 bool IsLeaf() const;
298 291
299 class Assembler* assembler_; 292 class Assembler* assembler_;
300 const ParsedFunction& parsed_function_; 293 const ParsedFunction& parsed_function_;
301 const GrowableArray<BlockEntryInstr*>& block_order_; 294 const GrowableArray<BlockEntryInstr*>& block_order_;
302 295
303 // Compiler specific per-block state. Indexed by postorder block number 296 // Compiler specific per-block state. Indexed by postorder block number
304 // for convenience. This is not the block's index in the block order, 297 // for convenience. This is not the block's index in the block order,
305 // which is reverse postorder. 298 // which is reverse postorder.
306 BlockEntryInstr* current_block_; 299 BlockEntryInstr* current_block_;
307 ExceptionHandlerList* exception_handlers_list_; 300 ExceptionHandlerList* exception_handlers_list_;
308 DescriptorList* pc_descriptors_list_; 301 DescriptorList* pc_descriptors_list_;
309 StackmapTableBuilder* stackmap_table_builder_; 302 StackmapTableBuilder* stackmap_table_builder_;
310 GrowableArray<BlockInfo*> block_info_; 303 GrowableArray<BlockInfo*> block_info_;
311 GrowableArray<DeoptimizationStub*> deopt_stubs_; 304 GrowableArray<DeoptimizationStub*> deopt_stubs_;
312 GrowableArray<SlowPathCode*> slow_path_code_; 305 GrowableArray<SlowPathCode*> slow_path_code_;
313 const GrowableObjectArray& object_table_; 306 const GrowableObjectArray& object_table_;
314 const bool is_optimizing_; 307 const bool is_optimizing_;
315 const bool is_ssa_;
316 const bool is_dart_leaf_; 308 const bool is_dart_leaf_;
317 309
318 const Bool& bool_true_; 310 const Bool& bool_true_;
319 const Bool& bool_false_; 311 const Bool& bool_false_;
320 const Class& double_class_; 312 const Class& double_class_;
321 313
322 FrameRegisterAllocator frame_register_allocator_;
323 ParallelMoveResolver parallel_move_resolver_; 314 ParallelMoveResolver parallel_move_resolver_;
324 315
325 // Currently instructions generate deopt stubs internally by 316 // Currently instructions generate deopt stubs internally by
326 // calling AddDeoptStub. To communicate deoptimization environment 317 // calling AddDeoptStub. To communicate deoptimization environment
327 // that should be used when deoptimizing we store it in this variable. 318 // that should be used when deoptimizing we store it in this variable.
328 // In future AddDeoptStub should be moved out of the instruction template. 319 // In future AddDeoptStub should be moved out of the instruction template.
329 Environment* pending_deoptimization_env_; 320 Environment* pending_deoptimization_env_;
330 321
331 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); 322 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler);
332 }; 323 };
333 324
334 } // namespace dart 325 } // namespace dart
335 326
336 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ 327 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698