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

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

Issue 2229243003: [turbofan] Split CodeGenerator::GenerateCode into AssembleCode and FinishCodeObject. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months 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 | « no previous file | src/compiler/code-generator.cc » ('j') | src/compiler/code-generator.cc » ('J')
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/compiler/unwinding-info-writer.h" 10 #include "src/compiler/unwinding-info-writer.h"
(...skipping 30 matching lines...) Expand all
41 41
42 private: 42 private:
43 Instruction* instr_; 43 Instruction* instr_;
44 size_t pos_; 44 size_t pos_;
45 }; 45 };
46 46
47 47
48 // Generates native code for a sequence of instructions. 48 // Generates native code for a sequence of instructions.
49 class CodeGenerator final : public GapResolver::Assembler { 49 class CodeGenerator final : public GapResolver::Assembler {
50 public: 50 public:
51 explicit CodeGenerator(Frame* frame, Linkage* linkage, 51 explicit CodeGenerator(Zone* zone, CompilationInfo* info);
Michael Starzinger 2016/08/11 14:16:26 nit: Doesn't need to be "explicit" with more than
ahaas 2016/08/11 14:54:19 Done.
52 InstructionSequence* code, CompilationInfo* info);
53 52
53 void Initialize(Frame* frame, Linkage* linkage, InstructionSequence* code);
Michael Starzinger 2016/08/11 14:16:26 nit: Can we add a "// Initialize before calling as
ahaas 2016/08/11 14:54:19 Done.
54 // Generate native code. 54 // Generate native code.
Michael Starzinger 2016/08/11 14:16:26 nit: Empty whitespace between declarations for rea
ahaas 2016/08/11 14:54:19 Done.
55 Handle<Code> GenerateCode(); 55 bool AssembleCode();
56 // Finishes the code object generated in AssembleCode.
Michael Starzinger 2016/08/11 14:16:26 nit: Empty whitespace between declarations for rea
ahaas 2016/08/11 14:54:19 Done.
57 Handle<Code> FinishCodeObject();
56 58
57 InstructionSequence* code() const { return code_; } 59 InstructionSequence* code() const { return code_; }
58 FrameAccessState* frame_access_state() const { return frame_access_state_; } 60 FrameAccessState* frame_access_state() const { return frame_access_state_; }
59 const Frame* frame() const { return frame_access_state_->frame(); } 61 const Frame* frame() const { return frame_access_state_->frame(); }
60 Isolate* isolate() const { return info_->isolate(); } 62 Isolate* isolate() const { return info_->isolate(); }
61 Linkage* linkage() const { return linkage_; } 63 Linkage* linkage() const { return linkage_; }
64 bool assemble_code_successful() { return assemble_code_successful_; }
62 65
63 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; } 66 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; }
64 67
65 private: 68 private:
66 MacroAssembler* masm() { return &masm_; } 69 MacroAssembler* masm() { return &masm_; }
67 GapResolver* resolver() { return &resolver_; } 70 GapResolver* resolver() { return &resolver_; }
68 SafepointTableBuilder* safepoints() { return &safepoints_; } 71 SafepointTableBuilder* safepoints() { return &safepoints_; }
69 Zone* zone() const { return code()->zone(); } 72 Zone* zone() const { return code()->zone(); }
70 CompilationInfo* info() const { return info_; } 73 CompilationInfo* info() const { return info_; }
71 74
72 // Create the FrameAccessState object. The Frame is immutable from here on.
73 void CreateFrameAccessState(Frame* frame);
74
75 // Architecture - specific frame finalization. 75 // Architecture - specific frame finalization.
76 void FinishFrame(Frame* frame); 76 void FinishFrame(Frame* frame);
77 77
78 // Checks if {block} will appear directly after {current_block_} when 78 // Checks if {block} will appear directly after {current_block_} when
79 // assembling code, in which case, a fall-through can be used. 79 // assembling code, in which case, a fall-through can be used.
80 bool IsNextInAssemblyOrder(RpoNumber block) const; 80 bool IsNextInAssemblyOrder(RpoNumber block) const;
81 81
82 // Record a safepoint with the given pointer map. 82 // Record a safepoint with the given pointer map.
83 void RecordSafepoint(ReferenceMap* references, Safepoint::Kind kind, 83 void RecordSafepoint(ReferenceMap* references, Safepoint::Kind kind,
84 int arguments, Safepoint::DeoptMode deopt_mode); 84 int arguments, Safepoint::DeoptMode deopt_mode);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 }; 250 };
251 251
252 struct HandlerInfo { 252 struct HandlerInfo {
253 Label* handler; 253 Label* handler;
254 int pc_offset; 254 int pc_offset;
255 }; 255 };
256 256
257 friend class OutOfLineCode; 257 friend class OutOfLineCode;
258 258
259 FrameAccessState* frame_access_state_; 259 FrameAccessState* frame_access_state_;
260 Linkage* const linkage_; 260 Linkage* linkage_;
261 InstructionSequence* const code_; 261 InstructionSequence* code_;
262 UnwindingInfoWriter unwinding_info_writer_; 262 UnwindingInfoWriter unwinding_info_writer_;
263 CompilationInfo* const info_; 263 CompilationInfo* const info_;
264 Label* const labels_; 264 Label* labels_;
265 Label return_label_; 265 Label return_label_;
266 RpoNumber current_block_; 266 RpoNumber current_block_;
267 SourcePosition current_source_position_; 267 SourcePosition current_source_position_;
268 MacroAssembler masm_; 268 MacroAssembler masm_;
269 GapResolver resolver_; 269 GapResolver resolver_;
270 SafepointTableBuilder safepoints_; 270 SafepointTableBuilder safepoints_;
271 ZoneVector<HandlerInfo> handlers_; 271 ZoneVector<HandlerInfo> handlers_;
272 ZoneDeque<DeoptimizationExit*> deoptimization_exits_; 272 ZoneDeque<DeoptimizationExit*> deoptimization_exits_;
273 ZoneDeque<DeoptimizationState*> deoptimization_states_; 273 ZoneDeque<DeoptimizationState*> deoptimization_states_;
274 ZoneDeque<Handle<Object>> deoptimization_literals_; 274 ZoneDeque<Handle<Object>> deoptimization_literals_;
275 size_t inlined_function_count_; 275 size_t inlined_function_count_;
276 TranslationBuffer translations_; 276 TranslationBuffer translations_;
277 int last_lazy_deopt_pc_; 277 int last_lazy_deopt_pc_;
278 JumpTable* jump_tables_; 278 JumpTable* jump_tables_;
279 OutOfLineCode* ools_; 279 OutOfLineCode* ools_;
280 int osr_pc_offset_; 280 int osr_pc_offset_;
281 SourcePositionTableBuilder source_position_table_builder_; 281 SourcePositionTableBuilder source_position_table_builder_;
282 bool assemble_code_successful_;
282 }; 283 };
283 284
284 } // namespace compiler 285 } // namespace compiler
285 } // namespace internal 286 } // namespace internal
286 } // namespace v8 287 } // namespace v8
287 288
288 #endif // V8_COMPILER_CODE_GENERATOR_H 289 #endif // V8_COMPILER_CODE_GENERATOR_H
OLDNEW
« no previous file with comments | « no previous file | src/compiler/code-generator.cc » ('j') | src/compiler/code-generator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698