OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_CODE_GENERATOR_H_ | 5 #ifndef V8_COMPILER_CODE_GENERATOR_H_ |
6 #define V8_COMPILER_CODE_GENERATOR_H_ | 6 #define V8_COMPILER_CODE_GENERATOR_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "src/compiler/gap-resolver.h" | 10 #include "src/compiler/gap-resolver.h" |
11 #include "src/compiler/instruction.h" | 11 #include "src/compiler/instruction.h" |
12 #include "src/deoptimizer.h" | 12 #include "src/deoptimizer.h" |
13 #include "src/macro-assembler.h" | 13 #include "src/macro-assembler.h" |
14 #include "src/safepoint-table.h" | 14 #include "src/safepoint-table.h" |
15 | 15 |
16 namespace v8 { | 16 namespace v8 { |
17 namespace internal { | 17 namespace internal { |
18 namespace compiler { | 18 namespace compiler { |
19 | 19 |
20 class Linkage; | 20 class Linkage; |
21 | 21 |
| 22 struct BranchInfo { |
| 23 FlagsCondition condition; |
| 24 Label* true_label; |
| 25 Label* false_label; |
| 26 bool fallthru; |
| 27 }; |
| 28 |
| 29 |
22 // Generates native code for a sequence of instructions. | 30 // Generates native code for a sequence of instructions. |
23 class CodeGenerator FINAL : public GapResolver::Assembler { | 31 class CodeGenerator FINAL : public GapResolver::Assembler { |
24 public: | 32 public: |
25 explicit CodeGenerator(Frame* frame, Linkage* linkage, | 33 explicit CodeGenerator(Frame* frame, Linkage* linkage, |
26 InstructionSequence* code, CompilationInfo* info); | 34 InstructionSequence* code, CompilationInfo* info); |
27 | 35 |
28 // Generate native code. | 36 // Generate native code. |
29 Handle<Code> GenerateCode(); | 37 Handle<Code> GenerateCode(); |
30 | 38 |
31 InstructionSequence* code() const { return code_; } | 39 InstructionSequence* code() const { return code_; } |
(...skipping 21 matching lines...) Expand all Loading... |
53 // Assemble code for the specified instruction. | 61 // Assemble code for the specified instruction. |
54 void AssembleInstruction(Instruction* instr); | 62 void AssembleInstruction(Instruction* instr); |
55 void AssembleSourcePosition(SourcePositionInstruction* instr); | 63 void AssembleSourcePosition(SourcePositionInstruction* instr); |
56 void AssembleGap(GapInstruction* gap); | 64 void AssembleGap(GapInstruction* gap); |
57 | 65 |
58 // =========================================================================== | 66 // =========================================================================== |
59 // ============= Architecture-specific code generation methods. ============== | 67 // ============= Architecture-specific code generation methods. ============== |
60 // =========================================================================== | 68 // =========================================================================== |
61 | 69 |
62 void AssembleArchInstruction(Instruction* instr); | 70 void AssembleArchInstruction(Instruction* instr); |
63 void AssembleArchBranch(Instruction* instr, FlagsCondition condition); | 71 void AssembleArchJump(BasicBlock::RpoNumber target); |
| 72 void AssembleArchBranch(Instruction* instr, BranchInfo* branch); |
64 void AssembleArchBoolean(Instruction* instr, FlagsCondition condition); | 73 void AssembleArchBoolean(Instruction* instr, FlagsCondition condition); |
65 | 74 |
66 void AssembleDeoptimizerCall(int deoptimization_id); | 75 void AssembleDeoptimizerCall(int deoptimization_id); |
67 | 76 |
68 // Generates an architecture-specific, descriptor-specific prologue | 77 // Generates an architecture-specific, descriptor-specific prologue |
69 // to set up a stack frame. | 78 // to set up a stack frame. |
70 void AssemblePrologue(); | 79 void AssemblePrologue(); |
71 // Generates an architecture-specific, descriptor-specific return sequence | 80 // Generates an architecture-specific, descriptor-specific return sequence |
72 // to tear down a stack frame. | 81 // to tear down a stack frame. |
73 void AssembleReturn(); | 82 void AssembleReturn(); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 ZoneDeque<Handle<Object> > deoptimization_literals_; | 143 ZoneDeque<Handle<Object> > deoptimization_literals_; |
135 TranslationBuffer translations_; | 144 TranslationBuffer translations_; |
136 int last_lazy_deopt_pc_; | 145 int last_lazy_deopt_pc_; |
137 }; | 146 }; |
138 | 147 |
139 } // namespace compiler | 148 } // namespace compiler |
140 } // namespace internal | 149 } // namespace internal |
141 } // namespace v8 | 150 } // namespace v8 |
142 | 151 |
143 #endif // V8_COMPILER_CODE_GENERATOR_H | 152 #endif // V8_COMPILER_CODE_GENERATOR_H |
OLD | NEW |