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-impl.h" | 5 #include "src/compiler/instruction-selector-impl.h" |
6 #include "src/compiler/node-matchers.h" | 6 #include "src/compiler/node-matchers.h" |
7 #include "src/compiler/node-properties-inl.h" | 7 #include "src/compiler/node-properties-inl.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 static inline void VisitShift(InstructionSelector* selector, Node* node, | 517 static inline void VisitShift(InstructionSelector* selector, Node* node, |
518 ArchOpcode opcode) { | 518 ArchOpcode opcode) { |
519 IA32OperandGenerator g(selector); | 519 IA32OperandGenerator g(selector); |
520 Node* left = node->InputAt(0); | 520 Node* left = node->InputAt(0); |
521 Node* right = node->InputAt(1); | 521 Node* right = node->InputAt(1); |
522 | 522 |
523 if (g.CanBeImmediate(right)) { | 523 if (g.CanBeImmediate(right)) { |
524 selector->Emit(opcode, g.DefineSameAsFirst(node), g.UseRegister(left), | 524 selector->Emit(opcode, g.DefineSameAsFirst(node), g.UseRegister(left), |
525 g.UseImmediate(right)); | 525 g.UseImmediate(right)); |
526 } else { | 526 } else { |
527 Int32BinopMatcher m(node); | |
528 if (m.right().IsWord32And()) { | |
529 Int32BinopMatcher mright(right); | |
530 if (mright.right().Is(0x1F)) { | |
531 right = mright.left().node(); | |
532 } | |
533 } | |
534 selector->Emit(opcode, g.DefineSameAsFirst(node), g.UseRegister(left), | 527 selector->Emit(opcode, g.DefineSameAsFirst(node), g.UseRegister(left), |
535 g.UseFixed(right, ecx)); | 528 g.UseFixed(right, ecx)); |
536 } | 529 } |
537 } | 530 } |
538 | 531 |
539 | 532 |
540 void InstructionSelector::VisitWord32Shl(Node* node) { | 533 void InstructionSelector::VisitWord32Shl(Node* node) { |
541 VisitShift(this, node, kIA32Shl); | 534 VisitShift(this, node, kIA32Shl); |
542 } | 535 } |
543 | 536 |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 VisitFloat64Compare(this, node, &cont); | 1082 VisitFloat64Compare(this, node, &cont); |
1090 } | 1083 } |
1091 | 1084 |
1092 | 1085 |
1093 // static | 1086 // static |
1094 MachineOperatorBuilder::Flags | 1087 MachineOperatorBuilder::Flags |
1095 InstructionSelector::SupportedMachineOperatorFlags() { | 1088 InstructionSelector::SupportedMachineOperatorFlags() { |
1096 if (CpuFeatures::IsSupported(SSE4_1)) { | 1089 if (CpuFeatures::IsSupported(SSE4_1)) { |
1097 return MachineOperatorBuilder::kFloat64Floor | | 1090 return MachineOperatorBuilder::kFloat64Floor | |
1098 MachineOperatorBuilder::kFloat64Ceil | | 1091 MachineOperatorBuilder::kFloat64Ceil | |
1099 MachineOperatorBuilder::kFloat64RoundTruncate; | 1092 MachineOperatorBuilder::kFloat64RoundTruncate | |
| 1093 MachineOperatorBuilder::kWord32ShiftIsSafe; |
1100 } | 1094 } |
1101 return MachineOperatorBuilder::Flag::kNoFlags; | 1095 return MachineOperatorBuilder::Flag::kNoFlags; |
1102 } | 1096 } |
1103 } // namespace compiler | 1097 } // namespace compiler |
1104 } // namespace internal | 1098 } // namespace internal |
1105 } // namespace v8 | 1099 } // namespace v8 |
OLD | NEW |