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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 return kMode_MR1; | 172 return kMode_MR1; |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 bool CanBeBetterLeftOperand(Node* node) const { | 176 bool CanBeBetterLeftOperand(Node* node) const { |
177 return !selector()->IsLive(node); | 177 return !selector()->IsLive(node); |
178 } | 178 } |
179 }; | 179 }; |
180 | 180 |
181 namespace { | 181 namespace { |
182 | 182 ArchOpcode GetLoadOpcode(LoadRepresentation load_rep, bool protect) { |
183 ArchOpcode GetLoadOpcode(LoadRepresentation load_rep) { | |
184 ArchOpcode opcode = kArchNop; | 183 ArchOpcode opcode = kArchNop; |
185 switch (load_rep.representation()) { | 184 switch (load_rep.representation()) { |
186 case MachineRepresentation::kFloat32: | 185 case MachineRepresentation::kFloat32: |
187 opcode = kX64Movss; | 186 opcode = kX64Movss; |
188 break; | 187 break; |
189 case MachineRepresentation::kFloat64: | 188 case MachineRepresentation::kFloat64: |
190 opcode = kX64Movsd; | 189 opcode = kX64Movsd; |
191 break; | 190 break; |
192 case MachineRepresentation::kBit: // Fall through. | 191 case MachineRepresentation::kBit: // Fall through. |
193 case MachineRepresentation::kWord8: | 192 case MachineRepresentation::kWord8: |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 UNREACHABLE(); | 244 UNREACHABLE(); |
246 return kArchNop; | 245 return kArchNop; |
247 } | 246 } |
248 | 247 |
249 } // namespace | 248 } // namespace |
250 | 249 |
251 void InstructionSelector::VisitLoad(Node* node) { | 250 void InstructionSelector::VisitLoad(Node* node) { |
252 LoadRepresentation load_rep = LoadRepresentationOf(node->op()); | 251 LoadRepresentation load_rep = LoadRepresentationOf(node->op()); |
253 X64OperandGenerator g(this); | 252 X64OperandGenerator g(this); |
254 | 253 |
255 ArchOpcode opcode = GetLoadOpcode(load_rep); | 254 const bool protect = false; |
| 255 ArchOpcode opcode = GetLoadOpcode(load_rep, protect); |
256 InstructionOperand outputs[1]; | 256 InstructionOperand outputs[1]; |
257 outputs[0] = g.DefineAsRegister(node); | 257 outputs[0] = g.DefineAsRegister(node); |
258 InstructionOperand inputs[3]; | 258 InstructionOperand inputs[3]; |
259 size_t input_count = 0; | 259 size_t input_count = 0; |
260 AddressingMode mode = | 260 AddressingMode mode = |
261 g.GetEffectiveAddressMemoryOperand(node, inputs, &input_count); | 261 g.GetEffectiveAddressMemoryOperand(node, inputs, &input_count); |
262 InstructionCode code = opcode | AddressingModeField::encode(mode); | 262 InstructionCode code = opcode | AddressingModeField::encode(mode); |
263 Emit(code, 1, outputs, input_count, inputs); | 263 Emit(code, 1, outputs, input_count, inputs); |
264 } | 264 } |
265 | 265 |
266 void InstructionSelector::VisitProtectedLoad(Node* node) { | 266 void InstructionSelector::VisitProtectedLoad(Node* node) { |
267 LoadRepresentation load_rep = LoadRepresentationOf(node->op()); | 267 LoadRepresentation load_rep = LoadRepresentationOf(node->op()); |
268 X64OperandGenerator g(this); | 268 X64OperandGenerator g(this); |
269 | 269 |
270 ArchOpcode opcode = GetLoadOpcode(load_rep); | 270 const bool protect = true; |
| 271 ArchOpcode opcode = GetLoadOpcode(load_rep, protect); |
271 InstructionOperand outputs[1]; | 272 InstructionOperand outputs[1]; |
272 outputs[0] = g.DefineAsRegister(node); | 273 outputs[0] = g.DefineAsRegister(node); |
273 InstructionOperand inputs[4]; | 274 InstructionOperand inputs[4]; |
274 size_t input_count = 0; | 275 size_t input_count = 0; |
275 AddressingMode mode = | 276 AddressingMode mode = |
276 g.GetEffectiveAddressMemoryOperand(node, inputs, &input_count); | 277 g.GetEffectiveAddressMemoryOperand(node, inputs, &input_count); |
277 // Add the context parameter as an input. | 278 // Add the context parameter as an input. |
278 inputs[input_count++] = g.UseUniqueRegister(node->InputAt(2)); | 279 inputs[input_count++] = g.UseUniqueRegister(node->InputAt(2)); |
279 // Add the source position as an input | 280 // Add the source position as an input |
280 inputs[input_count++] = g.UseImmediate(node->InputAt(3)); | 281 inputs[input_count++] = g.UseImmediate(node->InputAt(3)); |
(...skipping 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2408 // static | 2409 // static |
2409 MachineOperatorBuilder::AlignmentRequirements | 2410 MachineOperatorBuilder::AlignmentRequirements |
2410 InstructionSelector::AlignmentRequirements() { | 2411 InstructionSelector::AlignmentRequirements() { |
2411 return MachineOperatorBuilder::AlignmentRequirements:: | 2412 return MachineOperatorBuilder::AlignmentRequirements:: |
2412 FullUnalignedAccessSupport(); | 2413 FullUnalignedAccessSupport(); |
2413 } | 2414 } |
2414 | 2415 |
2415 } // namespace compiler | 2416 } // namespace compiler |
2416 } // namespace internal | 2417 } // namespace internal |
2417 } // namespace v8 | 2418 } // namespace v8 |
OLD | NEW |