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/ast-graph-builder.h" | 5 #include "src/compiler/ast-graph-builder.h" |
6 | 6 |
7 #include "src/ast/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1550 environment()->Push(value); | 1550 environment()->Push(value); |
1551 VisitForValue(property->obj()); | 1551 VisitForValue(property->obj()); |
1552 VisitForValue(property->key()); | 1552 VisitForValue(property->key()); |
1553 Node* key = environment()->Pop(); | 1553 Node* key = environment()->Pop(); |
1554 Node* object = environment()->Pop(); | 1554 Node* object = environment()->Pop(); |
1555 value = environment()->Pop(); | 1555 value = environment()->Pop(); |
1556 Node* store = BuildKeyedStore(object, key, value, feedback); | 1556 Node* store = BuildKeyedStore(object, key, value, feedback); |
1557 PrepareFrameState(store, bailout_id, OutputFrameStateCombine::Ignore()); | 1557 PrepareFrameState(store, bailout_id, OutputFrameStateCombine::Ignore()); |
1558 break; | 1558 break; |
1559 } | 1559 } |
1560 case NAMED_SUPER_PROPERTY: { | 1560 case NAMED_SUPER_PROPERTY: |
1561 environment()->Push(value); | 1561 case KEYED_SUPER_PROPERTY: |
1562 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var()); | 1562 UNREACHABLE(); |
1563 VisitForValue(property->obj()->AsSuperPropertyReference()->home_object()); | |
1564 Node* home_object = environment()->Pop(); | |
1565 Node* receiver = environment()->Pop(); | |
1566 value = environment()->Pop(); | |
1567 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | |
1568 Node* store = BuildNamedSuperStore(receiver, home_object, name, value); | |
1569 PrepareFrameState(store, bailout_id, OutputFrameStateCombine::Ignore()); | |
1570 break; | 1563 break; |
1571 } | |
1572 case KEYED_SUPER_PROPERTY: { | |
1573 environment()->Push(value); | |
1574 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var()); | |
1575 VisitForValue(property->obj()->AsSuperPropertyReference()->home_object()); | |
1576 VisitForValue(property->key()); | |
1577 Node* key = environment()->Pop(); | |
1578 Node* home_object = environment()->Pop(); | |
1579 Node* receiver = environment()->Pop(); | |
1580 value = environment()->Pop(); | |
1581 Node* store = BuildKeyedSuperStore(receiver, home_object, key, value); | |
1582 PrepareFrameState(store, bailout_id, OutputFrameStateCombine::Ignore()); | |
1583 break; | |
1584 } | |
1585 } | 1564 } |
1586 } | 1565 } |
1587 | 1566 |
1588 | 1567 |
1589 void AstGraphBuilder::VisitAssignment(Assignment* expr) { | 1568 void AstGraphBuilder::VisitAssignment(Assignment* expr) { |
1590 DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); | 1569 DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); |
1591 | 1570 |
1592 // Left-hand side can only be a property, a global or a variable slot. | 1571 // Left-hand side can only be a property, a global or a variable slot. |
1593 Property* property = expr->target()->AsProperty(); | 1572 Property* property = expr->target()->AsProperty(); |
1594 LhsKind assign_type = Property::GetAssignType(property); | 1573 LhsKind assign_type = Property::GetAssignType(property); |
(...skipping 11 matching lines...) Expand all Loading... |
1606 break; | 1585 break; |
1607 } | 1586 } |
1608 case NAMED_PROPERTY: | 1587 case NAMED_PROPERTY: |
1609 VisitForValue(property->obj()); | 1588 VisitForValue(property->obj()); |
1610 break; | 1589 break; |
1611 case KEYED_PROPERTY: | 1590 case KEYED_PROPERTY: |
1612 VisitForValue(property->obj()); | 1591 VisitForValue(property->obj()); |
1613 VisitForValue(property->key()); | 1592 VisitForValue(property->key()); |
1614 break; | 1593 break; |
1615 case NAMED_SUPER_PROPERTY: | 1594 case NAMED_SUPER_PROPERTY: |
1616 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var()); | |
1617 VisitForValue(property->obj()->AsSuperPropertyReference()->home_object()); | |
1618 break; | |
1619 case KEYED_SUPER_PROPERTY: | 1595 case KEYED_SUPER_PROPERTY: |
1620 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var()); | 1596 UNREACHABLE(); |
1621 VisitForValue(property->obj()->AsSuperPropertyReference()->home_object()); | |
1622 VisitForValue(property->key()); | |
1623 break; | 1597 break; |
1624 } | 1598 } |
1625 | 1599 |
1626 // Evaluate the value and potentially handle compound assignments by loading | 1600 // Evaluate the value and potentially handle compound assignments by loading |
1627 // the left-hand side value and performing a binary operation. | 1601 // the left-hand side value and performing a binary operation. |
1628 if (expr->is_compound()) { | 1602 if (expr->is_compound()) { |
1629 Node* old_value = nullptr; | 1603 Node* old_value = nullptr; |
1630 switch (assign_type) { | 1604 switch (assign_type) { |
1631 case VARIABLE: { | 1605 case VARIABLE: { |
1632 VariableProxy* proxy = expr->target()->AsVariableProxy(); | 1606 VariableProxy* proxy = expr->target()->AsVariableProxy(); |
(...skipping 17 matching lines...) Expand all Loading... |
1650 case KEYED_PROPERTY: { | 1624 case KEYED_PROPERTY: { |
1651 Node* key = environment()->Top(); | 1625 Node* key = environment()->Top(); |
1652 Node* object = environment()->Peek(1); | 1626 Node* object = environment()->Peek(1); |
1653 VectorSlotPair pair = | 1627 VectorSlotPair pair = |
1654 CreateVectorSlotPair(property->PropertyFeedbackSlot()); | 1628 CreateVectorSlotPair(property->PropertyFeedbackSlot()); |
1655 old_value = BuildKeyedLoad(object, key, pair); | 1629 old_value = BuildKeyedLoad(object, key, pair); |
1656 PrepareFrameState(old_value, property->LoadId(), | 1630 PrepareFrameState(old_value, property->LoadId(), |
1657 OutputFrameStateCombine::Push()); | 1631 OutputFrameStateCombine::Push()); |
1658 break; | 1632 break; |
1659 } | 1633 } |
1660 case NAMED_SUPER_PROPERTY: { | 1634 case NAMED_SUPER_PROPERTY: |
1661 Node* home_object = environment()->Top(); | 1635 case KEYED_SUPER_PROPERTY: |
1662 Node* receiver = environment()->Peek(1); | 1636 UNREACHABLE(); |
1663 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | |
1664 VectorSlotPair pair = | |
1665 CreateVectorSlotPair(property->PropertyFeedbackSlot()); | |
1666 old_value = BuildNamedSuperLoad(receiver, home_object, name, pair); | |
1667 PrepareFrameState(old_value, property->LoadId(), | |
1668 OutputFrameStateCombine::Push()); | |
1669 break; | 1637 break; |
1670 } | |
1671 case KEYED_SUPER_PROPERTY: { | |
1672 Node* key = environment()->Top(); | |
1673 Node* home_object = environment()->Peek(1); | |
1674 Node* receiver = environment()->Peek(2); | |
1675 VectorSlotPair pair = | |
1676 CreateVectorSlotPair(property->PropertyFeedbackSlot()); | |
1677 old_value = BuildKeyedSuperLoad(receiver, home_object, key, pair); | |
1678 PrepareFrameState(old_value, property->LoadId(), | |
1679 OutputFrameStateCombine::Push()); | |
1680 break; | |
1681 } | |
1682 } | 1638 } |
1683 environment()->Push(old_value); | 1639 environment()->Push(old_value); |
1684 VisitForValue(expr->value()); | 1640 VisitForValue(expr->value()); |
1685 Node* right = environment()->Pop(); | 1641 Node* right = environment()->Pop(); |
1686 Node* left = environment()->Pop(); | 1642 Node* left = environment()->Pop(); |
1687 Node* value = | 1643 Node* value = |
1688 BuildBinaryOp(left, right, expr->binary_op(), | 1644 BuildBinaryOp(left, right, expr->binary_op(), |
1689 expr->binary_operation()->BinaryOperationFeedbackId()); | 1645 expr->binary_operation()->BinaryOperationFeedbackId()); |
1690 PrepareFrameState(value, expr->binary_operation()->id(), | 1646 PrepareFrameState(value, expr->binary_operation()->id(), |
1691 OutputFrameStateCombine::Push()); | 1647 OutputFrameStateCombine::Push()); |
(...skipping 24 matching lines...) Expand all Loading... |
1716 break; | 1672 break; |
1717 } | 1673 } |
1718 case KEYED_PROPERTY: { | 1674 case KEYED_PROPERTY: { |
1719 Node* key = environment()->Pop(); | 1675 Node* key = environment()->Pop(); |
1720 Node* object = environment()->Pop(); | 1676 Node* object = environment()->Pop(); |
1721 Node* store = BuildKeyedStore(object, key, value, feedback); | 1677 Node* store = BuildKeyedStore(object, key, value, feedback); |
1722 PrepareFrameState(store, expr->AssignmentId(), | 1678 PrepareFrameState(store, expr->AssignmentId(), |
1723 OutputFrameStateCombine::Push()); | 1679 OutputFrameStateCombine::Push()); |
1724 break; | 1680 break; |
1725 } | 1681 } |
1726 case NAMED_SUPER_PROPERTY: { | 1682 case NAMED_SUPER_PROPERTY: |
1727 Node* home_object = environment()->Pop(); | 1683 case KEYED_SUPER_PROPERTY: |
1728 Node* receiver = environment()->Pop(); | 1684 UNREACHABLE(); |
1729 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | |
1730 Node* store = BuildNamedSuperStore(receiver, home_object, name, value); | |
1731 PrepareFrameState(store, expr->id(), ast_context()->GetStateCombine()); | |
1732 break; | 1685 break; |
1733 } | |
1734 case KEYED_SUPER_PROPERTY: { | |
1735 Node* key = environment()->Pop(); | |
1736 Node* home_object = environment()->Pop(); | |
1737 Node* receiver = environment()->Pop(); | |
1738 Node* store = BuildKeyedSuperStore(receiver, home_object, key, value); | |
1739 PrepareFrameState(store, expr->id(), ast_context()->GetStateCombine()); | |
1740 break; | |
1741 } | |
1742 } | 1686 } |
1743 | 1687 |
1744 ast_context()->ProduceValue(expr, value); | 1688 ast_context()->ProduceValue(expr, value); |
1745 } | 1689 } |
1746 | 1690 |
1747 | 1691 |
1748 void AstGraphBuilder::VisitYield(Yield* expr) { | 1692 void AstGraphBuilder::VisitYield(Yield* expr) { |
1749 // Generator functions are supported only by going through Ignition first. | 1693 // Generator functions are supported only by going through Ignition first. |
1750 UNREACHABLE(); | 1694 UNREACHABLE(); |
1751 } | 1695 } |
(...skipping 25 matching lines...) Expand all Loading... |
1777 } | 1721 } |
1778 case KEYED_PROPERTY: { | 1722 case KEYED_PROPERTY: { |
1779 VisitForValue(expr->obj()); | 1723 VisitForValue(expr->obj()); |
1780 VisitForValue(expr->key()); | 1724 VisitForValue(expr->key()); |
1781 Node* key = environment()->Pop(); | 1725 Node* key = environment()->Pop(); |
1782 Node* object = environment()->Pop(); | 1726 Node* object = environment()->Pop(); |
1783 value = BuildKeyedLoad(object, key, pair); | 1727 value = BuildKeyedLoad(object, key, pair); |
1784 PrepareFrameState(value, expr->LoadId(), OutputFrameStateCombine::Push()); | 1728 PrepareFrameState(value, expr->LoadId(), OutputFrameStateCombine::Push()); |
1785 break; | 1729 break; |
1786 } | 1730 } |
1787 case NAMED_SUPER_PROPERTY: { | 1731 case NAMED_SUPER_PROPERTY: |
1788 VisitForValue(expr->obj()->AsSuperPropertyReference()->this_var()); | 1732 case KEYED_SUPER_PROPERTY: |
1789 VisitForValue(expr->obj()->AsSuperPropertyReference()->home_object()); | 1733 UNREACHABLE(); |
1790 Node* home_object = environment()->Pop(); | |
1791 Node* receiver = environment()->Pop(); | |
1792 Handle<Name> name = expr->key()->AsLiteral()->AsPropertyName(); | |
1793 value = BuildNamedSuperLoad(receiver, home_object, name, pair); | |
1794 PrepareFrameState(value, expr->LoadId(), OutputFrameStateCombine::Push()); | |
1795 break; | 1734 break; |
1796 } | |
1797 case KEYED_SUPER_PROPERTY: { | |
1798 VisitForValue(expr->obj()->AsSuperPropertyReference()->this_var()); | |
1799 VisitForValue(expr->obj()->AsSuperPropertyReference()->home_object()); | |
1800 VisitForValue(expr->key()); | |
1801 Node* key = environment()->Pop(); | |
1802 Node* home_object = environment()->Pop(); | |
1803 Node* receiver = environment()->Pop(); | |
1804 value = BuildKeyedSuperLoad(receiver, home_object, key, pair); | |
1805 PrepareFrameState(value, expr->LoadId(), OutputFrameStateCombine::Push()); | |
1806 break; | |
1807 } | |
1808 } | 1735 } |
1809 ast_context()->ProduceValue(expr, value); | 1736 ast_context()->ProduceValue(expr, value); |
1810 } | 1737 } |
1811 | 1738 |
1812 | 1739 |
1813 void AstGraphBuilder::VisitCall(Call* expr) { | 1740 void AstGraphBuilder::VisitCall(Call* expr) { |
1814 Expression* callee = expr->expression(); | 1741 Expression* callee = expr->expression(); |
1815 Call::CallType call_type = expr->GetCallType(); | 1742 Call::CallType call_type = expr->GetCallType(); |
1816 CHECK(!expr->is_possibly_eval()); | 1743 CHECK(!expr->is_possibly_eval()); |
1817 | 1744 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1859 callee_value = BuildKeyedLoad(object, key, feedback); | 1786 callee_value = BuildKeyedLoad(object, key, feedback); |
1860 PrepareFrameState(callee_value, property->LoadId(), | 1787 PrepareFrameState(callee_value, property->LoadId(), |
1861 OutputFrameStateCombine::Push()); | 1788 OutputFrameStateCombine::Push()); |
1862 // Note that a property call requires the receiver to be wrapped into | 1789 // Note that a property call requires the receiver to be wrapped into |
1863 // an object for sloppy callees. However the receiver is guaranteed | 1790 // an object for sloppy callees. However the receiver is guaranteed |
1864 // not to be null or undefined at this point. | 1791 // not to be null or undefined at this point. |
1865 receiver_hint = ConvertReceiverMode::kNotNullOrUndefined; | 1792 receiver_hint = ConvertReceiverMode::kNotNullOrUndefined; |
1866 receiver_value = environment()->Pop(); | 1793 receiver_value = environment()->Pop(); |
1867 break; | 1794 break; |
1868 } | 1795 } |
1869 case Call::NAMED_SUPER_PROPERTY_CALL: { | |
1870 Property* property = callee->AsProperty(); | |
1871 SuperPropertyReference* super_ref = | |
1872 property->obj()->AsSuperPropertyReference(); | |
1873 VisitForValue(super_ref->home_object()); | |
1874 VisitForValue(super_ref->this_var()); | |
1875 Node* home = environment()->Peek(1); | |
1876 Node* object = environment()->Top(); | |
1877 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | |
1878 callee_value = BuildNamedSuperLoad(object, home, name, VectorSlotPair()); | |
1879 PrepareFrameState(callee_value, property->LoadId(), | |
1880 OutputFrameStateCombine::Push()); | |
1881 // Note that a property call requires the receiver to be wrapped into | |
1882 // an object for sloppy callees. Since the receiver is not the target of | |
1883 // the load, it could very well be null or undefined at this point. | |
1884 receiver_value = environment()->Pop(); | |
1885 environment()->Drop(1); | |
1886 break; | |
1887 } | |
1888 case Call::KEYED_SUPER_PROPERTY_CALL: { | |
1889 Property* property = callee->AsProperty(); | |
1890 SuperPropertyReference* super_ref = | |
1891 property->obj()->AsSuperPropertyReference(); | |
1892 VisitForValue(super_ref->home_object()); | |
1893 VisitForValue(super_ref->this_var()); | |
1894 environment()->Push(environment()->Top()); // Duplicate this_var. | |
1895 environment()->Push(environment()->Peek(2)); // Duplicate home_obj. | |
1896 VisitForValue(property->key()); | |
1897 Node* key = environment()->Pop(); | |
1898 Node* home = environment()->Pop(); | |
1899 Node* object = environment()->Pop(); | |
1900 callee_value = BuildKeyedSuperLoad(object, home, key, VectorSlotPair()); | |
1901 PrepareFrameState(callee_value, property->LoadId(), | |
1902 OutputFrameStateCombine::Push()); | |
1903 // Note that a property call requires the receiver to be wrapped into | |
1904 // an object for sloppy callees. Since the receiver is not the target of | |
1905 // the load, it could very well be null or undefined at this point. | |
1906 receiver_value = environment()->Pop(); | |
1907 environment()->Drop(1); | |
1908 break; | |
1909 } | |
1910 case Call::OTHER_CALL: | 1796 case Call::OTHER_CALL: |
1911 VisitForValue(callee); | 1797 VisitForValue(callee); |
1912 callee_value = environment()->Pop(); | 1798 callee_value = environment()->Pop(); |
1913 receiver_hint = ConvertReceiverMode::kNullOrUndefined; | 1799 receiver_hint = ConvertReceiverMode::kNullOrUndefined; |
1914 receiver_value = jsgraph()->UndefinedConstant(); | 1800 receiver_value = jsgraph()->UndefinedConstant(); |
1915 break; | 1801 break; |
| 1802 case Call::NAMED_SUPER_PROPERTY_CALL: |
| 1803 case Call::KEYED_SUPER_PROPERTY_CALL: |
1916 case Call::SUPER_CALL: | 1804 case Call::SUPER_CALL: |
1917 case Call::WITH_CALL: | 1805 case Call::WITH_CALL: |
1918 UNREACHABLE(); | 1806 UNREACHABLE(); |
1919 } | 1807 } |
1920 | 1808 |
1921 // The callee and the receiver both have to be pushed onto the operand stack | 1809 // The callee and the receiver both have to be pushed onto the operand stack |
1922 // before arguments are being evaluated. | 1810 // before arguments are being evaluated. |
1923 environment()->Push(callee_value); | 1811 environment()->Push(callee_value); |
1924 environment()->Push(receiver_value); | 1812 environment()->Push(receiver_value); |
1925 | 1813 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2100 Node* key = environment()->Top(); | 1988 Node* key = environment()->Top(); |
2101 Node* object = environment()->Peek(1); | 1989 Node* object = environment()->Peek(1); |
2102 VectorSlotPair pair = | 1990 VectorSlotPair pair = |
2103 CreateVectorSlotPair(property->PropertyFeedbackSlot()); | 1991 CreateVectorSlotPair(property->PropertyFeedbackSlot()); |
2104 old_value = BuildKeyedLoad(object, key, pair); | 1992 old_value = BuildKeyedLoad(object, key, pair); |
2105 PrepareFrameState(old_value, property->LoadId(), | 1993 PrepareFrameState(old_value, property->LoadId(), |
2106 OutputFrameStateCombine::Push()); | 1994 OutputFrameStateCombine::Push()); |
2107 stack_depth = 2; | 1995 stack_depth = 2; |
2108 break; | 1996 break; |
2109 } | 1997 } |
2110 case NAMED_SUPER_PROPERTY: { | 1998 case NAMED_SUPER_PROPERTY: |
2111 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var()); | 1999 case KEYED_SUPER_PROPERTY: |
2112 VisitForValue(property->obj()->AsSuperPropertyReference()->home_object()); | 2000 UNREACHABLE(); |
2113 Node* home_object = environment()->Top(); | |
2114 Node* receiver = environment()->Peek(1); | |
2115 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | |
2116 VectorSlotPair pair = | |
2117 CreateVectorSlotPair(property->PropertyFeedbackSlot()); | |
2118 old_value = BuildNamedSuperLoad(receiver, home_object, name, pair); | |
2119 PrepareFrameState(old_value, property->LoadId(), | |
2120 OutputFrameStateCombine::Push()); | |
2121 stack_depth = 2; | |
2122 break; | 2001 break; |
2123 } | |
2124 case KEYED_SUPER_PROPERTY: { | |
2125 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var()); | |
2126 VisitForValue(property->obj()->AsSuperPropertyReference()->home_object()); | |
2127 VisitForValue(property->key()); | |
2128 Node* key = environment()->Top(); | |
2129 Node* home_object = environment()->Peek(1); | |
2130 Node* receiver = environment()->Peek(2); | |
2131 VectorSlotPair pair = | |
2132 CreateVectorSlotPair(property->PropertyFeedbackSlot()); | |
2133 old_value = BuildKeyedSuperLoad(receiver, home_object, key, pair); | |
2134 PrepareFrameState(old_value, property->LoadId(), | |
2135 OutputFrameStateCombine::Push()); | |
2136 stack_depth = 3; | |
2137 break; | |
2138 } | |
2139 } | 2002 } |
2140 | 2003 |
2141 // Convert old value into a number. | 2004 // Convert old value into a number. |
2142 old_value = NewNode(javascript()->ToNumber(), old_value); | 2005 old_value = NewNode(javascript()->ToNumber(), old_value); |
2143 PrepareFrameState(old_value, expr->ToNumberId(), | 2006 PrepareFrameState(old_value, expr->ToNumberId(), |
2144 OutputFrameStateCombine::Push()); | 2007 OutputFrameStateCombine::Push()); |
2145 | 2008 |
2146 // Create a proper eager frame state for the stores. | 2009 // Create a proper eager frame state for the stores. |
2147 environment()->Push(old_value); | 2010 environment()->Push(old_value); |
2148 PrepareEagerCheckpoint(expr->ToNumberId()); | 2011 PrepareEagerCheckpoint(expr->ToNumberId()); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2183 break; | 2046 break; |
2184 } | 2047 } |
2185 case KEYED_PROPERTY: { | 2048 case KEYED_PROPERTY: { |
2186 Node* key = environment()->Pop(); | 2049 Node* key = environment()->Pop(); |
2187 Node* object = environment()->Pop(); | 2050 Node* object = environment()->Pop(); |
2188 Node* store = BuildKeyedStore(object, key, value, feedback); | 2051 Node* store = BuildKeyedStore(object, key, value, feedback); |
2189 PrepareFrameState(store, expr->AssignmentId(), | 2052 PrepareFrameState(store, expr->AssignmentId(), |
2190 OutputFrameStateCombine::Push()); | 2053 OutputFrameStateCombine::Push()); |
2191 break; | 2054 break; |
2192 } | 2055 } |
2193 case NAMED_SUPER_PROPERTY: { | 2056 case NAMED_SUPER_PROPERTY: |
2194 Node* home_object = environment()->Pop(); | 2057 case KEYED_SUPER_PROPERTY: |
2195 Node* receiver = environment()->Pop(); | 2058 UNREACHABLE(); |
2196 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | |
2197 Node* store = BuildNamedSuperStore(receiver, home_object, name, value); | |
2198 PrepareFrameState(store, expr->AssignmentId(), | |
2199 OutputFrameStateCombine::Push()); | |
2200 break; | 2059 break; |
2201 } | |
2202 case KEYED_SUPER_PROPERTY: { | |
2203 Node* key = environment()->Pop(); | |
2204 Node* home_object = environment()->Pop(); | |
2205 Node* receiver = environment()->Pop(); | |
2206 Node* store = BuildKeyedSuperStore(receiver, home_object, key, value); | |
2207 PrepareFrameState(store, expr->AssignmentId(), | |
2208 OutputFrameStateCombine::Push()); | |
2209 break; | |
2210 } | |
2211 } | 2060 } |
2212 | 2061 |
2213 // Restore old value for postfix expressions. | 2062 // Restore old value for postfix expressions. |
2214 if (is_postfix) value = environment()->Pop(); | 2063 if (is_postfix) value = environment()->Pop(); |
2215 | 2064 |
2216 ast_context()->ProduceValue(expr, value); | 2065 ast_context()->ProduceValue(expr, value); |
2217 } | 2066 } |
2218 | 2067 |
2219 | 2068 |
2220 void AstGraphBuilder::VisitBinaryOperation(BinaryOperation* expr) { | 2069 void AstGraphBuilder::VisitBinaryOperation(BinaryOperation* expr) { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2346 | 2195 |
2347 | 2196 |
2348 void AstGraphBuilder::VisitThisFunction(ThisFunction* expr) { | 2197 void AstGraphBuilder::VisitThisFunction(ThisFunction* expr) { |
2349 Node* value = GetFunctionClosure(); | 2198 Node* value = GetFunctionClosure(); |
2350 ast_context()->ProduceValue(expr, value); | 2199 ast_context()->ProduceValue(expr, value); |
2351 } | 2200 } |
2352 | 2201 |
2353 | 2202 |
2354 void AstGraphBuilder::VisitSuperPropertyReference( | 2203 void AstGraphBuilder::VisitSuperPropertyReference( |
2355 SuperPropertyReference* expr) { | 2204 SuperPropertyReference* expr) { |
2356 Node* value = BuildThrowUnsupportedSuperError(expr->id()); | 2205 UNREACHABLE(); |
2357 ast_context()->ProduceValue(expr, value); | |
2358 } | 2206 } |
2359 | 2207 |
2360 | 2208 |
2361 void AstGraphBuilder::VisitSuperCallReference(SuperCallReference* expr) { | 2209 void AstGraphBuilder::VisitSuperCallReference(SuperCallReference* expr) { |
2362 // Handled by VisitCall | 2210 // Handled by VisitCall |
2363 UNREACHABLE(); | 2211 UNREACHABLE(); |
2364 } | 2212 } |
2365 | 2213 |
2366 | 2214 |
2367 void AstGraphBuilder::VisitCaseClause(CaseClause* expr) { | 2215 void AstGraphBuilder::VisitCaseClause(CaseClause* expr) { |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2918 Node* AstGraphBuilder::BuildNamedStore(Node* object, Handle<Name> name, | 2766 Node* AstGraphBuilder::BuildNamedStore(Node* object, Handle<Name> name, |
2919 Node* value, | 2767 Node* value, |
2920 const VectorSlotPair& feedback) { | 2768 const VectorSlotPair& feedback) { |
2921 const Operator* op = | 2769 const Operator* op = |
2922 javascript()->StoreNamed(language_mode(), name, feedback); | 2770 javascript()->StoreNamed(language_mode(), name, feedback); |
2923 Node* node = NewNode(op, object, value); | 2771 Node* node = NewNode(op, object, value); |
2924 return node; | 2772 return node; |
2925 } | 2773 } |
2926 | 2774 |
2927 | 2775 |
2928 Node* AstGraphBuilder::BuildNamedSuperLoad(Node* receiver, Node* home_object, | |
2929 Handle<Name> name, | |
2930 const VectorSlotPair& feedback) { | |
2931 Node* name_node = jsgraph()->Constant(name); | |
2932 const Operator* op = javascript()->CallRuntime(Runtime::kLoadFromSuper); | |
2933 Node* node = NewNode(op, receiver, home_object, name_node); | |
2934 return node; | |
2935 } | |
2936 | |
2937 | |
2938 Node* AstGraphBuilder::BuildKeyedSuperLoad(Node* receiver, Node* home_object, | |
2939 Node* key, | |
2940 const VectorSlotPair& feedback) { | |
2941 const Operator* op = javascript()->CallRuntime(Runtime::kLoadKeyedFromSuper); | |
2942 Node* node = NewNode(op, receiver, home_object, key); | |
2943 return node; | |
2944 } | |
2945 | |
2946 | |
2947 Node* AstGraphBuilder::BuildKeyedSuperStore(Node* receiver, Node* home_object, | |
2948 Node* key, Node* value) { | |
2949 Runtime::FunctionId function_id = is_strict(language_mode()) | |
2950 ? Runtime::kStoreKeyedToSuper_Strict | |
2951 : Runtime::kStoreKeyedToSuper_Sloppy; | |
2952 const Operator* op = javascript()->CallRuntime(function_id, 4); | |
2953 Node* node = NewNode(op, receiver, home_object, key, value); | |
2954 return node; | |
2955 } | |
2956 | |
2957 | |
2958 Node* AstGraphBuilder::BuildNamedSuperStore(Node* receiver, Node* home_object, | |
2959 Handle<Name> name, Node* value) { | |
2960 Node* name_node = jsgraph()->Constant(name); | |
2961 Runtime::FunctionId function_id = is_strict(language_mode()) | |
2962 ? Runtime::kStoreToSuper_Strict | |
2963 : Runtime::kStoreToSuper_Sloppy; | |
2964 const Operator* op = javascript()->CallRuntime(function_id, 4); | |
2965 Node* node = NewNode(op, receiver, home_object, name_node, value); | |
2966 return node; | |
2967 } | |
2968 | |
2969 | |
2970 Node* AstGraphBuilder::BuildGlobalLoad(Handle<Name> name, | 2776 Node* AstGraphBuilder::BuildGlobalLoad(Handle<Name> name, |
2971 const VectorSlotPair& feedback, | 2777 const VectorSlotPair& feedback, |
2972 TypeofMode typeof_mode) { | 2778 TypeofMode typeof_mode) { |
2973 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode); | 2779 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode); |
2974 Node* node = NewNode(op); | 2780 Node* node = NewNode(op); |
2975 return node; | 2781 return node; |
2976 } | 2782 } |
2977 | 2783 |
2978 | 2784 |
2979 Node* AstGraphBuilder::BuildGlobalStore(Handle<Name> name, Node* value, | 2785 Node* AstGraphBuilder::BuildGlobalStore(Handle<Name> name, Node* value, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3052 Node* AstGraphBuilder::BuildThrowConstAssignError(BailoutId bailout_id) { | 2858 Node* AstGraphBuilder::BuildThrowConstAssignError(BailoutId bailout_id) { |
3053 const Operator* op = | 2859 const Operator* op = |
3054 javascript()->CallRuntime(Runtime::kThrowConstAssignError); | 2860 javascript()->CallRuntime(Runtime::kThrowConstAssignError); |
3055 Node* call = NewNode(op); | 2861 Node* call = NewNode(op); |
3056 PrepareFrameState(call, bailout_id); | 2862 PrepareFrameState(call, bailout_id); |
3057 Node* control = NewNode(common()->Throw(), call); | 2863 Node* control = NewNode(common()->Throw(), call); |
3058 UpdateControlDependencyToLeaveFunction(control); | 2864 UpdateControlDependencyToLeaveFunction(control); |
3059 return call; | 2865 return call; |
3060 } | 2866 } |
3061 | 2867 |
3062 Node* AstGraphBuilder::BuildThrowUnsupportedSuperError(BailoutId bailout_id) { | |
3063 const Operator* op = | |
3064 javascript()->CallRuntime(Runtime::kThrowUnsupportedSuperError); | |
3065 Node* call = NewNode(op); | |
3066 PrepareFrameState(call, bailout_id); | |
3067 Node* control = NewNode(common()->Throw(), call); | |
3068 UpdateControlDependencyToLeaveFunction(control); | |
3069 return call; | |
3070 } | |
3071 | |
3072 | 2868 |
3073 Node* AstGraphBuilder::BuildReturn(Node* return_value) { | 2869 Node* AstGraphBuilder::BuildReturn(Node* return_value) { |
3074 // Emit tracing call if requested to do so. | 2870 // Emit tracing call if requested to do so. |
3075 if (FLAG_trace) { | 2871 if (FLAG_trace) { |
3076 return_value = | 2872 return_value = |
3077 NewNode(javascript()->CallRuntime(Runtime::kTraceExit), return_value); | 2873 NewNode(javascript()->CallRuntime(Runtime::kTraceExit), return_value); |
3078 } | 2874 } |
3079 Node* pop_node = jsgraph()->ZeroConstant(); | 2875 Node* pop_node = jsgraph()->ZeroConstant(); |
3080 Node* control = NewNode(common()->Return(), pop_node, return_value); | 2876 Node* control = NewNode(common()->Return(), pop_node, return_value); |
3081 UpdateControlDependencyToLeaveFunction(control); | 2877 UpdateControlDependencyToLeaveFunction(control); |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3525 float invocation_frequency, LoopAssignmentAnalysis* loop_assignment, | 3321 float invocation_frequency, LoopAssignmentAnalysis* loop_assignment, |
3526 SourcePositionTable* source_positions, int inlining_id) | 3322 SourcePositionTable* source_positions, int inlining_id) |
3527 : AstGraphBuilder(local_zone, info, jsgraph, invocation_frequency, | 3323 : AstGraphBuilder(local_zone, info, jsgraph, invocation_frequency, |
3528 loop_assignment), | 3324 loop_assignment), |
3529 source_positions_(source_positions), | 3325 source_positions_(source_positions), |
3530 start_position_(info->shared_info()->start_position(), inlining_id) {} | 3326 start_position_(info->shared_info()->start_position(), inlining_id) {} |
3531 | 3327 |
3532 } // namespace compiler | 3328 } // namespace compiler |
3533 } // namespace internal | 3329 } // namespace internal |
3534 } // namespace v8 | 3330 } // namespace v8 |
OLD | NEW |