Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Side by Side Diff: src/compiler/code-generator.h

Issue 1460183002: [turbofan] Add general support for sp-based frame access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: All platforms Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/frame-access-state.h"
titzer 2015/11/23 20:00:54 You don't need this include if you forward declare
danno 2015/11/24 12:02:00 Done.
8 #include "src/compiler/gap-resolver.h" 9 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/instruction.h" 10 #include "src/compiler/instruction.h"
10 #include "src/deoptimizer.h" 11 #include "src/deoptimizer.h"
11 #include "src/macro-assembler.h" 12 #include "src/macro-assembler.h"
12 #include "src/safepoint-table.h" 13 #include "src/safepoint-table.h"
13 14
14 namespace v8 { 15 namespace v8 {
15 namespace internal { 16 namespace internal {
16 namespace compiler { 17 namespace compiler {
17 18
18 // Forward declarations. 19 // Forward declarations.
20 class FrameAccessState;
19 class Linkage; 21 class Linkage;
20 class OutOfLineCode; 22 class OutOfLineCode;
21 23
22 struct BranchInfo { 24 struct BranchInfo {
23 FlagsCondition condition; 25 FlagsCondition condition;
24 Label* true_label; 26 Label* true_label;
25 Label* false_label; 27 Label* false_label;
26 bool fallthru; 28 bool fallthru;
27 }; 29 };
28 30
29 31
30 // Generates native code for a sequence of instructions. 32 // Generates native code for a sequence of instructions.
31 class CodeGenerator final : public GapResolver::Assembler { 33 class CodeGenerator final : public GapResolver::Assembler {
32 public: 34 public:
33 explicit CodeGenerator(Frame* frame, Linkage* linkage, 35 explicit CodeGenerator(Frame* frame, Linkage* linkage,
34 InstructionSequence* code, CompilationInfo* info); 36 InstructionSequence* code, CompilationInfo* info);
35 37
36 // Generate native code. 38 // Generate native code.
37 Handle<Code> GenerateCode(); 39 Handle<Code> GenerateCode();
38 40
39 InstructionSequence* code() const { return code_; } 41 InstructionSequence* code() const { return code_; }
40 Frame* frame() const { return frame_; } 42 FrameAccessState* frame_access_state() const { return frame_access_state_; }
43 Frame* const frame() const { return frame_access_state_->frame(); }
41 Isolate* isolate() const { return info_->isolate(); } 44 Isolate* isolate() const { return info_->isolate(); }
42 Linkage* linkage() const { return linkage_; } 45 Linkage* linkage() const { return linkage_; }
43 46
44 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; } 47 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; }
45 48
46 private: 49 private:
47 MacroAssembler* masm() { return &masm_; } 50 MacroAssembler* masm() { return &masm_; }
48 GapResolver* resolver() { return &resolver_; } 51 GapResolver* resolver() { return &resolver_; }
49 SafepointTableBuilder* safepoints() { return &safepoints_; } 52 SafepointTableBuilder* safepoints() { return &safepoints_; }
50 Zone* zone() const { return code()->zone(); } 53 Zone* zone() const { return code()->zone(); }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // Emits a jump table. 124 // Emits a jump table.
122 void AssembleJumpTable(Label** targets, size_t target_count); 125 void AssembleJumpTable(Label** targets, size_t target_count);
123 126
124 // =========================================================================== 127 // ===========================================================================
125 // ================== Deoptimization table construction. ===================== 128 // ================== Deoptimization table construction. =====================
126 // =========================================================================== 129 // ===========================================================================
127 130
128 void RecordCallPosition(Instruction* instr); 131 void RecordCallPosition(Instruction* instr);
129 void PopulateDeoptimizationData(Handle<Code> code); 132 void PopulateDeoptimizationData(Handle<Code> code);
130 int DefineDeoptimizationLiteral(Handle<Object> literal); 133 int DefineDeoptimizationLiteral(Handle<Object> literal);
131 FrameStateDescriptor* GetFrameStateDescriptor(Instruction* instr, 134 FrameStateDescriptor* GetFrameStateDescriptor(
132 size_t frame_state_offset); 135 Instruction* instr, size_t frame_access_state_offset);
133 int BuildTranslation(Instruction* instr, int pc_offset, 136 int BuildTranslation(Instruction* instr, int pc_offset,
134 size_t frame_state_offset, 137 size_t frame_access_state_offset,
135 OutputFrameStateCombine state_combine); 138 OutputFrameStateCombine state_combine);
136 void BuildTranslationForFrameStateDescriptor( 139 void BuildTranslationForFrameStateDescriptor(
137 FrameStateDescriptor* descriptor, Instruction* instr, 140 FrameStateDescriptor* descriptor, Instruction* instr,
138 Translation* translation, size_t frame_state_offset, 141 Translation* translation, size_t frame_access_state_offset,
139 OutputFrameStateCombine state_combine); 142 OutputFrameStateCombine state_combine);
140 void AddTranslationForOperand(Translation* translation, Instruction* instr, 143 void AddTranslationForOperand(Translation* translation, Instruction* instr,
141 InstructionOperand* op, MachineType type); 144 InstructionOperand* op, MachineType type);
142 void AddNopForSmiCodeInlining(); 145 void AddNopForSmiCodeInlining();
143 void EnsureSpaceForLazyDeopt(); 146 void EnsureSpaceForLazyDeopt();
144 void MarkLazyDeoptSite(); 147 void MarkLazyDeoptSite();
145 148
146 // Converts the delta in the number of stack parameter passed from a tail 149 // Converts the delta in the number of stack parameter passed from a tail
147 // caller to the callee into the distance (in pointers) the SP must be 150 // caller to the callee into the distance (in pointers) the SP must be
148 // adjusted, taking frame elision and other relevant factors into 151 // adjusted, taking frame elision and other relevant factors into
(...skipping 20 matching lines...) Expand all
169 }; 172 };
170 173
171 struct HandlerInfo { 174 struct HandlerInfo {
172 bool caught_locally; 175 bool caught_locally;
173 Label* handler; 176 Label* handler;
174 int pc_offset; 177 int pc_offset;
175 }; 178 };
176 179
177 friend class OutOfLineCode; 180 friend class OutOfLineCode;
178 181
179 Frame* const frame_; 182 FrameAccessState* frame_access_state_;
180 Linkage* const linkage_; 183 Linkage* const linkage_;
181 InstructionSequence* const code_; 184 InstructionSequence* const code_;
182 CompilationInfo* const info_; 185 CompilationInfo* const info_;
183 Label* const labels_; 186 Label* const labels_;
184 Label return_label_; 187 Label return_label_;
185 RpoNumber current_block_; 188 RpoNumber current_block_;
186 SourcePosition current_source_position_; 189 SourcePosition current_source_position_;
187 MacroAssembler masm_; 190 MacroAssembler masm_;
188 GapResolver resolver_; 191 GapResolver resolver_;
189 SafepointTableBuilder safepoints_; 192 SafepointTableBuilder safepoints_;
190 ZoneVector<HandlerInfo> handlers_; 193 ZoneVector<HandlerInfo> handlers_;
191 ZoneDeque<DeoptimizationState*> deoptimization_states_; 194 ZoneDeque<DeoptimizationState*> deoptimization_states_;
192 ZoneDeque<Handle<Object>> deoptimization_literals_; 195 ZoneDeque<Handle<Object>> deoptimization_literals_;
193 size_t inlined_function_count_; 196 size_t inlined_function_count_;
194 TranslationBuffer translations_; 197 TranslationBuffer translations_;
195 int last_lazy_deopt_pc_; 198 int last_lazy_deopt_pc_;
196 JumpTable* jump_tables_; 199 JumpTable* jump_tables_;
197 OutOfLineCode* ools_; 200 OutOfLineCode* ools_;
198 int osr_pc_offset_; 201 int osr_pc_offset_;
199 bool needs_frame_;
200 }; 202 };
201 203
202 } // namespace compiler 204 } // namespace compiler
203 } // namespace internal 205 } // namespace internal
204 } // namespace v8 206 } // namespace v8
205 207
206 #endif // V8_COMPILER_CODE_GENERATOR_H 208 #endif // V8_COMPILER_CODE_GENERATOR_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698