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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 // Assembles an instruction after register allocation, producing machine code. | 430 // Assembles an instruction after register allocation, producing machine code. |
431 CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( | 431 CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
432 Instruction* instr) { | 432 Instruction* instr) { |
433 IA32OperandConverter i(this, instr); | 433 IA32OperandConverter i(this, instr); |
434 InstructionCode opcode = instr->opcode(); | 434 InstructionCode opcode = instr->opcode(); |
435 ArchOpcode arch_opcode = ArchOpcodeField::decode(opcode); | 435 ArchOpcode arch_opcode = ArchOpcodeField::decode(opcode); |
436 switch (arch_opcode) { | 436 switch (arch_opcode) { |
437 case kArchCallCodeObject: { | 437 case kArchCallCodeObject: { |
438 EnsureSpaceForLazyDeopt(); | 438 EnsureSpaceForLazyDeopt(); |
439 if (HasImmediateInput(instr, 0)) { | 439 if (HasImmediateInput(instr, 0)) { |
440 Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0)); | 440 Constant callee_operand = i.ToConstant(instr->InputAt(0)); |
441 __ call(code, RelocInfo::CODE_TARGET); | 441 if (callee_operand.type() == Constant::Type::kInt32) { |
| 442 __ wasm_direct_call(callee_operand.ToInt32()); |
| 443 } else { |
| 444 Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0)); |
| 445 __ call(code, RelocInfo::CODE_TARGET); |
| 446 } |
442 } else { | 447 } else { |
443 Register reg = i.InputRegister(0); | 448 Register reg = i.InputRegister(0); |
444 __ add(reg, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 449 __ add(reg, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
445 __ call(reg); | 450 __ call(reg); |
446 } | 451 } |
447 RecordCallPosition(instr); | 452 RecordCallPosition(instr); |
448 frame_access_state()->ClearSPDelta(); | 453 frame_access_state()->ClearSPDelta(); |
449 break; | 454 break; |
450 } | 455 } |
451 case kArchTailCallCodeObjectFromJSFunction: | 456 case kArchTailCallCodeObjectFromJSFunction: |
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1957 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 1962 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
1958 __ Nop(padding_size); | 1963 __ Nop(padding_size); |
1959 } | 1964 } |
1960 } | 1965 } |
1961 | 1966 |
1962 #undef __ | 1967 #undef __ |
1963 | 1968 |
1964 } // namespace compiler | 1969 } // namespace compiler |
1965 } // namespace internal | 1970 } // namespace internal |
1966 } // namespace v8 | 1971 } // namespace v8 |
OLD | NEW |