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