| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 m.index().Value() + | 147 m.index().Value() + |
| 148 (m.object().Value().address() - kRootsRegisterValue); | 148 (m.object().Value().address() - kRootsRegisterValue); |
| 149 if (is_int32(delta)) { | 149 if (is_int32(delta)) { |
| 150 inputs[(*input_count)++] = TempImmediate(static_cast<int32_t>(delta)); | 150 inputs[(*input_count)++] = TempImmediate(static_cast<int32_t>(delta)); |
| 151 return kMode_Root; | 151 return kMode_Root; |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 BaseWithIndexAndDisplacement64Matcher m(operand, AddressOption::kAllowAll); | 155 BaseWithIndexAndDisplacement64Matcher m(operand, AddressOption::kAllowAll); |
| 156 DCHECK(m.matches()); | 156 DCHECK(m.matches()); |
| 157 if ((m.displacement() == nullptr || CanBeImmediate(m.displacement()))) { | 157 if (m.displacement() == nullptr || CanBeImmediate(m.displacement())) { |
| 158 return GenerateMemoryOperandInputs( | 158 return GenerateMemoryOperandInputs( |
| 159 m.index(), m.scale(), m.base(), m.displacement(), | 159 m.index(), m.scale(), m.base(), m.displacement(), |
| 160 m.displacement_mode(), inputs, input_count); | 160 m.displacement_mode(), inputs, input_count); |
| 161 } else if (m.base() == nullptr && |
| 162 m.displacement_mode() == kPositiveDisplacement) { |
| 163 // The displacement cannot be an immediate, but we can use the |
| 164 // displacement as base instead and still benefit from addressing |
| 165 // modes for the scale. |
| 166 return GenerateMemoryOperandInputs(m.index(), m.scale(), m.displacement(), |
| 167 nullptr, m.displacement_mode(), inputs, |
| 168 input_count); |
| 161 } else { | 169 } else { |
| 162 inputs[(*input_count)++] = UseRegister(operand->InputAt(0)); | 170 inputs[(*input_count)++] = UseRegister(operand->InputAt(0)); |
| 163 inputs[(*input_count)++] = UseRegister(operand->InputAt(1)); | 171 inputs[(*input_count)++] = UseRegister(operand->InputAt(1)); |
| 164 return kMode_MR1; | 172 return kMode_MR1; |
| 165 } | 173 } |
| 166 } | 174 } |
| 167 | 175 |
| 168 bool CanBeBetterLeftOperand(Node* node) const { | 176 bool CanBeBetterLeftOperand(Node* node) const { |
| 169 return !selector()->IsLive(node); | 177 return !selector()->IsLive(node); |
| 170 } | 178 } |
| (...skipping 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2377 // static | 2385 // static |
| 2378 MachineOperatorBuilder::AlignmentRequirements | 2386 MachineOperatorBuilder::AlignmentRequirements |
| 2379 InstructionSelector::AlignmentRequirements() { | 2387 InstructionSelector::AlignmentRequirements() { |
| 2380 return MachineOperatorBuilder::AlignmentRequirements:: | 2388 return MachineOperatorBuilder::AlignmentRequirements:: |
| 2381 FullUnalignedAccessSupport(); | 2389 FullUnalignedAccessSupport(); |
| 2382 } | 2390 } |
| 2383 | 2391 |
| 2384 } // namespace compiler | 2392 } // namespace compiler |
| 2385 } // namespace internal | 2393 } // namespace internal |
| 2386 } // namespace v8 | 2394 } // namespace v8 |
| OLD | NEW |