Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 766 int position() const { return position_; } | 766 int position() const { return position_; } |
| 767 bool has_position() const { return position_ != RelocInfo::kNoPosition; } | 767 bool has_position() const { return position_ != RelocInfo::kNoPosition; } |
| 768 void set_position(int position) { position_ = position; } | 768 void set_position(int position) { position_ = position; } |
| 769 | 769 |
| 770 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; | 770 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; |
| 771 | 771 |
| 772 #ifdef DEBUG | 772 #ifdef DEBUG |
| 773 virtual void Verify() const; | 773 virtual void Verify() const; |
| 774 #endif | 774 #endif |
| 775 | 775 |
| 776 // Conservative indication of whether the instruction can | |
| 777 // deoptimize. Allowed to have false positives. | |
|
Kevin Millikin (Chromium)
2011/01/18 11:18:39
The comment is also confusing. The predicate has
Vitaly Repeshko
2011/01/18 12:24:56
I renamed the function and the comment is much cle
| |
| 778 virtual bool CanDeoptimize() const { return false; } | |
|
fschneider
2011/01/18 10:45:51
I'd rather name this predicate IsCheckInstruction(
Vitaly Repeshko
2011/01/18 12:24:56
Done.
| |
| 779 | |
| 776 DECLARE_INSTRUCTION(Instruction) | 780 DECLARE_INSTRUCTION(Instruction) |
| 777 | 781 |
| 778 protected: | 782 protected: |
| 779 HInstruction() | 783 HInstruction() |
| 780 : next_(NULL), | 784 : next_(NULL), |
| 781 previous_(NULL), | 785 previous_(NULL), |
| 782 position_(RelocInfo::kNoPosition) { | 786 position_(RelocInfo::kNoPosition) { |
| 783 SetFlag(kDependsOnOsrEntries); | 787 SetFlag(kDependsOnOsrEntries); |
| 784 } | 788 } |
| 785 | 789 |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1497 | 1501 |
| 1498 class HCheckMap: public HUnaryOperation { | 1502 class HCheckMap: public HUnaryOperation { |
| 1499 public: | 1503 public: |
| 1500 HCheckMap(HValue* value, Handle<Map> map) | 1504 HCheckMap(HValue* value, Handle<Map> map) |
| 1501 : HUnaryOperation(value), map_(map) { | 1505 : HUnaryOperation(value), map_(map) { |
| 1502 set_representation(Representation::Tagged()); | 1506 set_representation(Representation::Tagged()); |
| 1503 SetFlag(kUseGVN); | 1507 SetFlag(kUseGVN); |
| 1504 SetFlag(kDependsOnMaps); | 1508 SetFlag(kDependsOnMaps); |
| 1505 } | 1509 } |
| 1506 | 1510 |
| 1511 virtual bool CanDeoptimize() const { return true; } | |
| 1512 | |
| 1507 virtual Representation RequiredInputRepresentation(int index) const { | 1513 virtual Representation RequiredInputRepresentation(int index) const { |
| 1508 return Representation::Tagged(); | 1514 return Representation::Tagged(); |
| 1509 } | 1515 } |
| 1510 virtual void PrintDataTo(StringStream* stream) const; | 1516 virtual void PrintDataTo(StringStream* stream) const; |
| 1511 virtual HType CalculateInferredType() const; | 1517 virtual HType CalculateInferredType() const; |
| 1512 | 1518 |
| 1513 #ifdef DEBUG | 1519 #ifdef DEBUG |
| 1514 virtual void Verify() const; | 1520 virtual void Verify() const; |
| 1515 #endif | 1521 #endif |
| 1516 | 1522 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1530 | 1536 |
| 1531 | 1537 |
| 1532 class HCheckFunction: public HUnaryOperation { | 1538 class HCheckFunction: public HUnaryOperation { |
| 1533 public: | 1539 public: |
| 1534 HCheckFunction(HValue* value, Handle<JSFunction> function) | 1540 HCheckFunction(HValue* value, Handle<JSFunction> function) |
| 1535 : HUnaryOperation(value), target_(function) { | 1541 : HUnaryOperation(value), target_(function) { |
| 1536 set_representation(Representation::Tagged()); | 1542 set_representation(Representation::Tagged()); |
| 1537 SetFlag(kUseGVN); | 1543 SetFlag(kUseGVN); |
| 1538 } | 1544 } |
| 1539 | 1545 |
| 1546 virtual bool CanDeoptimize() const { return true; } | |
| 1547 | |
| 1540 virtual Representation RequiredInputRepresentation(int index) const { | 1548 virtual Representation RequiredInputRepresentation(int index) const { |
| 1541 return Representation::Tagged(); | 1549 return Representation::Tagged(); |
| 1542 } | 1550 } |
| 1543 virtual void PrintDataTo(StringStream* stream) const; | 1551 virtual void PrintDataTo(StringStream* stream) const; |
| 1544 virtual HType CalculateInferredType() const; | 1552 virtual HType CalculateInferredType() const; |
| 1545 | 1553 |
| 1546 #ifdef DEBUG | 1554 #ifdef DEBUG |
| 1547 virtual void Verify() const; | 1555 virtual void Verify() const; |
| 1548 #endif | 1556 #endif |
| 1549 | 1557 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1566 public: | 1574 public: |
| 1567 // Check that the instance type is in the range [first, last] where | 1575 // Check that the instance type is in the range [first, last] where |
| 1568 // both first and last are included. | 1576 // both first and last are included. |
| 1569 HCheckInstanceType(HValue* value, InstanceType first, InstanceType last) | 1577 HCheckInstanceType(HValue* value, InstanceType first, InstanceType last) |
| 1570 : HUnaryOperation(value), first_(first), last_(last) { | 1578 : HUnaryOperation(value), first_(first), last_(last) { |
| 1571 ASSERT(first <= last); | 1579 ASSERT(first <= last); |
| 1572 set_representation(Representation::Tagged()); | 1580 set_representation(Representation::Tagged()); |
| 1573 SetFlag(kUseGVN); | 1581 SetFlag(kUseGVN); |
| 1574 } | 1582 } |
| 1575 | 1583 |
| 1584 virtual bool CanDeoptimize() const { return true; } | |
| 1585 | |
| 1576 virtual Representation RequiredInputRepresentation(int index) const { | 1586 virtual Representation RequiredInputRepresentation(int index) const { |
| 1577 return Representation::Tagged(); | 1587 return Representation::Tagged(); |
| 1578 } | 1588 } |
| 1579 | 1589 |
| 1580 #ifdef DEBUG | 1590 #ifdef DEBUG |
| 1581 virtual void Verify() const; | 1591 virtual void Verify() const; |
| 1582 #endif | 1592 #endif |
| 1583 | 1593 |
| 1584 static HCheckInstanceType* NewIsJSObjectOrJSFunction(HValue* value); | 1594 static HCheckInstanceType* NewIsJSObjectOrJSFunction(HValue* value); |
| 1585 | 1595 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 1603 }; | 1613 }; |
| 1604 | 1614 |
| 1605 | 1615 |
| 1606 class HCheckNonSmi: public HUnaryOperation { | 1616 class HCheckNonSmi: public HUnaryOperation { |
| 1607 public: | 1617 public: |
| 1608 explicit HCheckNonSmi(HValue* value) : HUnaryOperation(value) { | 1618 explicit HCheckNonSmi(HValue* value) : HUnaryOperation(value) { |
| 1609 set_representation(Representation::Tagged()); | 1619 set_representation(Representation::Tagged()); |
| 1610 SetFlag(kUseGVN); | 1620 SetFlag(kUseGVN); |
| 1611 } | 1621 } |
| 1612 | 1622 |
| 1623 virtual bool CanDeoptimize() const { return true; } | |
| 1624 | |
| 1613 virtual Representation RequiredInputRepresentation(int index) const { | 1625 virtual Representation RequiredInputRepresentation(int index) const { |
| 1614 return Representation::Tagged(); | 1626 return Representation::Tagged(); |
| 1615 } | 1627 } |
| 1616 | 1628 |
| 1617 virtual HType CalculateInferredType() const; | 1629 virtual HType CalculateInferredType() const; |
| 1618 | 1630 |
| 1619 #ifdef DEBUG | 1631 #ifdef DEBUG |
| 1620 virtual void Verify() const; | 1632 virtual void Verify() const; |
| 1621 #endif | 1633 #endif |
| 1622 | 1634 |
| 1623 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check_non_smi") | 1635 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check_non_smi") |
| 1624 }; | 1636 }; |
| 1625 | 1637 |
| 1626 | 1638 |
| 1627 class HCheckPrototypeMaps: public HInstruction { | 1639 class HCheckPrototypeMaps: public HInstruction { |
| 1628 public: | 1640 public: |
| 1629 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) | 1641 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) |
| 1630 : prototype_(prototype), holder_(holder) { | 1642 : prototype_(prototype), holder_(holder) { |
| 1631 SetFlag(kUseGVN); | 1643 SetFlag(kUseGVN); |
| 1632 SetFlag(kDependsOnMaps); | 1644 SetFlag(kDependsOnMaps); |
| 1633 } | 1645 } |
| 1634 | 1646 |
| 1647 virtual bool CanDeoptimize() const { return true; } | |
| 1648 | |
| 1635 #ifdef DEBUG | 1649 #ifdef DEBUG |
| 1636 virtual void Verify() const; | 1650 virtual void Verify() const; |
| 1637 #endif | 1651 #endif |
| 1638 | 1652 |
| 1639 Handle<JSObject> prototype() const { return prototype_; } | 1653 Handle<JSObject> prototype() const { return prototype_; } |
| 1640 Handle<JSObject> holder() const { return holder_; } | 1654 Handle<JSObject> holder() const { return holder_; } |
| 1641 | 1655 |
| 1642 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check_prototype_maps") | 1656 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check_prototype_maps") |
| 1643 | 1657 |
| 1644 virtual intptr_t Hashcode() const { | 1658 virtual intptr_t Hashcode() const { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1661 }; | 1675 }; |
| 1662 | 1676 |
| 1663 | 1677 |
| 1664 class HCheckSmi: public HUnaryOperation { | 1678 class HCheckSmi: public HUnaryOperation { |
| 1665 public: | 1679 public: |
| 1666 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { | 1680 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { |
| 1667 set_representation(Representation::Tagged()); | 1681 set_representation(Representation::Tagged()); |
| 1668 SetFlag(kUseGVN); | 1682 SetFlag(kUseGVN); |
| 1669 } | 1683 } |
| 1670 | 1684 |
| 1685 virtual bool CanDeoptimize() const { return true; } | |
| 1686 | |
| 1671 virtual Representation RequiredInputRepresentation(int index) const { | 1687 virtual Representation RequiredInputRepresentation(int index) const { |
| 1672 return Representation::Tagged(); | 1688 return Representation::Tagged(); |
| 1673 } | 1689 } |
| 1674 virtual HType CalculateInferredType() const; | 1690 virtual HType CalculateInferredType() const; |
| 1675 | 1691 |
| 1676 #ifdef DEBUG | 1692 #ifdef DEBUG |
| 1677 virtual void Verify() const; | 1693 virtual void Verify() const; |
| 1678 #endif | 1694 #endif |
| 1679 | 1695 |
| 1680 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check_smi") | 1696 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check_smi") |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1989 }; | 2005 }; |
| 1990 | 2006 |
| 1991 | 2007 |
| 1992 class HBoundsCheck: public HBinaryOperation { | 2008 class HBoundsCheck: public HBinaryOperation { |
| 1993 public: | 2009 public: |
| 1994 HBoundsCheck(HValue* index, HValue* length) | 2010 HBoundsCheck(HValue* index, HValue* length) |
| 1995 : HBinaryOperation(index, length) { | 2011 : HBinaryOperation(index, length) { |
| 1996 SetFlag(kUseGVN); | 2012 SetFlag(kUseGVN); |
| 1997 } | 2013 } |
| 1998 | 2014 |
| 2015 virtual bool CanDeoptimize() const { return true; } | |
| 2016 | |
| 1999 virtual Representation RequiredInputRepresentation(int index) const { | 2017 virtual Representation RequiredInputRepresentation(int index) const { |
| 2000 return Representation::Integer32(); | 2018 return Representation::Integer32(); |
| 2001 } | 2019 } |
| 2002 | 2020 |
| 2003 #ifdef DEBUG | 2021 #ifdef DEBUG |
| 2004 virtual void Verify() const; | 2022 virtual void Verify() const; |
| 2005 #endif | 2023 #endif |
| 2006 | 2024 |
| 2007 HValue* index() const { return left(); } | 2025 HValue* index() const { return left(); } |
| 2008 HValue* length() const { return right(); } | 2026 HValue* length() const { return right(); } |
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3058 HValue* object() const { return left(); } | 3076 HValue* object() const { return left(); } |
| 3059 HValue* key() const { return right(); } | 3077 HValue* key() const { return right(); } |
| 3060 }; | 3078 }; |
| 3061 | 3079 |
| 3062 #undef DECLARE_INSTRUCTION | 3080 #undef DECLARE_INSTRUCTION |
| 3063 #undef DECLARE_CONCRETE_INSTRUCTION | 3081 #undef DECLARE_CONCRETE_INSTRUCTION |
| 3064 | 3082 |
| 3065 } } // namespace v8::internal | 3083 } } // namespace v8::internal |
| 3066 | 3084 |
| 3067 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3085 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |