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/compiler/unwinding-info-writer.h" | 10 #include "src/compiler/unwinding-info-writer.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 InstructionSequence* code() const { return code_; } | 63 InstructionSequence* code() const { return code_; } |
64 FrameAccessState* frame_access_state() const { return frame_access_state_; } | 64 FrameAccessState* frame_access_state() const { return frame_access_state_; } |
65 const Frame* frame() const { return frame_access_state_->frame(); } | 65 const Frame* frame() const { return frame_access_state_->frame(); } |
66 Isolate* isolate() const; | 66 Isolate* isolate() const; |
67 Linkage* linkage() const { return linkage_; } | 67 Linkage* linkage() const { return linkage_; } |
68 | 68 |
69 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; } | 69 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; } |
70 | 70 |
71 void AddProtectedInstruction(int instr_offset, int landing_offset); | 71 void AddProtectedInstruction(int instr_offset, int landing_offset); |
72 | 72 |
| 73 void AssembleSourcePosition(Instruction* instr); |
| 74 |
73 private: | 75 private: |
74 MacroAssembler* masm() { return &masm_; } | 76 MacroAssembler* masm() { return &masm_; } |
75 GapResolver* resolver() { return &resolver_; } | 77 GapResolver* resolver() { return &resolver_; } |
76 SafepointTableBuilder* safepoints() { return &safepoints_; } | 78 SafepointTableBuilder* safepoints() { return &safepoints_; } |
77 Zone* zone() const { return code()->zone(); } | 79 Zone* zone() const { return code()->zone(); } |
78 CompilationInfo* info() const { return info_; } | 80 CompilationInfo* info() const { return info_; } |
79 | 81 |
80 // Create the FrameAccessState object. The Frame is immutable from here on. | 82 // Create the FrameAccessState object. The Frame is immutable from here on. |
81 void CreateFrameAccessState(Frame* frame); | 83 void CreateFrameAccessState(Frame* frame); |
82 | 84 |
(...skipping 15 matching lines...) Expand all Loading... |
98 Heap::RootListIndex* index_return); | 100 Heap::RootListIndex* index_return); |
99 | 101 |
100 enum CodeGenResult { kSuccess, kTooManyDeoptimizationBailouts }; | 102 enum CodeGenResult { kSuccess, kTooManyDeoptimizationBailouts }; |
101 | 103 |
102 // Assemble instructions for the specified block. | 104 // Assemble instructions for the specified block. |
103 CodeGenResult AssembleBlock(const InstructionBlock* block); | 105 CodeGenResult AssembleBlock(const InstructionBlock* block); |
104 | 106 |
105 // Assemble code for the specified instruction. | 107 // Assemble code for the specified instruction. |
106 CodeGenResult AssembleInstruction(Instruction* instr, | 108 CodeGenResult AssembleInstruction(Instruction* instr, |
107 const InstructionBlock* block); | 109 const InstructionBlock* block); |
108 void AssembleSourcePosition(Instruction* instr); | |
109 void AssembleGaps(Instruction* instr); | 110 void AssembleGaps(Instruction* instr); |
110 | 111 |
111 // Returns true if a instruction is a tail call that needs to adjust the stack | 112 // Returns true if a instruction is a tail call that needs to adjust the stack |
112 // pointer before execution. The stack slot index to the empty slot above the | 113 // pointer before execution. The stack slot index to the empty slot above the |
113 // adjusted stack pointer is returned in |slot|. | 114 // adjusted stack pointer is returned in |slot|. |
114 bool GetSlotAboveSPBeforeTailCall(Instruction* instr, int* slot); | 115 bool GetSlotAboveSPBeforeTailCall(Instruction* instr, int* slot); |
115 | 116 |
116 // =========================================================================== | 117 // =========================================================================== |
117 // ============= Architecture-specific code generation methods. ============== | 118 // ============= Architecture-specific code generation methods. ============== |
118 // =========================================================================== | 119 // =========================================================================== |
119 | 120 |
120 CodeGenResult AssembleArchInstruction(Instruction* instr); | 121 CodeGenResult AssembleArchInstruction(Instruction* instr); |
121 void AssembleArchJump(RpoNumber target); | 122 void AssembleArchJump(RpoNumber target); |
122 void AssembleArchBranch(Instruction* instr, BranchInfo* branch); | 123 void AssembleArchBranch(Instruction* instr, BranchInfo* branch); |
123 void AssembleArchBoolean(Instruction* instr, FlagsCondition condition); | 124 void AssembleArchBoolean(Instruction* instr, FlagsCondition condition); |
| 125 void AssembleArchTrap(Instruction* instr, FlagsCondition condition); |
124 void AssembleArchLookupSwitch(Instruction* instr); | 126 void AssembleArchLookupSwitch(Instruction* instr); |
125 void AssembleArchTableSwitch(Instruction* instr); | 127 void AssembleArchTableSwitch(Instruction* instr); |
126 | 128 |
127 CodeGenResult AssembleDeoptimizerCall(int deoptimization_id, | 129 CodeGenResult AssembleDeoptimizerCall(int deoptimization_id, |
128 Deoptimizer::BailoutType bailout_type, | 130 Deoptimizer::BailoutType bailout_type, |
129 SourcePosition pos); | 131 SourcePosition pos); |
130 | 132 |
131 // Generates an architecture-specific, descriptor-specific prologue | 133 // Generates an architecture-specific, descriptor-specific prologue |
132 // to set up a stack frame. | 134 // to set up a stack frame. |
133 void AssembleConstructFrame(); | 135 void AssembleConstructFrame(); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 int optimized_out_literal_id_; | 290 int optimized_out_literal_id_; |
289 SourcePositionTableBuilder source_position_table_builder_; | 291 SourcePositionTableBuilder source_position_table_builder_; |
290 ZoneVector<trap_handler::ProtectedInstructionData>* protected_instructions_; | 292 ZoneVector<trap_handler::ProtectedInstructionData>* protected_instructions_; |
291 }; | 293 }; |
292 | 294 |
293 } // namespace compiler | 295 } // namespace compiler |
294 } // namespace internal | 296 } // namespace internal |
295 } // namespace v8 | 297 } // namespace v8 |
296 | 298 |
297 #endif // V8_COMPILER_CODE_GENERATOR_H | 299 #endif // V8_COMPILER_CODE_GENERATOR_H |
OLD | NEW |