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

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: Extend parallel compilation of wasm in a separate CL 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') | 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/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 CodeGenerator(Zone* zone, CompilationInfo* info);
52 InstructionSequence* code, CompilationInfo* info);
53 52
54 // Generate native code. 53 // Initialize before calling AssembleCode or FinishCodeObject.
55 Handle<Code> GenerateCode(); 54 void Initialize(Frame* frame, Linkage* linkage, InstructionSequence* code);
55
56 // Generate native code. This function can be run off the main thread.
57 bool AssembleCode();
58
59 // Finishes the code object generated in AssembleCode. This function returns
60 // an empty handle if AssembleCode() fails or has not been called.
61 Handle<Code> FinishCodeObject();
56 62
57 InstructionSequence* code() const { return code_; } 63 InstructionSequence* code() const { return code_; }
58 FrameAccessState* frame_access_state() const { return frame_access_state_; } 64 FrameAccessState* frame_access_state() const { return frame_access_state_; }
59 const Frame* frame() const { return frame_access_state_->frame(); } 65 const Frame* frame() const { return frame_access_state_->frame(); }
60 Isolate* isolate() const { return info_->isolate(); } 66 Isolate* isolate() const { return info_->isolate(); }
61 Linkage* linkage() const { return linkage_; } 67 Linkage* linkage() const { return linkage_; }
68 bool assemble_code_successful() { return assemble_code_successful_; }
62 69
63 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; } 70 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; }
64 71
65 private: 72 private:
66 MacroAssembler* masm() { return &masm_; } 73 MacroAssembler* masm() { return &masm_; }
67 GapResolver* resolver() { return &resolver_; } 74 GapResolver* resolver() { return &resolver_; }
68 SafepointTableBuilder* safepoints() { return &safepoints_; } 75 SafepointTableBuilder* safepoints() { return &safepoints_; }
69 Zone* zone() const { return code()->zone(); } 76 Zone* zone() const { return code()->zone(); }
70 CompilationInfo* info() const { return info_; } 77 CompilationInfo* info() const { return info_; }
71 78
72 // Create the FrameAccessState object. The Frame is immutable from here on.
73 void CreateFrameAccessState(Frame* frame);
74
75 // Architecture - specific frame finalization. 79 // Architecture - specific frame finalization.
76 void FinishFrame(Frame* frame); 80 void FinishFrame(Frame* frame);
77 81
78 // Checks if {block} will appear directly after {current_block_} when 82 // Checks if {block} will appear directly after {current_block_} when
79 // assembling code, in which case, a fall-through can be used. 83 // assembling code, in which case, a fall-through can be used.
80 bool IsNextInAssemblyOrder(RpoNumber block) const; 84 bool IsNextInAssemblyOrder(RpoNumber block) const;
81 85
82 // Record a safepoint with the given pointer map. 86 // Record a safepoint with the given pointer map.
83 void RecordSafepoint(ReferenceMap* references, Safepoint::Kind kind, 87 void RecordSafepoint(ReferenceMap* references, Safepoint::Kind kind,
84 int arguments, Safepoint::DeoptMode deopt_mode); 88 int arguments, Safepoint::DeoptMode deopt_mode);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 }; 254 };
251 255
252 struct HandlerInfo { 256 struct HandlerInfo {
253 Label* handler; 257 Label* handler;
254 int pc_offset; 258 int pc_offset;
255 }; 259 };
256 260
257 friend class OutOfLineCode; 261 friend class OutOfLineCode;
258 262
259 FrameAccessState* frame_access_state_; 263 FrameAccessState* frame_access_state_;
260 Linkage* const linkage_; 264 Linkage* linkage_;
261 InstructionSequence* const code_; 265 InstructionSequence* code_;
262 UnwindingInfoWriter unwinding_info_writer_; 266 UnwindingInfoWriter unwinding_info_writer_;
263 CompilationInfo* const info_; 267 CompilationInfo* const info_;
264 Label* const labels_; 268 Label* labels_;
265 Label return_label_; 269 Label return_label_;
266 RpoNumber current_block_; 270 RpoNumber current_block_;
267 SourcePosition current_source_position_; 271 SourcePosition current_source_position_;
268 MacroAssembler masm_; 272 MacroAssembler masm_;
269 GapResolver resolver_; 273 GapResolver resolver_;
270 SafepointTableBuilder safepoints_; 274 SafepointTableBuilder safepoints_;
271 ZoneVector<HandlerInfo> handlers_; 275 ZoneVector<HandlerInfo> handlers_;
272 ZoneDeque<DeoptimizationExit*> deoptimization_exits_; 276 ZoneDeque<DeoptimizationExit*> deoptimization_exits_;
273 ZoneDeque<DeoptimizationState*> deoptimization_states_; 277 ZoneDeque<DeoptimizationState*> deoptimization_states_;
274 ZoneDeque<Handle<Object>> deoptimization_literals_; 278 ZoneDeque<Handle<Object>> deoptimization_literals_;
275 size_t inlined_function_count_; 279 size_t inlined_function_count_;
276 TranslationBuffer translations_; 280 TranslationBuffer translations_;
277 int last_lazy_deopt_pc_; 281 int last_lazy_deopt_pc_;
278 JumpTable* jump_tables_; 282 JumpTable* jump_tables_;
279 OutOfLineCode* ools_; 283 OutOfLineCode* ools_;
280 int osr_pc_offset_; 284 int osr_pc_offset_;
281 SourcePositionTableBuilder source_position_table_builder_; 285 SourcePositionTableBuilder source_position_table_builder_;
286 bool assemble_code_successful_;
282 }; 287 };
283 288
284 } // namespace compiler 289 } // namespace compiler
285 } // namespace internal 290 } // namespace internal
286 } // namespace v8 291 } // namespace v8
287 292
288 #endif // V8_COMPILER_CODE_GENERATOR_H 293 #endif // V8_COMPILER_CODE_GENERATOR_H
OLDNEW
« no previous file with comments | « no previous file | src/compiler/code-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698