| 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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
| 9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
| 10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 // Assembles an instruction after register allocation, producing machine code. | 652 // Assembles an instruction after register allocation, producing machine code. |
| 653 CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( | 653 CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
| 654 Instruction* instr) { | 654 Instruction* instr) { |
| 655 X64OperandConverter i(this, instr); | 655 X64OperandConverter i(this, instr); |
| 656 InstructionCode opcode = instr->opcode(); | 656 InstructionCode opcode = instr->opcode(); |
| 657 ArchOpcode arch_opcode = ArchOpcodeField::decode(opcode); | 657 ArchOpcode arch_opcode = ArchOpcodeField::decode(opcode); |
| 658 switch (arch_opcode) { | 658 switch (arch_opcode) { |
| 659 case kArchCallCodeObject: { | 659 case kArchCallCodeObject: { |
| 660 EnsureSpaceForLazyDeopt(); | 660 EnsureSpaceForLazyDeopt(); |
| 661 if (HasImmediateInput(instr, 0)) { | 661 if (HasImmediateInput(instr, 0)) { |
| 662 Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0)); | 662 Constant callee_operand = i.ToConstant(instr->InputAt(0)); |
| 663 __ Call(code, RelocInfo::CODE_TARGET); | 663 if (callee_operand.type() == Constant::Type::kInt32) { |
| 664 __ wasm_direct_call(callee_operand.ToInt32()); |
| 665 } else { |
| 666 Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0)); |
| 667 __ Call(code, RelocInfo::CODE_TARGET); |
| 668 } |
| 664 } else { | 669 } else { |
| 665 Register reg = i.InputRegister(0); | 670 Register reg = i.InputRegister(0); |
| 666 __ addp(reg, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 671 __ addp(reg, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| 667 __ call(reg); | 672 __ call(reg); |
| 668 } | 673 } |
| 669 RecordCallPosition(instr); | 674 RecordCallPosition(instr); |
| 670 frame_access_state()->ClearSPDelta(); | 675 frame_access_state()->ClearSPDelta(); |
| 671 break; | 676 break; |
| 672 } | 677 } |
| 673 case kArchTailCallCodeObjectFromJSFunction: | 678 case kArchTailCallCodeObjectFromJSFunction: |
| (...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2316 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2321 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
| 2317 __ Nop(padding_size); | 2322 __ Nop(padding_size); |
| 2318 } | 2323 } |
| 2319 } | 2324 } |
| 2320 | 2325 |
| 2321 #undef __ | 2326 #undef __ |
| 2322 | 2327 |
| 2323 } // namespace compiler | 2328 } // namespace compiler |
| 2324 } // namespace internal | 2329 } // namespace internal |
| 2325 } // namespace v8 | 2330 } // namespace v8 |
| OLD | NEW |