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 #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/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/ppc/macro-assembler-ppc.h" | 10 #include "src/ppc/macro-assembler-ppc.h" |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 LinkRegisterStatus lr_status = kLRHasNotBeenSaved; \ | 578 LinkRegisterStatus lr_status = kLRHasNotBeenSaved; \ |
579 __ RecordWrite(object, index, value, lr_status, mode); \ | 579 __ RecordWrite(object, index, value, lr_status, mode); \ |
580 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \ | 580 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \ |
581 } while (0) | 581 } while (0) |
582 | 582 |
583 | 583 |
584 void CodeGenerator::AssembleDeconstructActivationRecord() { | 584 void CodeGenerator::AssembleDeconstructActivationRecord() { |
585 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 585 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
586 int stack_slots = frame()->GetSpillSlotCount(); | 586 int stack_slots = frame()->GetSpillSlotCount(); |
587 if (descriptor->IsJSFunctionCall() || stack_slots > 0) { | 587 if (descriptor->IsJSFunctionCall() || stack_slots > 0) { |
588 int pop_count = descriptor->IsJSFunctionCall() | 588 __ LeaveFrame(StackFrame::MANUAL); |
589 ? static_cast<int>(descriptor->JSParameterCount()) | |
590 : 0; | |
591 __ LeaveFrame(StackFrame::MANUAL, pop_count * kPointerSize); | |
592 } | 589 } |
593 } | 590 } |
594 | 591 |
595 | 592 |
596 // Assembles an instruction after register allocation, producing machine code. | 593 // Assembles an instruction after register allocation, producing machine code. |
597 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { | 594 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
598 PPCOperandConverter i(this, instr); | 595 PPCOperandConverter i(this, instr); |
599 ArchOpcode opcode = ArchOpcodeField::decode(instr->opcode()); | 596 ArchOpcode opcode = ArchOpcodeField::decode(instr->opcode()); |
600 | 597 |
601 switch (opcode) { | 598 switch (opcode) { |
(...skipping 11 matching lines...) Expand all Loading... |
613 DCHECK_EQ(LeaveRC, i.OutputRCBit()); | 610 DCHECK_EQ(LeaveRC, i.OutputRCBit()); |
614 break; | 611 break; |
615 } | 612 } |
616 case kArchTailCallCodeObject: { | 613 case kArchTailCallCodeObject: { |
617 AssembleDeconstructActivationRecord(); | 614 AssembleDeconstructActivationRecord(); |
618 if (HasRegisterInput(instr, 0)) { | 615 if (HasRegisterInput(instr, 0)) { |
619 __ addi(ip, i.InputRegister(0), | 616 __ addi(ip, i.InputRegister(0), |
620 Operand(Code::kHeaderSize - kHeapObjectTag)); | 617 Operand(Code::kHeaderSize - kHeapObjectTag)); |
621 __ Jump(ip); | 618 __ Jump(ip); |
622 } else { | 619 } else { |
| 620 // We cannot use the constant pool to load the target since |
| 621 // we've already restored the caller's frame. |
| 622 ConstantPoolUnavailableScope constant_pool_unavailable(masm()); |
623 __ Jump(Handle<Code>::cast(i.InputHeapObject(0)), | 623 __ Jump(Handle<Code>::cast(i.InputHeapObject(0)), |
624 RelocInfo::CODE_TARGET); | 624 RelocInfo::CODE_TARGET); |
625 } | 625 } |
626 DCHECK_EQ(LeaveRC, i.OutputRCBit()); | 626 DCHECK_EQ(LeaveRC, i.OutputRCBit()); |
627 break; | 627 break; |
628 } | 628 } |
629 case kArchCallJSFunction: { | 629 case kArchCallJSFunction: { |
630 EnsureSpaceForLazyDeopt(); | 630 EnsureSpaceForLazyDeopt(); |
631 Register func = i.InputRegister(0); | 631 Register func = i.InputRegister(0); |
632 if (FLAG_debug_code) { | 632 if (FLAG_debug_code) { |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 __ LeaveFrame(StackFrame::MANUAL); | 1372 __ LeaveFrame(StackFrame::MANUAL); |
1373 __ Ret(); | 1373 __ Ret(); |
1374 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { | 1374 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { |
1375 // Canonicalize JSFunction return sites for now. | 1375 // Canonicalize JSFunction return sites for now. |
1376 if (return_label_.is_bound()) { | 1376 if (return_label_.is_bound()) { |
1377 __ b(&return_label_); | 1377 __ b(&return_label_); |
1378 } else { | 1378 } else { |
1379 __ bind(&return_label_); | 1379 __ bind(&return_label_); |
1380 int pop_count = descriptor->IsJSFunctionCall() | 1380 int pop_count = descriptor->IsJSFunctionCall() |
1381 ? static_cast<int>(descriptor->JSParameterCount()) | 1381 ? static_cast<int>(descriptor->JSParameterCount()) |
1382 : 0; | 1382 : (info()->IsStub() |
| 1383 ? info()->code_stub()->GetStackParameterCount() |
| 1384 : 0); |
1383 __ LeaveFrame(StackFrame::MANUAL, pop_count * kPointerSize); | 1385 __ LeaveFrame(StackFrame::MANUAL, pop_count * kPointerSize); |
1384 __ Ret(); | 1386 __ Ret(); |
1385 } | 1387 } |
1386 } else { | 1388 } else { |
1387 __ Ret(); | 1389 __ Ret(); |
1388 } | 1390 } |
1389 } | 1391 } |
1390 | 1392 |
1391 | 1393 |
1392 void CodeGenerator::AssembleMove(InstructionOperand* source, | 1394 void CodeGenerator::AssembleMove(InstructionOperand* source, |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 } | 1589 } |
1588 } | 1590 } |
1589 } | 1591 } |
1590 } | 1592 } |
1591 | 1593 |
1592 #undef __ | 1594 #undef __ |
1593 | 1595 |
1594 } // namespace compiler | 1596 } // namespace compiler |
1595 } // namespace internal | 1597 } // namespace internal |
1596 } // namespace v8 | 1598 } // namespace v8 |
OLD | NEW |