| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
| 6 | 6 |
| 7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
| 8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
| 9 #include "src/compiler/pipeline.h" | 9 #include "src/compiler/pipeline.h" |
| 10 | 10 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 return result; | 159 return result; |
| 160 } | 160 } |
| 161 | 161 |
| 162 | 162 |
| 163 bool CodeGenerator::IsNextInAssemblyOrder(RpoNumber block) const { | 163 bool CodeGenerator::IsNextInAssemblyOrder(RpoNumber block) const { |
| 164 return code()->InstructionBlockAt(current_block_)->ao_number().IsNext( | 164 return code()->InstructionBlockAt(current_block_)->ao_number().IsNext( |
| 165 code()->InstructionBlockAt(block)->ao_number()); | 165 code()->InstructionBlockAt(block)->ao_number()); |
| 166 } | 166 } |
| 167 | 167 |
| 168 | 168 |
| 169 void CodeGenerator::RecordSafepoint(PointerMap* pointers, Safepoint::Kind kind, | 169 void CodeGenerator::RecordSafepoint(ReferenceMap* references, |
| 170 int arguments, | 170 Safepoint::Kind kind, int arguments, |
| 171 Safepoint::DeoptMode deopt_mode) { | 171 Safepoint::DeoptMode deopt_mode) { |
| 172 const ZoneList<InstructionOperand*>* operands = | |
| 173 pointers->GetNormalizedOperands(); | |
| 174 Safepoint safepoint = | 172 Safepoint safepoint = |
| 175 safepoints()->DefineSafepoint(masm(), kind, arguments, deopt_mode); | 173 safepoints()->DefineSafepoint(masm(), kind, arguments, deopt_mode); |
| 176 for (int i = 0; i < operands->length(); i++) { | 174 for (auto& operand : references->reference_operands()) { |
| 177 InstructionOperand* pointer = operands->at(i); | 175 if (operand.IsStackSlot()) { |
| 178 if (pointer->IsStackSlot()) { | 176 safepoint.DefinePointerSlot(StackSlotOperand::cast(operand).index(), |
| 179 safepoint.DefinePointerSlot(StackSlotOperand::cast(pointer)->index(), | |
| 180 zone()); | 177 zone()); |
| 181 } else if (pointer->IsRegister() && (kind & Safepoint::kWithRegisters)) { | 178 } else if (operand.IsRegister() && (kind & Safepoint::kWithRegisters)) { |
| 182 Register reg = Register::FromAllocationIndex( | 179 Register reg = |
| 183 RegisterOperand::cast(pointer)->index()); | 180 Register::FromAllocationIndex(RegisterOperand::cast(operand).index()); |
| 184 safepoint.DefinePointerRegister(reg, zone()); | 181 safepoint.DefinePointerRegister(reg, zone()); |
| 185 } | 182 } |
| 186 } | 183 } |
| 187 } | 184 } |
| 188 | 185 |
| 189 | 186 |
| 190 void CodeGenerator::AssembleInstruction(Instruction* instr) { | 187 void CodeGenerator::AssembleInstruction(Instruction* instr) { |
| 191 AssembleGaps(instr); | 188 AssembleGaps(instr); |
| 192 if (instr->IsSourcePosition()) { | 189 if (instr->IsSourcePosition()) { |
| 193 AssembleSourcePosition(SourcePositionInstruction::cast(instr)); | 190 AssembleSourcePosition(SourcePositionInstruction::cast(instr)); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 return jump_tables_->label(); | 329 return jump_tables_->label(); |
| 333 } | 330 } |
| 334 | 331 |
| 335 | 332 |
| 336 void CodeGenerator::RecordCallPosition(Instruction* instr) { | 333 void CodeGenerator::RecordCallPosition(Instruction* instr) { |
| 337 CallDescriptor::Flags flags(MiscField::decode(instr->opcode())); | 334 CallDescriptor::Flags flags(MiscField::decode(instr->opcode())); |
| 338 | 335 |
| 339 bool needs_frame_state = (flags & CallDescriptor::kNeedsFrameState); | 336 bool needs_frame_state = (flags & CallDescriptor::kNeedsFrameState); |
| 340 | 337 |
| 341 RecordSafepoint( | 338 RecordSafepoint( |
| 342 instr->pointer_map(), Safepoint::kSimple, 0, | 339 instr->reference_map(), Safepoint::kSimple, 0, |
| 343 needs_frame_state ? Safepoint::kLazyDeopt : Safepoint::kNoLazyDeopt); | 340 needs_frame_state ? Safepoint::kLazyDeopt : Safepoint::kNoLazyDeopt); |
| 344 | 341 |
| 345 if (flags & CallDescriptor::kHasExceptionHandler) { | 342 if (flags & CallDescriptor::kHasExceptionHandler) { |
| 346 InstructionOperandConverter i(this, instr); | 343 InstructionOperandConverter i(this, instr); |
| 347 RpoNumber handler_rpo = | 344 RpoNumber handler_rpo = |
| 348 i.InputRpo(static_cast<int>(instr->InputCount()) - 1); | 345 i.InputRpo(static_cast<int>(instr->InputCount()) - 1); |
| 349 handlers_.push_back({GetLabel(handler_rpo), masm()->pc_offset()}); | 346 handlers_.push_back({GetLabel(handler_rpo), masm()->pc_offset()}); |
| 350 } | 347 } |
| 351 | 348 |
| 352 if (flags & CallDescriptor::kNeedsNopAfterCall) { | 349 if (flags & CallDescriptor::kNeedsNopAfterCall) { |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 : masm_(gen->masm()), next_(gen->ools_) { | 639 : masm_(gen->masm()), next_(gen->ools_) { |
| 643 gen->ools_ = this; | 640 gen->ools_ = this; |
| 644 } | 641 } |
| 645 | 642 |
| 646 | 643 |
| 647 OutOfLineCode::~OutOfLineCode() {} | 644 OutOfLineCode::~OutOfLineCode() {} |
| 648 | 645 |
| 649 } // namespace compiler | 646 } // namespace compiler |
| 650 } // namespace internal | 647 } // namespace internal |
| 651 } // namespace v8 | 648 } // namespace v8 |
| OLD | NEW |