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

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: Last comment addressed 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
« no previous file with comments | « src/compiler/arm64/code-generator-arm64.cc ('k') | src/compiler/code-generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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"
11 #include "src/macro-assembler.h" 11 #include "src/macro-assembler.h"
12 #include "src/safepoint-table.h" 12 #include "src/safepoint-table.h"
13 13
14 namespace v8 { 14 namespace v8 {
15 namespace internal { 15 namespace internal {
16 namespace compiler { 16 namespace compiler {
17 17
18 // Forward declarations. 18 // Forward declarations.
19 class FrameAccessState;
19 class Linkage; 20 class Linkage;
20 class OutOfLineCode; 21 class OutOfLineCode;
21 22
22 struct BranchInfo { 23 struct BranchInfo {
23 FlagsCondition condition; 24 FlagsCondition condition;
24 Label* true_label; 25 Label* true_label;
25 Label* false_label; 26 Label* false_label;
26 bool fallthru; 27 bool fallthru;
27 }; 28 };
28 29
29 30
30 // Generates native code for a sequence of instructions. 31 // Generates native code for a sequence of instructions.
31 class CodeGenerator final : public GapResolver::Assembler { 32 class CodeGenerator final : public GapResolver::Assembler {
32 public: 33 public:
33 explicit CodeGenerator(Frame* frame, Linkage* linkage, 34 explicit CodeGenerator(Frame* frame, Linkage* linkage,
34 InstructionSequence* code, CompilationInfo* info); 35 InstructionSequence* code, CompilationInfo* info);
35 36
36 // Generate native code. 37 // Generate native code.
37 Handle<Code> GenerateCode(); 38 Handle<Code> GenerateCode();
38 39
39 InstructionSequence* code() const { return code_; } 40 InstructionSequence* code() const { return code_; }
40 Frame* frame() const { return frame_; } 41 FrameAccessState* frame_access_state() const { return frame_access_state_; }
42 Frame* const frame() const { return frame_access_state_->frame(); }
41 Isolate* isolate() const { return info_->isolate(); } 43 Isolate* isolate() const { return info_->isolate(); }
42 Linkage* linkage() const { return linkage_; } 44 Linkage* linkage() const { return linkage_; }
43 45
44 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; } 46 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; }
45 47
46 private: 48 private:
47 MacroAssembler* masm() { return &masm_; } 49 MacroAssembler* masm() { return &masm_; }
48 GapResolver* resolver() { return &resolver_; } 50 GapResolver* resolver() { return &resolver_; }
49 SafepointTableBuilder* safepoints() { return &safepoints_; } 51 SafepointTableBuilder* safepoints() { return &safepoints_; }
50 Zone* zone() const { return code()->zone(); } 52 Zone* zone() const { return code()->zone(); }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // Emits a jump table. 123 // Emits a jump table.
122 void AssembleJumpTable(Label** targets, size_t target_count); 124 void AssembleJumpTable(Label** targets, size_t target_count);
123 125
124 // =========================================================================== 126 // ===========================================================================
125 // ================== Deoptimization table construction. ===================== 127 // ================== Deoptimization table construction. =====================
126 // =========================================================================== 128 // ===========================================================================
127 129
128 void RecordCallPosition(Instruction* instr); 130 void RecordCallPosition(Instruction* instr);
129 void PopulateDeoptimizationData(Handle<Code> code); 131 void PopulateDeoptimizationData(Handle<Code> code);
130 int DefineDeoptimizationLiteral(Handle<Object> literal); 132 int DefineDeoptimizationLiteral(Handle<Object> literal);
131 FrameStateDescriptor* GetFrameStateDescriptor(Instruction* instr, 133 FrameStateDescriptor* GetFrameStateDescriptor(
132 size_t frame_state_offset); 134 Instruction* instr, size_t frame_access_state_offset);
133 int BuildTranslation(Instruction* instr, int pc_offset, 135 int BuildTranslation(Instruction* instr, int pc_offset,
134 size_t frame_state_offset, 136 size_t frame_access_state_offset,
135 OutputFrameStateCombine state_combine); 137 OutputFrameStateCombine state_combine);
136 void BuildTranslationForFrameStateDescriptor( 138 void BuildTranslationForFrameStateDescriptor(
137 FrameStateDescriptor* descriptor, Instruction* instr, 139 FrameStateDescriptor* descriptor, Instruction* instr,
138 Translation* translation, size_t frame_state_offset, 140 Translation* translation, size_t frame_access_state_offset,
139 OutputFrameStateCombine state_combine); 141 OutputFrameStateCombine state_combine);
140 void AddTranslationForOperand(Translation* translation, Instruction* instr, 142 void AddTranslationForOperand(Translation* translation, Instruction* instr,
141 InstructionOperand* op, MachineType type); 143 InstructionOperand* op, MachineType type);
142 void AddNopForSmiCodeInlining(); 144 void AddNopForSmiCodeInlining();
143 void EnsureSpaceForLazyDeopt(); 145 void EnsureSpaceForLazyDeopt();
144 void MarkLazyDeoptSite(); 146 void MarkLazyDeoptSite();
145 147
146 // Converts the delta in the number of stack parameter passed from a tail 148 // 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 149 // caller to the callee into the distance (in pointers) the SP must be
148 // adjusted, taking frame elision and other relevant factors into 150 // adjusted, taking frame elision and other relevant factors into
(...skipping 20 matching lines...) Expand all
169 }; 171 };
170 172
171 struct HandlerInfo { 173 struct HandlerInfo {
172 bool caught_locally; 174 bool caught_locally;
173 Label* handler; 175 Label* handler;
174 int pc_offset; 176 int pc_offset;
175 }; 177 };
176 178
177 friend class OutOfLineCode; 179 friend class OutOfLineCode;
178 180
179 Frame* const frame_; 181 FrameAccessState* frame_access_state_;
180 Linkage* const linkage_; 182 Linkage* const linkage_;
181 InstructionSequence* const code_; 183 InstructionSequence* const code_;
182 CompilationInfo* const info_; 184 CompilationInfo* const info_;
183 Label* const labels_; 185 Label* const labels_;
184 Label return_label_; 186 Label return_label_;
185 RpoNumber current_block_; 187 RpoNumber current_block_;
186 SourcePosition current_source_position_; 188 SourcePosition current_source_position_;
187 MacroAssembler masm_; 189 MacroAssembler masm_;
188 GapResolver resolver_; 190 GapResolver resolver_;
189 SafepointTableBuilder safepoints_; 191 SafepointTableBuilder safepoints_;
190 ZoneVector<HandlerInfo> handlers_; 192 ZoneVector<HandlerInfo> handlers_;
191 ZoneDeque<DeoptimizationState*> deoptimization_states_; 193 ZoneDeque<DeoptimizationState*> deoptimization_states_;
192 ZoneDeque<Handle<Object>> deoptimization_literals_; 194 ZoneDeque<Handle<Object>> deoptimization_literals_;
193 size_t inlined_function_count_; 195 size_t inlined_function_count_;
194 TranslationBuffer translations_; 196 TranslationBuffer translations_;
195 int last_lazy_deopt_pc_; 197 int last_lazy_deopt_pc_;
196 JumpTable* jump_tables_; 198 JumpTable* jump_tables_;
197 OutOfLineCode* ools_; 199 OutOfLineCode* ools_;
198 int osr_pc_offset_; 200 int osr_pc_offset_;
199 bool needs_frame_;
200 }; 201 };
201 202
202 } // namespace compiler 203 } // namespace compiler
203 } // namespace internal 204 } // namespace internal
204 } // namespace v8 205 } // namespace v8
205 206
206 #endif // V8_COMPILER_CODE_GENERATOR_H 207 #endif // V8_COMPILER_CODE_GENERATOR_H
OLDNEW
« no previous file with comments | « src/compiler/arm64/code-generator-arm64.cc ('k') | src/compiler/code-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698