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

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

Issue 10447133: FlowGraphCompiler is not a visitor any longer. Start consolidating shared code between the x64 and … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 | « no previous file | runtime/vm/flow_graph_compiler_ia32.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_IA32_H_ 5 #ifndef VM_FLOW_GRAPH_COMPILER_IA32_H_
6 #define VM_FLOW_GRAPH_COMPILER_IA32_H_ 6 #define VM_FLOW_GRAPH_COMPILER_IA32_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_ia32.h. 9 #error Include flow_graph_compiler.h instead of flow_graph_compiler_ia32.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/flow_graph_compiler_shared.h"
16 #include "vm/intermediate_language.h" 17 #include "vm/intermediate_language.h"
17 18
18 namespace dart { 19 namespace dart {
19 20
20 class Assembler; 21 class Assembler;
21 class Code; 22 class Code;
22 class DeoptimizationStub; 23 class DeoptimizationStub;
23 template <typename T> class GrowableArray; 24 template <typename T> class GrowableArray;
24 class ParsedFunction; 25 class ParsedFunction;
25 class StackMapBuilder; 26 class StackMapBuilder;
26 27
27 // Stubbed out implementation of graph compiler, bails out immediately if 28 // Stubbed out implementation of graph compiler, bails out immediately if
28 // CompileGraph is called. The rest of the public API is UNIMPLEMENTED. 29 // CompileGraph is called. The rest of the public API is UNIMPLEMENTED.
29 class FlowGraphCompiler : public FlowGraphVisitor { 30 class FlowGraphCompiler : public FlowGraphCompilerShared {
30 public: 31 public:
31 FlowGraphCompiler(Assembler* assembler, 32 FlowGraphCompiler(Assembler* assembler,
32 const ParsedFunction& parsed_function, 33 const ParsedFunction& parsed_function,
33 const GrowableArray<BlockEntryInstr*>& block_order, 34 const GrowableArray<BlockEntryInstr*>& block_order,
34 bool is_optimizing); 35 bool is_optimizing);
35 36
36 virtual ~FlowGraphCompiler();
37
38 void CompileGraph(); 37 void CompileGraph();
39 38
40 // Infrastructure copied from class CodeGenerator or stubbed out.
41 void FinalizePcDescriptors(const Code& code);
42 void FinalizeStackmaps(const Code& code);
43 void FinalizeVarDescriptors(const Code& code);
44 void FinalizeExceptionHandlers(const Code& code);
45 void FinalizeComments(const Code& code); 39 void FinalizeComments(const Code& code);
46 40
47 Assembler* assembler() const { return assembler_; }
48 bool is_optimizing() const { return is_optimizing_; }
49 const ParsedFunction& parsed_function() const { return parsed_function_; }
50
51 void GenerateCallRuntime(intptr_t cid, 41 void GenerateCallRuntime(intptr_t cid,
52 intptr_t token_index, 42 intptr_t token_index,
53 intptr_t try_index, 43 intptr_t try_index,
54 const RuntimeEntry& entry); 44 const RuntimeEntry& entry);
55 void AddCurrentDescriptor(PcDescriptors::Kind kind,
56 intptr_t cid,
57 intptr_t token_index,
58 intptr_t try_index);
59 45
60 void EmitInstanceCall(intptr_t cid, 46 void EmitInstanceCall(intptr_t cid,
61 intptr_t token_index, 47 intptr_t token_index,
62 intptr_t try_index, 48 intptr_t try_index,
63 const String& function_name, 49 const String& function_name,
64 intptr_t argument_count, 50 intptr_t argument_count,
65 const Array& argument_names, 51 const Array& argument_names,
66 intptr_t checked_argument_count); 52 intptr_t checked_argument_count);
67 void EmitStaticCall(intptr_t token_index, 53 void EmitStaticCall(intptr_t token_index,
68 intptr_t try_index, 54 intptr_t try_index,
69 const Function& function, 55 const Function& function,
70 intptr_t argument_count, 56 intptr_t argument_count,
71 const Array& argument_names); 57 const Array& argument_names);
72 void GenerateCall(intptr_t token_index, 58 void GenerateCall(intptr_t token_index,
73 intptr_t try_index, 59 intptr_t try_index,
74 const ExternalLabel* label, 60 const ExternalLabel* label,
75 PcDescriptors::Kind kind); 61 PcDescriptors::Kind kind);
76 62
77 private: 63 private:
78 friend class DeoptimizationStub; 64 friend class DeoptimizationStub;
79 65
80 // Bail out of the flow graph compiler. Does not return to the caller. 66 // Bail out of the flow graph compiler. Does not return to the caller.
81 void Bailout(const char* reason); 67 void Bailout(const char* reason);
82 68
83 virtual void VisitBlocks(); 69 virtual void VisitBlocks();
84 70
85 BlockEntryInstr* current_block() const { return current_block_; }
86
87 // Constructor is lighweight, major initialization work should occur here.
88 // This makes it easier to measure time spent in the compiler.
89 void InitCompiler();
90
91 struct BlockInfo : public ZoneAllocated {
92 public:
93 BlockInfo() : label() { }
94
95 Label label;
96 };
97
98 void CopyParameters(); 71 void CopyParameters();
99 void EmitInstructionPrologue(Instruction* instr); 72 void EmitInstructionPrologue(Instruction* instr);
100 73
101 intptr_t StackSize() const;
102
103 bool CanOptimize(); 74 bool CanOptimize();
104 bool TryIntrinsify(); 75 bool TryIntrinsify();
105 void IntrinsifyGetter(); 76 void IntrinsifyGetter();
106 void IntrinsifySetter(); 77 void IntrinsifySetter();
107 78
108 void GenerateDeferredCode();
109 void EmitComment(Instruction* instr); 79 void EmitComment(Instruction* instr);
110 void BailoutOnInstruction(Instruction* instr); 80 void BailoutOnInstruction(Instruction* instr);
111 81
112 Assembler* assembler_;
113 const ParsedFunction& parsed_function_;
114
115 // Compiler specific per-block state. Indexed by postorder block number
116 // for convenience. This is not the block's index in the block order,
117 // which is reverse postorder.
118 GrowableArray<BlockInfo*> block_info_;
119 BlockEntryInstr* current_block_;
120 DescriptorList* pc_descriptors_list_;
121 StackmapBuilder* stackmap_builder_;
122 ExceptionHandlerList* exception_handlers_list_;
123 GrowableArray<DeoptimizationStub*> deopt_stubs_;
124 const bool is_optimizing_;
125
126 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); 82 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler);
127 }; 83 };
128 84
129 } // namespace dart 85 } // namespace dart
130 86
131 #endif // VM_FLOW_GRAPH_COMPILER_IA32_H_ 87 #endif // VM_FLOW_GRAPH_COMPILER_IA32_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698