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" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 namespace compiler { | 14 namespace compiler { |
15 | 15 |
16 // Adds X64-specific methods for generating operands. | 16 // Adds X64-specific methods for generating operands. |
17 class X64OperandGenerator final : public OperandGenerator { | 17 class X64OperandGenerator final : public OperandGenerator { |
18 public: | 18 public: |
19 explicit X64OperandGenerator(InstructionSelector* selector) | 19 explicit X64OperandGenerator(InstructionSelector* selector) |
20 : OperandGenerator(selector) {} | 20 : OperandGenerator(selector) {} |
21 | 21 |
22 bool CanBeImmediate(Node* node) { | 22 bool CanBeImmediate(Node* node) { |
23 switch (node->opcode()) { | 23 switch (node->opcode()) { |
24 case IrOpcode::kInt32Constant: | 24 case IrOpcode::kInt32Constant: |
25 return true; | 25 return true; |
26 case IrOpcode::kInt64Constant: { | 26 case IrOpcode::kInt64Constant: { |
27 const int64_t value = OpParameter<int64_t>(node); | 27 const int64_t value = OpParameter<int64_t>(node); |
28 return value == static_cast<int64_t>(static_cast<int32_t>(value)); | 28 return value == static_cast<int64_t>(static_cast<int32_t>(value)); |
29 } | 29 } |
| 30 case IrOpcode::kNumberConstant: { |
| 31 const double value = OpParameter<double>(node); |
| 32 return bit_cast<int64_t>(value) == 0; |
| 33 } |
30 default: | 34 default: |
31 return false; | 35 return false; |
32 } | 36 } |
33 } | 37 } |
34 | 38 |
35 AddressingMode GenerateMemoryOperandInputs(Node* index, int scale_exponent, | 39 AddressingMode GenerateMemoryOperandInputs(Node* index, int scale_exponent, |
36 Node* base, Node* displacement, | 40 Node* base, Node* displacement, |
37 InstructionOperand inputs[], | 41 InstructionOperand inputs[], |
38 size_t* input_count) { | 42 size_t* input_count) { |
39 AddressingMode mode = kMode_MRI; | 43 AddressingMode mode = kMode_MRI; |
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1632 if (CpuFeatures::IsSupported(SSE4_1)) { | 1636 if (CpuFeatures::IsSupported(SSE4_1)) { |
1633 flags |= MachineOperatorBuilder::kFloat64RoundDown | | 1637 flags |= MachineOperatorBuilder::kFloat64RoundDown | |
1634 MachineOperatorBuilder::kFloat64RoundTruncate; | 1638 MachineOperatorBuilder::kFloat64RoundTruncate; |
1635 } | 1639 } |
1636 return flags; | 1640 return flags; |
1637 } | 1641 } |
1638 | 1642 |
1639 } // namespace compiler | 1643 } // namespace compiler |
1640 } // namespace internal | 1644 } // namespace internal |
1641 } // namespace v8 | 1645 } // namespace v8 |
OLD | NEW |