Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1044)

Side by Side Diff: test/unittests/compiler/machine-operator-reducer-unittest.cc

Issue 1513383003: [turbofan] Store nodes use only MachineRepresentation, not MachineType. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: please mips64 Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/base/bits.h" 5 #include "src/base/bits.h"
6 #include "src/base/division-by-constant.h" 6 #include "src/base/division-by-constant.h"
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/machine-operator-reducer.h" 8 #include "src/compiler/machine-operator-reducer.h"
9 #include "src/compiler/typer.h" 9 #include "src/compiler/typer.h"
10 #include "src/conversions-inl.h" 10 #include "src/conversions-inl.h"
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 } 1553 }
1554 } 1554 }
1555 } 1555 }
1556 1556
1557 1557
1558 // ----------------------------------------------------------------------------- 1558 // -----------------------------------------------------------------------------
1559 // Store 1559 // Store
1560 1560
1561 1561
1562 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) { 1562 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) {
1563 const StoreRepresentation rep(MachineType::Uint8(), kNoWriteBarrier); 1563 const StoreRepresentation rep(MachineRepresentation::kWord8, kNoWriteBarrier);
1564 Node* const base = Parameter(0); 1564 Node* const base = Parameter(0);
1565 Node* const index = Parameter(1); 1565 Node* const index = Parameter(1);
1566 Node* const value = Parameter(2); 1566 Node* const value = Parameter(2);
1567 Node* const effect = graph()->start(); 1567 Node* const effect = graph()->start();
1568 Node* const control = graph()->start(); 1568 Node* const control = graph()->start();
1569 TRACED_FOREACH(uint32_t, x, kUint32Values) { 1569 TRACED_FOREACH(uint32_t, x, kUint32Values) {
1570 Node* const node = 1570 Node* const node =
1571 graph()->NewNode(machine()->Store(rep), base, index, 1571 graph()->NewNode(machine()->Store(rep), base, index,
1572 graph()->NewNode(machine()->Word32And(), value, 1572 graph()->NewNode(machine()->Word32And(), value,
1573 Uint32Constant(x | 0xffu)), 1573 Uint32Constant(x | 0xffu)),
1574 effect, control); 1574 effect, control);
1575 1575
1576 Reduction r = Reduce(node); 1576 Reduction r = Reduce(node);
1577 ASSERT_TRUE(r.Changed()); 1577 ASSERT_TRUE(r.Changed());
1578 EXPECT_THAT(r.replacement(), 1578 EXPECT_THAT(r.replacement(),
1579 IsStore(rep, base, index, value, effect, control)); 1579 IsStore(rep, base, index, value, effect, control));
1580 } 1580 }
1581 } 1581 }
1582 1582
1583 1583
1584 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32SarAndWord32Shl) { 1584 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32SarAndWord32Shl) {
1585 const StoreRepresentation rep(MachineType::Uint8(), kNoWriteBarrier); 1585 const StoreRepresentation rep(MachineRepresentation::kWord8, kNoWriteBarrier);
1586 Node* const base = Parameter(0); 1586 Node* const base = Parameter(0);
1587 Node* const index = Parameter(1); 1587 Node* const index = Parameter(1);
1588 Node* const value = Parameter(2); 1588 Node* const value = Parameter(2);
1589 Node* const effect = graph()->start(); 1589 Node* const effect = graph()->start();
1590 Node* const control = graph()->start(); 1590 Node* const control = graph()->start();
1591 TRACED_FORRANGE(int32_t, x, 1, 24) { 1591 TRACED_FORRANGE(int32_t, x, 1, 24) {
1592 Node* const node = graph()->NewNode( 1592 Node* const node = graph()->NewNode(
1593 machine()->Store(rep), base, index, 1593 machine()->Store(rep), base, index,
1594 graph()->NewNode( 1594 graph()->NewNode(
1595 machine()->Word32Sar(), 1595 machine()->Word32Sar(),
1596 graph()->NewNode(machine()->Word32Shl(), value, Int32Constant(x)), 1596 graph()->NewNode(machine()->Word32Shl(), value, Int32Constant(x)),
1597 Int32Constant(x)), 1597 Int32Constant(x)),
1598 effect, control); 1598 effect, control);
1599 1599
1600 Reduction r = Reduce(node); 1600 Reduction r = Reduce(node);
1601 ASSERT_TRUE(r.Changed()); 1601 ASSERT_TRUE(r.Changed());
1602 EXPECT_THAT(r.replacement(), 1602 EXPECT_THAT(r.replacement(),
1603 IsStore(rep, base, index, value, effect, control)); 1603 IsStore(rep, base, index, value, effect, control));
1604 } 1604 }
1605 } 1605 }
1606 1606
1607 1607
1608 TEST_F(MachineOperatorReducerTest, StoreRepWord16WithWord32And) { 1608 TEST_F(MachineOperatorReducerTest, StoreRepWord16WithWord32And) {
1609 const StoreRepresentation rep(MachineType::Uint16(), kNoWriteBarrier); 1609 const StoreRepresentation rep(MachineRepresentation::kWord16,
1610 kNoWriteBarrier);
1610 Node* const base = Parameter(0); 1611 Node* const base = Parameter(0);
1611 Node* const index = Parameter(1); 1612 Node* const index = Parameter(1);
1612 Node* const value = Parameter(2); 1613 Node* const value = Parameter(2);
1613 Node* const effect = graph()->start(); 1614 Node* const effect = graph()->start();
1614 Node* const control = graph()->start(); 1615 Node* const control = graph()->start();
1615 TRACED_FOREACH(uint32_t, x, kUint32Values) { 1616 TRACED_FOREACH(uint32_t, x, kUint32Values) {
1616 Node* const node = 1617 Node* const node =
1617 graph()->NewNode(machine()->Store(rep), base, index, 1618 graph()->NewNode(machine()->Store(rep), base, index,
1618 graph()->NewNode(machine()->Word32And(), value, 1619 graph()->NewNode(machine()->Word32And(), value,
1619 Uint32Constant(x | 0xffffu)), 1620 Uint32Constant(x | 0xffffu)),
1620 effect, control); 1621 effect, control);
1621 1622
1622 Reduction r = Reduce(node); 1623 Reduction r = Reduce(node);
1623 ASSERT_TRUE(r.Changed()); 1624 ASSERT_TRUE(r.Changed());
1624 EXPECT_THAT(r.replacement(), 1625 EXPECT_THAT(r.replacement(),
1625 IsStore(rep, base, index, value, effect, control)); 1626 IsStore(rep, base, index, value, effect, control));
1626 } 1627 }
1627 } 1628 }
1628 1629
1629 1630
1630 TEST_F(MachineOperatorReducerTest, StoreRepWord16WithWord32SarAndWord32Shl) { 1631 TEST_F(MachineOperatorReducerTest, StoreRepWord16WithWord32SarAndWord32Shl) {
1631 const StoreRepresentation rep(MachineType::Uint16(), kNoWriteBarrier); 1632 const StoreRepresentation rep(MachineRepresentation::kWord16,
1633 kNoWriteBarrier);
1632 Node* const base = Parameter(0); 1634 Node* const base = Parameter(0);
1633 Node* const index = Parameter(1); 1635 Node* const index = Parameter(1);
1634 Node* const value = Parameter(2); 1636 Node* const value = Parameter(2);
1635 Node* const effect = graph()->start(); 1637 Node* const effect = graph()->start();
1636 Node* const control = graph()->start(); 1638 Node* const control = graph()->start();
1637 TRACED_FORRANGE(int32_t, x, 1, 16) { 1639 TRACED_FORRANGE(int32_t, x, 1, 16) {
1638 Node* const node = graph()->NewNode( 1640 Node* const node = graph()->NewNode(
1639 machine()->Store(rep), base, index, 1641 machine()->Store(rep), base, index,
1640 graph()->NewNode( 1642 graph()->NewNode(
1641 machine()->Word32Sar(), 1643 machine()->Word32Sar(),
1642 graph()->NewNode(machine()->Word32Shl(), value, Int32Constant(x)), 1644 graph()->NewNode(machine()->Word32Shl(), value, Int32Constant(x)),
1643 Int32Constant(x)), 1645 Int32Constant(x)),
1644 effect, control); 1646 effect, control);
1645 1647
1646 Reduction r = Reduce(node); 1648 Reduction r = Reduce(node);
1647 ASSERT_TRUE(r.Changed()); 1649 ASSERT_TRUE(r.Changed());
1648 EXPECT_THAT(r.replacement(), 1650 EXPECT_THAT(r.replacement(),
1649 IsStore(rep, base, index, value, effect, control)); 1651 IsStore(rep, base, index, value, effect, control));
1650 } 1652 }
1651 } 1653 }
1652 1654
1653 } // namespace compiler 1655 } // namespace compiler
1654 } // namespace internal 1656 } // namespace internal
1655 } // namespace v8 1657 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/interpreter-assembler-unittest.cc ('k') | test/unittests/compiler/machine-operator-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698