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 // Generates native code for a sequence of instructions. | 20 // Generates native code for a sequence of instructions. |
21 class CodeGenerator V8_FINAL : public GapResolver::Assembler { | 21 class CodeGenerator FINAL : public GapResolver::Assembler { |
22 public: | 22 public: |
23 explicit CodeGenerator(InstructionSequence* code); | 23 explicit CodeGenerator(InstructionSequence* code); |
24 | 24 |
25 // Generate native code. | 25 // Generate native code. |
26 Handle<Code> GenerateCode(); | 26 Handle<Code> GenerateCode(); |
27 | 27 |
28 InstructionSequence* code() const { return code_; } | 28 InstructionSequence* code() const { return code_; } |
29 Frame* frame() const { return code()->frame(); } | 29 Frame* frame() const { return code()->frame(); } |
30 Graph* graph() const { return code()->graph(); } | 30 Graph* graph() const { return code()->graph(); } |
31 Isolate* isolate() const { return zone()->isolate(); } | 31 Isolate* isolate() const { return zone()->isolate(); } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // Generates an architecture-specific, descriptor-specific return sequence | 70 // Generates an architecture-specific, descriptor-specific return sequence |
71 // to tear down a stack frame. | 71 // to tear down a stack frame. |
72 void AssembleReturn(); | 72 void AssembleReturn(); |
73 | 73 |
74 // =========================================================================== | 74 // =========================================================================== |
75 // ============== Architecture-specific gap resolver methods. ================ | 75 // ============== Architecture-specific gap resolver methods. ================ |
76 // =========================================================================== | 76 // =========================================================================== |
77 | 77 |
78 // Interface used by the gap resolver to emit moves and swaps. | 78 // Interface used by the gap resolver to emit moves and swaps. |
79 virtual void AssembleMove(InstructionOperand* source, | 79 virtual void AssembleMove(InstructionOperand* source, |
80 InstructionOperand* destination) V8_OVERRIDE; | 80 InstructionOperand* destination) OVERRIDE; |
81 virtual void AssembleSwap(InstructionOperand* source, | 81 virtual void AssembleSwap(InstructionOperand* source, |
82 InstructionOperand* destination) V8_OVERRIDE; | 82 InstructionOperand* destination) OVERRIDE; |
83 | 83 |
84 // =========================================================================== | 84 // =========================================================================== |
85 // Deoptimization table construction | 85 // Deoptimization table construction |
86 void AddSafepointAndDeopt(Instruction* instr); | 86 void AddSafepointAndDeopt(Instruction* instr); |
87 void EmitLazyDeoptimizationCallTable(); | 87 void EmitLazyDeoptimizationCallTable(); |
88 void PopulateDeoptimizationData(Handle<Code> code); | 88 void PopulateDeoptimizationData(Handle<Code> code); |
89 int DefineDeoptimizationLiteral(Handle<Object> literal); | 89 int DefineDeoptimizationLiteral(Handle<Object> literal); |
90 FrameStateDescriptor* GetFrameStateDescriptor(Instruction* instr, | 90 FrameStateDescriptor* GetFrameStateDescriptor(Instruction* instr, |
91 int frame_state_offset); | 91 int frame_state_offset); |
92 int BuildTranslation(Instruction* instr, int frame_state_offset, | 92 int BuildTranslation(Instruction* instr, int frame_state_offset, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 ZoneDeque<DeoptimizationState*> deoptimization_states_; | 141 ZoneDeque<DeoptimizationState*> deoptimization_states_; |
142 ZoneDeque<Handle<Object> > deoptimization_literals_; | 142 ZoneDeque<Handle<Object> > deoptimization_literals_; |
143 TranslationBuffer translations_; | 143 TranslationBuffer translations_; |
144 }; | 144 }; |
145 | 145 |
146 } // namespace compiler | 146 } // namespace compiler |
147 } // namespace internal | 147 } // namespace internal |
148 } // namespace v8 | 148 } // namespace v8 |
149 | 149 |
150 #endif // V8_COMPILER_CODE_GENERATOR_H | 150 #endif // V8_COMPILER_CODE_GENERATOR_H |
OLD | NEW |