OLD | NEW |
---|---|
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" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 class CodeGenerator final : public GapResolver::Assembler { | 47 class CodeGenerator final : public GapResolver::Assembler { |
48 public: | 48 public: |
49 explicit CodeGenerator(Frame* frame, Linkage* linkage, | 49 explicit CodeGenerator(Frame* frame, Linkage* linkage, |
50 InstructionSequence* code, CompilationInfo* info); | 50 InstructionSequence* code, CompilationInfo* info); |
51 | 51 |
52 // Generate native code. | 52 // Generate native code. |
53 Handle<Code> GenerateCode(); | 53 Handle<Code> GenerateCode(); |
54 | 54 |
55 InstructionSequence* code() const { return code_; } | 55 InstructionSequence* code() const { return code_; } |
56 FrameAccessState* frame_access_state() const { return frame_access_state_; } | 56 FrameAccessState* frame_access_state() const { return frame_access_state_; } |
57 Frame* frame() const { return frame_access_state_->frame(); } | 57 const Frame* frame() const { return frame_access_state_->frame(); } |
58 Isolate* isolate() const { return info_->isolate(); } | 58 Isolate* isolate() const { return info_->isolate(); } |
59 Linkage* linkage() const { return linkage_; } | 59 Linkage* linkage() const { return linkage_; } |
60 | 60 |
61 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; } | 61 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; } |
62 | 62 |
63 private: | 63 private: |
64 MacroAssembler* masm() { return &masm_; } | 64 MacroAssembler* masm() { return &masm_; } |
65 GapResolver* resolver() { return &resolver_; } | 65 GapResolver* resolver() { return &resolver_; } |
66 SafepointTableBuilder* safepoints() { return &safepoints_; } | 66 SafepointTableBuilder* safepoints() { return &safepoints_; } |
67 Zone* zone() const { return code()->zone(); } | 67 Zone* zone() const { return code()->zone(); } |
68 CompilationInfo* info() const { return info_; } | 68 CompilationInfo* info() const { return info_; } |
69 | 69 |
70 // Create the FrameAccessState object. The Frame is immutable from here on. | |
71 void CreateFrameAccessState(Frame* frame) { | |
72 FinishFrame(frame); | |
73 frame_access_state_ = new (code()->zone()) FrameAccessState(frame); | |
danno
2016/04/01 15:56:26
The body of this shouldn't be inline.
| |
74 } | |
75 // Architecture - specific frame finalization. | |
76 void FinishFrame(Frame* frame); | |
77 | |
70 // Checks if {block} will appear directly after {current_block_} when | 78 // Checks if {block} will appear directly after {current_block_} when |
71 // assembling code, in which case, a fall-through can be used. | 79 // assembling code, in which case, a fall-through can be used. |
72 bool IsNextInAssemblyOrder(RpoNumber block) const; | 80 bool IsNextInAssemblyOrder(RpoNumber block) const; |
73 | 81 |
74 // Record a safepoint with the given pointer map. | 82 // Record a safepoint with the given pointer map. |
75 void RecordSafepoint(ReferenceMap* references, Safepoint::Kind kind, | 83 void RecordSafepoint(ReferenceMap* references, Safepoint::Kind kind, |
76 int arguments, Safepoint::DeoptMode deopt_mode); | 84 int arguments, Safepoint::DeoptMode deopt_mode); |
77 | 85 |
78 // Check if a heap object can be materialized by loading from the frame, which | 86 // Check if a heap object can be materialized by loading from the frame, which |
79 // is usually way cheaper than materializing the actual heap object constant. | 87 // is usually way cheaper than materializing the actual heap object constant. |
(...skipping 18 matching lines...) Expand all Loading... | |
98 void AssembleArchBranch(Instruction* instr, BranchInfo* branch); | 106 void AssembleArchBranch(Instruction* instr, BranchInfo* branch); |
99 void AssembleArchBoolean(Instruction* instr, FlagsCondition condition); | 107 void AssembleArchBoolean(Instruction* instr, FlagsCondition condition); |
100 void AssembleArchLookupSwitch(Instruction* instr); | 108 void AssembleArchLookupSwitch(Instruction* instr); |
101 void AssembleArchTableSwitch(Instruction* instr); | 109 void AssembleArchTableSwitch(Instruction* instr); |
102 | 110 |
103 void AssembleDeoptimizerCall(int deoptimization_id, | 111 void AssembleDeoptimizerCall(int deoptimization_id, |
104 Deoptimizer::BailoutType bailout_type); | 112 Deoptimizer::BailoutType bailout_type); |
105 | 113 |
106 // Generates an architecture-specific, descriptor-specific prologue | 114 // Generates an architecture-specific, descriptor-specific prologue |
107 // to set up a stack frame. | 115 // to set up a stack frame. |
108 void AssemblePrologue(); | 116 void AssembleConstructFrame(); |
109 | |
110 void AssembleSetupStackPointer(); | |
111 | 117 |
112 // Generates an architecture-specific, descriptor-specific return sequence | 118 // Generates an architecture-specific, descriptor-specific return sequence |
113 // to tear down a stack frame. | 119 // to tear down a stack frame. |
114 void AssembleReturn(); | 120 void AssembleReturn(); |
115 | 121 |
116 // Generates code to deconstruct a the caller's frame, including arguments. | 122 // Generates code to deconstruct a the caller's frame, including arguments. |
117 void AssembleDeconstructActivationRecord(int stack_param_delta); | 123 void AssembleDeconstructActivationRecord(int stack_param_delta); |
118 | 124 |
119 void AssembleDeconstructFrame(); | 125 void AssembleDeconstructFrame(); |
120 | 126 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 JumpTable* jump_tables_; | 238 JumpTable* jump_tables_; |
233 OutOfLineCode* ools_; | 239 OutOfLineCode* ools_; |
234 int osr_pc_offset_; | 240 int osr_pc_offset_; |
235 }; | 241 }; |
236 | 242 |
237 } // namespace compiler | 243 } // namespace compiler |
238 } // namespace internal | 244 } // namespace internal |
239 } // namespace v8 | 245 } // namespace v8 |
240 | 246 |
241 #endif // V8_COMPILER_CODE_GENERATOR_H | 247 #endif // V8_COMPILER_CODE_GENERATOR_H |
OLD | NEW |