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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 kArchCallCodeObject: { | 576 case kArchCallCodeObject: { |
577 EnsureSpaceForLazyDeopt(); | 577 EnsureSpaceForLazyDeopt(); |
578 if (instr->InputAt(0)->IsImmediate()) { | 578 if (instr->InputAt(0)->IsImmediate()) { |
579 __ Call(Handle<Code>::cast(i.InputHeapObject(0)), | 579 Constant callee_operand = i.ToConstant(instr->InputAt(0)); |
580 RelocInfo::CODE_TARGET); | 580 if (callee_operand.type() == Constant::Type::kInt32) { |
| 581 __ Call(reinterpret_cast<Address>(callee_operand.ToInt32()), |
| 582 RelocInfo::WASM_DIRECT_CALL); |
| 583 } else { |
| 584 __ Call(Handle<Code>::cast(i.InputHeapObject(0)), |
| 585 RelocInfo::CODE_TARGET); |
| 586 } |
581 } else { | 587 } else { |
582 Register target = i.InputRegister(0); | 588 Register target = i.InputRegister(0); |
583 __ Add(target, target, Code::kHeaderSize - kHeapObjectTag); | 589 __ Add(target, target, Code::kHeaderSize - kHeapObjectTag); |
584 __ Call(target); | 590 __ Call(target); |
585 } | 591 } |
586 RecordCallPosition(instr); | 592 RecordCallPosition(instr); |
587 // TODO(titzer): this is ugly. JSSP should be a caller-save register | 593 // TODO(titzer): this is ugly. JSSP should be a caller-save register |
588 // in this case, but it is not possible to express in the register | 594 // in this case, but it is not possible to express in the register |
589 // allocator. | 595 // allocator. |
590 CallDescriptor::Flags flags(MiscField::decode(opcode)); | 596 CallDescriptor::Flags flags(MiscField::decode(opcode)); |
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1905 padding_size -= kInstructionSize; | 1911 padding_size -= kInstructionSize; |
1906 } | 1912 } |
1907 } | 1913 } |
1908 } | 1914 } |
1909 | 1915 |
1910 #undef __ | 1916 #undef __ |
1911 | 1917 |
1912 } // namespace compiler | 1918 } // namespace compiler |
1913 } // namespace internal | 1919 } // namespace internal |
1914 } // namespace v8 | 1920 } // namespace v8 |
OLD | NEW |