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

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

Issue 9447102: Implement x64 compilation for loading and storing local variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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
11 11
12 #include "vm/assembler.h" 12 #include "vm/assembler.h"
13 #include "vm/code_generator.h" 13 #include "vm/code_generator.h"
14 #include "vm/intermediate_language.h" 14 #include "vm/intermediate_language.h"
15 15
16 namespace dart { 16 namespace dart {
17 17
18 class ParsedFunction; 18 class ParsedFunction;
19 19
20 class FlowGraphCompiler : public InstructionVisitor { 20 class FlowGraphCompiler : public FlowGraphVisitor {
21 public: 21 public:
22 FlowGraphCompiler(Assembler* assembler, 22 FlowGraphCompiler(Assembler* assembler,
23 const ParsedFunction& parsed_function, 23 const ParsedFunction& parsed_function,
24 const GrowableArray<BlockEntryInstr*>* blocks) 24 const GrowableArray<BlockEntryInstr*>* blocks)
25 : assembler_(assembler), 25 : assembler_(assembler),
26 parsed_function_(parsed_function), 26 parsed_function_(parsed_function),
27 blocks_(blocks), 27 blocks_(blocks),
28 pc_descriptors_list_(new CodeGenerator::DescriptorList()) { } 28 pc_descriptors_list_(new CodeGenerator::DescriptorList()),
29 stack_local_count_(0) { }
29 30
30 virtual ~FlowGraphCompiler() { } 31 virtual ~FlowGraphCompiler() { }
31 32
32 void CompileGraph(); 33 void CompileGraph();
33 34
34 private: 35 private:
36 int stack_local_count() const { return stack_local_count_; }
37 void set_stack_local_count(int count) { stack_local_count_ = count; }
38
35 // Bail out of the flow graph compiler. Does not return to the caller. 39 // Bail out of the flow graph compiler. Does not return to the caller.
36 void Bailout(const char* reason); 40 void Bailout(const char* reason);
37 41
42 // Emit code to perform a computation, leaving its value in RAX.
43 #define DECLARE_VISIT_COMPUTATION(ShortName, ClassName) \
44 virtual void Visit##ShortName(ClassName* comp);
45
38 // Each visit function compiles a type of instruction. 46 // Each visit function compiles a type of instruction.
39 #define DECLARE_VISIT(type) \ 47 #define DECLARE_VISIT_INSTRUCTION(ShortName) \
40 virtual void Visit##type(type##Instr* instr); 48 virtual void Visit##ShortName(ShortName##Instr* instr);
41 FOR_EACH_INSTRUCTION(DECLARE_VISIT) 49
42 #undef DECLARE_VISIT 50 FOR_EACH_COMPUTATION(DECLARE_VISIT_COMPUTATION)
51 FOR_EACH_INSTRUCTION(DECLARE_VISIT_INSTRUCTION)
52
53 #undef DECLARE_VISIT_COMPUTATION
54 #undef DECLARE_VISIT_INSTRUCTION
43 55
44 // Emit code to load a Value into register RAX. 56 // Emit code to load a Value into register RAX.
45 void LoadValue(Value* value); 57 void LoadValue(Value* value);
46 58
47 // Infrastructure copied from class CodeGenerator. 59 // Infrastructure copied from class CodeGenerator.
48 void GenerateCallRuntime(intptr_t node_id, 60 void GenerateCallRuntime(intptr_t node_id,
49 intptr_t token_index, 61 intptr_t token_index,
50 const RuntimeEntry& entry); 62 const RuntimeEntry& entry);
51 void AddCurrentDescriptor(PcDescriptors::Kind kind, 63 void AddCurrentDescriptor(PcDescriptors::Kind kind,
52 intptr_t node_id, 64 intptr_t node_id,
53 intptr_t token_index); 65 intptr_t token_index);
54 66
55 Assembler* assembler_; 67 Assembler* assembler_;
56 const ParsedFunction& parsed_function_; 68 const ParsedFunction& parsed_function_;
57 const GrowableArray<BlockEntryInstr*>* blocks_; 69 const GrowableArray<BlockEntryInstr*>* blocks_;
58 70
59 CodeGenerator::DescriptorList* pc_descriptors_list_; 71 CodeGenerator::DescriptorList* pc_descriptors_list_;
72 int stack_local_count_;
60 73
61 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); 74 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler);
62 }; 75 };
63 76
64 } // namespace dart 77 } // namespace dart
65 78
66 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_ 79 #endif // VM_FLOW_GRAPH_COMPILER_X64_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698