Chromium Code Reviews| 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 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1568 // is needed here since the constructor is created by the class literal. | 1568 // is needed here since the constructor is created by the class literal. |
| 1569 Node* proto = | 1569 Node* proto = |
| 1570 BuildLoadObjectField(literal, JSFunction::kPrototypeOrInitialMapOffset); | 1570 BuildLoadObjectField(literal, JSFunction::kPrototypeOrInitialMapOffset); |
| 1571 | 1571 |
| 1572 // The class literal and the prototype are both expected on the operand stack | 1572 // The class literal and the prototype are both expected on the operand stack |
| 1573 // during evaluation of the method values. | 1573 // during evaluation of the method values. |
| 1574 environment()->Push(literal); | 1574 environment()->Push(literal); |
| 1575 environment()->Push(proto); | 1575 environment()->Push(proto); |
| 1576 | 1576 |
| 1577 // Create nodes to store method values into the literal. | 1577 // Create nodes to store method values into the literal. |
| 1578 int store_slot_index = 0; | |
| 1579 for (int i = 0; i < expr->properties()->length(); i++) { | 1578 for (int i = 0; i < expr->properties()->length(); i++) { |
| 1580 ObjectLiteral::Property* property = expr->properties()->at(i); | 1579 ObjectLiteral::Property* property = expr->properties()->at(i); |
| 1581 environment()->Push(property->is_static() ? literal : proto); | 1580 environment()->Push(property->is_static() ? literal : proto); |
| 1582 | 1581 |
| 1583 VisitForValue(property->key()); | 1582 VisitForValue(property->key()); |
| 1584 Node* name = BuildToName(environment()->Pop(), expr->GetIdForProperty(i)); | 1583 Node* name = BuildToName(environment()->Pop(), expr->GetIdForProperty(i)); |
| 1585 environment()->Push(name); | 1584 environment()->Push(name); |
| 1586 | 1585 |
| 1587 // The static prototype property is read only. We handle the non computed | 1586 // The static prototype property is read only. We handle the non computed |
| 1588 // property name case in the parser. Since this is the only case where we | 1587 // property name case in the parser. Since this is the only case where we |
| 1589 // need to check for an own read only property we special case this so we do | 1588 // need to check for an own read only property we special case this so we do |
| 1590 // not need to do this for every property. | 1589 // not need to do this for every property. |
| 1591 if (property->is_static() && property->is_computed_name()) { | 1590 if (property->is_static() && property->is_computed_name()) { |
| 1592 Node* check = BuildThrowIfStaticPrototype(environment()->Pop(), | 1591 Node* check = BuildThrowIfStaticPrototype(environment()->Pop(), |
| 1593 expr->GetIdForProperty(i)); | 1592 expr->GetIdForProperty(i)); |
| 1594 environment()->Push(check); | 1593 environment()->Push(check); |
| 1595 } | 1594 } |
| 1596 | 1595 |
| 1597 VisitForValue(property->value()); | 1596 VisitForValue(property->value()); |
| 1598 Node* value = environment()->Pop(); | 1597 Node* value = environment()->Pop(); |
| 1599 Node* key = environment()->Pop(); | 1598 Node* key = environment()->Pop(); |
| 1600 Node* receiver = environment()->Pop(); | 1599 Node* receiver = environment()->Pop(); |
| 1601 VectorSlotPair feedback = CreateVectorSlotPair( | 1600 |
| 1602 expr->SlotForHomeObject(property->value(), &store_slot_index)); | 1601 BuildSetHomeObject(value, receiver, property); |
| 1603 BuildSetHomeObject(value, receiver, property->value(), feedback); | |
| 1604 | 1602 |
| 1605 switch (property->kind()) { | 1603 switch (property->kind()) { |
| 1606 case ObjectLiteral::Property::CONSTANT: | 1604 case ObjectLiteral::Property::CONSTANT: |
| 1607 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 1605 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
| 1608 case ObjectLiteral::Property::PROTOTYPE: | 1606 case ObjectLiteral::Property::PROTOTYPE: |
| 1609 UNREACHABLE(); | 1607 UNREACHABLE(); |
| 1610 case ObjectLiteral::Property::COMPUTED: { | 1608 case ObjectLiteral::Property::COMPUTED: { |
| 1611 const Operator* op = | 1609 const Operator* op = |
| 1612 javascript()->CallRuntime(Runtime::kDefineClassMethod, 3); | 1610 javascript()->CallRuntime(Runtime::kDefineClassMethod, 3); |
| 1613 NewNode(op, receiver, key, value); | 1611 NewNode(op, receiver, key, value); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 1636 environment()->Pop(); // literal | 1634 environment()->Pop(); // literal |
| 1637 const Operator* op = | 1635 const Operator* op = |
| 1638 javascript()->CallRuntime(Runtime::kFinalizeClassDefinition, 2); | 1636 javascript()->CallRuntime(Runtime::kFinalizeClassDefinition, 2); |
| 1639 literal = NewNode(op, literal, proto); | 1637 literal = NewNode(op, literal, proto); |
| 1640 | 1638 |
| 1641 // Assign to class variable. | 1639 // Assign to class variable. |
| 1642 if (expr->scope() != NULL) { | 1640 if (expr->scope() != NULL) { |
| 1643 DCHECK_NOT_NULL(expr->class_variable_proxy()); | 1641 DCHECK_NOT_NULL(expr->class_variable_proxy()); |
| 1644 Variable* var = expr->class_variable_proxy()->var(); | 1642 Variable* var = expr->class_variable_proxy()->var(); |
| 1645 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 1643 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
| 1646 VectorSlotPair feedback = | 1644 VectorSlotPair feedback = CreateVectorSlotPair( |
| 1647 CreateVectorSlotPair(FLAG_vector_stores && var->IsUnallocated() | 1645 expr->NeedsProxySlot() ? expr->ProxySlot() |
| 1648 ? expr->GetNthSlot(store_slot_index++) | 1646 : FeedbackVectorICSlot::Invalid()); |
| 1649 : FeedbackVectorICSlot::Invalid()); | |
| 1650 BuildVariableAssignment(var, literal, Token::INIT_CONST, feedback, | 1647 BuildVariableAssignment(var, literal, Token::INIT_CONST, feedback, |
| 1651 BailoutId::None(), states); | 1648 BailoutId::None(), states); |
| 1652 } | 1649 } |
| 1653 ast_context()->ProduceValue(literal); | 1650 ast_context()->ProduceValue(literal); |
| 1654 } | 1651 } |
| 1655 | 1652 |
| 1656 | 1653 |
| 1657 void AstGraphBuilder::VisitNativeFunctionLiteral(NativeFunctionLiteral* expr) { | 1654 void AstGraphBuilder::VisitNativeFunctionLiteral(NativeFunctionLiteral* expr) { |
| 1658 UNREACHABLE(); | 1655 UNREACHABLE(); |
| 1659 } | 1656 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1698 Node* pattern = jsgraph()->Constant(expr->pattern()); | 1695 Node* pattern = jsgraph()->Constant(expr->pattern()); |
| 1699 Node* flags = jsgraph()->Constant(expr->flags()); | 1696 Node* flags = jsgraph()->Constant(expr->flags()); |
| 1700 const Operator* op = | 1697 const Operator* op = |
| 1701 javascript()->CallRuntime(Runtime::kMaterializeRegExpLiteral, 4); | 1698 javascript()->CallRuntime(Runtime::kMaterializeRegExpLiteral, 4); |
| 1702 Node* literal = NewNode(op, literals_array, literal_index, pattern, flags); | 1699 Node* literal = NewNode(op, literals_array, literal_index, pattern, flags); |
| 1703 PrepareFrameState(literal, expr->id(), ast_context()->GetStateCombine()); | 1700 PrepareFrameState(literal, expr->id(), ast_context()->GetStateCombine()); |
| 1704 ast_context()->ProduceValue(literal); | 1701 ast_context()->ProduceValue(literal); |
| 1705 } | 1702 } |
| 1706 | 1703 |
| 1707 | 1704 |
| 1705 void AstGraphBuilder::BuildAccessor(Node* home_object, | |
|
Michael Starzinger
2015/09/07 08:31:13
As discussed offline, this is not really a builder
mvstanton
2015/09/07 13:36:09
Right on, done.
| |
| 1706 ObjectLiteralProperty* property) { | |
| 1707 if (property == NULL) { | |
| 1708 VisitForValueOrNull(NULL); | |
| 1709 } else { | |
| 1710 Expression* value = property->value(); | |
| 1711 VisitForValueOrNull(value); | |
| 1712 BuildSetHomeObject(environment()->Top(), home_object, property); | |
| 1713 } | |
| 1714 } | |
| 1715 | |
| 1716 | |
| 1708 void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { | 1717 void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
| 1709 Node* closure = GetFunctionClosure(); | 1718 Node* closure = GetFunctionClosure(); |
| 1710 | 1719 |
| 1711 // Create node to deep-copy the literal boilerplate. | 1720 // Create node to deep-copy the literal boilerplate. |
| 1712 Node* literals_array = | 1721 Node* literals_array = |
| 1713 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); | 1722 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); |
| 1714 Node* literal_index = jsgraph()->Constant(expr->literal_index()); | 1723 Node* literal_index = jsgraph()->Constant(expr->literal_index()); |
| 1715 Node* constants = jsgraph()->Constant(expr->constant_properties()); | 1724 Node* constants = jsgraph()->Constant(expr->constant_properties()); |
| 1716 const Operator* op = | 1725 const Operator* op = |
| 1717 javascript()->CreateLiteralObject(expr->ComputeFlags(true)); | 1726 javascript()->CreateLiteralObject(expr->ComputeFlags(true)); |
| 1718 Node* literal = NewNode(op, literals_array, literal_index, constants); | 1727 Node* literal = NewNode(op, literals_array, literal_index, constants); |
| 1719 PrepareFrameState(literal, expr->CreateLiteralId(), | 1728 PrepareFrameState(literal, expr->CreateLiteralId(), |
| 1720 OutputFrameStateCombine::Push()); | 1729 OutputFrameStateCombine::Push()); |
| 1721 | 1730 |
| 1722 // The object is expected on the operand stack during computation of the | 1731 // The object is expected on the operand stack during computation of the |
| 1723 // property values and is the value of the entire expression. | 1732 // property values and is the value of the entire expression. |
| 1724 environment()->Push(literal); | 1733 environment()->Push(literal); |
| 1725 | 1734 |
| 1726 // Create nodes to store computed values into the literal. | 1735 // Create nodes to store computed values into the literal. |
| 1727 int property_index = 0; | 1736 int property_index = 0; |
| 1728 int store_slot_index = 0; | |
| 1729 AccessorTable accessor_table(zone()); | 1737 AccessorTable accessor_table(zone()); |
| 1730 for (; property_index < expr->properties()->length(); property_index++) { | 1738 for (; property_index < expr->properties()->length(); property_index++) { |
| 1731 ObjectLiteral::Property* property = expr->properties()->at(property_index); | 1739 ObjectLiteral::Property* property = expr->properties()->at(property_index); |
| 1732 if (property->is_computed_name()) break; | 1740 if (property->is_computed_name()) break; |
| 1733 if (property->IsCompileTimeValue()) continue; | 1741 if (property->IsCompileTimeValue()) continue; |
| 1734 | 1742 |
| 1735 Literal* key = property->key()->AsLiteral(); | 1743 Literal* key = property->key()->AsLiteral(); |
| 1736 switch (property->kind()) { | 1744 switch (property->kind()) { |
| 1737 case ObjectLiteral::Property::CONSTANT: | 1745 case ObjectLiteral::Property::CONSTANT: |
| 1738 UNREACHABLE(); | 1746 UNREACHABLE(); |
| 1739 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 1747 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
| 1740 DCHECK(!CompileTimeValue::IsCompileTimeValue(property->value())); | 1748 DCHECK(!CompileTimeValue::IsCompileTimeValue(property->value())); |
| 1741 // Fall through. | 1749 // Fall through. |
| 1742 case ObjectLiteral::Property::COMPUTED: { | 1750 case ObjectLiteral::Property::COMPUTED: { |
| 1743 // It is safe to use [[Put]] here because the boilerplate already | 1751 // It is safe to use [[Put]] here because the boilerplate already |
| 1744 // contains computed properties with an uninitialized value. | 1752 // contains computed properties with an uninitialized value. |
| 1745 if (key->value()->IsInternalizedString()) { | 1753 if (key->value()->IsInternalizedString()) { |
| 1746 if (property->emit_store()) { | 1754 if (property->emit_store()) { |
| 1747 VisitForValue(property->value()); | 1755 VisitForValue(property->value()); |
| 1748 FrameStateBeforeAndAfter states(this, property->value()->id()); | 1756 FrameStateBeforeAndAfter states(this, property->value()->id()); |
| 1749 Node* value = environment()->Pop(); | 1757 Node* value = environment()->Pop(); |
| 1750 Handle<Name> name = key->AsPropertyName(); | 1758 Handle<Name> name = key->AsPropertyName(); |
| 1751 VectorSlotPair feedback = | 1759 VectorSlotPair feedback = |
| 1752 FLAG_vector_stores | 1760 CreateVectorSlotPair(property->GetSlot(0)); |
| 1753 ? CreateVectorSlotPair(expr->GetNthSlot(store_slot_index++)) | |
| 1754 : VectorSlotPair(); | |
| 1755 Node* store = BuildNamedStore(literal, name, value, feedback, | 1761 Node* store = BuildNamedStore(literal, name, value, feedback, |
| 1756 TypeFeedbackId::None()); | 1762 TypeFeedbackId::None()); |
| 1757 states.AddToNode(store, key->id(), | 1763 states.AddToNode(store, key->id(), |
| 1758 OutputFrameStateCombine::Ignore()); | 1764 OutputFrameStateCombine::Ignore()); |
| 1759 VectorSlotPair home_feedback = CreateVectorSlotPair( | 1765 BuildSetHomeObject(value, literal, property, 1); |
| 1760 expr->SlotForHomeObject(property->value(), &store_slot_index)); | |
| 1761 BuildSetHomeObject(value, literal, property->value(), | |
| 1762 home_feedback); | |
| 1763 } else { | 1766 } else { |
| 1764 VisitForEffect(property->value()); | 1767 VisitForEffect(property->value()); |
| 1765 } | 1768 } |
| 1766 break; | 1769 break; |
| 1767 } | 1770 } |
| 1768 environment()->Push(literal); // Duplicate receiver. | 1771 environment()->Push(literal); // Duplicate receiver. |
| 1769 VisitForValue(property->key()); | 1772 VisitForValue(property->key()); |
| 1770 VisitForValue(property->value()); | 1773 VisitForValue(property->value()); |
| 1771 Node* value = environment()->Pop(); | 1774 Node* value = environment()->Pop(); |
| 1772 Node* key = environment()->Pop(); | 1775 Node* key = environment()->Pop(); |
| 1773 Node* receiver = environment()->Pop(); | 1776 Node* receiver = environment()->Pop(); |
| 1774 if (property->emit_store()) { | 1777 if (property->emit_store()) { |
| 1775 Node* language = jsgraph()->Constant(SLOPPY); | 1778 Node* language = jsgraph()->Constant(SLOPPY); |
| 1776 const Operator* op = | 1779 const Operator* op = |
| 1777 javascript()->CallRuntime(Runtime::kSetProperty, 4); | 1780 javascript()->CallRuntime(Runtime::kSetProperty, 4); |
| 1778 Node* set_property = NewNode(op, receiver, key, value, language); | 1781 Node* set_property = NewNode(op, receiver, key, value, language); |
| 1779 // SetProperty should not lazy deopt on an object literal. | 1782 // SetProperty should not lazy deopt on an object literal. |
| 1780 PrepareFrameState(set_property, BailoutId::None()); | 1783 PrepareFrameState(set_property, BailoutId::None()); |
| 1781 VectorSlotPair home_feedback = CreateVectorSlotPair( | 1784 BuildSetHomeObject(value, receiver, property); |
| 1782 expr->SlotForHomeObject(property->value(), &store_slot_index)); | |
| 1783 BuildSetHomeObject(value, receiver, property->value(), home_feedback); | |
| 1784 } | 1785 } |
| 1785 break; | 1786 break; |
| 1786 } | 1787 } |
| 1787 case ObjectLiteral::Property::PROTOTYPE: { | 1788 case ObjectLiteral::Property::PROTOTYPE: { |
| 1788 environment()->Push(literal); // Duplicate receiver. | 1789 environment()->Push(literal); // Duplicate receiver. |
| 1789 VisitForValue(property->value()); | 1790 VisitForValue(property->value()); |
| 1790 Node* value = environment()->Pop(); | 1791 Node* value = environment()->Pop(); |
| 1791 Node* receiver = environment()->Pop(); | 1792 Node* receiver = environment()->Pop(); |
| 1792 DCHECK(property->emit_store()); | 1793 DCHECK(property->emit_store()); |
| 1793 const Operator* op = | 1794 const Operator* op = |
| 1794 javascript()->CallRuntime(Runtime::kInternalSetPrototype, 2); | 1795 javascript()->CallRuntime(Runtime::kInternalSetPrototype, 2); |
| 1795 Node* set_prototype = NewNode(op, receiver, value); | 1796 Node* set_prototype = NewNode(op, receiver, value); |
| 1796 // SetPrototype should not lazy deopt on an object literal. | 1797 // SetPrototype should not lazy deopt on an object literal. |
| 1797 PrepareFrameState(set_prototype, BailoutId::None()); | 1798 PrepareFrameState(set_prototype, BailoutId::None()); |
| 1798 break; | 1799 break; |
| 1799 } | 1800 } |
| 1800 case ObjectLiteral::Property::GETTER: | 1801 case ObjectLiteral::Property::GETTER: |
| 1801 if (property->emit_store()) { | 1802 if (property->emit_store()) { |
| 1802 accessor_table.lookup(key)->second->getter = property->value(); | 1803 accessor_table.lookup(key)->second->getter = property; |
| 1803 } | 1804 } |
| 1804 break; | 1805 break; |
| 1805 case ObjectLiteral::Property::SETTER: | 1806 case ObjectLiteral::Property::SETTER: |
| 1806 if (property->emit_store()) { | 1807 if (property->emit_store()) { |
| 1807 accessor_table.lookup(key)->second->setter = property->value(); | 1808 accessor_table.lookup(key)->second->setter = property; |
| 1808 } | 1809 } |
| 1809 break; | 1810 break; |
| 1810 } | 1811 } |
| 1811 } | 1812 } |
| 1812 | 1813 |
| 1813 // Create nodes to define accessors, using only a single call to the runtime | 1814 // Create nodes to define accessors, using only a single call to the runtime |
| 1814 // for each pair of corresponding getters and setters. | 1815 // for each pair of corresponding getters and setters. |
| 1815 for (AccessorTable::Iterator it = accessor_table.begin(); | 1816 for (AccessorTable::Iterator it = accessor_table.begin(); |
| 1816 it != accessor_table.end(); ++it) { | 1817 it != accessor_table.end(); ++it) { |
| 1817 VisitForValue(it->first); | 1818 VisitForValue(it->first); |
| 1818 VisitForValueOrNull(it->second->getter); | 1819 BuildAccessor(literal, it->second->getter); |
| 1819 VectorSlotPair feedback_getter = CreateVectorSlotPair( | 1820 BuildAccessor(literal, it->second->setter); |
| 1820 expr->SlotForHomeObject(it->second->getter, &store_slot_index)); | |
| 1821 BuildSetHomeObject(environment()->Top(), literal, it->second->getter, | |
| 1822 feedback_getter); | |
| 1823 VisitForValueOrNull(it->second->setter); | |
| 1824 VectorSlotPair feedback_setter = CreateVectorSlotPair( | |
| 1825 expr->SlotForHomeObject(it->second->setter, &store_slot_index)); | |
| 1826 BuildSetHomeObject(environment()->Top(), literal, it->second->setter, | |
| 1827 feedback_setter); | |
| 1828 Node* setter = environment()->Pop(); | 1821 Node* setter = environment()->Pop(); |
| 1829 Node* getter = environment()->Pop(); | 1822 Node* getter = environment()->Pop(); |
| 1830 Node* name = environment()->Pop(); | 1823 Node* name = environment()->Pop(); |
| 1831 Node* attr = jsgraph()->Constant(NONE); | 1824 Node* attr = jsgraph()->Constant(NONE); |
| 1832 const Operator* op = | 1825 const Operator* op = |
| 1833 javascript()->CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); | 1826 javascript()->CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); |
| 1834 Node* call = NewNode(op, literal, name, getter, setter, attr); | 1827 Node* call = NewNode(op, literal, name, getter, setter, attr); |
| 1835 // This should not lazy deopt on a new literal. | 1828 // This should not lazy deopt on a new literal. |
| 1836 PrepareFrameState(call, BailoutId::None()); | 1829 PrepareFrameState(call, BailoutId::None()); |
| 1837 } | 1830 } |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 1862 | 1855 |
| 1863 environment()->Push(literal); // Duplicate receiver. | 1856 environment()->Push(literal); // Duplicate receiver. |
| 1864 VisitForValue(property->key()); | 1857 VisitForValue(property->key()); |
| 1865 Node* name = BuildToName(environment()->Pop(), | 1858 Node* name = BuildToName(environment()->Pop(), |
| 1866 expr->GetIdForProperty(property_index)); | 1859 expr->GetIdForProperty(property_index)); |
| 1867 environment()->Push(name); | 1860 environment()->Push(name); |
| 1868 VisitForValue(property->value()); | 1861 VisitForValue(property->value()); |
| 1869 Node* value = environment()->Pop(); | 1862 Node* value = environment()->Pop(); |
| 1870 Node* key = environment()->Pop(); | 1863 Node* key = environment()->Pop(); |
| 1871 Node* receiver = environment()->Pop(); | 1864 Node* receiver = environment()->Pop(); |
| 1872 VectorSlotPair feedback = CreateVectorSlotPair( | 1865 BuildSetHomeObject(value, receiver, property); |
| 1873 expr->SlotForHomeObject(property->value(), &store_slot_index)); | |
| 1874 BuildSetHomeObject(value, receiver, property->value(), feedback); | |
| 1875 switch (property->kind()) { | 1866 switch (property->kind()) { |
| 1876 case ObjectLiteral::Property::CONSTANT: | 1867 case ObjectLiteral::Property::CONSTANT: |
| 1877 case ObjectLiteral::Property::COMPUTED: | 1868 case ObjectLiteral::Property::COMPUTED: |
| 1878 case ObjectLiteral::Property::MATERIALIZED_LITERAL: { | 1869 case ObjectLiteral::Property::MATERIALIZED_LITERAL: { |
| 1879 Node* attr = jsgraph()->Constant(NONE); | 1870 Node* attr = jsgraph()->Constant(NONE); |
| 1880 const Operator* op = | 1871 const Operator* op = |
| 1881 javascript()->CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4); | 1872 javascript()->CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4); |
| 1882 Node* call = NewNode(op, receiver, key, value, attr); | 1873 Node* call = NewNode(op, receiver, key, value, attr); |
| 1883 PrepareFrameState(call, BailoutId::None()); | 1874 PrepareFrameState(call, BailoutId::None()); |
| 1884 break; | 1875 break; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 1905 } | 1896 } |
| 1906 } | 1897 } |
| 1907 | 1898 |
| 1908 // Transform literals that contain functions to fast properties. | 1899 // Transform literals that contain functions to fast properties. |
| 1909 if (expr->has_function()) { | 1900 if (expr->has_function()) { |
| 1910 const Operator* op = | 1901 const Operator* op = |
| 1911 javascript()->CallRuntime(Runtime::kToFastProperties, 1); | 1902 javascript()->CallRuntime(Runtime::kToFastProperties, 1); |
| 1912 NewNode(op, literal); | 1903 NewNode(op, literal); |
| 1913 } | 1904 } |
| 1914 | 1905 |
| 1915 // Verify that compilation exactly consumed the number of store ic slots that | |
| 1916 // the ObjectLiteral node had to offer. | |
| 1917 DCHECK(!FLAG_vector_stores || store_slot_index == expr->slot_count()); | |
| 1918 | |
| 1919 ast_context()->ProduceValue(environment()->Pop()); | 1906 ast_context()->ProduceValue(environment()->Pop()); |
| 1920 } | 1907 } |
| 1921 | 1908 |
| 1922 | 1909 |
| 1923 void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { | 1910 void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
| 1924 Node* closure = GetFunctionClosure(); | 1911 Node* closure = GetFunctionClosure(); |
| 1925 | 1912 |
| 1926 // Create node to deep-copy the literal boilerplate. | 1913 // Create node to deep-copy the literal boilerplate. |
| 1927 expr->BuildConstantElements(isolate()); | 1914 expr->BuildConstantElements(isolate()); |
| 1928 Node* literals_array = | 1915 Node* literals_array = |
| (...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3806 | 3793 |
| 3807 | 3794 |
| 3808 Node* AstGraphBuilder::BuildToObject(Node* input, BailoutId bailout_id) { | 3795 Node* AstGraphBuilder::BuildToObject(Node* input, BailoutId bailout_id) { |
| 3809 Node* object = NewNode(javascript()->ToObject(), input); | 3796 Node* object = NewNode(javascript()->ToObject(), input); |
| 3810 PrepareFrameState(object, bailout_id, OutputFrameStateCombine::Push()); | 3797 PrepareFrameState(object, bailout_id, OutputFrameStateCombine::Push()); |
| 3811 return object; | 3798 return object; |
| 3812 } | 3799 } |
| 3813 | 3800 |
| 3814 | 3801 |
| 3815 Node* AstGraphBuilder::BuildSetHomeObject(Node* value, Node* home_object, | 3802 Node* AstGraphBuilder::BuildSetHomeObject(Node* value, Node* home_object, |
| 3816 Expression* expr, | 3803 ObjectLiteralProperty* property, |
| 3817 const VectorSlotPair& feedback) { | 3804 int slot_number) { |
| 3805 Expression* expr = property->value(); | |
| 3818 if (!FunctionLiteral::NeedsHomeObject(expr)) return value; | 3806 if (!FunctionLiteral::NeedsHomeObject(expr)) return value; |
| 3819 Handle<Name> name = isolate()->factory()->home_object_symbol(); | 3807 Handle<Name> name = isolate()->factory()->home_object_symbol(); |
| 3820 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 3808 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
| 3809 VectorSlotPair feedback = | |
| 3810 CreateVectorSlotPair(property->GetSlot(slot_number)); | |
| 3821 Node* store = BuildNamedStore(value, name, home_object, feedback, | 3811 Node* store = BuildNamedStore(value, name, home_object, feedback, |
| 3822 TypeFeedbackId::None()); | 3812 TypeFeedbackId::None()); |
| 3823 states.AddToNode(store, BailoutId::None(), OutputFrameStateCombine::Ignore()); | 3813 states.AddToNode(store, BailoutId::None(), OutputFrameStateCombine::Ignore()); |
| 3824 return store; | 3814 return store; |
| 3825 } | 3815 } |
| 3826 | 3816 |
| 3827 | 3817 |
| 3828 Node* AstGraphBuilder::BuildThrowError(Node* exception, BailoutId bailout_id) { | 3818 Node* AstGraphBuilder::BuildThrowError(Node* exception, BailoutId bailout_id) { |
| 3829 const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1); | 3819 const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1); |
| 3830 Node* call = NewNode(op, exception); | 3820 Node* call = NewNode(op, exception); |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4266 // Phi does not exist yet, introduce one. | 4256 // Phi does not exist yet, introduce one. |
| 4267 value = NewPhi(inputs, value, control); | 4257 value = NewPhi(inputs, value, control); |
| 4268 value->ReplaceInput(inputs - 1, other); | 4258 value->ReplaceInput(inputs - 1, other); |
| 4269 } | 4259 } |
| 4270 return value; | 4260 return value; |
| 4271 } | 4261 } |
| 4272 | 4262 |
| 4273 } // namespace compiler | 4263 } // namespace compiler |
| 4274 } // namespace internal | 4264 } // namespace internal |
| 4275 } // namespace v8 | 4265 } // namespace v8 |
| OLD | NEW |