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/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/compiler/ast-loop-assignment-analyzer.h" | 8 #include "src/compiler/ast-loop-assignment-analyzer.h" |
9 #include "src/compiler/control-builders.h" | 9 #include "src/compiler/control-builders.h" |
10 #include "src/compiler/js-type-feedback.h" | 10 #include "src/compiler/js-type-feedback.h" |
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1358 PrepareFrameState(value, stmt->FilterId(), | 1358 PrepareFrameState(value, stmt->FilterId(), |
1359 OutputFrameStateCombine::Push()); | 1359 OutputFrameStateCombine::Push()); |
1360 IfBuilder test_value(this); | 1360 IfBuilder test_value(this); |
1361 Node* test_value_cond = NewNode(javascript()->StrictEqual(), value, | 1361 Node* test_value_cond = NewNode(javascript()->StrictEqual(), value, |
1362 jsgraph()->UndefinedConstant()); | 1362 jsgraph()->UndefinedConstant()); |
1363 test_value.If(test_value_cond, BranchHint::kFalse); | 1363 test_value.If(test_value_cond, BranchHint::kFalse); |
1364 test_value.Then(); | 1364 test_value.Then(); |
1365 test_value.Else(); | 1365 test_value.Else(); |
1366 { | 1366 { |
1367 // Bind value and do loop body. | 1367 // Bind value and do loop body. |
1368 VisitForInAssignment(stmt->each(), value, stmt->AssignmentId()); | 1368 ResolvedFeedbackSlot slot = |
| 1369 ResolveFeedbackSlot(stmt->EachFeedbackSlot()); |
| 1370 VisitForInAssignment(stmt->each(), value, slot, stmt->AssignmentId()); |
1369 VisitIterationBody(stmt, &for_loop); | 1371 VisitIterationBody(stmt, &for_loop); |
1370 } | 1372 } |
1371 test_value.End(); | 1373 test_value.End(); |
1372 index = environment()->Peek(0); | 1374 index = environment()->Peek(0); |
1373 for_loop.EndBody(); | 1375 for_loop.EndBody(); |
1374 | 1376 |
1375 // Increment counter and continue. | 1377 // Increment counter and continue. |
1376 index = NewNode(javascript()->ForInStep(), index); | 1378 index = NewNode(javascript()->ForInStep(), index); |
1377 environment()->Poke(0, index); | 1379 environment()->Poke(0, index); |
1378 } | 1380 } |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 // is needed here since the constructor is created by the class literal. | 1581 // is needed here since the constructor is created by the class literal. |
1580 Node* proto = | 1582 Node* proto = |
1581 BuildLoadObjectField(literal, JSFunction::kPrototypeOrInitialMapOffset); | 1583 BuildLoadObjectField(literal, JSFunction::kPrototypeOrInitialMapOffset); |
1582 | 1584 |
1583 // The class literal and the prototype are both expected on the operand stack | 1585 // The class literal and the prototype are both expected on the operand stack |
1584 // during evaluation of the method values. | 1586 // during evaluation of the method values. |
1585 environment()->Push(literal); | 1587 environment()->Push(literal); |
1586 environment()->Push(proto); | 1588 environment()->Push(proto); |
1587 | 1589 |
1588 // Create nodes to store method values into the literal. | 1590 // Create nodes to store method values into the literal. |
| 1591 int store_slot_index = 0; |
1589 for (int i = 0; i < expr->properties()->length(); i++) { | 1592 for (int i = 0; i < expr->properties()->length(); i++) { |
1590 ObjectLiteral::Property* property = expr->properties()->at(i); | 1593 ObjectLiteral::Property* property = expr->properties()->at(i); |
1591 environment()->Push(property->is_static() ? literal : proto); | 1594 environment()->Push(property->is_static() ? literal : proto); |
1592 | 1595 |
1593 VisitForValue(property->key()); | 1596 VisitForValue(property->key()); |
1594 Node* name = BuildToName(environment()->Pop(), expr->GetIdForProperty(i)); | 1597 Node* name = BuildToName(environment()->Pop(), expr->GetIdForProperty(i)); |
1595 environment()->Push(name); | 1598 environment()->Push(name); |
1596 | 1599 |
1597 // The static prototype property is read only. We handle the non computed | 1600 // The static prototype property is read only. We handle the non computed |
1598 // property name case in the parser. Since this is the only case where we | 1601 // property name case in the parser. Since this is the only case where we |
1599 // need to check for an own read only property we special case this so we do | 1602 // need to check for an own read only property we special case this so we do |
1600 // not need to do this for every property. | 1603 // not need to do this for every property. |
1601 if (property->is_static() && property->is_computed_name()) { | 1604 if (property->is_static() && property->is_computed_name()) { |
1602 Node* check = BuildThrowIfStaticPrototype(environment()->Pop(), | 1605 Node* check = BuildThrowIfStaticPrototype(environment()->Pop(), |
1603 expr->GetIdForProperty(i)); | 1606 expr->GetIdForProperty(i)); |
1604 environment()->Push(check); | 1607 environment()->Push(check); |
1605 } | 1608 } |
1606 | 1609 |
1607 VisitForValue(property->value()); | 1610 VisitForValue(property->value()); |
1608 Node* value = environment()->Pop(); | 1611 Node* value = environment()->Pop(); |
1609 Node* key = environment()->Pop(); | 1612 Node* key = environment()->Pop(); |
1610 Node* receiver = environment()->Pop(); | 1613 Node* receiver = environment()->Pop(); |
1611 BuildSetHomeObject(value, receiver, property->value()); | 1614 ResolvedFeedbackSlot slot = ResolveFeedbackSlot( |
| 1615 expr->SlotForHomeObject(property->value(), &store_slot_index)); |
| 1616 BuildSetHomeObject(value, receiver, property->value(), slot); |
1612 | 1617 |
1613 switch (property->kind()) { | 1618 switch (property->kind()) { |
1614 case ObjectLiteral::Property::CONSTANT: | 1619 case ObjectLiteral::Property::CONSTANT: |
1615 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 1620 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
1616 case ObjectLiteral::Property::PROTOTYPE: | 1621 case ObjectLiteral::Property::PROTOTYPE: |
1617 UNREACHABLE(); | 1622 UNREACHABLE(); |
1618 case ObjectLiteral::Property::COMPUTED: { | 1623 case ObjectLiteral::Property::COMPUTED: { |
1619 const Operator* op = | 1624 const Operator* op = |
1620 javascript()->CallRuntime(Runtime::kDefineClassMethod, 3); | 1625 javascript()->CallRuntime(Runtime::kDefineClassMethod, 3); |
1621 NewNode(op, receiver, key, value); | 1626 NewNode(op, receiver, key, value); |
(...skipping 19 matching lines...) Expand all Loading... |
1641 // Transform both the class literal and the prototype to fast properties. | 1646 // Transform both the class literal and the prototype to fast properties. |
1642 const Operator* op = javascript()->CallRuntime(Runtime::kToFastProperties, 1); | 1647 const Operator* op = javascript()->CallRuntime(Runtime::kToFastProperties, 1); |
1643 NewNode(op, environment()->Pop()); // prototype | 1648 NewNode(op, environment()->Pop()); // prototype |
1644 NewNode(op, environment()->Pop()); // literal | 1649 NewNode(op, environment()->Pop()); // literal |
1645 | 1650 |
1646 // Assign to class variable. | 1651 // Assign to class variable. |
1647 if (expr->scope() != NULL) { | 1652 if (expr->scope() != NULL) { |
1648 DCHECK_NOT_NULL(expr->class_variable_proxy()); | 1653 DCHECK_NOT_NULL(expr->class_variable_proxy()); |
1649 Variable* var = expr->class_variable_proxy()->var(); | 1654 Variable* var = expr->class_variable_proxy()->var(); |
1650 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 1655 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
1651 BuildVariableAssignment(var, literal, Token::INIT_CONST, BailoutId::None(), | 1656 ResolvedFeedbackSlot slot = ResolveFeedbackSlot( |
1652 states); | 1657 FLAG_vector_stores ? expr->GetNthSlot(store_slot_index++) |
| 1658 : FeedbackVectorICSlot::Invalid()); |
| 1659 BuildVariableAssignment(var, literal, Token::INIT_CONST, slot, |
| 1660 BailoutId::None(), states); |
1653 } | 1661 } |
1654 | 1662 |
1655 ast_context()->ProduceValue(literal); | 1663 ast_context()->ProduceValue(literal); |
1656 } | 1664 } |
1657 | 1665 |
1658 | 1666 |
1659 void AstGraphBuilder::VisitNativeFunctionLiteral(NativeFunctionLiteral* expr) { | 1667 void AstGraphBuilder::VisitNativeFunctionLiteral(NativeFunctionLiteral* expr) { |
1660 UNREACHABLE(); | 1668 UNREACHABLE(); |
1661 } | 1669 } |
1662 | 1670 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1720 Node* literal = NewNode(op, literals_array, literal_index, constants); | 1728 Node* literal = NewNode(op, literals_array, literal_index, constants); |
1721 PrepareFrameState(literal, expr->CreateLiteralId(), | 1729 PrepareFrameState(literal, expr->CreateLiteralId(), |
1722 OutputFrameStateCombine::Push()); | 1730 OutputFrameStateCombine::Push()); |
1723 | 1731 |
1724 // The object is expected on the operand stack during computation of the | 1732 // The object is expected on the operand stack during computation of the |
1725 // property values and is the value of the entire expression. | 1733 // property values and is the value of the entire expression. |
1726 environment()->Push(literal); | 1734 environment()->Push(literal); |
1727 | 1735 |
1728 // Create nodes to store computed values into the literal. | 1736 // Create nodes to store computed values into the literal. |
1729 int property_index = 0; | 1737 int property_index = 0; |
| 1738 int store_slot_index = 0; |
1730 AccessorTable accessor_table(zone()); | 1739 AccessorTable accessor_table(zone()); |
1731 for (; property_index < expr->properties()->length(); property_index++) { | 1740 for (; property_index < expr->properties()->length(); property_index++) { |
1732 ObjectLiteral::Property* property = expr->properties()->at(property_index); | 1741 ObjectLiteral::Property* property = expr->properties()->at(property_index); |
1733 if (property->is_computed_name()) break; | 1742 if (property->is_computed_name()) break; |
1734 if (property->IsCompileTimeValue()) continue; | 1743 if (property->IsCompileTimeValue()) continue; |
1735 | 1744 |
1736 Literal* key = property->key()->AsLiteral(); | 1745 Literal* key = property->key()->AsLiteral(); |
1737 switch (property->kind()) { | 1746 switch (property->kind()) { |
1738 case ObjectLiteral::Property::CONSTANT: | 1747 case ObjectLiteral::Property::CONSTANT: |
1739 UNREACHABLE(); | 1748 UNREACHABLE(); |
1740 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 1749 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
1741 DCHECK(!CompileTimeValue::IsCompileTimeValue(property->value())); | 1750 DCHECK(!CompileTimeValue::IsCompileTimeValue(property->value())); |
1742 // Fall through. | 1751 // Fall through. |
1743 case ObjectLiteral::Property::COMPUTED: { | 1752 case ObjectLiteral::Property::COMPUTED: { |
1744 // It is safe to use [[Put]] here because the boilerplate already | 1753 // It is safe to use [[Put]] here because the boilerplate already |
1745 // contains computed properties with an uninitialized value. | 1754 // contains computed properties with an uninitialized value. |
1746 if (key->value()->IsInternalizedString()) { | 1755 if (key->value()->IsInternalizedString()) { |
1747 if (property->emit_store()) { | 1756 if (property->emit_store()) { |
1748 VisitForValue(property->value()); | 1757 VisitForValue(property->value()); |
1749 FrameStateBeforeAndAfter states(this, property->value()->id()); | 1758 FrameStateBeforeAndAfter states(this, property->value()->id()); |
1750 Node* value = environment()->Pop(); | 1759 Node* value = environment()->Pop(); |
1751 Handle<Name> name = key->AsPropertyName(); | 1760 Handle<Name> name = key->AsPropertyName(); |
1752 Node* store = | 1761 ResolvedFeedbackSlot slot = |
1753 BuildNamedStore(literal, name, value, TypeFeedbackId::None()); | 1762 FLAG_vector_stores |
| 1763 ? ResolveFeedbackSlot(expr->GetNthSlot(store_slot_index++)) |
| 1764 : ResolvedFeedbackSlot(); |
| 1765 Node* store = BuildNamedStore(literal, name, value, slot, |
| 1766 TypeFeedbackId::None()); |
1754 states.AddToNode(store, key->id(), | 1767 states.AddToNode(store, key->id(), |
1755 OutputFrameStateCombine::Ignore()); | 1768 OutputFrameStateCombine::Ignore()); |
1756 BuildSetHomeObject(value, literal, property->value()); | 1769 ResolvedFeedbackSlot home_slot = ResolveFeedbackSlot( |
| 1770 expr->SlotForHomeObject(property->value(), &store_slot_index)); |
| 1771 BuildSetHomeObject(value, literal, property->value(), home_slot); |
1757 } else { | 1772 } else { |
1758 VisitForEffect(property->value()); | 1773 VisitForEffect(property->value()); |
1759 } | 1774 } |
1760 break; | 1775 break; |
1761 } | 1776 } |
1762 environment()->Push(literal); // Duplicate receiver. | 1777 environment()->Push(literal); // Duplicate receiver. |
1763 VisitForValue(property->key()); | 1778 VisitForValue(property->key()); |
1764 VisitForValue(property->value()); | 1779 VisitForValue(property->value()); |
1765 Node* value = environment()->Pop(); | 1780 Node* value = environment()->Pop(); |
1766 Node* key = environment()->Pop(); | 1781 Node* key = environment()->Pop(); |
1767 Node* receiver = environment()->Pop(); | 1782 Node* receiver = environment()->Pop(); |
1768 if (property->emit_store()) { | 1783 if (property->emit_store()) { |
1769 Node* language = jsgraph()->Constant(SLOPPY); | 1784 Node* language = jsgraph()->Constant(SLOPPY); |
1770 const Operator* op = | 1785 const Operator* op = |
1771 javascript()->CallRuntime(Runtime::kSetProperty, 4); | 1786 javascript()->CallRuntime(Runtime::kSetProperty, 4); |
1772 Node* set_property = NewNode(op, receiver, key, value, language); | 1787 Node* set_property = NewNode(op, receiver, key, value, language); |
1773 // SetProperty should not lazy deopt on an object literal. | 1788 // SetProperty should not lazy deopt on an object literal. |
1774 PrepareFrameState(set_property, BailoutId::None()); | 1789 PrepareFrameState(set_property, BailoutId::None()); |
1775 BuildSetHomeObject(value, receiver, property->value()); | 1790 ResolvedFeedbackSlot home_slot = ResolveFeedbackSlot( |
| 1791 expr->SlotForHomeObject(property->value(), &store_slot_index)); |
| 1792 BuildSetHomeObject(value, receiver, property->value(), home_slot); |
1776 } | 1793 } |
1777 break; | 1794 break; |
1778 } | 1795 } |
1779 case ObjectLiteral::Property::PROTOTYPE: { | 1796 case ObjectLiteral::Property::PROTOTYPE: { |
1780 environment()->Push(literal); // Duplicate receiver. | 1797 environment()->Push(literal); // Duplicate receiver. |
1781 VisitForValue(property->value()); | 1798 VisitForValue(property->value()); |
1782 Node* value = environment()->Pop(); | 1799 Node* value = environment()->Pop(); |
1783 Node* receiver = environment()->Pop(); | 1800 Node* receiver = environment()->Pop(); |
1784 DCHECK(property->emit_store()); | 1801 DCHECK(property->emit_store()); |
1785 const Operator* op = | 1802 const Operator* op = |
(...skipping 15 matching lines...) Expand all Loading... |
1801 break; | 1818 break; |
1802 } | 1819 } |
1803 } | 1820 } |
1804 | 1821 |
1805 // Create nodes to define accessors, using only a single call to the runtime | 1822 // Create nodes to define accessors, using only a single call to the runtime |
1806 // for each pair of corresponding getters and setters. | 1823 // for each pair of corresponding getters and setters. |
1807 for (AccessorTable::Iterator it = accessor_table.begin(); | 1824 for (AccessorTable::Iterator it = accessor_table.begin(); |
1808 it != accessor_table.end(); ++it) { | 1825 it != accessor_table.end(); ++it) { |
1809 VisitForValue(it->first); | 1826 VisitForValue(it->first); |
1810 VisitForValueOrNull(it->second->getter); | 1827 VisitForValueOrNull(it->second->getter); |
1811 BuildSetHomeObject(environment()->Top(), literal, it->second->getter); | 1828 ResolvedFeedbackSlot slot_getter = ResolveFeedbackSlot( |
| 1829 expr->SlotForHomeObject(it->second->getter, &store_slot_index)); |
| 1830 BuildSetHomeObject(environment()->Top(), literal, it->second->getter, |
| 1831 slot_getter); |
1812 VisitForValueOrNull(it->second->setter); | 1832 VisitForValueOrNull(it->second->setter); |
1813 BuildSetHomeObject(environment()->Top(), literal, it->second->setter); | 1833 ResolvedFeedbackSlot slot_setter = ResolveFeedbackSlot( |
| 1834 expr->SlotForHomeObject(it->second->getter, &store_slot_index)); |
| 1835 BuildSetHomeObject(environment()->Top(), literal, it->second->setter, |
| 1836 slot_setter); |
1814 Node* setter = environment()->Pop(); | 1837 Node* setter = environment()->Pop(); |
1815 Node* getter = environment()->Pop(); | 1838 Node* getter = environment()->Pop(); |
1816 Node* name = environment()->Pop(); | 1839 Node* name = environment()->Pop(); |
1817 Node* attr = jsgraph()->Constant(NONE); | 1840 Node* attr = jsgraph()->Constant(NONE); |
1818 const Operator* op = | 1841 const Operator* op = |
1819 javascript()->CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); | 1842 javascript()->CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
1820 Node* call = NewNode(op, literal, name, getter, setter, attr); | 1843 Node* call = NewNode(op, literal, name, getter, setter, attr); |
1821 // This should not lazy deopt on a new literal. | 1844 // This should not lazy deopt on a new literal. |
1822 PrepareFrameState(call, BailoutId::None()); | 1845 PrepareFrameState(call, BailoutId::None()); |
1823 } | 1846 } |
(...skipping 24 matching lines...) Expand all Loading... |
1848 | 1871 |
1849 environment()->Push(literal); // Duplicate receiver. | 1872 environment()->Push(literal); // Duplicate receiver. |
1850 VisitForValue(property->key()); | 1873 VisitForValue(property->key()); |
1851 Node* name = BuildToName(environment()->Pop(), | 1874 Node* name = BuildToName(environment()->Pop(), |
1852 expr->GetIdForProperty(property_index)); | 1875 expr->GetIdForProperty(property_index)); |
1853 environment()->Push(name); | 1876 environment()->Push(name); |
1854 VisitForValue(property->value()); | 1877 VisitForValue(property->value()); |
1855 Node* value = environment()->Pop(); | 1878 Node* value = environment()->Pop(); |
1856 Node* key = environment()->Pop(); | 1879 Node* key = environment()->Pop(); |
1857 Node* receiver = environment()->Pop(); | 1880 Node* receiver = environment()->Pop(); |
1858 BuildSetHomeObject(value, receiver, property->value()); | 1881 ResolvedFeedbackSlot slot = ResolveFeedbackSlot( |
1859 | 1882 expr->SlotForHomeObject(property->value(), &store_slot_index)); |
| 1883 BuildSetHomeObject(value, receiver, property->value(), slot); |
1860 switch (property->kind()) { | 1884 switch (property->kind()) { |
1861 case ObjectLiteral::Property::CONSTANT: | 1885 case ObjectLiteral::Property::CONSTANT: |
1862 case ObjectLiteral::Property::COMPUTED: | 1886 case ObjectLiteral::Property::COMPUTED: |
1863 case ObjectLiteral::Property::MATERIALIZED_LITERAL: { | 1887 case ObjectLiteral::Property::MATERIALIZED_LITERAL: { |
1864 Node* attr = jsgraph()->Constant(NONE); | 1888 Node* attr = jsgraph()->Constant(NONE); |
1865 const Operator* op = | 1889 const Operator* op = |
1866 javascript()->CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4); | 1890 javascript()->CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4); |
1867 Node* call = NewNode(op, receiver, key, value, attr); | 1891 Node* call = NewNode(op, receiver, key, value, attr); |
1868 PrepareFrameState(call, BailoutId::None()); | 1892 PrepareFrameState(call, BailoutId::None()); |
1869 break; | 1893 break; |
(...skipping 20 matching lines...) Expand all Loading... |
1890 } | 1914 } |
1891 } | 1915 } |
1892 | 1916 |
1893 // Transform literals that contain functions to fast properties. | 1917 // Transform literals that contain functions to fast properties. |
1894 if (expr->has_function()) { | 1918 if (expr->has_function()) { |
1895 const Operator* op = | 1919 const Operator* op = |
1896 javascript()->CallRuntime(Runtime::kToFastProperties, 1); | 1920 javascript()->CallRuntime(Runtime::kToFastProperties, 1); |
1897 NewNode(op, literal); | 1921 NewNode(op, literal); |
1898 } | 1922 } |
1899 | 1923 |
| 1924 // Verify that compilation exactly consumed the number of store ic slots that |
| 1925 // the ObjectLiteral node had to offer. |
| 1926 DCHECK(!FLAG_vector_stores || store_slot_index == expr->slot_count()); |
| 1927 |
1900 ast_context()->ProduceValue(environment()->Pop()); | 1928 ast_context()->ProduceValue(environment()->Pop()); |
1901 } | 1929 } |
1902 | 1930 |
1903 | 1931 |
1904 void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { | 1932 void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
1905 Node* closure = GetFunctionClosure(); | 1933 Node* closure = GetFunctionClosure(); |
1906 | 1934 |
1907 // Create node to deep-copy the literal boilerplate. | 1935 // Create node to deep-copy the literal boilerplate. |
1908 expr->BuildConstantElements(isolate()); | 1936 expr->BuildConstantElements(isolate()); |
1909 Node* literals_array = | 1937 Node* literals_array = |
(...skipping 18 matching lines...) Expand all Loading... |
1928 Expression* subexpr = expr->values()->at(array_index); | 1956 Expression* subexpr = expr->values()->at(array_index); |
1929 if (subexpr->IsSpread()) break; | 1957 if (subexpr->IsSpread()) break; |
1930 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; | 1958 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; |
1931 | 1959 |
1932 VisitForValue(subexpr); | 1960 VisitForValue(subexpr); |
1933 { | 1961 { |
1934 FrameStateBeforeAndAfter states(this, subexpr->id()); | 1962 FrameStateBeforeAndAfter states(this, subexpr->id()); |
1935 Node* value = environment()->Pop(); | 1963 Node* value = environment()->Pop(); |
1936 Node* index = jsgraph()->Constant(array_index); | 1964 Node* index = jsgraph()->Constant(array_index); |
1937 Node* store = | 1965 Node* store = |
1938 BuildKeyedStore(literal, index, value, TypeFeedbackId::None()); | 1966 BuildKeyedStore(literal, index, value, ResolvedFeedbackSlot(), |
| 1967 TypeFeedbackId::None()); |
1939 states.AddToNode(store, expr->GetIdForElement(array_index), | 1968 states.AddToNode(store, expr->GetIdForElement(array_index), |
1940 OutputFrameStateCombine::Ignore()); | 1969 OutputFrameStateCombine::Ignore()); |
1941 } | 1970 } |
1942 } | 1971 } |
1943 | 1972 |
1944 // In case the array literal contains spread expressions it has two parts. The | 1973 // In case the array literal contains spread expressions it has two parts. The |
1945 // first part is the "static" array which has a literal index is handled | 1974 // first part is the "static" array which has a literal index is handled |
1946 // above. The second part is the part after the first spread expression | 1975 // above. The second part is the part after the first spread expression |
1947 // (inclusive) and these elements gets appended to the array. Note that the | 1976 // (inclusive) and these elements gets appended to the array. Note that the |
1948 // number elements an iterable produces is unknown ahead of time. | 1977 // number elements an iterable produces is unknown ahead of time. |
(...skipping 23 matching lines...) Expand all Loading... |
1972 | 2001 |
1973 PrepareFrameState(result, expr->GetIdForElement(array_index)); | 2002 PrepareFrameState(result, expr->GetIdForElement(array_index)); |
1974 environment()->Push(result); | 2003 environment()->Push(result); |
1975 } | 2004 } |
1976 | 2005 |
1977 ast_context()->ProduceValue(environment()->Pop()); | 2006 ast_context()->ProduceValue(environment()->Pop()); |
1978 } | 2007 } |
1979 | 2008 |
1980 | 2009 |
1981 void AstGraphBuilder::VisitForInAssignment(Expression* expr, Node* value, | 2010 void AstGraphBuilder::VisitForInAssignment(Expression* expr, Node* value, |
| 2011 const ResolvedFeedbackSlot& slot, |
1982 BailoutId bailout_id) { | 2012 BailoutId bailout_id) { |
1983 DCHECK(expr->IsValidReferenceExpression()); | 2013 DCHECK(expr->IsValidReferenceExpression()); |
1984 | 2014 |
1985 // Left-hand side can only be a property, a global or a variable slot. | 2015 // Left-hand side can only be a property, a global or a variable slot. |
1986 Property* property = expr->AsProperty(); | 2016 Property* property = expr->AsProperty(); |
1987 LhsKind assign_type = Property::GetAssignType(property); | 2017 LhsKind assign_type = Property::GetAssignType(property); |
1988 | 2018 |
1989 // Evaluate LHS expression and store the value. | 2019 // Evaluate LHS expression and store the value. |
1990 switch (assign_type) { | 2020 switch (assign_type) { |
1991 case VARIABLE: { | 2021 case VARIABLE: { |
1992 Variable* var = expr->AsVariableProxy()->var(); | 2022 Variable* var = expr->AsVariableProxy()->var(); |
1993 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 2023 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
1994 BuildVariableAssignment(var, value, Token::ASSIGN, bailout_id, states); | 2024 BuildVariableAssignment(var, value, Token::ASSIGN, slot, bailout_id, |
| 2025 states); |
1995 break; | 2026 break; |
1996 } | 2027 } |
1997 case NAMED_PROPERTY: { | 2028 case NAMED_PROPERTY: { |
1998 environment()->Push(value); | 2029 environment()->Push(value); |
1999 VisitForValue(property->obj()); | 2030 VisitForValue(property->obj()); |
2000 FrameStateBeforeAndAfter states(this, property->obj()->id()); | 2031 FrameStateBeforeAndAfter states(this, property->obj()->id()); |
2001 Node* object = environment()->Pop(); | 2032 Node* object = environment()->Pop(); |
2002 value = environment()->Pop(); | 2033 value = environment()->Pop(); |
2003 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | 2034 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); |
2004 Node* store = | 2035 Node* store = |
2005 BuildNamedStore(object, name, value, TypeFeedbackId::None()); | 2036 BuildNamedStore(object, name, value, slot, TypeFeedbackId::None()); |
2006 states.AddToNode(store, bailout_id, OutputFrameStateCombine::Ignore()); | 2037 states.AddToNode(store, bailout_id, OutputFrameStateCombine::Ignore()); |
2007 break; | 2038 break; |
2008 } | 2039 } |
2009 case KEYED_PROPERTY: { | 2040 case KEYED_PROPERTY: { |
2010 environment()->Push(value); | 2041 environment()->Push(value); |
2011 VisitForValue(property->obj()); | 2042 VisitForValue(property->obj()); |
2012 VisitForValue(property->key()); | 2043 VisitForValue(property->key()); |
2013 FrameStateBeforeAndAfter states(this, property->key()->id()); | 2044 FrameStateBeforeAndAfter states(this, property->key()->id()); |
2014 Node* key = environment()->Pop(); | 2045 Node* key = environment()->Pop(); |
2015 Node* object = environment()->Pop(); | 2046 Node* object = environment()->Pop(); |
2016 value = environment()->Pop(); | 2047 value = environment()->Pop(); |
2017 Node* store = BuildKeyedStore(object, key, value, TypeFeedbackId::None()); | 2048 Node* store = |
| 2049 BuildKeyedStore(object, key, value, slot, TypeFeedbackId::None()); |
2018 states.AddToNode(store, bailout_id, OutputFrameStateCombine::Ignore()); | 2050 states.AddToNode(store, bailout_id, OutputFrameStateCombine::Ignore()); |
2019 break; | 2051 break; |
2020 } | 2052 } |
2021 case NAMED_SUPER_PROPERTY: { | 2053 case NAMED_SUPER_PROPERTY: { |
2022 environment()->Push(value); | 2054 environment()->Push(value); |
2023 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var()); | 2055 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var()); |
2024 VisitForValue(property->obj()->AsSuperPropertyReference()->home_object()); | 2056 VisitForValue(property->obj()->AsSuperPropertyReference()->home_object()); |
2025 FrameStateBeforeAndAfter states(this, property->obj()->id()); | 2057 FrameStateBeforeAndAfter states(this, property->obj()->id()); |
2026 Node* home_object = environment()->Pop(); | 2058 Node* home_object = environment()->Pop(); |
2027 Node* receiver = environment()->Pop(); | 2059 Node* receiver = environment()->Pop(); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2169 } else { | 2201 } else { |
2170 VisitForValue(expr->value()); | 2202 VisitForValue(expr->value()); |
2171 if (needs_frame_state_before) { | 2203 if (needs_frame_state_before) { |
2172 before_store_id = expr->value()->id(); | 2204 before_store_id = expr->value()->id(); |
2173 } | 2205 } |
2174 } | 2206 } |
2175 | 2207 |
2176 FrameStateBeforeAndAfter store_states(this, before_store_id); | 2208 FrameStateBeforeAndAfter store_states(this, before_store_id); |
2177 // Store the value. | 2209 // Store the value. |
2178 Node* value = environment()->Pop(); | 2210 Node* value = environment()->Pop(); |
| 2211 ResolvedFeedbackSlot slot = ResolveFeedbackSlot(expr->AssignmentSlot()); |
2179 switch (assign_type) { | 2212 switch (assign_type) { |
2180 case VARIABLE: { | 2213 case VARIABLE: { |
2181 Variable* variable = expr->target()->AsVariableProxy()->var(); | 2214 Variable* variable = expr->target()->AsVariableProxy()->var(); |
2182 BuildVariableAssignment(variable, value, expr->op(), expr->id(), | 2215 BuildVariableAssignment(variable, value, expr->op(), slot, expr->id(), |
2183 store_states, ast_context()->GetStateCombine()); | 2216 store_states, ast_context()->GetStateCombine()); |
2184 break; | 2217 break; |
2185 } | 2218 } |
2186 case NAMED_PROPERTY: { | 2219 case NAMED_PROPERTY: { |
2187 Node* object = environment()->Pop(); | 2220 Node* object = environment()->Pop(); |
2188 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | 2221 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); |
2189 Node* store = | 2222 Node* store = BuildNamedStore(object, name, value, slot, |
2190 BuildNamedStore(object, name, value, expr->AssignmentFeedbackId()); | 2223 expr->AssignmentFeedbackId()); |
2191 store_states.AddToNode(store, expr->id(), | 2224 store_states.AddToNode(store, expr->id(), |
2192 ast_context()->GetStateCombine()); | 2225 ast_context()->GetStateCombine()); |
2193 break; | 2226 break; |
2194 } | 2227 } |
2195 case KEYED_PROPERTY: { | 2228 case KEYED_PROPERTY: { |
2196 Node* key = environment()->Pop(); | 2229 Node* key = environment()->Pop(); |
2197 Node* object = environment()->Pop(); | 2230 Node* object = environment()->Pop(); |
2198 Node* store = | 2231 Node* store = BuildKeyedStore(object, key, value, slot, |
2199 BuildKeyedStore(object, key, value, expr->AssignmentFeedbackId()); | 2232 expr->AssignmentFeedbackId()); |
2200 store_states.AddToNode(store, expr->id(), | 2233 store_states.AddToNode(store, expr->id(), |
2201 ast_context()->GetStateCombine()); | 2234 ast_context()->GetStateCombine()); |
2202 break; | 2235 break; |
2203 } | 2236 } |
2204 case NAMED_SUPER_PROPERTY: { | 2237 case NAMED_SUPER_PROPERTY: { |
2205 Node* home_object = environment()->Pop(); | 2238 Node* home_object = environment()->Pop(); |
2206 Node* receiver = environment()->Pop(); | 2239 Node* receiver = environment()->Pop(); |
2207 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | 2240 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); |
2208 Node* store = BuildNamedSuperStore(receiver, home_object, name, value, | 2241 Node* store = BuildNamedSuperStore(receiver, home_object, name, value, |
2209 expr->AssignmentFeedbackId()); | 2242 expr->AssignmentFeedbackId()); |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2640 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 2673 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
2641 value = | 2674 value = |
2642 BuildBinaryOp(old_value, jsgraph()->OneConstant(), expr->binary_op()); | 2675 BuildBinaryOp(old_value, jsgraph()->OneConstant(), expr->binary_op()); |
2643 // This should never deoptimize because we have converted to number | 2676 // This should never deoptimize because we have converted to number |
2644 // before. | 2677 // before. |
2645 states.AddToNode(value, BailoutId::None(), | 2678 states.AddToNode(value, BailoutId::None(), |
2646 OutputFrameStateCombine::Ignore()); | 2679 OutputFrameStateCombine::Ignore()); |
2647 } | 2680 } |
2648 | 2681 |
2649 // Store the value. | 2682 // Store the value. |
| 2683 ResolvedFeedbackSlot slot = ResolveFeedbackSlot(expr->CountSlot()); |
2650 switch (assign_type) { | 2684 switch (assign_type) { |
2651 case VARIABLE: { | 2685 case VARIABLE: { |
2652 Variable* variable = expr->expression()->AsVariableProxy()->var(); | 2686 Variable* variable = expr->expression()->AsVariableProxy()->var(); |
2653 environment()->Push(value); | 2687 environment()->Push(value); |
2654 BuildVariableAssignment(variable, value, expr->op(), expr->AssignmentId(), | 2688 BuildVariableAssignment(variable, value, expr->op(), slot, |
2655 store_states); | 2689 expr->AssignmentId(), store_states); |
2656 environment()->Pop(); | 2690 environment()->Pop(); |
2657 break; | 2691 break; |
2658 } | 2692 } |
2659 case NAMED_PROPERTY: { | 2693 case NAMED_PROPERTY: { |
2660 Node* object = environment()->Pop(); | 2694 Node* object = environment()->Pop(); |
2661 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | 2695 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); |
2662 Node* store = | 2696 Node* store = BuildNamedStore(object, name, value, slot, |
2663 BuildNamedStore(object, name, value, expr->CountStoreFeedbackId()); | 2697 expr->CountStoreFeedbackId()); |
2664 environment()->Push(value); | 2698 environment()->Push(value); |
2665 store_states.AddToNode(store, expr->AssignmentId(), | 2699 store_states.AddToNode(store, expr->AssignmentId(), |
2666 OutputFrameStateCombine::Ignore()); | 2700 OutputFrameStateCombine::Ignore()); |
2667 environment()->Pop(); | 2701 environment()->Pop(); |
2668 break; | 2702 break; |
2669 } | 2703 } |
2670 case KEYED_PROPERTY: { | 2704 case KEYED_PROPERTY: { |
2671 Node* key = environment()->Pop(); | 2705 Node* key = environment()->Pop(); |
2672 Node* object = environment()->Pop(); | 2706 Node* object = environment()->Pop(); |
2673 Node* store = | 2707 Node* store = BuildKeyedStore(object, key, value, slot, |
2674 BuildKeyedStore(object, key, value, expr->CountStoreFeedbackId()); | 2708 expr->CountStoreFeedbackId()); |
2675 environment()->Push(value); | 2709 environment()->Push(value); |
2676 store_states.AddToNode(store, expr->AssignmentId(), | 2710 store_states.AddToNode(store, expr->AssignmentId(), |
2677 OutputFrameStateCombine::Ignore()); | 2711 OutputFrameStateCombine::Ignore()); |
2678 environment()->Pop(); | 2712 environment()->Pop(); |
2679 break; | 2713 break; |
2680 } | 2714 } |
2681 case NAMED_SUPER_PROPERTY: { | 2715 case NAMED_SUPER_PROPERTY: { |
2682 Node* home_object = environment()->Pop(); | 2716 Node* home_object = environment()->Pop(); |
2683 Node* receiver = environment()->Pop(); | 2717 Node* receiver = environment()->Pop(); |
2684 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | 2718 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3105 | 3139 |
3106 // Allocate and initialize a new arguments object. | 3140 // Allocate and initialize a new arguments object. |
3107 Node* callee = GetFunctionClosure(); | 3141 Node* callee = GetFunctionClosure(); |
3108 const Operator* op = javascript()->CallRuntime(Runtime::kNewArguments, 1); | 3142 const Operator* op = javascript()->CallRuntime(Runtime::kNewArguments, 1); |
3109 Node* object = NewNode(op, callee); | 3143 Node* object = NewNode(op, callee); |
3110 | 3144 |
3111 // Assign the object to the arguments variable. | 3145 // Assign the object to the arguments variable. |
3112 DCHECK(arguments->IsContextSlot() || arguments->IsStackAllocated()); | 3146 DCHECK(arguments->IsContextSlot() || arguments->IsStackAllocated()); |
3113 // This should never lazy deopt, so it is fine to send invalid bailout id. | 3147 // This should never lazy deopt, so it is fine to send invalid bailout id. |
3114 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 3148 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
3115 BuildVariableAssignment(arguments, object, Token::ASSIGN, BailoutId::None(), | 3149 ResolvedFeedbackSlot slot; |
3116 states); | 3150 BuildVariableAssignment(arguments, object, Token::ASSIGN, slot, |
| 3151 BailoutId::None(), states); |
3117 | 3152 |
3118 return object; | 3153 return object; |
3119 } | 3154 } |
3120 | 3155 |
3121 | 3156 |
3122 Node* AstGraphBuilder::BuildRestArgumentsArray(Variable* rest, int index) { | 3157 Node* AstGraphBuilder::BuildRestArgumentsArray(Variable* rest, int index) { |
3123 if (rest == NULL) return NULL; | 3158 if (rest == NULL) return NULL; |
3124 | 3159 |
3125 DCHECK(index >= 0); | 3160 DCHECK(index >= 0); |
3126 const Operator* op = javascript()->CallRuntime(Runtime::kNewRestParamSlow, 2); | 3161 const Operator* op = javascript()->CallRuntime(Runtime::kNewRestParamSlow, 2); |
3127 Node* object = NewNode(op, jsgraph()->SmiConstant(index), | 3162 Node* object = NewNode(op, jsgraph()->SmiConstant(index), |
3128 jsgraph()->SmiConstant(language_mode())); | 3163 jsgraph()->SmiConstant(language_mode())); |
3129 | 3164 |
3130 // Assign the object to the rest array | 3165 // Assign the object to the rest array |
3131 DCHECK(rest->IsContextSlot() || rest->IsStackAllocated()); | 3166 DCHECK(rest->IsContextSlot() || rest->IsStackAllocated()); |
3132 // This should never lazy deopt, so it is fine to send invalid bailout id. | 3167 // This should never lazy deopt, so it is fine to send invalid bailout id. |
3133 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 3168 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
3134 BuildVariableAssignment(rest, object, Token::ASSIGN, BailoutId::None(), | 3169 ResolvedFeedbackSlot slot; |
| 3170 BuildVariableAssignment(rest, object, Token::ASSIGN, slot, BailoutId::None(), |
3135 states); | 3171 states); |
3136 | 3172 |
3137 return object; | 3173 return object; |
3138 } | 3174 } |
3139 | 3175 |
3140 | 3176 |
3141 Node* AstGraphBuilder::BuildThisFunctionVar(Variable* this_function_var) { | 3177 Node* AstGraphBuilder::BuildThisFunctionVar(Variable* this_function_var) { |
3142 if (this_function_var == nullptr) return nullptr; | 3178 if (this_function_var == nullptr) return nullptr; |
3143 | 3179 |
3144 Node* this_function = GetFunctionClosure(); | 3180 Node* this_function = GetFunctionClosure(); |
3145 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 3181 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
| 3182 ResolvedFeedbackSlot slot; |
3146 BuildVariableAssignment(this_function_var, this_function, Token::INIT_CONST, | 3183 BuildVariableAssignment(this_function_var, this_function, Token::INIT_CONST, |
3147 BailoutId::None(), states); | 3184 slot, BailoutId::None(), states); |
3148 return this_function; | 3185 return this_function; |
3149 } | 3186 } |
3150 | 3187 |
3151 | 3188 |
3152 Node* AstGraphBuilder::BuildHoleCheckSilent(Node* value, Node* for_hole, | 3189 Node* AstGraphBuilder::BuildHoleCheckSilent(Node* value, Node* for_hole, |
3153 Node* not_hole) { | 3190 Node* not_hole) { |
3154 Node* the_hole = jsgraph()->TheHoleConstant(); | 3191 Node* the_hole = jsgraph()->TheHoleConstant(); |
3155 Node* check = NewNode(javascript()->StrictEqual(), value, the_hole); | 3192 Node* check = NewNode(javascript()->StrictEqual(), value, the_hole); |
3156 return NewNode(common()->Select(kMachAnyTagged, BranchHint::kFalse), check, | 3193 return NewNode(common()->Select(kMachAnyTagged, BranchHint::kFalse), check, |
3157 for_hole, not_hole); | 3194 for_hole, not_hole); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3322 PrepareFrameState(result, bailout_id, combine); | 3359 PrepareFrameState(result, bailout_id, combine); |
3323 return result; | 3360 return result; |
3324 } | 3361 } |
3325 } | 3362 } |
3326 UNREACHABLE(); | 3363 UNREACHABLE(); |
3327 return NULL; | 3364 return NULL; |
3328 } | 3365 } |
3329 | 3366 |
3330 | 3367 |
3331 Node* AstGraphBuilder::BuildVariableAssignment( | 3368 Node* AstGraphBuilder::BuildVariableAssignment( |
3332 Variable* variable, Node* value, Token::Value op, BailoutId bailout_id, | 3369 Variable* variable, Node* value, Token::Value op, |
| 3370 const ResolvedFeedbackSlot& slot, BailoutId bailout_id, |
3333 FrameStateBeforeAndAfter& states, OutputFrameStateCombine combine) { | 3371 FrameStateBeforeAndAfter& states, OutputFrameStateCombine combine) { |
3334 Node* the_hole = jsgraph()->TheHoleConstant(); | 3372 Node* the_hole = jsgraph()->TheHoleConstant(); |
3335 VariableMode mode = variable->mode(); | 3373 VariableMode mode = variable->mode(); |
3336 switch (variable->location()) { | 3374 switch (variable->location()) { |
3337 case Variable::UNALLOCATED: { | 3375 case Variable::UNALLOCATED: { |
3338 // Global var, const, or let variable. | 3376 // Global var, const, or let variable. |
3339 Node* global = BuildLoadGlobalObject(); | 3377 Node* global = BuildLoadGlobalObject(); |
3340 Handle<Name> name = variable->name(); | 3378 Handle<Name> name = variable->name(); |
3341 Node* store = | 3379 Node* store = |
3342 BuildNamedStore(global, name, value, TypeFeedbackId::None()); | 3380 BuildNamedStore(global, name, value, slot, TypeFeedbackId::None()); |
3343 states.AddToNode(store, bailout_id, combine); | 3381 states.AddToNode(store, bailout_id, combine); |
3344 return store; | 3382 return store; |
3345 } | 3383 } |
3346 case Variable::PARAMETER: | 3384 case Variable::PARAMETER: |
3347 case Variable::LOCAL: | 3385 case Variable::LOCAL: |
3348 // Local var, const, or let variable. | 3386 // Local var, const, or let variable. |
3349 if (mode == CONST_LEGACY && op == Token::INIT_CONST_LEGACY) { | 3387 if (mode == CONST_LEGACY && op == Token::INIT_CONST_LEGACY) { |
3350 // Perform an initialization check for legacy const variables. | 3388 // Perform an initialization check for legacy const variables. |
3351 Node* current = environment()->Lookup(variable); | 3389 Node* current = environment()->Lookup(variable); |
3352 if (current->op() != the_hole->op()) { | 3390 if (current->op() != the_hole->op()) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3465 const ResolvedFeedbackSlot& feedback, | 3503 const ResolvedFeedbackSlot& feedback, |
3466 ContextualMode mode) { | 3504 ContextualMode mode) { |
3467 const Operator* op = | 3505 const Operator* op = |
3468 javascript()->LoadNamed(MakeUnique(name), feedback, mode); | 3506 javascript()->LoadNamed(MakeUnique(name), feedback, mode); |
3469 return Record(js_type_feedback_, NewNode(op, object, GetFeedbackVector()), | 3507 return Record(js_type_feedback_, NewNode(op, object, GetFeedbackVector()), |
3470 feedback.slot()); | 3508 feedback.slot()); |
3471 } | 3509 } |
3472 | 3510 |
3473 | 3511 |
3474 Node* AstGraphBuilder::BuildKeyedStore(Node* object, Node* key, Node* value, | 3512 Node* AstGraphBuilder::BuildKeyedStore(Node* object, Node* key, Node* value, |
| 3513 const ResolvedFeedbackSlot& feedback, |
3475 TypeFeedbackId id) { | 3514 TypeFeedbackId id) { |
3476 const Operator* op = javascript()->StoreProperty(language_mode()); | 3515 const Operator* op = javascript()->StoreProperty(language_mode(), feedback); |
3477 return Record(js_type_feedback_, NewNode(op, object, key, value), id); | 3516 return Record(js_type_feedback_, NewNode(op, object, key, value), id); |
3478 } | 3517 } |
3479 | 3518 |
3480 | 3519 |
3481 Node* AstGraphBuilder::BuildNamedStore(Node* object, Handle<Name> name, | 3520 Node* AstGraphBuilder::BuildNamedStore(Node* object, Handle<Name> name, |
3482 Node* value, TypeFeedbackId id) { | 3521 Node* value, |
| 3522 const ResolvedFeedbackSlot& feedback, |
| 3523 TypeFeedbackId id) { |
3483 const Operator* op = | 3524 const Operator* op = |
3484 javascript()->StoreNamed(language_mode(), MakeUnique(name)); | 3525 javascript()->StoreNamed(language_mode(), MakeUnique(name), feedback); |
3485 return Record(js_type_feedback_, NewNode(op, object, value), id); | 3526 return Record(js_type_feedback_, NewNode(op, object, value), id); |
3486 } | 3527 } |
3487 | 3528 |
3488 | 3529 |
3489 Node* AstGraphBuilder::BuildNamedSuperLoad( | 3530 Node* AstGraphBuilder::BuildNamedSuperLoad( |
3490 Node* receiver, Node* home_object, Handle<Name> name, | 3531 Node* receiver, Node* home_object, Handle<Name> name, |
3491 const ResolvedFeedbackSlot& feedback) { | 3532 const ResolvedFeedbackSlot& feedback) { |
3492 Node* name_node = jsgraph()->Constant(name); | 3533 Node* name_node = jsgraph()->Constant(name); |
3493 const Operator* op = javascript()->CallRuntime(Runtime::kLoadFromSuper, 3); | 3534 const Operator* op = javascript()->CallRuntime(Runtime::kLoadFromSuper, 3); |
3494 Node* value = NewNode(op, receiver, home_object, name_node); | 3535 Node* value = NewNode(op, receiver, home_object, name_node); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3619 | 3660 |
3620 | 3661 |
3621 Node* AstGraphBuilder::BuildToObject(Node* input, BailoutId bailout_id) { | 3662 Node* AstGraphBuilder::BuildToObject(Node* input, BailoutId bailout_id) { |
3622 Node* object = NewNode(javascript()->ToObject(), input); | 3663 Node* object = NewNode(javascript()->ToObject(), input); |
3623 PrepareFrameState(object, bailout_id, OutputFrameStateCombine::Push()); | 3664 PrepareFrameState(object, bailout_id, OutputFrameStateCombine::Push()); |
3624 return object; | 3665 return object; |
3625 } | 3666 } |
3626 | 3667 |
3627 | 3668 |
3628 Node* AstGraphBuilder::BuildSetHomeObject(Node* value, Node* home_object, | 3669 Node* AstGraphBuilder::BuildSetHomeObject(Node* value, Node* home_object, |
3629 Expression* expr) { | 3670 Expression* expr, |
| 3671 const ResolvedFeedbackSlot& slot) { |
3630 if (!FunctionLiteral::NeedsHomeObject(expr)) return value; | 3672 if (!FunctionLiteral::NeedsHomeObject(expr)) return value; |
3631 Handle<Name> name = isolate()->factory()->home_object_symbol(); | 3673 Handle<Name> name = isolate()->factory()->home_object_symbol(); |
3632 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 3674 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
3633 Node* store = | 3675 Node* store = |
3634 BuildNamedStore(value, name, home_object, TypeFeedbackId::None()); | 3676 BuildNamedStore(value, name, home_object, slot, TypeFeedbackId::None()); |
3635 states.AddToNode(store, BailoutId::None(), OutputFrameStateCombine::Ignore()); | 3677 states.AddToNode(store, BailoutId::None(), OutputFrameStateCombine::Ignore()); |
3636 return store; | 3678 return store; |
3637 } | 3679 } |
3638 | 3680 |
3639 | 3681 |
3640 Node* AstGraphBuilder::BuildThrowError(Node* exception, BailoutId bailout_id) { | 3682 Node* AstGraphBuilder::BuildThrowError(Node* exception, BailoutId bailout_id) { |
3641 const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1); | 3683 const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1); |
3642 Node* call = NewNode(op, exception); | 3684 Node* call = NewNode(op, exception); |
3643 PrepareFrameState(call, bailout_id); | 3685 PrepareFrameState(call, bailout_id); |
3644 Node* control = NewNode(common()->Throw(), call); | 3686 Node* control = NewNode(common()->Throw(), call); |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4073 // Phi does not exist yet, introduce one. | 4115 // Phi does not exist yet, introduce one. |
4074 value = NewPhi(inputs, value, control); | 4116 value = NewPhi(inputs, value, control); |
4075 value->ReplaceInput(inputs - 1, other); | 4117 value->ReplaceInput(inputs - 1, other); |
4076 } | 4118 } |
4077 return value; | 4119 return value; |
4078 } | 4120 } |
4079 | 4121 |
4080 } // namespace compiler | 4122 } // namespace compiler |
4081 } // namespace internal | 4123 } // namespace internal |
4082 } // namespace v8 | 4124 } // namespace v8 |
OLD | NEW |