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/machine-operator-reducer.h" | 5 #include "src/compiler/machine-operator-reducer.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/compiler/generic-node-inl.h" | 9 #include "src/compiler/generic-node-inl.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
466 if (m.HasValue()) return ReplaceInt32(static_cast<int32_t>(m.Value())); | 466 if (m.HasValue()) return ReplaceInt32(static_cast<int32_t>(m.Value())); |
467 if (m.IsChangeInt32ToInt64()) return Replace(m.node()->InputAt(0)); | 467 if (m.IsChangeInt32ToInt64()) return Replace(m.node()->InputAt(0)); |
468 break; | 468 break; |
469 } | 469 } |
470 case IrOpcode::kTruncateFloat64ToFloat32: { | 470 case IrOpcode::kTruncateFloat64ToFloat32: { |
471 Float64Matcher m(node->InputAt(0)); | 471 Float64Matcher m(node->InputAt(0)); |
472 if (m.HasValue()) return ReplaceFloat32(DoubleToFloat32(m.Value())); | 472 if (m.HasValue()) return ReplaceFloat32(DoubleToFloat32(m.Value())); |
473 if (m.IsChangeFloat32ToFloat64()) return Replace(m.node()->InputAt(0)); | 473 if (m.IsChangeFloat32ToFloat64()) return Replace(m.node()->InputAt(0)); |
474 break; | 474 break; |
475 } | 475 } |
476 case IrOpcode::kStore: { | |
477 Node* const value = node->InputAt(2); | |
478 if (value->opcode() == IrOpcode::kWord32And) { | |
479 MachineType const rep = static_cast<MachineType>( | |
480 StoreRepresentationOf(node->op()).machine_type() & kRepMask); | |
481 Uint32BinopMatcher m(value); | |
482 if (m.right().HasValue() && | |
483 ((rep == kRepWord8 && (m.right().Value() & 0xff) == 0xff) || | |
484 (rep == kRepWord16 && (m.right().Value() & 0xffff) == 0xffff))) { | |
titzer
2014/10/09 10:54:47
We could generalize this to 64-bits as well, but p
| |
485 node->ReplaceInput(2, m.left().node()); | |
486 return Changed(node); | |
487 } | |
488 } | |
489 break; | |
490 } | |
476 default: | 491 default: |
477 break; | 492 break; |
478 } | 493 } |
479 return NoChange(); | 494 return NoChange(); |
480 } | 495 } |
481 | 496 |
482 | 497 |
483 Reduction MachineOperatorReducer::ReduceProjection(size_t index, Node* node) { | 498 Reduction MachineOperatorReducer::ReduceProjection(size_t index, Node* node) { |
484 switch (node->opcode()) { | 499 switch (node->opcode()) { |
485 case IrOpcode::kInt32AddWithOverflow: { | 500 case IrOpcode::kInt32AddWithOverflow: { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
525 MachineOperatorBuilder* MachineOperatorReducer::machine() const { | 540 MachineOperatorBuilder* MachineOperatorReducer::machine() const { |
526 return jsgraph()->machine(); | 541 return jsgraph()->machine(); |
527 } | 542 } |
528 | 543 |
529 | 544 |
530 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } | 545 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } |
531 | 546 |
532 } // namespace compiler | 547 } // namespace compiler |
533 } // namespace internal | 548 } // namespace internal |
534 } // namespace v8 | 549 } // namespace v8 |
OLD | NEW |