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

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: Fix arm64 Created 5 years, 1 month 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"
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 // =========================================================================== 149 // ===========================================================================
147 150
148 struct DeoptimizationState : ZoneObject { 151 struct DeoptimizationState : ZoneObject {
(...skipping 14 matching lines...) Expand all
163 }; 166 };
164 167
165 struct HandlerInfo { 168 struct HandlerInfo {
166 bool caught_locally; 169 bool caught_locally;
167 Label* handler; 170 Label* handler;
168 int pc_offset; 171 int pc_offset;
169 }; 172 };
170 173
171 friend class OutOfLineCode; 174 friend class OutOfLineCode;
172 175
173 Frame* const frame_; 176 FrameAccessState* frame_access_state_;
174 Linkage* const linkage_; 177 Linkage* const linkage_;
175 InstructionSequence* const code_; 178 InstructionSequence* const code_;
176 CompilationInfo* const info_; 179 CompilationInfo* const info_;
177 Label* const labels_; 180 Label* const labels_;
178 Label return_label_; 181 Label return_label_;
179 RpoNumber current_block_; 182 RpoNumber current_block_;
180 SourcePosition current_source_position_; 183 SourcePosition current_source_position_;
181 MacroAssembler masm_; 184 MacroAssembler masm_;
182 GapResolver resolver_; 185 GapResolver resolver_;
183 SafepointTableBuilder safepoints_; 186 SafepointTableBuilder safepoints_;
184 ZoneVector<HandlerInfo> handlers_; 187 ZoneVector<HandlerInfo> handlers_;
185 ZoneDeque<DeoptimizationState*> deoptimization_states_; 188 ZoneDeque<DeoptimizationState*> deoptimization_states_;
186 ZoneDeque<Handle<Object>> deoptimization_literals_; 189 ZoneDeque<Handle<Object>> deoptimization_literals_;
187 size_t inlined_function_count_; 190 size_t inlined_function_count_;
188 TranslationBuffer translations_; 191 TranslationBuffer translations_;
189 int last_lazy_deopt_pc_; 192 int last_lazy_deopt_pc_;
190 JumpTable* jump_tables_; 193 JumpTable* jump_tables_;
191 OutOfLineCode* ools_; 194 OutOfLineCode* ools_;
192 int osr_pc_offset_; 195 int osr_pc_offset_;
193 bool needs_frame_;
194 }; 196 };
195 197
196 } // namespace compiler 198 } // namespace compiler
197 } // namespace internal 199 } // namespace internal
198 } // namespace v8 200 } // namespace v8
199 201
200 #endif // V8_COMPILER_CODE_GENERATOR_H 202 #endif // V8_COMPILER_CODE_GENERATOR_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698