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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "src/base/adapters.h" | 7 #include "src/base/adapters.h" |
8 #include "src/compiler/instruction-selector-impl.h" | 8 #include "src/compiler/instruction-selector-impl.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 | 1047 |
1048 // Prepare for C function call. | 1048 // Prepare for C function call. |
1049 if (descriptor->IsCFunctionCall()) { | 1049 if (descriptor->IsCFunctionCall()) { |
1050 Emit(kArchPrepareCallCFunction | | 1050 Emit(kArchPrepareCallCFunction | |
1051 MiscField::encode(static_cast<int>(descriptor->CParameterCount())), | 1051 MiscField::encode(static_cast<int>(descriptor->CParameterCount())), |
1052 0, nullptr, 0, nullptr); | 1052 0, nullptr, 0, nullptr); |
1053 | 1053 |
1054 // Poke any stack arguments. | 1054 // Poke any stack arguments. |
1055 for (size_t n = 0; n < buffer.pushed_nodes.size(); ++n) { | 1055 for (size_t n = 0; n < buffer.pushed_nodes.size(); ++n) { |
1056 if (Node* input = buffer.pushed_nodes[n]) { | 1056 if (Node* input = buffer.pushed_nodes[n]) { |
1057 int const slot = static_cast<int>(n); | 1057 int slot = static_cast<int>(n); |
1058 InstructionOperand value = g.CanBeImmediate(input) | 1058 InstructionOperand value = g.CanBeImmediate(input) |
1059 ? g.UseImmediate(input) | 1059 ? g.UseImmediate(input) |
1060 : g.UseRegister(input); | 1060 : g.UseRegister(input); |
1061 Emit(kX64Poke | MiscField::encode(slot), g.NoOutput(), value); | 1061 Emit(kX64Poke | MiscField::encode(slot), g.NoOutput(), value); |
1062 } | 1062 } |
1063 } | 1063 } |
1064 } else { | 1064 } else { |
1065 // Push any stack arguments. | 1065 // Push any stack arguments. |
1066 for (Node* input : base::Reversed(buffer.pushed_nodes)) { | 1066 for (Node* input : base::Reversed(buffer.pushed_nodes)) { |
1067 // TODO(titzer): handle pushing double parameters. | 1067 // TODO(titzer): X64Push cannot handle stack->stack double moves |
| 1068 // because there is no way to encode fixed double slots. |
1068 InstructionOperand value = | 1069 InstructionOperand value = |
1069 g.CanBeImmediate(input) | 1070 g.CanBeImmediate(input) |
1070 ? g.UseImmediate(input) | 1071 ? g.UseImmediate(input) |
1071 : IsSupported(ATOM) ? g.UseRegister(input) : g.Use(input); | 1072 : IsSupported(ATOM) || |
| 1073 sequence()->IsFloat(GetVirtualRegister(input)) |
| 1074 ? g.UseRegister(input) |
| 1075 : g.Use(input); |
1072 Emit(kX64Push, g.NoOutput(), value); | 1076 Emit(kX64Push, g.NoOutput(), value); |
1073 } | 1077 } |
1074 } | 1078 } |
1075 | 1079 |
1076 // Pass label of exception handler block. | 1080 // Pass label of exception handler block. |
1077 CallDescriptor::Flags flags = descriptor->flags(); | 1081 CallDescriptor::Flags flags = descriptor->flags(); |
1078 if (handler) { | 1082 if (handler) { |
1079 DCHECK_EQ(IrOpcode::kIfException, handler->front()->opcode()); | 1083 DCHECK_EQ(IrOpcode::kIfException, handler->front()->opcode()); |
1080 IfExceptionHint hint = OpParameter<IfExceptionHint>(handler->front()); | 1084 IfExceptionHint hint = OpParameter<IfExceptionHint>(handler->front()); |
1081 if (hint == IfExceptionHint::kLocallyCaught) { | 1085 if (hint == IfExceptionHint::kLocallyCaught) { |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1674 if (CpuFeatures::IsSupported(SSE4_1)) { | 1678 if (CpuFeatures::IsSupported(SSE4_1)) { |
1675 flags |= MachineOperatorBuilder::kFloat64RoundDown | | 1679 flags |= MachineOperatorBuilder::kFloat64RoundDown | |
1676 MachineOperatorBuilder::kFloat64RoundTruncate; | 1680 MachineOperatorBuilder::kFloat64RoundTruncate; |
1677 } | 1681 } |
1678 return flags; | 1682 return flags; |
1679 } | 1683 } |
1680 | 1684 |
1681 } // namespace compiler | 1685 } // namespace compiler |
1682 } // namespace internal | 1686 } // namespace internal |
1683 } // namespace v8 | 1687 } // namespace v8 |
OLD | NEW |