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/address-map.h" | 7 #include "src/address-map.h" |
8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
10 #include "src/compiler/pipeline.h" | 10 #include "src/compiler/pipeline.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 void CodeGenerator::RecordSafepoint(ReferenceMap* references, | 214 void CodeGenerator::RecordSafepoint(ReferenceMap* references, |
215 Safepoint::Kind kind, int arguments, | 215 Safepoint::Kind kind, int arguments, |
216 Safepoint::DeoptMode deopt_mode) { | 216 Safepoint::DeoptMode deopt_mode) { |
217 Safepoint safepoint = | 217 Safepoint safepoint = |
218 safepoints()->DefineSafepoint(masm(), kind, arguments, deopt_mode); | 218 safepoints()->DefineSafepoint(masm(), kind, arguments, deopt_mode); |
219 int stackSlotToSpillSlotDelta = | 219 int stackSlotToSpillSlotDelta = |
220 frame()->GetTotalFrameSlotCount() - frame()->GetSpillSlotCount(); | 220 frame()->GetTotalFrameSlotCount() - frame()->GetSpillSlotCount(); |
221 for (auto& operand : references->reference_operands()) { | 221 for (auto& operand : references->reference_operands()) { |
222 if (operand.IsStackSlot()) { | 222 if (operand.IsStackSlot()) { |
223 int index = StackSlotOperand::cast(operand).index(); | 223 int index = LocationOperand::cast(operand).index(); |
224 DCHECK(index >= 0); | 224 DCHECK(index >= 0); |
225 // Safepoint table indices are 0-based from the beginning of the spill | 225 // Safepoint table indices are 0-based from the beginning of the spill |
226 // slot area, adjust appropriately. | 226 // slot area, adjust appropriately. |
227 index -= stackSlotToSpillSlotDelta; | 227 index -= stackSlotToSpillSlotDelta; |
228 safepoint.DefinePointerSlot(index, zone()); | 228 safepoint.DefinePointerSlot(index, zone()); |
229 } else if (operand.IsRegister() && (kind & Safepoint::kWithRegisters)) { | 229 } else if (operand.IsRegister() && (kind & Safepoint::kWithRegisters)) { |
230 Register reg = RegisterOperand::cast(operand).GetRegister(); | 230 Register reg = LocationOperand::cast(operand).GetRegister(); |
231 safepoint.DefinePointerRegister(reg, zone()); | 231 safepoint.DefinePointerRegister(reg, zone()); |
232 } | 232 } |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 | 236 |
237 bool CodeGenerator::IsMaterializableFromFrame(Handle<HeapObject> object, | 237 bool CodeGenerator::IsMaterializableFromFrame(Handle<HeapObject> object, |
238 int* offset_return) { | 238 int* offset_return) { |
239 if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) { | 239 if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) { |
240 if (info()->has_context() && object.is_identical_to(info()->context()) && | 240 if (info()->has_context() && object.is_identical_to(info()->context()) && |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 return deoptimization_id; | 582 return deoptimization_id; |
583 } | 583 } |
584 | 584 |
585 | 585 |
586 void CodeGenerator::AddTranslationForOperand(Translation* translation, | 586 void CodeGenerator::AddTranslationForOperand(Translation* translation, |
587 Instruction* instr, | 587 Instruction* instr, |
588 InstructionOperand* op, | 588 InstructionOperand* op, |
589 MachineType type) { | 589 MachineType type) { |
590 if (op->IsStackSlot()) { | 590 if (op->IsStackSlot()) { |
591 if (type == kMachBool || type == kRepBit) { | 591 if (type == kMachBool || type == kRepBit) { |
592 translation->StoreBoolStackSlot(StackSlotOperand::cast(op)->index()); | 592 translation->StoreBoolStackSlot(LocationOperand::cast(op)->index()); |
593 } else if (type == kMachInt32 || type == kMachInt8 || type == kMachInt16) { | 593 } else if (type == kMachInt32 || type == kMachInt8 || type == kMachInt16) { |
594 translation->StoreInt32StackSlot(StackSlotOperand::cast(op)->index()); | 594 translation->StoreInt32StackSlot(LocationOperand::cast(op)->index()); |
595 } else if (type == kMachUint32 || type == kMachUint16 || | 595 } else if (type == kMachUint32 || type == kMachUint16 || |
596 type == kMachUint8) { | 596 type == kMachUint8) { |
597 translation->StoreUint32StackSlot(StackSlotOperand::cast(op)->index()); | 597 translation->StoreUint32StackSlot(LocationOperand::cast(op)->index()); |
598 } else if ((type & kRepMask) == kRepTagged) { | 598 } else if ((type & kRepMask) == kRepTagged) { |
599 translation->StoreStackSlot(StackSlotOperand::cast(op)->index()); | 599 translation->StoreStackSlot(LocationOperand::cast(op)->index()); |
600 } else { | 600 } else { |
601 CHECK(false); | 601 CHECK(false); |
602 } | 602 } |
603 } else if (op->IsDoubleStackSlot()) { | 603 } else if (op->IsDoubleStackSlot()) { |
604 DCHECK((type & (kRepFloat32 | kRepFloat64)) != 0); | 604 DCHECK((type & (kRepFloat32 | kRepFloat64)) != 0); |
605 translation->StoreDoubleStackSlot( | 605 translation->StoreDoubleStackSlot(LocationOperand::cast(op)->index()); |
606 DoubleStackSlotOperand::cast(op)->index()); | |
607 } else if (op->IsRegister()) { | 606 } else if (op->IsRegister()) { |
608 InstructionOperandConverter converter(this, instr); | 607 InstructionOperandConverter converter(this, instr); |
609 if (type == kMachBool || type == kRepBit) { | 608 if (type == kMachBool || type == kRepBit) { |
610 translation->StoreBoolRegister(converter.ToRegister(op)); | 609 translation->StoreBoolRegister(converter.ToRegister(op)); |
611 } else if (type == kMachInt32 || type == kMachInt8 || type == kMachInt16) { | 610 } else if (type == kMachInt32 || type == kMachInt8 || type == kMachInt16) { |
612 translation->StoreInt32Register(converter.ToRegister(op)); | 611 translation->StoreInt32Register(converter.ToRegister(op)); |
613 } else if (type == kMachUint32 || type == kMachUint16 || | 612 } else if (type == kMachUint32 || type == kMachUint16 || |
614 type == kMachUint8) { | 613 type == kMachUint8) { |
615 translation->StoreUint32Register(converter.ToRegister(op)); | 614 translation->StoreUint32Register(converter.ToRegister(op)); |
616 } else if ((type & kRepMask) == kRepTagged) { | 615 } else if ((type & kRepMask) == kRepTagged) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 : masm_(gen->masm()), next_(gen->ools_) { | 667 : masm_(gen->masm()), next_(gen->ools_) { |
669 gen->ools_ = this; | 668 gen->ools_ = this; |
670 } | 669 } |
671 | 670 |
672 | 671 |
673 OutOfLineCode::~OutOfLineCode() {} | 672 OutOfLineCode::~OutOfLineCode() {} |
674 | 673 |
675 } // namespace compiler | 674 } // namespace compiler |
676 } // namespace internal | 675 } // namespace internal |
677 } // namespace v8 | 676 } // namespace v8 |
OLD | NEW |