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/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/arm64/macro-assembler-arm64.h" | 8 #include "src/arm64/macro-assembler-arm64.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/compiler/code-generator-impl.h" | 10 #include "src/compiler/code-generator-impl.h" |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 __ bind(&done); | 566 __ bind(&done); |
567 } | 567 } |
568 | 568 |
569 // Assembles an instruction after register allocation, producing machine code. | 569 // Assembles an instruction after register allocation, producing machine code. |
570 CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( | 570 CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
571 Instruction* instr) { | 571 Instruction* instr) { |
572 Arm64OperandConverter i(this, instr); | 572 Arm64OperandConverter i(this, instr); |
573 InstructionCode opcode = instr->opcode(); | 573 InstructionCode opcode = instr->opcode(); |
574 ArchOpcode arch_opcode = ArchOpcodeField::decode(opcode); | 574 ArchOpcode arch_opcode = ArchOpcodeField::decode(opcode); |
575 switch (arch_opcode) { | 575 switch (arch_opcode) { |
| 576 case kArchCallWasmFunction: { |
| 577 DCHECK(instr->InputAt(0)->IsImmediate()); |
| 578 Constant callee_operand = i.ToConstant(instr->InputAt(0)); |
| 579 DCHECK(callee_operand.type() == Constant::Type::kInt32); |
| 580 __ Call(reinterpret_cast<Address>(callee_operand.ToInt32()), |
| 581 callee_operand.rmode()); |
| 582 RecordCallPosition(instr); |
| 583 // TODO(titzer): this is ugly. JSSP should be a caller-save register |
| 584 // in this case, but it is not possible to express in the register |
| 585 // allocator. |
| 586 CallDescriptor::Flags flags(MiscField::decode(opcode)); |
| 587 if (flags & CallDescriptor::kRestoreJSSP) { |
| 588 __ Ldr(jssp, MemOperand(csp)); |
| 589 __ Mov(csp, jssp); |
| 590 } |
| 591 if (flags & CallDescriptor::kRestoreCSP) { |
| 592 __ Mov(csp, jssp); |
| 593 __ AssertCspAligned(); |
| 594 } |
| 595 frame_access_state()->ClearSPDelta(); |
| 596 break; |
| 597 } |
576 case kArchCallCodeObject: { | 598 case kArchCallCodeObject: { |
577 EnsureSpaceForLazyDeopt(); | 599 EnsureSpaceForLazyDeopt(); |
578 if (instr->InputAt(0)->IsImmediate()) { | 600 if (instr->InputAt(0)->IsImmediate()) { |
579 __ Call(Handle<Code>::cast(i.InputHeapObject(0)), | 601 __ Call(Handle<Code>::cast(i.InputHeapObject(0)), |
580 RelocInfo::CODE_TARGET); | 602 RelocInfo::CODE_TARGET); |
581 } else { | 603 } else { |
582 Register target = i.InputRegister(0); | 604 Register target = i.InputRegister(0); |
583 __ Add(target, target, Code::kHeaderSize - kHeapObjectTag); | 605 __ Add(target, target, Code::kHeaderSize - kHeapObjectTag); |
584 __ Call(target); | 606 __ Call(target); |
585 } | 607 } |
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1927 padding_size -= kInstructionSize; | 1949 padding_size -= kInstructionSize; |
1928 } | 1950 } |
1929 } | 1951 } |
1930 } | 1952 } |
1931 | 1953 |
1932 #undef __ | 1954 #undef __ |
1933 | 1955 |
1934 } // namespace compiler | 1956 } // namespace compiler |
1935 } // namespace internal | 1957 } // namespace internal |
1936 } // namespace v8 | 1958 } // namespace v8 |
OLD | NEW |