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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 InstructionSequence* code, CompilationInfo* info); | 50 InstructionSequence* code, CompilationInfo* info); |
51 | 51 |
52 // Generate native code. | 52 // Generate native code. |
53 Handle<Code> GenerateCode(); | 53 Handle<Code> GenerateCode(); |
54 | 54 |
55 InstructionSequence* code() const { return code_; } | 55 InstructionSequence* code() const { return code_; } |
56 FrameAccessState* frame_access_state() const { return frame_access_state_; } | 56 FrameAccessState* frame_access_state() const { return frame_access_state_; } |
57 Frame* frame() const { return frame_access_state_->frame(); } | 57 Frame* frame() const { return frame_access_state_->frame(); } |
58 Isolate* isolate() const { return info_->isolate(); } | 58 Isolate* isolate() const { return info_->isolate(); } |
59 Linkage* linkage() const { return linkage_; } | 59 Linkage* linkage() const { return linkage_; } |
60 | 60 bool deconstruct_frame_when_leaving() const { |
61 return deconstruct_frame_when_leaving_; | |
62 } | |
63 void set_deconstruct_frame_when_leaving(bool deconstruct) { | |
64 deconstruct_frame_when_leaving_ = deconstruct; | |
65 } | |
66 bool deconstruct_frame_between_blocks() const { | |
67 return deconstruct_frame_between_blocks_; | |
68 } | |
69 void set_deconstruct_frame_between_blocks(bool deconstruct) { | |
70 deconstruct_frame_between_blocks_ = deconstruct; | |
71 } | |
61 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; } | 72 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; } |
62 | 73 |
63 private: | 74 private: |
64 MacroAssembler* masm() { return &masm_; } | 75 MacroAssembler* masm() { return &masm_; } |
65 GapResolver* resolver() { return &resolver_; } | 76 GapResolver* resolver() { return &resolver_; } |
66 SafepointTableBuilder* safepoints() { return &safepoints_; } | 77 SafepointTableBuilder* safepoints() { return &safepoints_; } |
67 Zone* zone() const { return code()->zone(); } | 78 Zone* zone() const { return code()->zone(); } |
68 CompilationInfo* info() const { return info_; } | 79 CompilationInfo* info() const { return info_; } |
69 | 80 |
70 // Checks if {block} will appear directly after {current_block_} when | 81 // Checks if {block} will appear directly after {current_block_} when |
(...skipping 28 matching lines...) Expand all Loading... | |
99 void AssembleArchBoolean(Instruction* instr, FlagsCondition condition); | 110 void AssembleArchBoolean(Instruction* instr, FlagsCondition condition); |
100 void AssembleArchLookupSwitch(Instruction* instr); | 111 void AssembleArchLookupSwitch(Instruction* instr); |
101 void AssembleArchTableSwitch(Instruction* instr); | 112 void AssembleArchTableSwitch(Instruction* instr); |
102 | 113 |
103 void AssembleDeoptimizerCall(int deoptimization_id, | 114 void AssembleDeoptimizerCall(int deoptimization_id, |
104 Deoptimizer::BailoutType bailout_type); | 115 Deoptimizer::BailoutType bailout_type); |
105 | 116 |
106 // Generates an architecture-specific, descriptor-specific prologue | 117 // Generates an architecture-specific, descriptor-specific prologue |
107 // to set up a stack frame. | 118 // to set up a stack frame. |
108 void AssemblePrologue(); | 119 void AssemblePrologue(); |
120 | |
121 // Setup the type of frame access, and the occupied slots, based on the | |
122 // needs of the block. | |
123 void SetupFrameAccessForBlock(const InstructionBlock* block); | |
124 | |
125 void SetupStackPointer(); | |
126 | |
109 // Generates an architecture-specific, descriptor-specific return sequence | 127 // Generates an architecture-specific, descriptor-specific return sequence |
110 // to tear down a stack frame. | 128 // to tear down a stack frame. |
111 void AssembleReturn(); | 129 void AssembleReturn(); |
112 | 130 |
113 // Generates code to deconstruct a the caller's frame, including arguments. | 131 // Generates code to deconstruct a the caller's frame, including arguments. |
114 void AssembleDeconstructActivationRecord(int stack_param_delta); | 132 void AssembleDeconstructActivationRecord(int stack_param_delta); |
115 | 133 |
134 void AssembleDeconstructFrameWhenLeaving() { | |
135 if (deconstruct_frame_when_leaving()) { | |
136 AssembleDeconstructFrame(); | |
137 set_deconstruct_frame_between_blocks(false); | |
138 set_deconstruct_frame_when_leaving(false); | |
139 } | |
140 } | |
141 | |
142 void AssembleDeconstructFrameBetweenBlocks() { | |
143 if (deconstruct_frame_between_blocks()) { | |
144 AssembleDeconstructFrame(); | |
145 set_deconstruct_frame_between_blocks(false); | |
146 set_deconstruct_frame_when_leaving(false); | |
147 } | |
148 } | |
149 | |
150 void AssembleDeconstructFrame(); | |
151 | |
116 // Generates code to manipulate the stack in preparation for a tail call. | 152 // Generates code to manipulate the stack in preparation for a tail call. |
117 void AssemblePrepareTailCall(int stack_param_delta); | 153 void AssemblePrepareTailCall(int stack_param_delta); |
118 | 154 |
119 // Generates code to pop current frame if it is an arguments adaptor frame. | 155 // Generates code to pop current frame if it is an arguments adaptor frame. |
120 void AssemblePopArgumentsAdaptorFrame(Register args_reg, Register scratch1, | 156 void AssemblePopArgumentsAdaptorFrame(Register args_reg, Register scratch1, |
121 Register scratch2, Register scratch3); | 157 Register scratch2, Register scratch3); |
122 | 158 |
123 // =========================================================================== | 159 // =========================================================================== |
124 // ============== Architecture-specific gap resolver methods. ================ | 160 // ============== Architecture-specific gap resolver methods. ================ |
125 // =========================================================================== | 161 // =========================================================================== |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 ZoneVector<HandlerInfo> handlers_; | 256 ZoneVector<HandlerInfo> handlers_; |
221 ZoneDeque<DeoptimizationExit*> deoptimization_exits_; | 257 ZoneDeque<DeoptimizationExit*> deoptimization_exits_; |
222 ZoneDeque<DeoptimizationState*> deoptimization_states_; | 258 ZoneDeque<DeoptimizationState*> deoptimization_states_; |
223 ZoneDeque<Handle<Object>> deoptimization_literals_; | 259 ZoneDeque<Handle<Object>> deoptimization_literals_; |
224 size_t inlined_function_count_; | 260 size_t inlined_function_count_; |
225 TranslationBuffer translations_; | 261 TranslationBuffer translations_; |
226 int last_lazy_deopt_pc_; | 262 int last_lazy_deopt_pc_; |
227 JumpTable* jump_tables_; | 263 JumpTable* jump_tables_; |
228 OutOfLineCode* ools_; | 264 OutOfLineCode* ools_; |
229 int osr_pc_offset_; | 265 int osr_pc_offset_; |
266 bool deconstruct_frame_when_leaving_; | |
danno
2016/03/16 18:18:11
I don't think you want this variable here, I think
Mircea Trofin
2016/03/16 20:20:46
I agree, this was from my 3 month old prototype.
| |
267 bool deconstruct_frame_between_blocks_; | |
danno
2016/03/16 18:18:11
I don't think this boolean belongs here at all. Se
| |
230 }; | 268 }; |
231 | 269 |
232 } // namespace compiler | 270 } // namespace compiler |
233 } // namespace internal | 271 } // namespace internal |
234 } // namespace v8 | 272 } // namespace v8 |
235 | 273 |
236 #endif // V8_COMPILER_CODE_GENERATOR_H | 274 #endif // V8_COMPILER_CODE_GENERATOR_H |
OLD | NEW |