| 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 <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "src/compiler/gap-resolver.h" | 10 #include "src/compiler/gap-resolver.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 void AssembleGap(GapInstruction* gap); | 55 void AssembleGap(GapInstruction* gap); |
| 56 | 56 |
| 57 // =========================================================================== | 57 // =========================================================================== |
| 58 // ============= Architecture-specific code generation methods. ============== | 58 // ============= Architecture-specific code generation methods. ============== |
| 59 // =========================================================================== | 59 // =========================================================================== |
| 60 | 60 |
| 61 void AssembleArchInstruction(Instruction* instr); | 61 void AssembleArchInstruction(Instruction* instr); |
| 62 void AssembleArchBranch(Instruction* instr, FlagsCondition condition); | 62 void AssembleArchBranch(Instruction* instr, FlagsCondition condition); |
| 63 void AssembleArchBoolean(Instruction* instr, FlagsCondition condition); | 63 void AssembleArchBoolean(Instruction* instr, FlagsCondition condition); |
| 64 | 64 |
| 65 void AssembleDeoptimizerCall(int deoptimization_id); |
| 66 |
| 65 // Generates an architecture-specific, descriptor-specific prologue | 67 // Generates an architecture-specific, descriptor-specific prologue |
| 66 // to set up a stack frame. | 68 // to set up a stack frame. |
| 67 void AssemblePrologue(); | 69 void AssemblePrologue(); |
| 68 // Generates an architecture-specific, descriptor-specific return sequence | 70 // Generates an architecture-specific, descriptor-specific return sequence |
| 69 // to tear down a stack frame. | 71 // to tear down a stack frame. |
| 70 void AssembleReturn(); | 72 void AssembleReturn(); |
| 71 | 73 |
| 72 // =========================================================================== | 74 // =========================================================================== |
| 73 // ============== Architecture-specific gap resolver methods. ================ | 75 // ============== Architecture-specific gap resolver methods. ================ |
| 74 // =========================================================================== | 76 // =========================================================================== |
| 75 | 77 |
| 76 // Interface used by the gap resolver to emit moves and swaps. | 78 // Interface used by the gap resolver to emit moves and swaps. |
| 77 virtual void AssembleMove(InstructionOperand* source, | 79 virtual void AssembleMove(InstructionOperand* source, |
| 78 InstructionOperand* destination) V8_OVERRIDE; | 80 InstructionOperand* destination) V8_OVERRIDE; |
| 79 virtual void AssembleSwap(InstructionOperand* source, | 81 virtual void AssembleSwap(InstructionOperand* source, |
| 80 InstructionOperand* destination) V8_OVERRIDE; | 82 InstructionOperand* destination) V8_OVERRIDE; |
| 81 | 83 |
| 82 // =========================================================================== | 84 // =========================================================================== |
| 83 // Deoptimization table construction | 85 // Deoptimization table construction |
| 84 void AddSafepointAndDeopt(Instruction* instr); | 86 void AddSafepointAndDeopt(Instruction* instr); |
| 85 void UpdateSafepointsWithDeoptimizationPc(); | 87 void EmitLazyDeoptimizationCallTable(); |
| 86 void RecordLazyDeoptimizationEntry(Instruction* instr, | |
| 87 Safepoint::Id safepoint_id); | |
| 88 void PopulateDeoptimizationData(Handle<Code> code); | 88 void PopulateDeoptimizationData(Handle<Code> code); |
| 89 int DefineDeoptimizationLiteral(Handle<Object> literal); | 89 int DefineDeoptimizationLiteral(Handle<Object> literal); |
| 90 int BuildTranslation(Instruction* instr, int frame_state_offset); | 90 FrameStateDescriptor* GetFrameStateDescriptor(Instruction* instr, |
| 91 int frame_state_offset); |
| 92 int BuildTranslation(Instruction* instr, int frame_state_offset, |
| 93 OutputFrameStateCombine state_combine); |
| 91 void AddTranslationForOperand(Translation* translation, Instruction* instr, | 94 void AddTranslationForOperand(Translation* translation, Instruction* instr, |
| 92 InstructionOperand* op); | 95 InstructionOperand* op); |
| 93 void AddNopForSmiCodeInlining(); | 96 void AddNopForSmiCodeInlining(); |
| 94 // =========================================================================== | 97 // =========================================================================== |
| 95 | 98 |
| 96 class LazyDeoptimizationEntry V8_FINAL { | 99 class DeoptimizationPoint : public ZoneObject { |
| 97 public: | 100 public: |
| 98 LazyDeoptimizationEntry(int position_after_call, Label* continuation, | 101 int state_id() const { return state_id_; } |
| 99 Label* deoptimization, Safepoint::Id safepoint_id) | 102 int lazy_state_id() const { return lazy_state_id_; } |
| 100 : position_after_call_(position_after_call), | 103 FrameStateDescriptor* descriptor() const { return descriptor_; } |
| 101 continuation_(continuation), | 104 Safepoint::Id safepoint() const { return safepoint_; } |
| 102 deoptimization_(deoptimization), | |
| 103 safepoint_id_(safepoint_id) {} | |
| 104 | 105 |
| 105 int position_after_call() const { return position_after_call_; } | 106 DeoptimizationPoint(int state_id, int lazy_state_id, |
| 106 Label* continuation() const { return continuation_; } | 107 FrameStateDescriptor* descriptor, |
| 107 Label* deoptimization() const { return deoptimization_; } | 108 Safepoint::Id safepoint) |
| 108 Safepoint::Id safepoint_id() const { return safepoint_id_; } | 109 : state_id_(state_id), |
| 110 lazy_state_id_(lazy_state_id), |
| 111 descriptor_(descriptor), |
| 112 safepoint_(safepoint) {} |
| 109 | 113 |
| 110 private: | 114 private: |
| 111 int position_after_call_; | 115 int state_id_; |
| 112 Label* continuation_; | 116 int lazy_state_id_; |
| 113 Label* deoptimization_; | 117 FrameStateDescriptor* descriptor_; |
| 114 Safepoint::Id safepoint_id_; | 118 Safepoint::Id safepoint_; |
| 115 }; | 119 }; |
| 116 | 120 |
| 117 struct DeoptimizationState : ZoneObject { | 121 struct DeoptimizationState : ZoneObject { |
| 122 public: |
| 123 BailoutId bailout_id() const { return bailout_id_; } |
| 124 int translation_id() const { return translation_id_; } |
| 125 |
| 126 DeoptimizationState(BailoutId bailout_id, int translation_id) |
| 127 : bailout_id_(bailout_id), translation_id_(translation_id) {} |
| 128 |
| 129 private: |
| 130 BailoutId bailout_id_; |
| 118 int translation_id_; | 131 int translation_id_; |
| 119 | |
| 120 explicit DeoptimizationState(int translation_id) | |
| 121 : translation_id_(translation_id) {} | |
| 122 }; | 132 }; |
| 123 | 133 |
| 124 InstructionSequence* code_; | 134 InstructionSequence* code_; |
| 125 BasicBlock* current_block_; | 135 BasicBlock* current_block_; |
| 126 SourcePosition current_source_position_; | 136 SourcePosition current_source_position_; |
| 127 MacroAssembler masm_; | 137 MacroAssembler masm_; |
| 128 GapResolver resolver_; | 138 GapResolver resolver_; |
| 129 SafepointTableBuilder safepoints_; | 139 SafepointTableBuilder safepoints_; |
| 130 ZoneDeque<LazyDeoptimizationEntry> lazy_deoptimization_entries_; | 140 ZoneDeque<DeoptimizationPoint*> deoptimization_points_; |
| 131 ZoneDeque<DeoptimizationState*> deoptimization_states_; | 141 ZoneDeque<DeoptimizationState*> deoptimization_states_; |
| 132 ZoneDeque<Handle<Object> > deoptimization_literals_; | 142 ZoneDeque<Handle<Object> > deoptimization_literals_; |
| 133 TranslationBuffer translations_; | 143 TranslationBuffer translations_; |
| 134 }; | 144 }; |
| 135 | 145 |
| 136 } // namespace compiler | 146 } // namespace compiler |
| 137 } // namespace internal | 147 } // namespace internal |
| 138 } // namespace v8 | 148 } // namespace v8 |
| 139 | 149 |
| 140 #endif // V8_COMPILER_CODE_GENERATOR_H | 150 #endif // V8_COMPILER_CODE_GENERATOR_H |
| OLD | NEW |