| 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 |
| 73 // Architecture - specific frame finalization. |
| 74 void FinishFrame(Frame* frame); |
| 75 |
| 70 // Checks if {block} will appear directly after {current_block_} when | 76 // Checks if {block} will appear directly after {current_block_} when |
| 71 // assembling code, in which case, a fall-through can be used. | 77 // assembling code, in which case, a fall-through can be used. |
| 72 bool IsNextInAssemblyOrder(RpoNumber block) const; | 78 bool IsNextInAssemblyOrder(RpoNumber block) const; |
| 73 | 79 |
| 74 // Record a safepoint with the given pointer map. | 80 // Record a safepoint with the given pointer map. |
| 75 void RecordSafepoint(ReferenceMap* references, Safepoint::Kind kind, | 81 void RecordSafepoint(ReferenceMap* references, Safepoint::Kind kind, |
| 76 int arguments, Safepoint::DeoptMode deopt_mode); | 82 int arguments, Safepoint::DeoptMode deopt_mode); |
| 77 | 83 |
| 78 // Check if a heap object can be materialized by loading from the frame, which | 84 // 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. | 85 // is usually way cheaper than materializing the actual heap object constant. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 101 void AssembleArchBranch(Instruction* instr, BranchInfo* branch); | 107 void AssembleArchBranch(Instruction* instr, BranchInfo* branch); |
| 102 void AssembleArchBoolean(Instruction* instr, FlagsCondition condition); | 108 void AssembleArchBoolean(Instruction* instr, FlagsCondition condition); |
| 103 void AssembleArchLookupSwitch(Instruction* instr); | 109 void AssembleArchLookupSwitch(Instruction* instr); |
| 104 void AssembleArchTableSwitch(Instruction* instr); | 110 void AssembleArchTableSwitch(Instruction* instr); |
| 105 | 111 |
| 106 void AssembleDeoptimizerCall(int deoptimization_id, | 112 void AssembleDeoptimizerCall(int deoptimization_id, |
| 107 Deoptimizer::BailoutType bailout_type); | 113 Deoptimizer::BailoutType bailout_type); |
| 108 | 114 |
| 109 // Generates an architecture-specific, descriptor-specific prologue | 115 // Generates an architecture-specific, descriptor-specific prologue |
| 110 // to set up a stack frame. | 116 // to set up a stack frame. |
| 111 void AssemblePrologue(); | 117 void AssembleConstructFrame(); |
| 112 | |
| 113 void AssembleSetupStackPointer(); | |
| 114 | 118 |
| 115 // Generates an architecture-specific, descriptor-specific return sequence | 119 // Generates an architecture-specific, descriptor-specific return sequence |
| 116 // to tear down a stack frame. | 120 // to tear down a stack frame. |
| 117 void AssembleReturn(); | 121 void AssembleReturn(); |
| 118 | 122 |
| 119 // Generates code to deconstruct a the caller's frame, including arguments. | 123 // Generates code to deconstruct a the caller's frame, including arguments. |
| 120 void AssembleDeconstructActivationRecord(int stack_param_delta); | 124 void AssembleDeconstructActivationRecord(int stack_param_delta); |
| 121 | 125 |
| 122 void AssembleDeconstructFrame(); | 126 void AssembleDeconstructFrame(); |
| 123 | 127 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 JumpTable* jump_tables_; | 239 JumpTable* jump_tables_; |
| 236 OutOfLineCode* ools_; | 240 OutOfLineCode* ools_; |
| 237 int osr_pc_offset_; | 241 int osr_pc_offset_; |
| 238 }; | 242 }; |
| 239 | 243 |
| 240 } // namespace compiler | 244 } // namespace compiler |
| 241 } // namespace internal | 245 } // namespace internal |
| 242 } // namespace v8 | 246 } // namespace v8 |
| 243 | 247 |
| 244 #endif // V8_COMPILER_CODE_GENERATOR_H | 248 #endif // V8_COMPILER_CODE_GENERATOR_H |
| OLD | NEW |