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 "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
9 #include "src/compiler/instruction.h" | 9 #include "src/compiler/instruction.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 // Assemble instructions for the specified block. | 95 // Assemble instructions for the specified block. |
96 CodeGenResult AssembleBlock(const InstructionBlock* block); | 96 CodeGenResult AssembleBlock(const InstructionBlock* block); |
97 | 97 |
98 // Assemble code for the specified instruction. | 98 // Assemble code for the specified instruction. |
99 CodeGenResult AssembleInstruction(Instruction* instr, | 99 CodeGenResult AssembleInstruction(Instruction* instr, |
100 const InstructionBlock* block); | 100 const InstructionBlock* block); |
101 void AssembleSourcePosition(Instruction* instr); | 101 void AssembleSourcePosition(Instruction* instr); |
102 void AssembleGaps(Instruction* instr); | 102 void AssembleGaps(Instruction* instr); |
103 | 103 |
| 104 // Returns true if a instruction needs to adjust the stack pointer before |
| 105 // execution. The stack slot index to the empty slot above the adjusted stack |
| 106 // pointer is returned in |slot|. |
| 107 bool GetSlotAboveSPAfterGap(Instruction* instr, int* slot); |
| 108 |
104 // =========================================================================== | 109 // =========================================================================== |
105 // ============= Architecture-specific code generation methods. ============== | 110 // ============= Architecture-specific code generation methods. ============== |
106 // =========================================================================== | 111 // =========================================================================== |
107 | 112 |
108 CodeGenResult AssembleArchInstruction(Instruction* instr); | 113 CodeGenResult AssembleArchInstruction(Instruction* instr); |
109 void AssembleArchJump(RpoNumber target); | 114 void AssembleArchJump(RpoNumber target); |
110 void AssembleArchBranch(Instruction* instr, BranchInfo* branch); | 115 void AssembleArchBranch(Instruction* instr, BranchInfo* branch); |
111 void AssembleArchBoolean(Instruction* instr, FlagsCondition condition); | 116 void AssembleArchBoolean(Instruction* instr, FlagsCondition condition); |
112 void AssembleArchLookupSwitch(Instruction* instr); | 117 void AssembleArchLookupSwitch(Instruction* instr); |
113 void AssembleArchTableSwitch(Instruction* instr); | 118 void AssembleArchTableSwitch(Instruction* instr); |
114 | 119 |
115 CodeGenResult AssembleDeoptimizerCall(int deoptimization_id, | 120 CodeGenResult AssembleDeoptimizerCall(int deoptimization_id, |
116 Deoptimizer::BailoutType bailout_type); | 121 Deoptimizer::BailoutType bailout_type); |
117 | 122 |
118 // Generates an architecture-specific, descriptor-specific prologue | 123 // Generates an architecture-specific, descriptor-specific prologue |
119 // to set up a stack frame. | 124 // to set up a stack frame. |
120 void AssembleConstructFrame(); | 125 void AssembleConstructFrame(); |
121 | 126 |
122 // Generates an architecture-specific, descriptor-specific return sequence | 127 // Generates an architecture-specific, descriptor-specific return sequence |
123 // to tear down a stack frame. | 128 // to tear down a stack frame. |
124 void AssembleReturn(); | 129 void AssembleReturn(); |
125 | 130 |
126 // Generates code to deconstruct a the caller's frame, including arguments. | |
127 void AssembleDeconstructActivationRecord(int stack_param_delta); | |
128 | |
129 void AssembleDeconstructFrame(); | 131 void AssembleDeconstructFrame(); |
130 | 132 |
131 // Generates code to manipulate the stack in preparation for a tail call. | 133 // Generates code to manipulate the stack in preparation for a tail call. |
132 void AssemblePrepareTailCall(int stack_param_delta); | 134 void AssemblePrepareTailCall(); |
133 | 135 |
134 // Generates code to pop current frame if it is an arguments adaptor frame. | 136 // Generates code to pop current frame if it is an arguments adaptor frame. |
135 void AssemblePopArgumentsAdaptorFrame(Register args_reg, Register scratch1, | 137 void AssemblePopArgumentsAdaptorFrame(Register args_reg, Register scratch1, |
136 Register scratch2, Register scratch3); | 138 Register scratch2, Register scratch3); |
137 | 139 |
| 140 void AssemblePreGaps(Instruction* instr); |
| 141 void AssemblePostGaps(Instruction* instr); |
| 142 |
138 // =========================================================================== | 143 // =========================================================================== |
139 // ============== Architecture-specific gap resolver methods. ================ | 144 // ============== Architecture-specific gap resolver methods. ================ |
140 // =========================================================================== | 145 // =========================================================================== |
141 | 146 |
142 // Interface used by the gap resolver to emit moves and swaps. | 147 // Interface used by the gap resolver to emit moves and swaps. |
143 void AssembleMove(InstructionOperand* source, | 148 void AssembleMove(InstructionOperand* source, |
144 InstructionOperand* destination) final; | 149 InstructionOperand* destination) final; |
145 void AssembleSwap(InstructionOperand* source, | 150 void AssembleSwap(InstructionOperand* source, |
146 InstructionOperand* destination) final; | 151 InstructionOperand* destination) final; |
147 | 152 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 OutputFrameStateCombine combine, | 185 OutputFrameStateCombine combine, |
181 Translation* translation); | 186 Translation* translation); |
182 void AddTranslationForOperand(Translation* translation, Instruction* instr, | 187 void AddTranslationForOperand(Translation* translation, Instruction* instr, |
183 InstructionOperand* op, MachineType type); | 188 InstructionOperand* op, MachineType type); |
184 void EnsureSpaceForLazyDeopt(); | 189 void EnsureSpaceForLazyDeopt(); |
185 void MarkLazyDeoptSite(); | 190 void MarkLazyDeoptSite(); |
186 | 191 |
187 DeoptimizationExit* AddDeoptimizationExit(Instruction* instr, | 192 DeoptimizationExit* AddDeoptimizationExit(Instruction* instr, |
188 size_t frame_state_offset); | 193 size_t frame_state_offset); |
189 | 194 |
190 // Converts the delta in the number of stack parameter passed from a tail | |
191 // caller to the callee into the distance (in pointers) the SP must be | |
192 // adjusted, taking frame elision and other relevant factors into | |
193 // consideration. | |
194 int TailCallFrameStackSlotDelta(int stack_param_delta); | |
195 | |
196 // =========================================================================== | 195 // =========================================================================== |
197 | 196 |
198 struct DeoptimizationState : ZoneObject { | 197 struct DeoptimizationState : ZoneObject { |
199 public: | 198 public: |
200 BailoutId bailout_id() const { return bailout_id_; } | 199 BailoutId bailout_id() const { return bailout_id_; } |
201 int translation_id() const { return translation_id_; } | 200 int translation_id() const { return translation_id_; } |
202 int pc_offset() const { return pc_offset_; } | 201 int pc_offset() const { return pc_offset_; } |
203 | 202 |
204 DeoptimizationState(BailoutId bailout_id, int translation_id, int pc_offset) | 203 DeoptimizationState(BailoutId bailout_id, int translation_id, int pc_offset) |
205 : bailout_id_(bailout_id), | 204 : bailout_id_(bailout_id), |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 JumpTable* jump_tables_; | 240 JumpTable* jump_tables_; |
242 OutOfLineCode* ools_; | 241 OutOfLineCode* ools_; |
243 int osr_pc_offset_; | 242 int osr_pc_offset_; |
244 }; | 243 }; |
245 | 244 |
246 } // namespace compiler | 245 } // namespace compiler |
247 } // namespace internal | 246 } // namespace internal |
248 } // namespace v8 | 247 } // namespace v8 |
249 | 248 |
250 #endif // V8_COMPILER_CODE_GENERATOR_H | 249 #endif // V8_COMPILER_CODE_GENERATOR_H |
OLD | NEW |