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

Side by Side Diff: src/hydrogen-instructions.h

Issue 6255013: Change the default implementation of DataEquals for Hydrogen instructions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added verification to HInstruction::Verify. Created 9 years, 11 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 // Updated the inferred type of this instruction and returns true if 706 // Updated the inferred type of this instruction and returns true if
707 // it has changed. 707 // it has changed.
708 bool UpdateInferredType(); 708 bool UpdateInferredType();
709 709
710 virtual HType CalculateInferredType() const; 710 virtual HType CalculateInferredType() const;
711 711
712 // Helper for type conversions used by normal and phi instructions. 712 // Helper for type conversions used by normal and phi instructions.
713 void InsertInputConversion(HInstruction* previous, int index, HType type); 713 void InsertInputConversion(HInstruction* previous, int index, HType type);
714 714
715 #ifdef DEBUG 715 #ifdef DEBUG
716 virtual void Verify() const = 0; 716 virtual void Verify() = 0;
717 #endif 717 #endif
718 718
719 protected: 719 protected:
720 virtual bool DataEquals(HValue* other) const { return true; } 720 // This function must be overridden for instructions with flag kUseGVN, to
721 // compare the non-Operand parts of the instruction.
722 virtual bool DataEquals(HValue* other) const {
723 UNREACHABLE();
724 return false;
725 }
721 virtual void RepresentationChanged(Representation to) { } 726 virtual void RepresentationChanged(Representation to) { }
722 virtual Range* InferRange(); 727 virtual Range* InferRange();
723 virtual void DeleteFromGraph() = 0; 728 virtual void DeleteFromGraph() = 0;
724 virtual void InternalSetOperandAt(int index, HValue* value) { UNREACHABLE(); } 729 virtual void InternalSetOperandAt(int index, HValue* value) { UNREACHABLE(); }
725 void clear_block() { 730 void clear_block() {
726 ASSERT(block_ != NULL); 731 ASSERT(block_ != NULL);
727 block_ = NULL; 732 block_ = NULL;
728 } 733 }
729 734
730 void set_representation(Representation r) { 735 void set_representation(Representation r) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 void InsertBefore(HInstruction* next); 771 void InsertBefore(HInstruction* next);
767 void InsertAfter(HInstruction* previous); 772 void InsertAfter(HInstruction* previous);
768 773
769 int position() const { return position_; } 774 int position() const { return position_; }
770 bool has_position() const { return position_ != RelocInfo::kNoPosition; } 775 bool has_position() const { return position_ != RelocInfo::kNoPosition; }
771 void set_position(int position) { position_ = position; } 776 void set_position(int position) { position_ = position; }
772 777
773 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; 778 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0;
774 779
775 #ifdef DEBUG 780 #ifdef DEBUG
776 virtual void Verify() const; 781 virtual void Verify();
777 #endif 782 #endif
778 783
779 // Returns whether this is some kind of deoptimizing check 784 // Returns whether this is some kind of deoptimizing check
780 // instruction. 785 // instruction.
781 virtual bool IsCheckInstruction() const { return false; } 786 virtual bool IsCheckInstruction() const { return false; }
782 787
783 DECLARE_INSTRUCTION(Instruction) 788 DECLARE_INSTRUCTION(Instruction)
784 789
785 protected: 790 protected:
786 HInstruction() 791 HInstruction()
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 } 1060 }
1056 void AddPushedValue(HValue* value) { 1061 void AddPushedValue(HValue* value) {
1057 AddValue(kNoIndex, value); 1062 AddValue(kNoIndex, value);
1058 } 1063 }
1059 virtual int OperandCount() const { return values_.length(); } 1064 virtual int OperandCount() const { return values_.length(); }
1060 virtual HValue* OperandAt(int index) const { return values_[index]; } 1065 virtual HValue* OperandAt(int index) const { return values_[index]; }
1061 1066
1062 DECLARE_CONCRETE_INSTRUCTION(Simulate, "simulate") 1067 DECLARE_CONCRETE_INSTRUCTION(Simulate, "simulate")
1063 1068
1064 #ifdef DEBUG 1069 #ifdef DEBUG
1065 virtual void Verify() const; 1070 virtual void Verify();
1066 #endif 1071 #endif
1067 1072
1068 protected: 1073 protected:
1069 virtual void InternalSetOperandAt(int index, HValue* value) { 1074 virtual void InternalSetOperandAt(int index, HValue* value) {
1070 values_[index] = value; 1075 values_[index] = value;
1071 } 1076 }
1072 1077
1073 private: 1078 private:
1074 static const int kNoIndex = -1; 1079 static const int kNoIndex = -1;
1075 void AddValue(int index, HValue* value) { 1080 void AddValue(int index, HValue* value) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 1156
1152 class HGlobalObject: public HInstruction { 1157 class HGlobalObject: public HInstruction {
1153 public: 1158 public:
1154 HGlobalObject() { 1159 HGlobalObject() {
1155 set_representation(Representation::Tagged()); 1160 set_representation(Representation::Tagged());
1156 SetFlag(kUseGVN); 1161 SetFlag(kUseGVN);
1157 SetFlag(kDependsOnCalls); 1162 SetFlag(kDependsOnCalls);
1158 } 1163 }
1159 1164
1160 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global_object") 1165 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global_object")
1166
1167 protected:
1168 virtual bool DataEquals(HValue* other) const { return true; }
1161 }; 1169 };
1162 1170
1163 1171
1164 class HGlobalReceiver: public HInstruction { 1172 class HGlobalReceiver: public HInstruction {
1165 public: 1173 public:
1166 HGlobalReceiver() { 1174 HGlobalReceiver() {
1167 set_representation(Representation::Tagged()); 1175 set_representation(Representation::Tagged());
1168 SetFlag(kUseGVN); 1176 SetFlag(kUseGVN);
1169 SetFlag(kDependsOnCalls); 1177 SetFlag(kDependsOnCalls);
1170 } 1178 }
1171 1179
1172 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global_receiver") 1180 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global_receiver")
1181
1182 protected:
1183 virtual bool DataEquals(HValue* other) const { return true; }
1173 }; 1184 };
1174 1185
1175 1186
1176 class HCall: public HInstruction { 1187 class HCall: public HInstruction {
1177 public: 1188 public:
1178 // Construct a call with uninitialized arguments. The argument count 1189 // Construct a call with uninitialized arguments. The argument count
1179 // includes the receiver. 1190 // includes the receiver.
1180 explicit HCall(int count); 1191 explicit HCall(int count);
1181 1192
1182 virtual HType CalculateInferredType() const { return HType::Tagged(); } 1193 virtual HType CalculateInferredType() const { return HType::Tagged(); }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 set_representation(Representation::Tagged()); 1364 set_representation(Representation::Tagged());
1354 SetFlag(kDependsOnArrayLengths); 1365 SetFlag(kDependsOnArrayLengths);
1355 SetFlag(kUseGVN); 1366 SetFlag(kUseGVN);
1356 } 1367 }
1357 1368
1358 virtual Representation RequiredInputRepresentation(int index) const { 1369 virtual Representation RequiredInputRepresentation(int index) const {
1359 return Representation::Tagged(); 1370 return Representation::Tagged();
1360 } 1371 }
1361 1372
1362 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js_array_length") 1373 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js_array_length")
1374
1375 protected:
1376 virtual bool DataEquals(HValue* other) const { return true; }
1363 }; 1377 };
1364 1378
1365 1379
1366 class HFixedArrayLength: public HUnaryOperation { 1380 class HFixedArrayLength: public HUnaryOperation {
1367 public: 1381 public:
1368 explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) { 1382 explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) {
1369 set_representation(Representation::Tagged()); 1383 set_representation(Representation::Tagged());
1370 SetFlag(kDependsOnArrayLengths); 1384 SetFlag(kDependsOnArrayLengths);
1371 SetFlag(kUseGVN); 1385 SetFlag(kUseGVN);
1372 } 1386 }
1373 1387
1374 virtual Representation RequiredInputRepresentation(int index) const { 1388 virtual Representation RequiredInputRepresentation(int index) const {
1375 return Representation::Tagged(); 1389 return Representation::Tagged();
1376 } 1390 }
1377 1391
1378 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed_array_length") 1392 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed_array_length")
1393
1394 protected:
1395 virtual bool DataEquals(HValue* other) const { return true; }
1379 }; 1396 };
1380 1397
1381 1398
1382 class HBitNot: public HUnaryOperation { 1399 class HBitNot: public HUnaryOperation {
1383 public: 1400 public:
1384 explicit HBitNot(HValue* value) : HUnaryOperation(value) { 1401 explicit HBitNot(HValue* value) : HUnaryOperation(value) {
1385 set_representation(Representation::Integer32()); 1402 set_representation(Representation::Integer32());
1386 SetFlag(kUseGVN); 1403 SetFlag(kUseGVN);
1387 SetFlag(kTruncatingToInt32); 1404 SetFlag(kTruncatingToInt32);
1388 } 1405 }
1389 1406
1390 virtual Representation RequiredInputRepresentation(int index) const { 1407 virtual Representation RequiredInputRepresentation(int index) const {
1391 return Representation::Integer32(); 1408 return Representation::Integer32();
1392 } 1409 }
1393 virtual HType CalculateInferredType() const; 1410 virtual HType CalculateInferredType() const;
1394 1411
1395 DECLARE_CONCRETE_INSTRUCTION(BitNot, "bit_not") 1412 DECLARE_CONCRETE_INSTRUCTION(BitNot, "bit_not")
1413
1414 protected:
1415 virtual bool DataEquals(HValue* other) const { return true; }
1396 }; 1416 };
1397 1417
1398 1418
1399 class HUnaryMathOperation: public HUnaryOperation { 1419 class HUnaryMathOperation: public HUnaryOperation {
1400 public: 1420 public:
1401 HUnaryMathOperation(HValue* value, BuiltinFunctionId op) 1421 HUnaryMathOperation(HValue* value, BuiltinFunctionId op)
1402 : HUnaryOperation(value), op_(op) { 1422 : HUnaryOperation(value), op_(op) {
1403 switch (op) { 1423 switch (op) {
1404 case kMathFloor: 1424 case kMathFloor:
1405 case kMathRound: 1425 case kMathRound:
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 set_representation(Representation::Tagged()); 1501 set_representation(Representation::Tagged());
1482 SetFlag(kUseGVN); 1502 SetFlag(kUseGVN);
1483 SetFlag(kDependsOnMaps); 1503 SetFlag(kDependsOnMaps);
1484 } 1504 }
1485 1505
1486 virtual Representation RequiredInputRepresentation(int index) const { 1506 virtual Representation RequiredInputRepresentation(int index) const {
1487 return Representation::Tagged(); 1507 return Representation::Tagged();
1488 } 1508 }
1489 1509
1490 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements") 1510 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1511
1512 protected:
1513 virtual bool DataEquals(HValue* other) const { return true; }
1491 }; 1514 };
1492 1515
1493 1516
1494 class HCheckMap: public HUnaryOperation { 1517 class HCheckMap: public HUnaryOperation {
1495 public: 1518 public:
1496 HCheckMap(HValue* value, Handle<Map> map) 1519 HCheckMap(HValue* value, Handle<Map> map)
1497 : HUnaryOperation(value), map_(map) { 1520 : HUnaryOperation(value), map_(map) {
1498 set_representation(Representation::Tagged()); 1521 set_representation(Representation::Tagged());
1499 SetFlag(kUseGVN); 1522 SetFlag(kUseGVN);
1500 SetFlag(kDependsOnMaps); 1523 SetFlag(kDependsOnMaps);
1501 } 1524 }
1502 1525
1503 virtual bool IsCheckInstruction() const { return true; } 1526 virtual bool IsCheckInstruction() const { return true; }
1504 1527
1505 virtual Representation RequiredInputRepresentation(int index) const { 1528 virtual Representation RequiredInputRepresentation(int index) const {
1506 return Representation::Tagged(); 1529 return Representation::Tagged();
1507 } 1530 }
1508 virtual void PrintDataTo(StringStream* stream) const; 1531 virtual void PrintDataTo(StringStream* stream) const;
1509 virtual HType CalculateInferredType() const; 1532 virtual HType CalculateInferredType() const;
1510 1533
1511 #ifdef DEBUG 1534 #ifdef DEBUG
1512 virtual void Verify() const; 1535 virtual void Verify();
1513 #endif 1536 #endif
1514 1537
1515 Handle<Map> map() const { return map_; } 1538 Handle<Map> map() const { return map_; }
1516 1539
1517 DECLARE_CONCRETE_INSTRUCTION(CheckMap, "check_map") 1540 DECLARE_CONCRETE_INSTRUCTION(CheckMap, "check_map")
1518 1541
1519 protected: 1542 protected:
1520 virtual bool DataEquals(HValue* other) const { 1543 virtual bool DataEquals(HValue* other) const {
1521 HCheckMap* b = HCheckMap::cast(other); 1544 HCheckMap* b = HCheckMap::cast(other);
1522 return map_.is_identical_to(b->map()); 1545 return map_.is_identical_to(b->map());
(...skipping 14 matching lines...) Expand all
1537 1560
1538 virtual bool IsCheckInstruction() const { return true; } 1561 virtual bool IsCheckInstruction() const { return true; }
1539 1562
1540 virtual Representation RequiredInputRepresentation(int index) const { 1563 virtual Representation RequiredInputRepresentation(int index) const {
1541 return Representation::Tagged(); 1564 return Representation::Tagged();
1542 } 1565 }
1543 virtual void PrintDataTo(StringStream* stream) const; 1566 virtual void PrintDataTo(StringStream* stream) const;
1544 virtual HType CalculateInferredType() const; 1567 virtual HType CalculateInferredType() const;
1545 1568
1546 #ifdef DEBUG 1569 #ifdef DEBUG
1547 virtual void Verify() const; 1570 virtual void Verify();
1548 #endif 1571 #endif
1549 1572
1550 Handle<JSFunction> target() const { return target_; } 1573 Handle<JSFunction> target() const { return target_; }
1551 1574
1552 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check_function") 1575 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check_function")
1553 1576
1554 protected: 1577 protected:
1555 virtual bool DataEquals(HValue* other) const { 1578 virtual bool DataEquals(HValue* other) const {
1556 HCheckFunction* b = HCheckFunction::cast(other); 1579 HCheckFunction* b = HCheckFunction::cast(other);
1557 return target_.is_identical_to(b->target()); 1580 return target_.is_identical_to(b->target());
(...skipping 21 matching lines...) Expand all
1579 } 1602 }
1580 } 1603 }
1581 1604
1582 virtual bool IsCheckInstruction() const { return true; } 1605 virtual bool IsCheckInstruction() const { return true; }
1583 1606
1584 virtual Representation RequiredInputRepresentation(int index) const { 1607 virtual Representation RequiredInputRepresentation(int index) const {
1585 return Representation::Tagged(); 1608 return Representation::Tagged();
1586 } 1609 }
1587 1610
1588 #ifdef DEBUG 1611 #ifdef DEBUG
1589 virtual void Verify() const; 1612 virtual void Verify();
1590 #endif 1613 #endif
1591 1614
1592 static HCheckInstanceType* NewIsJSObjectOrJSFunction(HValue* value); 1615 static HCheckInstanceType* NewIsJSObjectOrJSFunction(HValue* value);
1593 1616
1594 InstanceType first() const { return first_; } 1617 InstanceType first() const { return first_; }
1595 InstanceType last() const { return last_; } 1618 InstanceType last() const { return last_; }
1596 1619
1597 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check_instance_type") 1620 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check_instance_type")
1598 1621
1599 protected: 1622 protected:
(...skipping 20 matching lines...) Expand all
1620 1643
1621 virtual bool IsCheckInstruction() const { return true; } 1644 virtual bool IsCheckInstruction() const { return true; }
1622 1645
1623 virtual Representation RequiredInputRepresentation(int index) const { 1646 virtual Representation RequiredInputRepresentation(int index) const {
1624 return Representation::Tagged(); 1647 return Representation::Tagged();
1625 } 1648 }
1626 1649
1627 virtual HType CalculateInferredType() const; 1650 virtual HType CalculateInferredType() const;
1628 1651
1629 #ifdef DEBUG 1652 #ifdef DEBUG
1630 virtual void Verify() const; 1653 virtual void Verify();
1631 #endif 1654 #endif
1632 1655
1633 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check_non_smi") 1656 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check_non_smi")
1657
1658 protected:
1659 virtual bool DataEquals(HValue* other) const { return true; }
1634 }; 1660 };
1635 1661
1636 1662
1637 class HCheckPrototypeMaps: public HInstruction { 1663 class HCheckPrototypeMaps: public HInstruction {
1638 public: 1664 public:
1639 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) 1665 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder)
1640 : prototype_(prototype), holder_(holder) { 1666 : prototype_(prototype), holder_(holder) {
1641 SetFlag(kUseGVN); 1667 SetFlag(kUseGVN);
1642 SetFlag(kDependsOnMaps); 1668 SetFlag(kDependsOnMaps);
1643 } 1669 }
1644 1670
1645 virtual bool IsCheckInstruction() const { return true; } 1671 virtual bool IsCheckInstruction() const { return true; }
1646 1672
1647 #ifdef DEBUG 1673 #ifdef DEBUG
1648 virtual void Verify() const; 1674 virtual void Verify();
1649 #endif 1675 #endif
1650 1676
1651 Handle<JSObject> prototype() const { return prototype_; } 1677 Handle<JSObject> prototype() const { return prototype_; }
1652 Handle<JSObject> holder() const { return holder_; } 1678 Handle<JSObject> holder() const { return holder_; }
1653 1679
1654 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check_prototype_maps") 1680 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check_prototype_maps")
1655 1681
1656 virtual intptr_t Hashcode() const { 1682 virtual intptr_t Hashcode() const {
1657 ASSERT(!Heap::IsAllocationAllowed()); 1683 ASSERT(!Heap::IsAllocationAllowed());
1658 intptr_t hash = reinterpret_cast<intptr_t>(*prototype()); 1684 intptr_t hash = reinterpret_cast<intptr_t>(*prototype());
(...skipping 22 matching lines...) Expand all
1681 } 1707 }
1682 1708
1683 virtual bool IsCheckInstruction() const { return true; } 1709 virtual bool IsCheckInstruction() const { return true; }
1684 1710
1685 virtual Representation RequiredInputRepresentation(int index) const { 1711 virtual Representation RequiredInputRepresentation(int index) const {
1686 return Representation::Tagged(); 1712 return Representation::Tagged();
1687 } 1713 }
1688 virtual HType CalculateInferredType() const; 1714 virtual HType CalculateInferredType() const;
1689 1715
1690 #ifdef DEBUG 1716 #ifdef DEBUG
1691 virtual void Verify() const; 1717 virtual void Verify();
1692 #endif 1718 #endif
1693 1719
1694 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check_smi") 1720 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check_smi")
1721
1722 protected:
1723 virtual bool DataEquals(HValue* other) const { return true; }
1695 }; 1724 };
1696 1725
1697 1726
1698 class HPhi: public HValue { 1727 class HPhi: public HValue {
1699 public: 1728 public:
1700 explicit HPhi(int merged_index) 1729 explicit HPhi(int merged_index)
1701 : inputs_(2), 1730 : inputs_(2),
1702 merged_index_(merged_index), 1731 merged_index_(merged_index),
1703 phi_id_(-1) { 1732 phi_id_(-1) {
1704 for (int i = 0; i < Representation::kNumRepresentations; i++) { 1733 for (int i = 0; i < Representation::kNumRepresentations; i++) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 1766
1738 bool HasReceiverOperand(); 1767 bool HasReceiverOperand();
1739 1768
1740 int merged_index() const { return merged_index_; } 1769 int merged_index() const { return merged_index_; }
1741 1770
1742 virtual const char* Mnemonic() const { return "phi"; } 1771 virtual const char* Mnemonic() const { return "phi"; }
1743 1772
1744 virtual void PrintTo(StringStream* stream) const; 1773 virtual void PrintTo(StringStream* stream) const;
1745 1774
1746 #ifdef DEBUG 1775 #ifdef DEBUG
1747 virtual void Verify() const; 1776 virtual void Verify();
1748 #endif 1777 #endif
1749 1778
1750 DECLARE_INSTRUCTION(Phi) 1779 DECLARE_INSTRUCTION(Phi)
1751 1780
1752 void InitRealUses(int id); 1781 void InitRealUses(int id);
1753 void AddNonPhiUsesFrom(HPhi* other); 1782 void AddNonPhiUsesFrom(HPhi* other);
1754 void AddIndirectUsesTo(int* use_count); 1783 void AddIndirectUsesTo(int* use_count);
1755 1784
1756 int tagged_non_phi_uses() const { 1785 int tagged_non_phi_uses() const {
1757 return non_phi_uses_[Representation::kTagged]; 1786 return non_phi_uses_[Representation::kTagged];
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 return double_value_; 1854 return double_value_;
1826 } 1855 }
1827 bool HasStringValue() const { return handle_->IsString(); } 1856 bool HasStringValue() const { return handle_->IsString(); }
1828 1857
1829 virtual intptr_t Hashcode() const { 1858 virtual intptr_t Hashcode() const {
1830 ASSERT(!Heap::allow_allocation(false)); 1859 ASSERT(!Heap::allow_allocation(false));
1831 return reinterpret_cast<intptr_t>(*handle()); 1860 return reinterpret_cast<intptr_t>(*handle());
1832 } 1861 }
1833 1862
1834 #ifdef DEBUG 1863 #ifdef DEBUG
1835 virtual void Verify() const { } 1864 virtual void Verify() { }
1836 #endif 1865 #endif
1837 1866
1838 DECLARE_CONCRETE_INSTRUCTION(Constant, "constant") 1867 DECLARE_CONCRETE_INSTRUCTION(Constant, "constant")
1839 1868
1840 protected: 1869 protected:
1841 virtual Range* InferRange(); 1870 virtual Range* InferRange();
1842 1871
1843 virtual bool DataEquals(HValue* other) const { 1872 virtual bool DataEquals(HValue* other) const {
1844 HConstant* other_constant = HConstant::cast(other); 1873 HConstant* other_constant = HConstant::cast(other);
1845 return handle().is_identical_to(other_constant->handle()); 1874 return handle().is_identical_to(other_constant->handle());
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 class HArgumentsElements: public HInstruction { 1973 class HArgumentsElements: public HInstruction {
1945 public: 1974 public:
1946 HArgumentsElements() { 1975 HArgumentsElements() {
1947 // The value produced by this instruction is a pointer into the stack 1976 // The value produced by this instruction is a pointer into the stack
1948 // that looks as if it was a smi because of alignment. 1977 // that looks as if it was a smi because of alignment.
1949 set_representation(Representation::Tagged()); 1978 set_representation(Representation::Tagged());
1950 SetFlag(kUseGVN); 1979 SetFlag(kUseGVN);
1951 } 1980 }
1952 1981
1953 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments_elements") 1982 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments_elements")
1983
1984 protected:
1985 virtual bool DataEquals(HValue* other) const { return true; }
1954 }; 1986 };
1955 1987
1956 1988
1957 class HArgumentsLength: public HUnaryOperation { 1989 class HArgumentsLength: public HUnaryOperation {
1958 public: 1990 public:
1959 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { 1991 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) {
1960 set_representation(Representation::Integer32()); 1992 set_representation(Representation::Integer32());
1961 SetFlag(kUseGVN); 1993 SetFlag(kUseGVN);
1962 } 1994 }
1963 1995
1964 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments_length") 1996 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments_length")
1997
1998 protected:
1999 virtual bool DataEquals(HValue* other) const { return true; }
1965 }; 2000 };
1966 2001
1967 2002
1968 class HAccessArgumentsAt: public HInstruction { 2003 class HAccessArgumentsAt: public HInstruction {
1969 public: 2004 public:
1970 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { 2005 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) {
1971 set_representation(Representation::Tagged()); 2006 set_representation(Representation::Tagged());
1972 SetFlag(kUseGVN); 2007 SetFlag(kUseGVN);
1973 SetOperandAt(0, arguments); 2008 SetOperandAt(0, arguments);
1974 SetOperandAt(1, length); 2009 SetOperandAt(1, length);
(...skipping 16 matching lines...) Expand all
1991 virtual int OperandCount() const { return operands_.length(); } 2026 virtual int OperandCount() const { return operands_.length(); }
1992 virtual HValue* OperandAt(int index) const { return operands_[index]; } 2027 virtual HValue* OperandAt(int index) const { return operands_[index]; }
1993 2028
1994 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access_arguments_at") 2029 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access_arguments_at")
1995 2030
1996 protected: 2031 protected:
1997 virtual void InternalSetOperandAt(int index, HValue* value) { 2032 virtual void InternalSetOperandAt(int index, HValue* value) {
1998 operands_[index] = value; 2033 operands_[index] = value;
1999 } 2034 }
2000 2035
2036 virtual bool DataEquals(HValue* other) const { return true; }
2037
2001 private: 2038 private:
2002 HOperandVector<3> operands_; 2039 HOperandVector<3> operands_;
2003 }; 2040 };
2004 2041
2005 2042
2006 class HBoundsCheck: public HBinaryOperation { 2043 class HBoundsCheck: public HBinaryOperation {
2007 public: 2044 public:
2008 HBoundsCheck(HValue* index, HValue* length) 2045 HBoundsCheck(HValue* index, HValue* length)
2009 : HBinaryOperation(index, length) { 2046 : HBinaryOperation(index, length) {
2010 SetFlag(kUseGVN); 2047 SetFlag(kUseGVN);
2011 } 2048 }
2012 2049
2013 virtual bool IsCheckInstruction() const { return true; } 2050 virtual bool IsCheckInstruction() const { return true; }
2014 2051
2015 virtual Representation RequiredInputRepresentation(int index) const { 2052 virtual Representation RequiredInputRepresentation(int index) const {
2016 return Representation::Integer32(); 2053 return Representation::Integer32();
2017 } 2054 }
2018 2055
2019 #ifdef DEBUG 2056 #ifdef DEBUG
2020 virtual void Verify() const; 2057 virtual void Verify();
2021 #endif 2058 #endif
2022 2059
2023 HValue* index() const { return left(); } 2060 HValue* index() const { return left(); }
2024 HValue* length() const { return right(); } 2061 HValue* length() const { return right(); }
2025 2062
2026 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds_check") 2063 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds_check")
2064
2065 protected:
2066 virtual bool DataEquals(HValue* other) const { return true; }
2027 }; 2067 };
2028 2068
2029 2069
2030 class HBitwiseBinaryOperation: public HBinaryOperation { 2070 class HBitwiseBinaryOperation: public HBinaryOperation {
2031 public: 2071 public:
2032 HBitwiseBinaryOperation(HValue* left, HValue* right) 2072 HBitwiseBinaryOperation(HValue* left, HValue* right)
2033 : HBinaryOperation(left, right) { 2073 : HBinaryOperation(left, right) {
2034 set_representation(Representation::Tagged()); 2074 set_representation(Representation::Tagged());
2035 SetFlag(kFlexibleRepresentation); 2075 SetFlag(kFlexibleRepresentation);
2036 SetFlagMask(AllSideEffects()); 2076 SetFlagMask(AllSideEffects());
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
2134 SetFlag(kUseGVN); 2174 SetFlag(kUseGVN);
2135 } 2175 }
2136 2176
2137 virtual bool EmitAtUses() const { return uses()->length() <= 1; } 2177 virtual bool EmitAtUses() const { return uses()->length() <= 1; }
2138 virtual Representation RequiredInputRepresentation(int index) const { 2178 virtual Representation RequiredInputRepresentation(int index) const {
2139 return Representation::Tagged(); 2179 return Representation::Tagged();
2140 } 2180 }
2141 virtual HType CalculateInferredType() const; 2181 virtual HType CalculateInferredType() const;
2142 2182
2143 DECLARE_CONCRETE_INSTRUCTION(CompareJSObjectEq, "compare-js-object-eq") 2183 DECLARE_CONCRETE_INSTRUCTION(CompareJSObjectEq, "compare-js-object-eq")
2184
2185 protected:
2186 virtual bool DataEquals(HValue* other) const { return true; }
2144 }; 2187 };
2145 2188
2146 2189
2147 class HUnaryPredicate: public HUnaryOperation { 2190 class HUnaryPredicate: public HUnaryOperation {
2148 public: 2191 public:
2149 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) { 2192 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) {
2150 set_representation(Representation::Tagged()); 2193 set_representation(Representation::Tagged());
2151 SetFlag(kUseGVN); 2194 SetFlag(kUseGVN);
2152 } 2195 }
2153 virtual bool EmitAtUses() const { return uses()->length() <= 1; } 2196 virtual bool EmitAtUses() const { return uses()->length() <= 1; }
(...skipping 22 matching lines...) Expand all
2176 private: 2219 private:
2177 bool is_strict_; 2220 bool is_strict_;
2178 }; 2221 };
2179 2222
2180 2223
2181 class HIsObject: public HUnaryPredicate { 2224 class HIsObject: public HUnaryPredicate {
2182 public: 2225 public:
2183 explicit HIsObject(HValue* value) : HUnaryPredicate(value) { } 2226 explicit HIsObject(HValue* value) : HUnaryPredicate(value) { }
2184 2227
2185 DECLARE_CONCRETE_INSTRUCTION(IsObject, "is_object") 2228 DECLARE_CONCRETE_INSTRUCTION(IsObject, "is_object")
2229
2230 protected:
2231 virtual bool DataEquals(HValue* other) const { return true; }
2186 }; 2232 };
2187 2233
2188 2234
2189 class HIsSmi: public HUnaryPredicate { 2235 class HIsSmi: public HUnaryPredicate {
2190 public: 2236 public:
2191 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { } 2237 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { }
2192 2238
2193 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is_smi") 2239 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is_smi")
2240
2241 protected:
2242 virtual bool DataEquals(HValue* other) const { return true; }
2194 }; 2243 };
2195 2244
2196 2245
2197 class HHasInstanceType: public HUnaryPredicate { 2246 class HHasInstanceType: public HUnaryPredicate {
2198 public: 2247 public:
2199 HHasInstanceType(HValue* value, InstanceType type) 2248 HHasInstanceType(HValue* value, InstanceType type)
2200 : HUnaryPredicate(value), from_(type), to_(type) { } 2249 : HUnaryPredicate(value), from_(type), to_(type) { }
2201 HHasInstanceType(HValue* value, InstanceType from, InstanceType to) 2250 HHasInstanceType(HValue* value, InstanceType from, InstanceType to)
2202 : HUnaryPredicate(value), from_(from), to_(to) { 2251 : HUnaryPredicate(value), from_(from), to_(to) {
2203 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. 2252 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend.
(...skipping 16 matching lines...) Expand all
2220 InstanceType from_; 2269 InstanceType from_;
2221 InstanceType to_; // Inclusive range, not all combinations work. 2270 InstanceType to_; // Inclusive range, not all combinations work.
2222 }; 2271 };
2223 2272
2224 2273
2225 class HHasCachedArrayIndex: public HUnaryPredicate { 2274 class HHasCachedArrayIndex: public HUnaryPredicate {
2226 public: 2275 public:
2227 explicit HHasCachedArrayIndex(HValue* value) : HUnaryPredicate(value) { } 2276 explicit HHasCachedArrayIndex(HValue* value) : HUnaryPredicate(value) { }
2228 2277
2229 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndex, "has_cached_array_index") 2278 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndex, "has_cached_array_index")
2279
2280 protected:
2281 virtual bool DataEquals(HValue* other) const { return true; }
2230 }; 2282 };
2231 2283
2232 2284
2233 class HClassOfTest: public HUnaryPredicate { 2285 class HClassOfTest: public HUnaryPredicate {
2234 public: 2286 public:
2235 HClassOfTest(HValue* value, Handle<String> class_name) 2287 HClassOfTest(HValue* value, Handle<String> class_name)
2236 : HUnaryPredicate(value), class_name_(class_name) { } 2288 : HUnaryPredicate(value), class_name_(class_name) { }
2237 2289
2238 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest, "class_of_test") 2290 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest, "class_of_test")
2239 2291
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2318 : HBinaryOperation(left, right) { 2370 : HBinaryOperation(left, right) {
2319 set_representation(Representation::Double()); 2371 set_representation(Representation::Double());
2320 SetFlag(kUseGVN); 2372 SetFlag(kUseGVN);
2321 } 2373 }
2322 2374
2323 virtual Representation RequiredInputRepresentation(int index) const { 2375 virtual Representation RequiredInputRepresentation(int index) const {
2324 return (index == 1) ? Representation::None() : Representation::Double(); 2376 return (index == 1) ? Representation::None() : Representation::Double();
2325 } 2377 }
2326 2378
2327 DECLARE_CONCRETE_INSTRUCTION(Power, "power") 2379 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
2380
2381 protected:
2382 virtual bool DataEquals(HValue* other) const { return true; }
2328 }; 2383 };
2329 2384
2330 2385
2331 class HAdd: public HArithmeticBinaryOperation { 2386 class HAdd: public HArithmeticBinaryOperation {
2332 public: 2387 public:
2333 HAdd(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2388 HAdd(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) {
2334 SetFlag(kCanOverflow); 2389 SetFlag(kCanOverflow);
2335 } 2390 }
2336 2391
2337 // Add is only commutative if two integer values are added and not if two 2392 // Add is only commutative if two integer values are added and not if two
2338 // tagged values are added (because it might be a String concatenation). 2393 // tagged values are added (because it might be a String concatenation).
2339 virtual bool IsCommutative() const { 2394 virtual bool IsCommutative() const {
2340 return !representation().IsTagged(); 2395 return !representation().IsTagged();
2341 } 2396 }
2342 2397
2343 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2398 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2344 2399
2345 virtual HType CalculateInferredType() const; 2400 virtual HType CalculateInferredType() const;
2346 2401
2347 DECLARE_CONCRETE_INSTRUCTION(Add, "add") 2402 DECLARE_CONCRETE_INSTRUCTION(Add, "add")
2348 2403
2349 protected: 2404 protected:
2405 virtual bool DataEquals(HValue* other) const { return true; }
2406
2350 virtual Range* InferRange(); 2407 virtual Range* InferRange();
2351 }; 2408 };
2352 2409
2353 2410
2354 class HSub: public HArithmeticBinaryOperation { 2411 class HSub: public HArithmeticBinaryOperation {
2355 public: 2412 public:
2356 HSub(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2413 HSub(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) {
2357 SetFlag(kCanOverflow); 2414 SetFlag(kCanOverflow);
2358 } 2415 }
2359 2416
2360 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2417 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2361 2418
2362 DECLARE_CONCRETE_INSTRUCTION(Sub, "sub") 2419 DECLARE_CONCRETE_INSTRUCTION(Sub, "sub")
2363 2420
2364 protected: 2421 protected:
2422 virtual bool DataEquals(HValue* other) const { return true; }
2423
2365 virtual Range* InferRange(); 2424 virtual Range* InferRange();
2366 }; 2425 };
2367 2426
2368 2427
2369 class HMul: public HArithmeticBinaryOperation { 2428 class HMul: public HArithmeticBinaryOperation {
2370 public: 2429 public:
2371 HMul(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2430 HMul(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) {
2372 SetFlag(kCanOverflow); 2431 SetFlag(kCanOverflow);
2373 } 2432 }
2374 2433
2375 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2434 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2376 2435
2377 // Only commutative if it is certain that not two objects are multiplicated. 2436 // Only commutative if it is certain that not two objects are multiplicated.
2378 virtual bool IsCommutative() const { 2437 virtual bool IsCommutative() const {
2379 return !representation().IsTagged(); 2438 return !representation().IsTagged();
2380 } 2439 }
2381 2440
2382 DECLARE_CONCRETE_INSTRUCTION(Mul, "mul") 2441 DECLARE_CONCRETE_INSTRUCTION(Mul, "mul")
2383 2442
2384 protected: 2443 protected:
2444 virtual bool DataEquals(HValue* other) const { return true; }
2445
2385 virtual Range* InferRange(); 2446 virtual Range* InferRange();
2386 }; 2447 };
2387 2448
2388 2449
2389 class HMod: public HArithmeticBinaryOperation { 2450 class HMod: public HArithmeticBinaryOperation {
2390 public: 2451 public:
2391 HMod(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2452 HMod(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) {
2392 SetFlag(kCanBeDivByZero); 2453 SetFlag(kCanBeDivByZero);
2393 } 2454 }
2394 2455
2395 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2456 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2396 2457
2397 DECLARE_CONCRETE_INSTRUCTION(Mod, "mod") 2458 DECLARE_CONCRETE_INSTRUCTION(Mod, "mod")
2398 2459
2399 protected: 2460 protected:
2461 virtual bool DataEquals(HValue* other) const { return true; }
2462
2400 virtual Range* InferRange(); 2463 virtual Range* InferRange();
2401 }; 2464 };
2402 2465
2403 2466
2404 class HDiv: public HArithmeticBinaryOperation { 2467 class HDiv: public HArithmeticBinaryOperation {
2405 public: 2468 public:
2406 HDiv(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2469 HDiv(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) {
2407 SetFlag(kCanBeDivByZero); 2470 SetFlag(kCanBeDivByZero);
2408 SetFlag(kCanOverflow); 2471 SetFlag(kCanOverflow);
2409 } 2472 }
2410 2473
2411 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2474 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2412 2475
2413 DECLARE_CONCRETE_INSTRUCTION(Div, "div") 2476 DECLARE_CONCRETE_INSTRUCTION(Div, "div")
2414 2477
2415 protected: 2478 protected:
2479 virtual bool DataEquals(HValue* other) const { return true; }
2480
2416 virtual Range* InferRange(); 2481 virtual Range* InferRange();
2417 }; 2482 };
2418 2483
2419 2484
2420 class HBitAnd: public HBitwiseBinaryOperation { 2485 class HBitAnd: public HBitwiseBinaryOperation {
2421 public: 2486 public:
2422 HBitAnd(HValue* left, HValue* right) 2487 HBitAnd(HValue* left, HValue* right)
2423 : HBitwiseBinaryOperation(left, right) { } 2488 : HBitwiseBinaryOperation(left, right) { }
2424 2489
2425 virtual bool IsCommutative() const { return true; } 2490 virtual bool IsCommutative() const { return true; }
2426 virtual HType CalculateInferredType() const; 2491 virtual HType CalculateInferredType() const;
2427 2492
2428 DECLARE_CONCRETE_INSTRUCTION(BitAnd, "bit_and") 2493 DECLARE_CONCRETE_INSTRUCTION(BitAnd, "bit_and")
2429 2494
2430 protected: 2495 protected:
2496 virtual bool DataEquals(HValue* other) const { return true; }
2497
2431 virtual Range* InferRange(); 2498 virtual Range* InferRange();
2432 }; 2499 };
2433 2500
2434 2501
2435 class HBitXor: public HBitwiseBinaryOperation { 2502 class HBitXor: public HBitwiseBinaryOperation {
2436 public: 2503 public:
2437 HBitXor(HValue* left, HValue* right) 2504 HBitXor(HValue* left, HValue* right)
2438 : HBitwiseBinaryOperation(left, right) { } 2505 : HBitwiseBinaryOperation(left, right) { }
2439 2506
2440 virtual bool IsCommutative() const { return true; } 2507 virtual bool IsCommutative() const { return true; }
2441 virtual HType CalculateInferredType() const; 2508 virtual HType CalculateInferredType() const;
2442 2509
2443 DECLARE_CONCRETE_INSTRUCTION(BitXor, "bit_xor") 2510 DECLARE_CONCRETE_INSTRUCTION(BitXor, "bit_xor")
2511
2512 protected:
2513 virtual bool DataEquals(HValue* other) const { return true; }
2444 }; 2514 };
2445 2515
2446 2516
2447 class HBitOr: public HBitwiseBinaryOperation { 2517 class HBitOr: public HBitwiseBinaryOperation {
2448 public: 2518 public:
2449 HBitOr(HValue* left, HValue* right) 2519 HBitOr(HValue* left, HValue* right)
2450 : HBitwiseBinaryOperation(left, right) { } 2520 : HBitwiseBinaryOperation(left, right) { }
2451 2521
2452 virtual bool IsCommutative() const { return true; } 2522 virtual bool IsCommutative() const { return true; }
2453 virtual HType CalculateInferredType() const; 2523 virtual HType CalculateInferredType() const;
2454 2524
2455 DECLARE_CONCRETE_INSTRUCTION(BitOr, "bit_or") 2525 DECLARE_CONCRETE_INSTRUCTION(BitOr, "bit_or")
2456 2526
2457 protected: 2527 protected:
2528 virtual bool DataEquals(HValue* other) const { return true; }
2529
2458 virtual Range* InferRange(); 2530 virtual Range* InferRange();
2459 }; 2531 };
2460 2532
2461 2533
2462 class HShl: public HBitwiseBinaryOperation { 2534 class HShl: public HBitwiseBinaryOperation {
2463 public: 2535 public:
2464 HShl(HValue* left, HValue* right) 2536 HShl(HValue* left, HValue* right)
2465 : HBitwiseBinaryOperation(left, right) { } 2537 : HBitwiseBinaryOperation(left, right) { }
2466 2538
2467 virtual Range* InferRange(); 2539 virtual Range* InferRange();
2468 virtual HType CalculateInferredType() const; 2540 virtual HType CalculateInferredType() const;
2469 2541
2470 DECLARE_CONCRETE_INSTRUCTION(Shl, "shl") 2542 DECLARE_CONCRETE_INSTRUCTION(Shl, "shl")
2543
2544 protected:
2545 virtual bool DataEquals(HValue* other) const { return true; }
2471 }; 2546 };
2472 2547
2473 2548
2474 class HShr: public HBitwiseBinaryOperation { 2549 class HShr: public HBitwiseBinaryOperation {
2475 public: 2550 public:
2476 HShr(HValue* left, HValue* right) 2551 HShr(HValue* left, HValue* right)
2477 : HBitwiseBinaryOperation(left, right) { } 2552 : HBitwiseBinaryOperation(left, right) { }
2478 2553
2479 virtual HType CalculateInferredType() const; 2554 virtual HType CalculateInferredType() const;
2480 2555
2481 DECLARE_CONCRETE_INSTRUCTION(Shr, "shr") 2556 DECLARE_CONCRETE_INSTRUCTION(Shr, "shr")
2557
2558 protected:
2559 virtual bool DataEquals(HValue* other) const { return true; }
2482 }; 2560 };
2483 2561
2484 2562
2485 class HSar: public HBitwiseBinaryOperation { 2563 class HSar: public HBitwiseBinaryOperation {
2486 public: 2564 public:
2487 HSar(HValue* left, HValue* right) 2565 HSar(HValue* left, HValue* right)
2488 : HBitwiseBinaryOperation(left, right) { } 2566 : HBitwiseBinaryOperation(left, right) { }
2489 2567
2490 virtual Range* InferRange(); 2568 virtual Range* InferRange();
2491 virtual HType CalculateInferredType() const; 2569 virtual HType CalculateInferredType() const;
2492 2570
2493 DECLARE_CONCRETE_INSTRUCTION(Sar, "sar") 2571 DECLARE_CONCRETE_INSTRUCTION(Sar, "sar")
2572
2573 protected:
2574 virtual bool DataEquals(HValue* other) const { return true; }
2494 }; 2575 };
2495 2576
2496 2577
2497 class HOsrEntry: public HInstruction { 2578 class HOsrEntry: public HInstruction {
2498 public: 2579 public:
2499 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) { 2580 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) {
2500 SetFlag(kChangesOsrEntries); 2581 SetFlag(kChangesOsrEntries);
2501 } 2582 }
2502 2583
2503 int ast_id() const { return ast_id_; } 2584 int ast_id() const { return ast_id_; }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2609 2690
2610 Handle<JSGlobalPropertyCell> cell() const { return cell_; } 2691 Handle<JSGlobalPropertyCell> cell() const { return cell_; }
2611 2692
2612 virtual Representation RequiredInputRepresentation(int index) const { 2693 virtual Representation RequiredInputRepresentation(int index) const {
2613 return Representation::Tagged(); 2694 return Representation::Tagged();
2614 } 2695 }
2615 virtual void PrintDataTo(StringStream* stream) const; 2696 virtual void PrintDataTo(StringStream* stream) const;
2616 2697
2617 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store_global") 2698 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store_global")
2618 2699
2619 protected:
2620 virtual bool DataEquals(HValue* other) const {
2621 HStoreGlobal* b = HStoreGlobal::cast(other);
2622 return cell_.is_identical_to(b->cell());
2623 }
2624
2625 private: 2700 private:
2626 Handle<JSGlobalPropertyCell> cell_; 2701 Handle<JSGlobalPropertyCell> cell_;
2627 }; 2702 };
2628 2703
2629 2704
2630 class HLoadContextSlot: public HInstruction { 2705 class HLoadContextSlot: public HInstruction {
2631 public: 2706 public:
2632 HLoadContextSlot(int context_chain_length , int slot_index) 2707 HLoadContextSlot(int context_chain_length , int slot_index)
2633 : context_chain_length_(context_chain_length), slot_index_(slot_index) { 2708 : context_chain_length_(context_chain_length), slot_index_(slot_index) {
2634 set_representation(Representation::Tagged()); 2709 set_representation(Representation::Tagged());
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2708 2783
2709 HValue* object() const { return OperandAt(0); } 2784 HValue* object() const { return OperandAt(0); }
2710 Handle<Object> name() const { return name_; } 2785 Handle<Object> name() const { return name_; }
2711 2786
2712 virtual Representation RequiredInputRepresentation(int index) const { 2787 virtual Representation RequiredInputRepresentation(int index) const {
2713 return Representation::Tagged(); 2788 return Representation::Tagged();
2714 } 2789 }
2715 2790
2716 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load_named_generic") 2791 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load_named_generic")
2717 2792
2718 protected:
2719 virtual bool DataEquals(HValue* other) const {
2720 HLoadNamedGeneric* b = HLoadNamedGeneric::cast(other);
2721 return name_.is_identical_to(b->name_);
2722 }
2723
2724 private: 2793 private:
2725 Handle<Object> name_; 2794 Handle<Object> name_;
2726 }; 2795 };
2727 2796
2728 2797
2729 class HLoadFunctionPrototype: public HUnaryOperation { 2798 class HLoadFunctionPrototype: public HUnaryOperation {
2730 public: 2799 public:
2731 explicit HLoadFunctionPrototype(HValue* function) 2800 explicit HLoadFunctionPrototype(HValue* function)
2732 : HUnaryOperation(function) { 2801 : HUnaryOperation(function) {
2733 set_representation(Representation::Tagged()); 2802 set_representation(Representation::Tagged());
2734 SetFlag(kUseGVN); 2803 SetFlag(kUseGVN);
2735 SetFlag(kDependsOnCalls); 2804 SetFlag(kDependsOnCalls);
2736 } 2805 }
2737 2806
2738 HValue* function() const { return OperandAt(0); } 2807 HValue* function() const { return OperandAt(0); }
2739 2808
2740 virtual Representation RequiredInputRepresentation(int index) const { 2809 virtual Representation RequiredInputRepresentation(int index) const {
2741 return Representation::Tagged(); 2810 return Representation::Tagged();
2742 } 2811 }
2743 2812
2744 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load_function_prototype") 2813 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load_function_prototype")
2814
2815 protected:
2816 virtual bool DataEquals(HValue* other) const { return true; }
2745 }; 2817 };
2746 2818
2747 2819
2748 class HLoadKeyed: public HBinaryOperation { 2820 class HLoadKeyed: public HBinaryOperation {
2749 public: 2821 public:
2750 HLoadKeyed(HValue* obj, HValue* key) : HBinaryOperation(obj, key) { 2822 HLoadKeyed(HValue* obj, HValue* key) : HBinaryOperation(obj, key) {
2751 set_representation(Representation::Tagged()); 2823 set_representation(Representation::Tagged());
2752 } 2824 }
2753 2825
2754 virtual void PrintDataTo(StringStream* stream) const; 2826 virtual void PrintDataTo(StringStream* stream) const;
(...skipping 16 matching lines...) Expand all
2771 } 2843 }
2772 2844
2773 virtual Representation RequiredInputRepresentation(int index) const { 2845 virtual Representation RequiredInputRepresentation(int index) const {
2774 // The key is supposed to be Integer32. 2846 // The key is supposed to be Integer32.
2775 return (index == 1) ? Representation::Integer32() 2847 return (index == 1) ? Representation::Integer32()
2776 : Representation::Tagged(); 2848 : Representation::Tagged();
2777 } 2849 }
2778 2850
2779 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, 2851 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement,
2780 "load_keyed_fast_element") 2852 "load_keyed_fast_element")
2853
2854 protected:
2855 virtual bool DataEquals(HValue* other) const { return true; }
2781 }; 2856 };
2782 2857
2783 2858
2784 class HLoadKeyedGeneric: public HLoadKeyed { 2859 class HLoadKeyedGeneric: public HLoadKeyed {
2785 public: 2860 public:
2786 HLoadKeyedGeneric(HValue* obj, HValue* key) : HLoadKeyed(obj, key) { 2861 HLoadKeyedGeneric(HValue* obj, HValue* key) : HLoadKeyed(obj, key) {
2787 SetFlagMask(AllSideEffects()); 2862 SetFlagMask(AllSideEffects());
2788 } 2863 }
2789 2864
2790 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic") 2865 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic")
(...skipping 22 matching lines...) Expand all
2813 Handle<Object> name() const { return name_; } 2888 Handle<Object> name() const { return name_; }
2814 HValue* value() const { return OperandAt(1); } 2889 HValue* value() const { return OperandAt(1); }
2815 void set_value(HValue* value) { SetOperandAt(1, value); } 2890 void set_value(HValue* value) { SetOperandAt(1, value); }
2816 2891
2817 bool NeedsWriteBarrier() const { 2892 bool NeedsWriteBarrier() const {
2818 return StoringValueNeedsWriteBarrier(value()); 2893 return StoringValueNeedsWriteBarrier(value());
2819 } 2894 }
2820 2895
2821 DECLARE_INSTRUCTION(StoreNamed) 2896 DECLARE_INSTRUCTION(StoreNamed)
2822 2897
2823 protected:
2824 virtual bool DataEquals(HValue* other) const {
2825 HStoreNamed* b = HStoreNamed::cast(other);
2826 return name_.is_identical_to(b->name_);
2827 }
2828
2829 private: 2898 private:
2830 Handle<Object> name_; 2899 Handle<Object> name_;
2831 }; 2900 };
2832 2901
2833 2902
2834 class HStoreNamedField: public HStoreNamed { 2903 class HStoreNamedField: public HStoreNamed {
2835 public: 2904 public:
2836 HStoreNamedField(HValue* obj, 2905 HStoreNamedField(HValue* obj,
2837 Handle<Object> name, 2906 Handle<Object> name,
2838 HValue* val, 2907 HValue* val,
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
2950 set_representation(Representation::Integer32()); 3019 set_representation(Representation::Integer32());
2951 SetFlag(kUseGVN); 3020 SetFlag(kUseGVN);
2952 } 3021 }
2953 3022
2954 virtual Representation RequiredInputRepresentation(int index) const { 3023 virtual Representation RequiredInputRepresentation(int index) const {
2955 // The index is supposed to be Integer32. 3024 // The index is supposed to be Integer32.
2956 return (index == 1) ? Representation::Integer32() 3025 return (index == 1) ? Representation::Integer32()
2957 : Representation::Tagged(); 3026 : Representation::Tagged();
2958 } 3027 }
2959 3028
2960 virtual bool DataEquals(HValue* other) const { return true; }
2961
2962 HValue* string() const { return OperandAt(0); } 3029 HValue* string() const { return OperandAt(0); }
2963 HValue* index() const { return OperandAt(1); } 3030 HValue* index() const { return OperandAt(1); }
2964 3031
2965 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string_char_code_at") 3032 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string_char_code_at")
2966 3033
2967 protected: 3034 protected:
3035 virtual bool DataEquals(HValue* other) const { return true; }
3036
2968 virtual Range* InferRange() { 3037 virtual Range* InferRange() {
2969 return new Range(0, String::kMaxUC16CharCode); 3038 return new Range(0, String::kMaxUC16CharCode);
2970 } 3039 }
2971 }; 3040 };
2972 3041
2973 3042
2974 class HStringLength: public HUnaryOperation { 3043 class HStringLength: public HUnaryOperation {
2975 public: 3044 public:
2976 explicit HStringLength(HValue* string) : HUnaryOperation(string) { 3045 explicit HStringLength(HValue* string) : HUnaryOperation(string) {
2977 set_representation(Representation::Tagged()); 3046 set_representation(Representation::Tagged());
2978 SetFlag(kUseGVN); 3047 SetFlag(kUseGVN);
2979 } 3048 }
2980 3049
2981 virtual Representation RequiredInputRepresentation(int index) const { 3050 virtual Representation RequiredInputRepresentation(int index) const {
2982 return Representation::Tagged(); 3051 return Representation::Tagged();
2983 } 3052 }
2984 3053
2985 virtual HType CalculateInferredType() const { 3054 virtual HType CalculateInferredType() const {
2986 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); 3055 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue);
2987 return HType::Smi(); 3056 return HType::Smi();
2988 } 3057 }
2989 3058
2990 virtual bool DataEquals(HValue* other) const { return true; }
2991
2992 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string_length") 3059 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string_length")
2993 3060
2994 protected: 3061 protected:
3062 virtual bool DataEquals(HValue* other) const { return true; }
3063
2995 virtual Range* InferRange() { 3064 virtual Range* InferRange() {
2996 return new Range(0, String::kMaxLength); 3065 return new Range(0, String::kMaxLength);
2997 } 3066 }
2998 }; 3067 };
2999 3068
3000 3069
3001 class HMaterializedLiteral: public HInstruction { 3070 class HMaterializedLiteral: public HInstruction {
3002 public: 3071 public:
3003 HMaterializedLiteral(int index, int depth) 3072 HMaterializedLiteral(int index, int depth)
3004 : literal_index_(index), depth_(depth) { 3073 : literal_index_(index), depth_(depth) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3137 HValue* object() const { return left(); } 3206 HValue* object() const { return left(); }
3138 HValue* key() const { return right(); } 3207 HValue* key() const { return right(); }
3139 }; 3208 };
3140 3209
3141 #undef DECLARE_INSTRUCTION 3210 #undef DECLARE_INSTRUCTION
3142 #undef DECLARE_CONCRETE_INSTRUCTION 3211 #undef DECLARE_CONCRETE_INSTRUCTION
3143 3212
3144 } } // namespace v8::internal 3213 } } // namespace v8::internal
3145 3214
3146 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 3215 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698