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/instruction-selector.h" | 5 #include "src/compiler/instruction-selector.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/base/adapters.h" | 9 #include "src/base/adapters.h" |
10 #include "src/compiler/instruction-selector-impl.h" | 10 #include "src/compiler/instruction-selector-impl.h" |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 Node* callee = call->InputAt(0); | 581 Node* callee = call->InputAt(0); |
582 bool call_code_immediate = (flags & kCallCodeImmediate) != 0; | 582 bool call_code_immediate = (flags & kCallCodeImmediate) != 0; |
583 bool call_address_immediate = (flags & kCallAddressImmediate) != 0; | 583 bool call_address_immediate = (flags & kCallAddressImmediate) != 0; |
584 switch (buffer->descriptor->kind()) { | 584 switch (buffer->descriptor->kind()) { |
585 case CallDescriptor::kCallCodeObject: | 585 case CallDescriptor::kCallCodeObject: |
586 buffer->instruction_args.push_back( | 586 buffer->instruction_args.push_back( |
587 (call_code_immediate && callee->opcode() == IrOpcode::kHeapConstant) | 587 (call_code_immediate && callee->opcode() == IrOpcode::kHeapConstant) |
588 ? g.UseImmediate(callee) | 588 ? g.UseImmediate(callee) |
589 : g.UseRegister(callee)); | 589 : g.UseRegister(callee)); |
590 break; | 590 break; |
| 591 case CallDescriptor::kCallWasmFunction: { |
| 592 DCHECK(callee->opcode() == IrOpcode::kRelocatableInt32Constant); |
| 593 buffer->instruction_args.push_back(g.UseImmediate(callee)); |
| 594 break; |
| 595 } |
591 case CallDescriptor::kCallAddress: | 596 case CallDescriptor::kCallAddress: |
592 buffer->instruction_args.push_back( | 597 buffer->instruction_args.push_back( |
593 (call_address_immediate && | 598 (call_address_immediate && |
594 callee->opcode() == IrOpcode::kExternalConstant) | 599 callee->opcode() == IrOpcode::kExternalConstant) |
595 ? g.UseImmediate(callee) | 600 ? g.UseImmediate(callee) |
596 : g.UseRegister(callee)); | 601 : g.UseRegister(callee)); |
597 break; | 602 break; |
598 case CallDescriptor::kCallJSFunction: | 603 case CallDescriptor::kCallJSFunction: |
599 buffer->instruction_args.push_back( | 604 buffer->instruction_args.push_back( |
600 g.UseLocation(callee, buffer->descriptor->GetInputLocation(0), | 605 g.UseLocation(callee, buffer->descriptor->GetInputLocation(0), |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 InstructionCode opcode = kArchNop; | 1599 InstructionCode opcode = kArchNop; |
1595 switch (descriptor->kind()) { | 1600 switch (descriptor->kind()) { |
1596 case CallDescriptor::kCallAddress: | 1601 case CallDescriptor::kCallAddress: |
1597 opcode = | 1602 opcode = |
1598 kArchCallCFunction | | 1603 kArchCallCFunction | |
1599 MiscField::encode(static_cast<int>(descriptor->CParameterCount())); | 1604 MiscField::encode(static_cast<int>(descriptor->CParameterCount())); |
1600 break; | 1605 break; |
1601 case CallDescriptor::kCallCodeObject: | 1606 case CallDescriptor::kCallCodeObject: |
1602 opcode = kArchCallCodeObject | MiscField::encode(flags); | 1607 opcode = kArchCallCodeObject | MiscField::encode(flags); |
1603 break; | 1608 break; |
| 1609 case CallDescriptor::kCallWasmFunction: |
| 1610 opcode = kArchCallWasmFunction | MiscField::encode(flags); |
| 1611 break; |
1604 case CallDescriptor::kCallJSFunction: | 1612 case CallDescriptor::kCallJSFunction: |
1605 opcode = kArchCallJSFunction | MiscField::encode(flags); | 1613 opcode = kArchCallJSFunction | MiscField::encode(flags); |
1606 break; | 1614 break; |
1607 } | 1615 } |
1608 | 1616 |
1609 // Emit the call instruction. | 1617 // Emit the call instruction. |
1610 size_t const output_count = buffer.outputs.size(); | 1618 size_t const output_count = buffer.outputs.size(); |
1611 auto* outputs = output_count ? &buffer.outputs.front() : nullptr; | 1619 auto* outputs = output_count ? &buffer.outputs.front() : nullptr; |
1612 Emit(opcode, output_count, outputs, buffer.instruction_args.size(), | 1620 Emit(opcode, output_count, outputs, buffer.instruction_args.size(), |
1613 &buffer.instruction_args.front()) | 1621 &buffer.instruction_args.front()) |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1830 return new (instruction_zone()) FrameStateDescriptor( | 1838 return new (instruction_zone()) FrameStateDescriptor( |
1831 instruction_zone(), state_info.type(), state_info.bailout_id(), | 1839 instruction_zone(), state_info.type(), state_info.bailout_id(), |
1832 state_info.state_combine(), parameters, locals, stack, | 1840 state_info.state_combine(), parameters, locals, stack, |
1833 state_info.shared_info(), outer_state); | 1841 state_info.shared_info(), outer_state); |
1834 } | 1842 } |
1835 | 1843 |
1836 | 1844 |
1837 } // namespace compiler | 1845 } // namespace compiler |
1838 } // namespace internal | 1846 } // namespace internal |
1839 } // namespace v8 | 1847 } // namespace v8 |
OLD | NEW |