| 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 28 matching lines...) Expand all Loading... |
| 39 Zone* zone() const { return code()->zone(); } | 39 Zone* zone() const { return code()->zone(); } |
| 40 | 40 |
| 41 // Checks if {block} will appear directly after {current_block_} when | 41 // Checks if {block} will appear directly after {current_block_} when |
| 42 // assembling code, in which case, a fall-through can be used. | 42 // assembling code, in which case, a fall-through can be used. |
| 43 bool IsNextInAssemblyOrder(const BasicBlock* block) const { | 43 bool IsNextInAssemblyOrder(const BasicBlock* block) const { |
| 44 return block->rpo_number_ == (current_block_->rpo_number_ + 1) && | 44 return block->rpo_number_ == (current_block_->rpo_number_ + 1) && |
| 45 block->deferred_ == current_block_->deferred_; | 45 block->deferred_ == current_block_->deferred_; |
| 46 } | 46 } |
| 47 | 47 |
| 48 // Record a safepoint with the given pointer map. | 48 // Record a safepoint with the given pointer map. |
| 49 void RecordSafepoint(PointerMap* pointers, Safepoint::Kind kind, | 49 Safepoint::Id RecordSafepoint(PointerMap* pointers, Safepoint::Kind kind, |
| 50 int arguments, Safepoint::DeoptMode deopt_mode); | 50 int arguments, Safepoint::DeoptMode deopt_mode); |
| 51 | 51 |
| 52 // Assemble code for the specified instruction. | 52 // Assemble code for the specified instruction. |
| 53 void AssembleInstruction(Instruction* instr); | 53 void AssembleInstruction(Instruction* instr); |
| 54 void AssembleSourcePosition(SourcePositionInstruction* instr); | 54 void AssembleSourcePosition(SourcePositionInstruction* instr); |
| 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 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 75 | 75 |
| 76 // Interface used by the gap resolver to emit moves and swaps. | 76 // Interface used by the gap resolver to emit moves and swaps. |
| 77 virtual void AssembleMove(InstructionOperand* source, | 77 virtual void AssembleMove(InstructionOperand* source, |
| 78 InstructionOperand* destination) V8_OVERRIDE; | 78 InstructionOperand* destination) V8_OVERRIDE; |
| 79 virtual void AssembleSwap(InstructionOperand* source, | 79 virtual void AssembleSwap(InstructionOperand* source, |
| 80 InstructionOperand* destination) V8_OVERRIDE; | 80 InstructionOperand* destination) V8_OVERRIDE; |
| 81 | 81 |
| 82 // =========================================================================== | 82 // =========================================================================== |
| 83 // Deoptimization table construction | 83 // Deoptimization table construction |
| 84 void AddSafepointAndDeopt(Instruction* instr); | 84 void AddSafepointAndDeopt(Instruction* instr); |
| 85 void RecordLazyDeoptimizationEntry(Instruction* instr); | 85 void UpdateSafepointsWithDeoptimizationPc(); |
| 86 void RecordLazyDeoptimizationEntry(Instruction* instr, |
| 87 Safepoint::Id safepoint_id); |
| 86 void PopulateDeoptimizationData(Handle<Code> code); | 88 void PopulateDeoptimizationData(Handle<Code> code); |
| 87 int DefineDeoptimizationLiteral(Handle<Object> literal); | 89 int DefineDeoptimizationLiteral(Handle<Object> literal); |
| 88 void BuildTranslation(Instruction* instr, int first_argument_index, | 90 void BuildTranslation(Instruction* instr, int first_argument_index, |
| 89 int deoptimization_id); | 91 int deoptimization_id); |
| 90 void AddTranslationForOperand(Translation* translation, Instruction* instr, | 92 void AddTranslationForOperand(Translation* translation, Instruction* instr, |
| 91 InstructionOperand* op); | 93 InstructionOperand* op); |
| 92 void AddNopForSmiCodeInlining(); | 94 void AddNopForSmiCodeInlining(); |
| 93 // =========================================================================== | 95 // =========================================================================== |
| 94 | 96 |
| 95 class LazyDeoptimizationEntry V8_FINAL { | 97 class LazyDeoptimizationEntry V8_FINAL { |
| 96 public: | 98 public: |
| 97 LazyDeoptimizationEntry(int position_after_call, Label* continuation, | 99 LazyDeoptimizationEntry(int position_after_call, Label* continuation, |
| 98 Label* deoptimization) | 100 Label* deoptimization, Safepoint::Id safepoint_id) |
| 99 : position_after_call_(position_after_call), | 101 : position_after_call_(position_after_call), |
| 100 continuation_(continuation), | 102 continuation_(continuation), |
| 101 deoptimization_(deoptimization) {} | 103 deoptimization_(deoptimization), |
| 104 safepoint_id_(safepoint_id) {} |
| 102 | 105 |
| 103 int position_after_call() const { return position_after_call_; } | 106 int position_after_call() const { return position_after_call_; } |
| 104 Label* continuation() const { return continuation_; } | 107 Label* continuation() const { return continuation_; } |
| 105 Label* deoptimization() const { return deoptimization_; } | 108 Label* deoptimization() const { return deoptimization_; } |
| 109 Safepoint::Id safepoint_id() const { return safepoint_id_; } |
| 106 | 110 |
| 107 private: | 111 private: |
| 108 int position_after_call_; | 112 int position_after_call_; |
| 109 Label* continuation_; | 113 Label* continuation_; |
| 110 Label* deoptimization_; | 114 Label* deoptimization_; |
| 115 Safepoint::Id safepoint_id_; |
| 111 }; | 116 }; |
| 112 | 117 |
| 113 struct DeoptimizationState : ZoneObject { | 118 struct DeoptimizationState : ZoneObject { |
| 114 int translation_id_; | 119 int translation_id_; |
| 115 | 120 |
| 116 explicit DeoptimizationState(int translation_id) | 121 explicit DeoptimizationState(int translation_id) |
| 117 : translation_id_(translation_id) {} | 122 : translation_id_(translation_id) {} |
| 118 }; | 123 }; |
| 119 | 124 |
| 120 typedef std::deque<LazyDeoptimizationEntry, | 125 typedef std::deque<LazyDeoptimizationEntry, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 135 DeoptimizationStates deoptimization_states_; | 140 DeoptimizationStates deoptimization_states_; |
| 136 Literals deoptimization_literals_; | 141 Literals deoptimization_literals_; |
| 137 TranslationBuffer translations_; | 142 TranslationBuffer translations_; |
| 138 }; | 143 }; |
| 139 | 144 |
| 140 } // namespace compiler | 145 } // namespace compiler |
| 141 } // namespace internal | 146 } // namespace internal |
| 142 } // namespace v8 | 147 } // namespace v8 |
| 143 | 148 |
| 144 #endif // V8_COMPILER_CODE_GENERATOR_H | 149 #endif // V8_COMPILER_CODE_GENERATOR_H |
| OLD | NEW |