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

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

Issue 9464009: Add enough compiler support to compile empty functions on x64. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Include file inadvertently left out. Created 8 years, 10 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/code_generator_x64.cc » ('j') | runtime/vm/compiler.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, 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_CODE_GENERATOR_X64_H_ 5 #ifndef VM_CODE_GENERATOR_X64_H_
6 #define VM_CODE_GENERATOR_X64_H_ 6 #define VM_CODE_GENERATOR_X64_H_
7 7
8 #ifndef VM_CODE_GENERATOR_H_ 8 #ifndef VM_CODE_GENERATOR_H_
9 #error Do not include code_generator_x64.h directly; use code_generator.h. 9 #error Do not include code_generator_x64.h directly; use code_generator.h.
10 #endif 10 #endif
11 11
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // We store the 'try index' of the block of code that we are 76 // We store the 'try index' of the block of code that we are
77 // currently generating code for in the current_try_index_ variable. 77 // currently generating code for in the current_try_index_ variable.
78 int current_try_index_; 78 int current_try_index_;
79 79
80 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeGeneratorState); 80 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeGeneratorState);
81 }; 81 };
82 82
83 83
84 class CodeGenerator : public AstNodeVisitor { 84 class CodeGenerator : public AstNodeVisitor {
85 public: 85 public:
86 // Forward declarations.
87 class DescriptorList;
srdjan 2012/02/24 23:13:02 Why the move?
Kevin Millikin (Google) 2012/02/27 08:22:07 Making it public for class FlowGraphCompiler. A f
88
86 CodeGenerator(Assembler* assembler, const ParsedFunction& parsed_function); 89 CodeGenerator(Assembler* assembler, const ParsedFunction& parsed_function);
87 virtual ~CodeGenerator() { } 90 virtual ~CodeGenerator() { }
88 91
89 // Accessors. 92 // Accessors.
90 Assembler* assembler() const { return assembler_; } 93 Assembler* assembler() const { return assembler_; }
91 94
92 const ParsedFunction& parsed_function() const { return parsed_function_; } 95 const ParsedFunction& parsed_function() const { return parsed_function_; }
93 96
94 void GenerateCode(); 97 void GenerateCode();
95 virtual void GenerateDeferredCode(); 98 virtual void GenerateDeferredCode();
(...skipping 30 matching lines...) Expand all
126 virtual void CountBackwardLoop(); 129 virtual void CountBackwardLoop();
127 130
128 void GenerateReturnEpilog(ReturnNode* node); 131 void GenerateReturnEpilog(ReturnNode* node);
129 132
130 private: 133 private:
131 // TODO(srdjan): Remove the friendship once the two compilers are properly 134 // TODO(srdjan): Remove the friendship once the two compilers are properly
132 // structured. 135 // structured.
133 friend class OptimizingCodeGenerator; 136 friend class OptimizingCodeGenerator;
134 137
135 // Forward declarations. 138 // Forward declarations.
136 class DescriptorList;
137 class HandlerList; 139 class HandlerList;
138 140
139 // Return true if intrinsification was completed and no other code 141 // Return true if intrinsification was completed and no other code
140 // needs to be generated. 142 // needs to be generated.
141 virtual bool TryIntrinsify() { return false; } 143 virtual bool TryIntrinsify() { return false; }
142 virtual void GeneratePreEntryCode(); 144 virtual void GeneratePreEntryCode();
143 void GenerateLegacyEntryCode(); 145 void GenerateLegacyEntryCode();
144 void GenerateEntryCode(); 146 void GenerateEntryCode();
145 void GenerateLoadVariable(Register dst, const LocalVariable& local); 147 void GenerateLoadVariable(Register dst, const LocalVariable& local);
146 void GeneratePushVariable(const LocalVariable& variable, Register scratch); 148 void GeneratePushVariable(const LocalVariable& variable, Register scratch);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 const ParsedFunction& parsed_function_; 222 const ParsedFunction& parsed_function_;
221 intptr_t locals_space_size_; 223 intptr_t locals_space_size_;
222 CodeGeneratorState* state_; 224 CodeGeneratorState* state_;
223 DescriptorList* pc_descriptors_list_; 225 DescriptorList* pc_descriptors_list_;
224 HandlerList* exception_handlers_list_; 226 HandlerList* exception_handlers_list_;
225 int try_index_; 227 int try_index_;
226 228
227 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeGenerator); 229 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeGenerator);
228 }; 230 };
229 231
232
233 class CodeGenerator::DescriptorList : public ZoneAllocated {
srdjan 2012/02/24 23:13:02 Remove since I have moved it into code_generator.h
Kevin Millikin (Google) 2012/02/27 08:22:07 Thanks, done.
234 public:
235 struct PcDesc {
236 intptr_t pc_offset; // PC offset value of the descriptor.
237 PcDescriptors::Kind kind; // Descriptor kind (kDeopt, kOther).
238 intptr_t node_id; // AST node id.
239 intptr_t token_index; // Token position in source of PC.
240 intptr_t try_index; // Try block index of PC.
241 };
242
243 DescriptorList() : list_() {
244 }
245 ~DescriptorList() { }
246
247 intptr_t Length() const {
248 return list_.length();
249 }
250
251 intptr_t PcOffset(int index) const {
252 return list_[index].pc_offset;
253 }
254 PcDescriptors::Kind Kind(int index) const {
255 return list_[index].kind;
256 }
257 intptr_t NodeId(int index) const {
258 return list_[index].node_id;
259 }
260 intptr_t TokenIndex(int index) const {
261 return list_[index].token_index;
262 }
263 intptr_t TryIndex(int index) const {
264 return list_[index].try_index;
265 }
266
267 void AddDescriptor(PcDescriptors::Kind kind,
268 intptr_t pc_offset,
269 intptr_t node_id,
270 intptr_t token_index,
271 intptr_t try_index) {
272 struct PcDesc data;
273 data.pc_offset = pc_offset;
274 data.kind = kind;
275 data.node_id = node_id;
276 data.token_index = token_index;
277 data.try_index = try_index;
278 list_.Add(data);
279 }
280
281 RawPcDescriptors* FinalizePcDescriptors(uword entry_point) {
282 intptr_t num_descriptors = Length();
283 const PcDescriptors& descriptors =
284 PcDescriptors::Handle(PcDescriptors::New(num_descriptors));
285 for (intptr_t i = 0; i < num_descriptors; i++) {
286 descriptors.AddDescriptor(i,
287 (entry_point + PcOffset(i)),
288 Kind(i),
289 NodeId(i),
290 TokenIndex(i),
291 TryIndex(i));
292 }
293 return descriptors.raw();
294 }
295
296 private:
297 GrowableArray<struct PcDesc> list_;
298 DISALLOW_COPY_AND_ASSIGN(DescriptorList);
299 };
300
301
230 } // namespace dart 302 } // namespace dart
231 303
232 #endif // VM_CODE_GENERATOR_X64_H_ 304 #endif // VM_CODE_GENERATOR_X64_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/code_generator_x64.cc » ('j') | runtime/vm/compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698