| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 void CodeGenerator::RecordSafepoint(PointerMap* pointers, Safepoint::Kind kind, | 169 void CodeGenerator::RecordSafepoint(PointerMap* pointers, Safepoint::Kind kind, |
| 170 int arguments, | 170 int arguments, |
| 171 Safepoint::DeoptMode deopt_mode) { | 171 Safepoint::DeoptMode deopt_mode) { |
| 172 const ZoneList<InstructionOperand*>* operands = | 172 const ZoneList<InstructionOperand*>* operands = |
| 173 pointers->GetNormalizedOperands(); | 173 pointers->GetNormalizedOperands(); |
| 174 Safepoint safepoint = | 174 Safepoint safepoint = |
| 175 safepoints()->DefineSafepoint(masm(), kind, arguments, deopt_mode); | 175 safepoints()->DefineSafepoint(masm(), kind, arguments, deopt_mode); |
| 176 for (int i = 0; i < operands->length(); i++) { | 176 for (int i = 0; i < operands->length(); i++) { |
| 177 InstructionOperand* pointer = operands->at(i); | 177 InstructionOperand* pointer = operands->at(i); |
| 178 if (pointer->IsStackSlot()) { | 178 if (pointer->IsStackSlot()) { |
| 179 safepoint.DefinePointerSlot(pointer->index(), zone()); | 179 safepoint.DefinePointerSlot(StackSlotOperand::cast(pointer)->index(), |
| 180 zone()); |
| 180 } else if (pointer->IsRegister() && (kind & Safepoint::kWithRegisters)) { | 181 } else if (pointer->IsRegister() && (kind & Safepoint::kWithRegisters)) { |
| 181 Register reg = Register::FromAllocationIndex(pointer->index()); | 182 Register reg = Register::FromAllocationIndex( |
| 183 RegisterOperand::cast(pointer)->index()); |
| 182 safepoint.DefinePointerRegister(reg, zone()); | 184 safepoint.DefinePointerRegister(reg, zone()); |
| 183 } | 185 } |
| 184 } | 186 } |
| 185 } | 187 } |
| 186 | 188 |
| 187 | 189 |
| 188 void CodeGenerator::AssembleInstruction(Instruction* instr) { | 190 void CodeGenerator::AssembleInstruction(Instruction* instr) { |
| 189 AssembleGaps(instr); | 191 AssembleGaps(instr); |
| 190 if (instr->IsSourcePosition()) { | 192 if (instr->IsSourcePosition()) { |
| 191 AssembleSourcePosition(SourcePositionInstruction::cast(instr)); | 193 AssembleSourcePosition(SourcePositionInstruction::cast(instr)); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 507 |
| 506 void CodeGenerator::AddTranslationForOperand(Translation* translation, | 508 void CodeGenerator::AddTranslationForOperand(Translation* translation, |
| 507 Instruction* instr, | 509 Instruction* instr, |
| 508 InstructionOperand* op, | 510 InstructionOperand* op, |
| 509 MachineType type) { | 511 MachineType type) { |
| 510 if (op->IsStackSlot()) { | 512 if (op->IsStackSlot()) { |
| 511 // TODO(jarin) kMachBool and kRepBit should materialize true and false | 513 // TODO(jarin) kMachBool and kRepBit should materialize true and false |
| 512 // rather than creating an int value. | 514 // rather than creating an int value. |
| 513 if (type == kMachBool || type == kRepBit || type == kMachInt32 || | 515 if (type == kMachBool || type == kRepBit || type == kMachInt32 || |
| 514 type == kMachInt8 || type == kMachInt16) { | 516 type == kMachInt8 || type == kMachInt16) { |
| 515 translation->StoreInt32StackSlot(op->index()); | 517 translation->StoreInt32StackSlot(StackSlotOperand::cast(op)->index()); |
| 516 } else if (type == kMachUint32 || type == kMachUint16 || | 518 } else if (type == kMachUint32 || type == kMachUint16 || |
| 517 type == kMachUint8) { | 519 type == kMachUint8) { |
| 518 translation->StoreUint32StackSlot(op->index()); | 520 translation->StoreUint32StackSlot(StackSlotOperand::cast(op)->index()); |
| 519 } else if ((type & kRepMask) == kRepTagged) { | 521 } else if ((type & kRepMask) == kRepTagged) { |
| 520 translation->StoreStackSlot(op->index()); | 522 translation->StoreStackSlot(StackSlotOperand::cast(op)->index()); |
| 521 } else { | 523 } else { |
| 522 CHECK(false); | 524 CHECK(false); |
| 523 } | 525 } |
| 524 } else if (op->IsDoubleStackSlot()) { | 526 } else if (op->IsDoubleStackSlot()) { |
| 525 DCHECK((type & (kRepFloat32 | kRepFloat64)) != 0); | 527 DCHECK((type & (kRepFloat32 | kRepFloat64)) != 0); |
| 526 translation->StoreDoubleStackSlot(op->index()); | 528 translation->StoreDoubleStackSlot( |
| 529 DoubleStackSlotOperand::cast(op)->index()); |
| 527 } else if (op->IsRegister()) { | 530 } else if (op->IsRegister()) { |
| 528 InstructionOperandConverter converter(this, instr); | 531 InstructionOperandConverter converter(this, instr); |
| 529 // TODO(jarin) kMachBool and kRepBit should materialize true and false | 532 // TODO(jarin) kMachBool and kRepBit should materialize true and false |
| 530 // rather than creating an int value. | 533 // rather than creating an int value. |
| 531 if (type == kMachBool || type == kRepBit || type == kMachInt32 || | 534 if (type == kMachBool || type == kRepBit || type == kMachInt32 || |
| 532 type == kMachInt8 || type == kMachInt16) { | 535 type == kMachInt8 || type == kMachInt16) { |
| 533 translation->StoreInt32Register(converter.ToRegister(op)); | 536 translation->StoreInt32Register(converter.ToRegister(op)); |
| 534 } else if (type == kMachUint32 || type == kMachUint16 || | 537 } else if (type == kMachUint32 || type == kMachUint16 || |
| 535 type == kMachUint8) { | 538 type == kMachUint8) { |
| 536 translation->StoreUint32Register(converter.ToRegister(op)); | 539 translation->StoreUint32Register(converter.ToRegister(op)); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 : masm_(gen->masm()), next_(gen->ools_) { | 642 : masm_(gen->masm()), next_(gen->ools_) { |
| 640 gen->ools_ = this; | 643 gen->ools_ = this; |
| 641 } | 644 } |
| 642 | 645 |
| 643 | 646 |
| 644 OutOfLineCode::~OutOfLineCode() {} | 647 OutOfLineCode::~OutOfLineCode() {} |
| 645 | 648 |
| 646 } // namespace compiler | 649 } // namespace compiler |
| 647 } // namespace internal | 650 } // namespace internal |
| 648 } // namespace v8 | 651 } // namespace v8 |
| OLD | NEW |