| 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/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
| 9 #include "src/compiler/ast-loop-assignment-analyzer.h" | 9 #include "src/compiler/ast-loop-assignment-analyzer.h" |
| 10 #include "src/compiler/control-builders.h" | 10 #include "src/compiler/control-builders.h" |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 BuildRestArgumentsArray(rest_parameter, rest_index); | 582 BuildRestArgumentsArray(rest_parameter, rest_index); |
| 583 | 583 |
| 584 // Build assignment to {.this_function} variable if it is used. | 584 // Build assignment to {.this_function} variable if it is used. |
| 585 BuildThisFunctionVariable(scope->this_function_var()); | 585 BuildThisFunctionVariable(scope->this_function_var()); |
| 586 | 586 |
| 587 // Build assignment to {new.target} variable if it is used. | 587 // Build assignment to {new.target} variable if it is used. |
| 588 BuildNewTargetVariable(scope->new_target_var()); | 588 BuildNewTargetVariable(scope->new_target_var()); |
| 589 | 589 |
| 590 // Emit tracing call if requested to do so. | 590 // Emit tracing call if requested to do so. |
| 591 if (FLAG_trace) { | 591 if (FLAG_trace) { |
| 592 NewNode(javascript()->CallRuntime(Runtime::kTraceEnter, 0)); | 592 NewNode(javascript()->CallRuntime(Runtime::kTraceEnter)); |
| 593 } | 593 } |
| 594 | 594 |
| 595 // Visit illegal re-declaration and bail out if it exists. | 595 // Visit illegal re-declaration and bail out if it exists. |
| 596 if (scope->HasIllegalRedeclaration()) { | 596 if (scope->HasIllegalRedeclaration()) { |
| 597 VisitForEffect(scope->GetIllegalRedeclaration()); | 597 VisitForEffect(scope->GetIllegalRedeclaration()); |
| 598 return; | 598 return; |
| 599 } | 599 } |
| 600 | 600 |
| 601 // Visit declarations within the function scope. | 601 // Visit declarations within the function scope. |
| 602 VisitDeclarations(scope->declarations()); | 602 VisitDeclarations(scope->declarations()); |
| 603 | 603 |
| 604 // Build a stack-check before the body. | 604 // Build a stack-check before the body. |
| 605 if (stack_check) { | 605 if (stack_check) { |
| 606 Node* node = NewNode(javascript()->StackCheck()); | 606 Node* node = NewNode(javascript()->StackCheck()); |
| 607 PrepareFrameState(node, BailoutId::FunctionEntry()); | 607 PrepareFrameState(node, BailoutId::FunctionEntry()); |
| 608 } | 608 } |
| 609 | 609 |
| 610 // Visit statements in the function body. | 610 // Visit statements in the function body. |
| 611 VisitStatements(info()->literal()->body()); | 611 VisitStatements(info()->literal()->body()); |
| 612 | 612 |
| 613 // Emit tracing call if requested to do so. | 613 // Emit tracing call if requested to do so. |
| 614 if (FLAG_trace) { | 614 if (FLAG_trace) { |
| 615 // TODO(mstarzinger): Only traces implicit return. | 615 // TODO(mstarzinger): Only traces implicit return. |
| 616 Node* return_value = jsgraph()->UndefinedConstant(); | 616 Node* return_value = jsgraph()->UndefinedConstant(); |
| 617 NewNode(javascript()->CallRuntime(Runtime::kTraceExit, 1), return_value); | 617 NewNode(javascript()->CallRuntime(Runtime::kTraceExit), return_value); |
| 618 } | 618 } |
| 619 | 619 |
| 620 // Return 'undefined' in case we can fall off the end. | 620 // Return 'undefined' in case we can fall off the end. |
| 621 BuildReturn(jsgraph()->UndefinedConstant()); | 621 BuildReturn(jsgraph()->UndefinedConstant()); |
| 622 } | 622 } |
| 623 | 623 |
| 624 | 624 |
| 625 void AstGraphBuilder::ClearNonLiveSlotsInFrameStates() { | 625 void AstGraphBuilder::ClearNonLiveSlotsInFrameStates() { |
| 626 if (!FLAG_analyze_environment_liveness || | 626 if (!FLAG_analyze_environment_liveness || |
| 627 !info()->is_deoptimization_enabled()) { | 627 !info()->is_deoptimization_enabled()) { |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1515 // Dynamic dispatch after the finally-block. | 1515 // Dynamic dispatch after the finally-block. |
| 1516 commands->ApplyDeferredCommands(token, result); | 1516 commands->ApplyDeferredCommands(token, result); |
| 1517 | 1517 |
| 1518 // TODO(mstarzinger): Remove bailout once everything works. | 1518 // TODO(mstarzinger): Remove bailout once everything works. |
| 1519 if (!FLAG_turbo_try_finally) SetStackOverflow(); | 1519 if (!FLAG_turbo_try_finally) SetStackOverflow(); |
| 1520 } | 1520 } |
| 1521 | 1521 |
| 1522 | 1522 |
| 1523 void AstGraphBuilder::VisitDebuggerStatement(DebuggerStatement* stmt) { | 1523 void AstGraphBuilder::VisitDebuggerStatement(DebuggerStatement* stmt) { |
| 1524 Node* node = | 1524 Node* node = |
| 1525 NewNode(javascript()->CallRuntime(Runtime::kHandleDebuggerStatement, 0)); | 1525 NewNode(javascript()->CallRuntime(Runtime::kHandleDebuggerStatement)); |
| 1526 PrepareFrameState(node, stmt->DebugBreakId()); | 1526 PrepareFrameState(node, stmt->DebugBreakId()); |
| 1527 environment()->MarkAllLocalsLive(); | 1527 environment()->MarkAllLocalsLive(); |
| 1528 } | 1528 } |
| 1529 | 1529 |
| 1530 | 1530 |
| 1531 void AstGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { | 1531 void AstGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { |
| 1532 // Find or build a shared function info. | 1532 // Find or build a shared function info. |
| 1533 Handle<SharedFunctionInfo> shared_info = | 1533 Handle<SharedFunctionInfo> shared_info = |
| 1534 Compiler::GetSharedFunctionInfo(expr, info()->script(), info()); | 1534 Compiler::GetSharedFunctionInfo(expr, info()->script(), info()); |
| 1535 CHECK(!shared_info.is_null()); // TODO(mstarzinger): Set stack overflow? | 1535 CHECK(!shared_info.is_null()); // TODO(mstarzinger): Set stack overflow? |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1564 environment()->Push(class_name); | 1564 environment()->Push(class_name); |
| 1565 VisitForValueOrTheHole(expr->extends()); | 1565 VisitForValueOrTheHole(expr->extends()); |
| 1566 VisitForValue(expr->constructor()); | 1566 VisitForValue(expr->constructor()); |
| 1567 | 1567 |
| 1568 // Create node to instantiate a new class. | 1568 // Create node to instantiate a new class. |
| 1569 Node* constructor = environment()->Pop(); | 1569 Node* constructor = environment()->Pop(); |
| 1570 Node* extends = environment()->Pop(); | 1570 Node* extends = environment()->Pop(); |
| 1571 Node* name = environment()->Pop(); | 1571 Node* name = environment()->Pop(); |
| 1572 Node* start = jsgraph()->Constant(expr->start_position()); | 1572 Node* start = jsgraph()->Constant(expr->start_position()); |
| 1573 Node* end = jsgraph()->Constant(expr->end_position()); | 1573 Node* end = jsgraph()->Constant(expr->end_position()); |
| 1574 const Operator* opc = javascript()->CallRuntime(Runtime::kDefineClass, 5); | 1574 const Operator* opc = javascript()->CallRuntime(Runtime::kDefineClass); |
| 1575 Node* literal = NewNode(opc, name, extends, constructor, start, end); | 1575 Node* literal = NewNode(opc, name, extends, constructor, start, end); |
| 1576 PrepareFrameState(literal, expr->CreateLiteralId(), | 1576 PrepareFrameState(literal, expr->CreateLiteralId(), |
| 1577 OutputFrameStateCombine::Push()); | 1577 OutputFrameStateCombine::Push()); |
| 1578 | 1578 |
| 1579 // The prototype is ensured to exist by Runtime_DefineClass. No access check | 1579 // The prototype is ensured to exist by Runtime_DefineClass. No access check |
| 1580 // is needed here since the constructor is created by the class literal. | 1580 // is needed here since the constructor is created by the class literal. |
| 1581 Node* prototype = | 1581 Node* prototype = |
| 1582 BuildLoadObjectField(literal, JSFunction::kPrototypeOrInitialMapOffset); | 1582 BuildLoadObjectField(literal, JSFunction::kPrototypeOrInitialMapOffset); |
| 1583 | 1583 |
| 1584 // The class literal and the prototype are both expected on the operand stack | 1584 // The class literal and the prototype are both expected on the operand stack |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1612 | 1612 |
| 1613 BuildSetHomeObject(value, receiver, property); | 1613 BuildSetHomeObject(value, receiver, property); |
| 1614 | 1614 |
| 1615 switch (property->kind()) { | 1615 switch (property->kind()) { |
| 1616 case ObjectLiteral::Property::CONSTANT: | 1616 case ObjectLiteral::Property::CONSTANT: |
| 1617 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 1617 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
| 1618 case ObjectLiteral::Property::PROTOTYPE: | 1618 case ObjectLiteral::Property::PROTOTYPE: |
| 1619 UNREACHABLE(); | 1619 UNREACHABLE(); |
| 1620 case ObjectLiteral::Property::COMPUTED: { | 1620 case ObjectLiteral::Property::COMPUTED: { |
| 1621 const Operator* op = | 1621 const Operator* op = |
| 1622 javascript()->CallRuntime(Runtime::kDefineClassMethod, 3); | 1622 javascript()->CallRuntime(Runtime::kDefineClassMethod); |
| 1623 NewNode(op, receiver, key, value); | 1623 NewNode(op, receiver, key, value); |
| 1624 break; | 1624 break; |
| 1625 } | 1625 } |
| 1626 case ObjectLiteral::Property::GETTER: { | 1626 case ObjectLiteral::Property::GETTER: { |
| 1627 Node* attr = jsgraph()->Constant(DONT_ENUM); | 1627 Node* attr = jsgraph()->Constant(DONT_ENUM); |
| 1628 const Operator* op = javascript()->CallRuntime( | 1628 const Operator* op = javascript()->CallRuntime( |
| 1629 Runtime::kDefineGetterPropertyUnchecked, 4); | 1629 Runtime::kDefineGetterPropertyUnchecked, 4); |
| 1630 NewNode(op, receiver, key, value, attr); | 1630 NewNode(op, receiver, key, value, attr); |
| 1631 break; | 1631 break; |
| 1632 } | 1632 } |
| 1633 case ObjectLiteral::Property::SETTER: { | 1633 case ObjectLiteral::Property::SETTER: { |
| 1634 Node* attr = jsgraph()->Constant(DONT_ENUM); | 1634 Node* attr = jsgraph()->Constant(DONT_ENUM); |
| 1635 const Operator* op = javascript()->CallRuntime( | 1635 const Operator* op = javascript()->CallRuntime( |
| 1636 Runtime::kDefineSetterPropertyUnchecked, 4); | 1636 Runtime::kDefineSetterPropertyUnchecked, 4); |
| 1637 NewNode(op, receiver, key, value, attr); | 1637 NewNode(op, receiver, key, value, attr); |
| 1638 break; | 1638 break; |
| 1639 } | 1639 } |
| 1640 } | 1640 } |
| 1641 } | 1641 } |
| 1642 | 1642 |
| 1643 // Set both the prototype and constructor to have fast properties, and also | 1643 // Set both the prototype and constructor to have fast properties, and also |
| 1644 // freeze them in strong mode. | 1644 // freeze them in strong mode. |
| 1645 prototype = environment()->Pop(); | 1645 prototype = environment()->Pop(); |
| 1646 literal = environment()->Pop(); | 1646 literal = environment()->Pop(); |
| 1647 const Operator* op = | 1647 const Operator* op = |
| 1648 javascript()->CallRuntime(Runtime::kFinalizeClassDefinition, 2); | 1648 javascript()->CallRuntime(Runtime::kFinalizeClassDefinition); |
| 1649 literal = NewNode(op, literal, prototype); | 1649 literal = NewNode(op, literal, prototype); |
| 1650 | 1650 |
| 1651 // Assign to class variable. | 1651 // Assign to class variable. |
| 1652 if (expr->class_variable_proxy() != nullptr) { | 1652 if (expr->class_variable_proxy() != nullptr) { |
| 1653 Variable* var = expr->class_variable_proxy()->var(); | 1653 Variable* var = expr->class_variable_proxy()->var(); |
| 1654 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 1654 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
| 1655 VectorSlotPair feedback = CreateVectorSlotPair( | 1655 VectorSlotPair feedback = CreateVectorSlotPair( |
| 1656 expr->NeedsProxySlot() ? expr->ProxySlot() | 1656 expr->NeedsProxySlot() ? expr->ProxySlot() |
| 1657 : FeedbackVectorSlot::Invalid()); | 1657 : FeedbackVectorSlot::Invalid()); |
| 1658 BuildVariableAssignment(var, literal, Token::INIT, feedback, | 1658 BuildVariableAssignment(var, literal, Token::INIT, feedback, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1767 break; | 1767 break; |
| 1768 } | 1768 } |
| 1769 environment()->Push(environment()->Top()); // Duplicate receiver. | 1769 environment()->Push(environment()->Top()); // Duplicate receiver. |
| 1770 VisitForValue(property->key()); | 1770 VisitForValue(property->key()); |
| 1771 VisitForValue(property->value()); | 1771 VisitForValue(property->value()); |
| 1772 Node* value = environment()->Pop(); | 1772 Node* value = environment()->Pop(); |
| 1773 Node* key = environment()->Pop(); | 1773 Node* key = environment()->Pop(); |
| 1774 Node* receiver = environment()->Pop(); | 1774 Node* receiver = environment()->Pop(); |
| 1775 if (property->emit_store()) { | 1775 if (property->emit_store()) { |
| 1776 Node* language = jsgraph()->Constant(SLOPPY); | 1776 Node* language = jsgraph()->Constant(SLOPPY); |
| 1777 const Operator* op = | 1777 const Operator* op = javascript()->CallRuntime(Runtime::kSetProperty); |
| 1778 javascript()->CallRuntime(Runtime::kSetProperty, 4); | |
| 1779 Node* set_property = NewNode(op, receiver, key, value, language); | 1778 Node* set_property = NewNode(op, receiver, key, value, language); |
| 1780 // SetProperty should not lazy deopt on an object literal. | 1779 // SetProperty should not lazy deopt on an object literal. |
| 1781 PrepareFrameState(set_property, BailoutId::None()); | 1780 PrepareFrameState(set_property, BailoutId::None()); |
| 1782 BuildSetHomeObject(value, receiver, property); | 1781 BuildSetHomeObject(value, receiver, property); |
| 1783 } | 1782 } |
| 1784 break; | 1783 break; |
| 1785 } | 1784 } |
| 1786 case ObjectLiteral::Property::PROTOTYPE: { | 1785 case ObjectLiteral::Property::PROTOTYPE: { |
| 1787 environment()->Push(environment()->Top()); // Duplicate receiver. | 1786 environment()->Push(environment()->Top()); // Duplicate receiver. |
| 1788 VisitForValue(property->value()); | 1787 VisitForValue(property->value()); |
| 1789 Node* value = environment()->Pop(); | 1788 Node* value = environment()->Pop(); |
| 1790 Node* receiver = environment()->Pop(); | 1789 Node* receiver = environment()->Pop(); |
| 1791 DCHECK(property->emit_store()); | 1790 DCHECK(property->emit_store()); |
| 1792 const Operator* op = | 1791 const Operator* op = |
| 1793 javascript()->CallRuntime(Runtime::kInternalSetPrototype, 2); | 1792 javascript()->CallRuntime(Runtime::kInternalSetPrototype); |
| 1794 Node* set_prototype = NewNode(op, receiver, value); | 1793 Node* set_prototype = NewNode(op, receiver, value); |
| 1795 // SetPrototype should not lazy deopt on an object literal. | 1794 // SetPrototype should not lazy deopt on an object literal. |
| 1796 PrepareFrameState(set_prototype, | 1795 PrepareFrameState(set_prototype, |
| 1797 expr->GetIdForPropertySet(property_index)); | 1796 expr->GetIdForPropertySet(property_index)); |
| 1798 break; | 1797 break; |
| 1799 } | 1798 } |
| 1800 case ObjectLiteral::Property::GETTER: | 1799 case ObjectLiteral::Property::GETTER: |
| 1801 if (property->emit_store()) { | 1800 if (property->emit_store()) { |
| 1802 accessor_table.lookup(key)->second->getter = property; | 1801 accessor_table.lookup(key)->second->getter = property; |
| 1803 } | 1802 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1816 for (AccessorTable::Iterator it = accessor_table.begin(); | 1815 for (AccessorTable::Iterator it = accessor_table.begin(); |
| 1817 it != accessor_table.end(); ++it) { | 1816 it != accessor_table.end(); ++it) { |
| 1818 VisitForValue(it->first); | 1817 VisitForValue(it->first); |
| 1819 VisitObjectLiteralAccessor(literal, it->second->getter); | 1818 VisitObjectLiteralAccessor(literal, it->second->getter); |
| 1820 VisitObjectLiteralAccessor(literal, it->second->setter); | 1819 VisitObjectLiteralAccessor(literal, it->second->setter); |
| 1821 Node* setter = environment()->Pop(); | 1820 Node* setter = environment()->Pop(); |
| 1822 Node* getter = environment()->Pop(); | 1821 Node* getter = environment()->Pop(); |
| 1823 Node* name = environment()->Pop(); | 1822 Node* name = environment()->Pop(); |
| 1824 Node* attr = jsgraph()->Constant(NONE); | 1823 Node* attr = jsgraph()->Constant(NONE); |
| 1825 const Operator* op = | 1824 const Operator* op = |
| 1826 javascript()->CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); | 1825 javascript()->CallRuntime(Runtime::kDefineAccessorPropertyUnchecked); |
| 1827 Node* call = NewNode(op, literal, name, getter, setter, attr); | 1826 Node* call = NewNode(op, literal, name, getter, setter, attr); |
| 1828 // This should not lazy deopt on a new literal. | 1827 // This should not lazy deopt on a new literal. |
| 1829 PrepareFrameState(call, BailoutId::None()); | 1828 PrepareFrameState(call, BailoutId::None()); |
| 1830 } | 1829 } |
| 1831 | 1830 |
| 1832 // Object literals have two parts. The "static" part on the left contains no | 1831 // Object literals have two parts. The "static" part on the left contains no |
| 1833 // computed property names, and so we can compute its map ahead of time; see | 1832 // computed property names, and so we can compute its map ahead of time; see |
| 1834 // Runtime_CreateObjectLiteralBoilerplate. The second "dynamic" part starts | 1833 // Runtime_CreateObjectLiteralBoilerplate. The second "dynamic" part starts |
| 1835 // with the first computed property name and continues with all properties to | 1834 // with the first computed property name and continues with all properties to |
| 1836 // its right. All the code from above initializes the static component of the | 1835 // its right. All the code from above initializes the static component of the |
| 1837 // object literal, and arranges for the map of the result to reflect the | 1836 // object literal, and arranges for the map of the result to reflect the |
| 1838 // static order in which the keys appear. For the dynamic properties, we | 1837 // static order in which the keys appear. For the dynamic properties, we |
| 1839 // compile them into a series of "SetOwnProperty" runtime calls. This will | 1838 // compile them into a series of "SetOwnProperty" runtime calls. This will |
| 1840 // preserve insertion order. | 1839 // preserve insertion order. |
| 1841 for (; property_index < expr->properties()->length(); property_index++) { | 1840 for (; property_index < expr->properties()->length(); property_index++) { |
| 1842 ObjectLiteral::Property* property = expr->properties()->at(property_index); | 1841 ObjectLiteral::Property* property = expr->properties()->at(property_index); |
| 1843 | 1842 |
| 1844 if (property->kind() == ObjectLiteral::Property::PROTOTYPE) { | 1843 if (property->kind() == ObjectLiteral::Property::PROTOTYPE) { |
| 1845 environment()->Push(environment()->Top()); // Duplicate receiver. | 1844 environment()->Push(environment()->Top()); // Duplicate receiver. |
| 1846 VisitForValue(property->value()); | 1845 VisitForValue(property->value()); |
| 1847 Node* value = environment()->Pop(); | 1846 Node* value = environment()->Pop(); |
| 1848 Node* receiver = environment()->Pop(); | 1847 Node* receiver = environment()->Pop(); |
| 1849 const Operator* op = | 1848 const Operator* op = |
| 1850 javascript()->CallRuntime(Runtime::kInternalSetPrototype, 2); | 1849 javascript()->CallRuntime(Runtime::kInternalSetPrototype); |
| 1851 Node* call = NewNode(op, receiver, value); | 1850 Node* call = NewNode(op, receiver, value); |
| 1852 PrepareFrameState(call, expr->GetIdForPropertySet(property_index)); | 1851 PrepareFrameState(call, expr->GetIdForPropertySet(property_index)); |
| 1853 continue; | 1852 continue; |
| 1854 } | 1853 } |
| 1855 | 1854 |
| 1856 environment()->Push(environment()->Top()); // Duplicate receiver. | 1855 environment()->Push(environment()->Top()); // Duplicate receiver. |
| 1857 VisitForValue(property->key()); | 1856 VisitForValue(property->key()); |
| 1858 Node* name = BuildToName(environment()->Pop(), | 1857 Node* name = BuildToName(environment()->Pop(), |
| 1859 expr->GetIdForPropertyName(property_index)); | 1858 expr->GetIdForPropertyName(property_index)); |
| 1860 environment()->Push(name); | 1859 environment()->Push(name); |
| 1861 VisitForValue(property->value()); | 1860 VisitForValue(property->value()); |
| 1862 Node* value = environment()->Pop(); | 1861 Node* value = environment()->Pop(); |
| 1863 Node* key = environment()->Pop(); | 1862 Node* key = environment()->Pop(); |
| 1864 Node* receiver = environment()->Pop(); | 1863 Node* receiver = environment()->Pop(); |
| 1865 BuildSetHomeObject(value, receiver, property); | 1864 BuildSetHomeObject(value, receiver, property); |
| 1866 switch (property->kind()) { | 1865 switch (property->kind()) { |
| 1867 case ObjectLiteral::Property::CONSTANT: | 1866 case ObjectLiteral::Property::CONSTANT: |
| 1868 case ObjectLiteral::Property::COMPUTED: | 1867 case ObjectLiteral::Property::COMPUTED: |
| 1869 case ObjectLiteral::Property::MATERIALIZED_LITERAL: { | 1868 case ObjectLiteral::Property::MATERIALIZED_LITERAL: { |
| 1870 Node* attr = jsgraph()->Constant(NONE); | 1869 Node* attr = jsgraph()->Constant(NONE); |
| 1871 const Operator* op = | 1870 const Operator* op = |
| 1872 javascript()->CallRuntime(Runtime::kDefineDataPropertyUnchecked, 4); | 1871 javascript()->CallRuntime(Runtime::kDefineDataPropertyUnchecked); |
| 1873 Node* call = NewNode(op, receiver, key, value, attr); | 1872 Node* call = NewNode(op, receiver, key, value, attr); |
| 1874 PrepareFrameState(call, BailoutId::None()); | 1873 PrepareFrameState(call, BailoutId::None()); |
| 1875 break; | 1874 break; |
| 1876 } | 1875 } |
| 1877 case ObjectLiteral::Property::PROTOTYPE: | 1876 case ObjectLiteral::Property::PROTOTYPE: |
| 1878 UNREACHABLE(); // Handled specially above. | 1877 UNREACHABLE(); // Handled specially above. |
| 1879 break; | 1878 break; |
| 1880 case ObjectLiteral::Property::GETTER: { | 1879 case ObjectLiteral::Property::GETTER: { |
| 1881 Node* attr = jsgraph()->Constant(NONE); | 1880 Node* attr = jsgraph()->Constant(NONE); |
| 1882 const Operator* op = javascript()->CallRuntime( | 1881 const Operator* op = javascript()->CallRuntime( |
| 1883 Runtime::kDefineGetterPropertyUnchecked, 4); | 1882 Runtime::kDefineGetterPropertyUnchecked, 4); |
| 1884 Node* call = NewNode(op, receiver, key, value, attr); | 1883 Node* call = NewNode(op, receiver, key, value, attr); |
| 1885 PrepareFrameState(call, BailoutId::None()); | 1884 PrepareFrameState(call, BailoutId::None()); |
| 1886 break; | 1885 break; |
| 1887 } | 1886 } |
| 1888 case ObjectLiteral::Property::SETTER: { | 1887 case ObjectLiteral::Property::SETTER: { |
| 1889 Node* attr = jsgraph()->Constant(NONE); | 1888 Node* attr = jsgraph()->Constant(NONE); |
| 1890 const Operator* op = javascript()->CallRuntime( | 1889 const Operator* op = javascript()->CallRuntime( |
| 1891 Runtime::kDefineSetterPropertyUnchecked, 4); | 1890 Runtime::kDefineSetterPropertyUnchecked, 4); |
| 1892 Node* call = NewNode(op, receiver, key, value, attr); | 1891 Node* call = NewNode(op, receiver, key, value, attr); |
| 1893 PrepareFrameState(call, BailoutId::None()); | 1892 PrepareFrameState(call, BailoutId::None()); |
| 1894 break; | 1893 break; |
| 1895 } | 1894 } |
| 1896 } | 1895 } |
| 1897 } | 1896 } |
| 1898 | 1897 |
| 1899 // Transform literals that contain functions to fast properties. | 1898 // Transform literals that contain functions to fast properties. |
| 1900 literal = environment()->Top(); // Reload from operand stack. | 1899 literal = environment()->Top(); // Reload from operand stack. |
| 1901 if (expr->has_function()) { | 1900 if (expr->has_function()) { |
| 1902 const Operator* op = | 1901 const Operator* op = javascript()->CallRuntime(Runtime::kToFastProperties); |
| 1903 javascript()->CallRuntime(Runtime::kToFastProperties, 1); | |
| 1904 NewNode(op, literal); | 1902 NewNode(op, literal); |
| 1905 } | 1903 } |
| 1906 | 1904 |
| 1907 ast_context()->ProduceValue(environment()->Pop()); | 1905 ast_context()->ProduceValue(environment()->Pop()); |
| 1908 } | 1906 } |
| 1909 | 1907 |
| 1910 | 1908 |
| 1911 void AstGraphBuilder::VisitObjectLiteralAccessor( | 1909 void AstGraphBuilder::VisitObjectLiteralAccessor( |
| 1912 Node* home_object, ObjectLiteralProperty* property) { | 1910 Node* home_object, ObjectLiteralProperty* property) { |
| 1913 if (property == nullptr) { | 1911 if (property == nullptr) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1972 Node* array = environment()->Pop(); | 1970 Node* array = environment()->Pop(); |
| 1973 Node* function = BuildLoadNativeContextField( | 1971 Node* function = BuildLoadNativeContextField( |
| 1974 Context::CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX); | 1972 Context::CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX); |
| 1975 result = NewNode(javascript()->CallFunction(3, language_mode()), function, | 1973 result = NewNode(javascript()->CallFunction(3, language_mode()), function, |
| 1976 array, iterable); | 1974 array, iterable); |
| 1977 states.AddToNode(result, expr->GetIdForElement(array_index)); | 1975 states.AddToNode(result, expr->GetIdForElement(array_index)); |
| 1978 } else { | 1976 } else { |
| 1979 VisitForValue(subexpr); | 1977 VisitForValue(subexpr); |
| 1980 Node* value = environment()->Pop(); | 1978 Node* value = environment()->Pop(); |
| 1981 Node* array = environment()->Pop(); | 1979 Node* array = environment()->Pop(); |
| 1982 const Operator* op = | 1980 const Operator* op = javascript()->CallRuntime(Runtime::kAppendElement); |
| 1983 javascript()->CallRuntime(Runtime::kAppendElement, 2); | |
| 1984 result = NewNode(op, array, value); | 1981 result = NewNode(op, array, value); |
| 1985 PrepareFrameState(result, expr->GetIdForElement(array_index)); | 1982 PrepareFrameState(result, expr->GetIdForElement(array_index)); |
| 1986 } | 1983 } |
| 1987 | 1984 |
| 1988 environment()->Push(result); | 1985 environment()->Push(result); |
| 1989 } | 1986 } |
| 1990 | 1987 |
| 1991 ast_context()->ProduceValue(environment()->Pop()); | 1988 ast_context()->ProduceValue(environment()->Pop()); |
| 1992 } | 1989 } |
| 1993 | 1990 |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2335 BuildVariableLoad(proxy->var(), expr->expression()->id(), states, | 2332 BuildVariableLoad(proxy->var(), expr->expression()->id(), states, |
| 2336 pair, OutputFrameStateCombine::Push()); | 2333 pair, OutputFrameStateCombine::Push()); |
| 2337 receiver_hint = ConvertReceiverMode::kNullOrUndefined; | 2334 receiver_hint = ConvertReceiverMode::kNullOrUndefined; |
| 2338 receiver_value = jsgraph()->UndefinedConstant(); | 2335 receiver_value = jsgraph()->UndefinedConstant(); |
| 2339 break; | 2336 break; |
| 2340 } | 2337 } |
| 2341 case Call::LOOKUP_SLOT_CALL: { | 2338 case Call::LOOKUP_SLOT_CALL: { |
| 2342 Variable* variable = callee->AsVariableProxy()->var(); | 2339 Variable* variable = callee->AsVariableProxy()->var(); |
| 2343 DCHECK(variable->location() == VariableLocation::LOOKUP); | 2340 DCHECK(variable->location() == VariableLocation::LOOKUP); |
| 2344 Node* name = jsgraph()->Constant(variable->name()); | 2341 Node* name = jsgraph()->Constant(variable->name()); |
| 2345 const Operator* op = | 2342 const Operator* op = javascript()->CallRuntime(Runtime::kLoadLookupSlot); |
| 2346 javascript()->CallRuntime(Runtime::kLoadLookupSlot, 2); | |
| 2347 Node* pair = NewNode(op, current_context(), name); | 2343 Node* pair = NewNode(op, current_context(), name); |
| 2348 callee_value = NewNode(common()->Projection(0), pair); | 2344 callee_value = NewNode(common()->Projection(0), pair); |
| 2349 receiver_value = NewNode(common()->Projection(1), pair); | 2345 receiver_value = NewNode(common()->Projection(1), pair); |
| 2350 PrepareFrameState(pair, expr->LookupId(), | 2346 PrepareFrameState(pair, expr->LookupId(), |
| 2351 OutputFrameStateCombine::Push(2)); | 2347 OutputFrameStateCombine::Push(2)); |
| 2352 break; | 2348 break; |
| 2353 } | 2349 } |
| 2354 case Call::NAMED_PROPERTY_CALL: { | 2350 case Call::NAMED_PROPERTY_CALL: { |
| 2355 Property* property = callee->AsProperty(); | 2351 Property* property = callee->AsProperty(); |
| 2356 VectorSlotPair feedback = | 2352 VectorSlotPair feedback = |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2432 break; | 2428 break; |
| 2433 } | 2429 } |
| 2434 case Call::SUPER_CALL: | 2430 case Call::SUPER_CALL: |
| 2435 return VisitCallSuper(expr); | 2431 return VisitCallSuper(expr); |
| 2436 case Call::POSSIBLY_EVAL_CALL: | 2432 case Call::POSSIBLY_EVAL_CALL: |
| 2437 possibly_eval = true; | 2433 possibly_eval = true; |
| 2438 if (callee->AsVariableProxy()->var()->IsLookupSlot()) { | 2434 if (callee->AsVariableProxy()->var()->IsLookupSlot()) { |
| 2439 Variable* variable = callee->AsVariableProxy()->var(); | 2435 Variable* variable = callee->AsVariableProxy()->var(); |
| 2440 Node* name = jsgraph()->Constant(variable->name()); | 2436 Node* name = jsgraph()->Constant(variable->name()); |
| 2441 const Operator* op = | 2437 const Operator* op = |
| 2442 javascript()->CallRuntime(Runtime::kLoadLookupSlot, 2); | 2438 javascript()->CallRuntime(Runtime::kLoadLookupSlot); |
| 2443 Node* pair = NewNode(op, current_context(), name); | 2439 Node* pair = NewNode(op, current_context(), name); |
| 2444 callee_value = NewNode(common()->Projection(0), pair); | 2440 callee_value = NewNode(common()->Projection(0), pair); |
| 2445 receiver_value = NewNode(common()->Projection(1), pair); | 2441 receiver_value = NewNode(common()->Projection(1), pair); |
| 2446 PrepareFrameState(pair, expr->LookupId(), | 2442 PrepareFrameState(pair, expr->LookupId(), |
| 2447 OutputFrameStateCombine::Push(2)); | 2443 OutputFrameStateCombine::Push(2)); |
| 2448 break; | 2444 break; |
| 2449 } | 2445 } |
| 2450 // Fall through. | 2446 // Fall through. |
| 2451 case Call::OTHER_CALL: | 2447 case Call::OTHER_CALL: |
| 2452 VisitForValue(callee); | 2448 VisitForValue(callee); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2473 // Extract callee and source string from the environment. | 2469 // Extract callee and source string from the environment. |
| 2474 Node* callee = environment()->Peek(arg_count + 1); | 2470 Node* callee = environment()->Peek(arg_count + 1); |
| 2475 Node* source = environment()->Peek(arg_count - 1); | 2471 Node* source = environment()->Peek(arg_count - 1); |
| 2476 | 2472 |
| 2477 // Create node to ask for help resolving potential eval call. This will | 2473 // Create node to ask for help resolving potential eval call. This will |
| 2478 // provide a fully resolved callee to patch into the environment. | 2474 // provide a fully resolved callee to patch into the environment. |
| 2479 Node* function = GetFunctionClosure(); | 2475 Node* function = GetFunctionClosure(); |
| 2480 Node* language = jsgraph()->Constant(language_mode()); | 2476 Node* language = jsgraph()->Constant(language_mode()); |
| 2481 Node* position = jsgraph()->Constant(current_scope()->start_position()); | 2477 Node* position = jsgraph()->Constant(current_scope()->start_position()); |
| 2482 const Operator* op = | 2478 const Operator* op = |
| 2483 javascript()->CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); | 2479 javascript()->CallRuntime(Runtime::kResolvePossiblyDirectEval); |
| 2484 Node* new_callee = | 2480 Node* new_callee = |
| 2485 NewNode(op, callee, source, function, language, position); | 2481 NewNode(op, callee, source, function, language, position); |
| 2486 PrepareFrameState(new_callee, expr->EvalId(), | 2482 PrepareFrameState(new_callee, expr->EvalId(), |
| 2487 OutputFrameStateCombine::PokeAt(arg_count + 1)); | 2483 OutputFrameStateCombine::PokeAt(arg_count + 1)); |
| 2488 | 2484 |
| 2489 // Patch callee on the environment. | 2485 // Patch callee on the environment. |
| 2490 environment()->Poke(arg_count + 1, new_callee); | 2486 environment()->Poke(arg_count + 1, new_callee); |
| 2491 } | 2487 } |
| 2492 | 2488 |
| 2493 // Create node to perform the function call. | 2489 // Create node to perform the function call. |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2923 if (globals()->empty()) return; | 2919 if (globals()->empty()) return; |
| 2924 int array_index = 0; | 2920 int array_index = 0; |
| 2925 Handle<FixedArray> data = isolate()->factory()->NewFixedArray( | 2921 Handle<FixedArray> data = isolate()->factory()->NewFixedArray( |
| 2926 static_cast<int>(globals()->size()), TENURED); | 2922 static_cast<int>(globals()->size()), TENURED); |
| 2927 for (Handle<Object> obj : *globals()) data->set(array_index++, *obj); | 2923 for (Handle<Object> obj : *globals()) data->set(array_index++, *obj); |
| 2928 int encoded_flags = DeclareGlobalsEvalFlag::encode(info()->is_eval()) | | 2924 int encoded_flags = DeclareGlobalsEvalFlag::encode(info()->is_eval()) | |
| 2929 DeclareGlobalsNativeFlag::encode(info()->is_native()) | | 2925 DeclareGlobalsNativeFlag::encode(info()->is_native()) | |
| 2930 DeclareGlobalsLanguageMode::encode(language_mode()); | 2926 DeclareGlobalsLanguageMode::encode(language_mode()); |
| 2931 Node* flags = jsgraph()->Constant(encoded_flags); | 2927 Node* flags = jsgraph()->Constant(encoded_flags); |
| 2932 Node* pairs = jsgraph()->Constant(data); | 2928 Node* pairs = jsgraph()->Constant(data); |
| 2933 const Operator* op = javascript()->CallRuntime(Runtime::kDeclareGlobals, 2); | 2929 const Operator* op = javascript()->CallRuntime(Runtime::kDeclareGlobals); |
| 2934 Node* call = NewNode(op, pairs, flags); | 2930 Node* call = NewNode(op, pairs, flags); |
| 2935 PrepareFrameState(call, BailoutId::Declarations()); | 2931 PrepareFrameState(call, BailoutId::Declarations()); |
| 2936 globals()->clear(); | 2932 globals()->clear(); |
| 2937 } | 2933 } |
| 2938 | 2934 |
| 2939 | 2935 |
| 2940 void AstGraphBuilder::VisitIfNotNull(Statement* stmt) { | 2936 void AstGraphBuilder::VisitIfNotNull(Statement* stmt) { |
| 2941 if (stmt == nullptr) return; | 2937 if (stmt == nullptr) return; |
| 2942 Visit(stmt); | 2938 Visit(stmt); |
| 2943 } | 2939 } |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3433 case VariableLocation::PARAMETER: | 3429 case VariableLocation::PARAMETER: |
| 3434 case VariableLocation::LOCAL: | 3430 case VariableLocation::LOCAL: |
| 3435 case VariableLocation::CONTEXT: { | 3431 case VariableLocation::CONTEXT: { |
| 3436 // Local var, const, or let variable or context variable. | 3432 // Local var, const, or let variable or context variable. |
| 3437 return jsgraph()->BooleanConstant(variable->HasThisName(isolate())); | 3433 return jsgraph()->BooleanConstant(variable->HasThisName(isolate())); |
| 3438 } | 3434 } |
| 3439 case VariableLocation::LOOKUP: { | 3435 case VariableLocation::LOOKUP: { |
| 3440 // Dynamic lookup of context variable (anywhere in the chain). | 3436 // Dynamic lookup of context variable (anywhere in the chain). |
| 3441 Node* name = jsgraph()->Constant(variable->name()); | 3437 Node* name = jsgraph()->Constant(variable->name()); |
| 3442 const Operator* op = | 3438 const Operator* op = |
| 3443 javascript()->CallRuntime(Runtime::kDeleteLookupSlot, 2); | 3439 javascript()->CallRuntime(Runtime::kDeleteLookupSlot); |
| 3444 Node* result = NewNode(op, current_context(), name); | 3440 Node* result = NewNode(op, current_context(), name); |
| 3445 PrepareFrameState(result, bailout_id, combine); | 3441 PrepareFrameState(result, bailout_id, combine); |
| 3446 return result; | 3442 return result; |
| 3447 } | 3443 } |
| 3448 } | 3444 } |
| 3449 UNREACHABLE(); | 3445 UNREACHABLE(); |
| 3450 return nullptr; | 3446 return nullptr; |
| 3451 } | 3447 } |
| 3452 | 3448 |
| 3453 | 3449 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3560 } | 3556 } |
| 3561 const Operator* op = javascript()->StoreContext(depth, variable->index()); | 3557 const Operator* op = javascript()->StoreContext(depth, variable->index()); |
| 3562 return NewNode(op, current_context(), value); | 3558 return NewNode(op, current_context(), value); |
| 3563 } | 3559 } |
| 3564 case VariableLocation::LOOKUP: { | 3560 case VariableLocation::LOOKUP: { |
| 3565 // Dynamic lookup of context variable (anywhere in the chain). | 3561 // Dynamic lookup of context variable (anywhere in the chain). |
| 3566 Node* name = jsgraph()->Constant(variable->name()); | 3562 Node* name = jsgraph()->Constant(variable->name()); |
| 3567 Node* language = jsgraph()->Constant(language_mode()); | 3563 Node* language = jsgraph()->Constant(language_mode()); |
| 3568 // TODO(mstarzinger): Use Runtime::kInitializeLegacyConstLookupSlot for | 3564 // TODO(mstarzinger): Use Runtime::kInitializeLegacyConstLookupSlot for |
| 3569 // initializations of const declarations. | 3565 // initializations of const declarations. |
| 3570 const Operator* op = | 3566 const Operator* op = javascript()->CallRuntime(Runtime::kStoreLookupSlot); |
| 3571 javascript()->CallRuntime(Runtime::kStoreLookupSlot, 4); | |
| 3572 Node* store = NewNode(op, value, current_context(), name, language); | 3567 Node* store = NewNode(op, value, current_context(), name, language); |
| 3573 PrepareFrameState(store, bailout_id, combine); | 3568 PrepareFrameState(store, bailout_id, combine); |
| 3574 return store; | 3569 return store; |
| 3575 } | 3570 } |
| 3576 } | 3571 } |
| 3577 UNREACHABLE(); | 3572 UNREACHABLE(); |
| 3578 return nullptr; | 3573 return nullptr; |
| 3579 } | 3574 } |
| 3580 | 3575 |
| 3581 | 3576 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 3611 Node* node = NewNode(op, object, value, BuildLoadFeedbackVector()); | 3606 Node* node = NewNode(op, object, value, BuildLoadFeedbackVector()); |
| 3612 return node; | 3607 return node; |
| 3613 } | 3608 } |
| 3614 | 3609 |
| 3615 | 3610 |
| 3616 Node* AstGraphBuilder::BuildNamedSuperLoad(Node* receiver, Node* home_object, | 3611 Node* AstGraphBuilder::BuildNamedSuperLoad(Node* receiver, Node* home_object, |
| 3617 Handle<Name> name, | 3612 Handle<Name> name, |
| 3618 const VectorSlotPair& feedback) { | 3613 const VectorSlotPair& feedback) { |
| 3619 Node* name_node = jsgraph()->Constant(name); | 3614 Node* name_node = jsgraph()->Constant(name); |
| 3620 Node* language = jsgraph()->Constant(language_mode()); | 3615 Node* language = jsgraph()->Constant(language_mode()); |
| 3621 const Operator* op = javascript()->CallRuntime(Runtime::kLoadFromSuper, 4); | 3616 const Operator* op = javascript()->CallRuntime(Runtime::kLoadFromSuper); |
| 3622 Node* node = NewNode(op, receiver, home_object, name_node, language); | 3617 Node* node = NewNode(op, receiver, home_object, name_node, language); |
| 3623 return node; | 3618 return node; |
| 3624 } | 3619 } |
| 3625 | 3620 |
| 3626 | 3621 |
| 3627 Node* AstGraphBuilder::BuildKeyedSuperLoad(Node* receiver, Node* home_object, | 3622 Node* AstGraphBuilder::BuildKeyedSuperLoad(Node* receiver, Node* home_object, |
| 3628 Node* key, | 3623 Node* key, |
| 3629 const VectorSlotPair& feedback) { | 3624 const VectorSlotPair& feedback) { |
| 3630 Node* language = jsgraph()->Constant(language_mode()); | 3625 Node* language = jsgraph()->Constant(language_mode()); |
| 3631 const Operator* op = | 3626 const Operator* op = javascript()->CallRuntime(Runtime::kLoadKeyedFromSuper); |
| 3632 javascript()->CallRuntime(Runtime::kLoadKeyedFromSuper, 4); | |
| 3633 Node* node = NewNode(op, receiver, home_object, key, language); | 3627 Node* node = NewNode(op, receiver, home_object, key, language); |
| 3634 return node; | 3628 return node; |
| 3635 } | 3629 } |
| 3636 | 3630 |
| 3637 | 3631 |
| 3638 Node* AstGraphBuilder::BuildKeyedSuperStore(Node* receiver, Node* home_object, | 3632 Node* AstGraphBuilder::BuildKeyedSuperStore(Node* receiver, Node* home_object, |
| 3639 Node* key, Node* value) { | 3633 Node* key, Node* value) { |
| 3640 Runtime::FunctionId function_id = is_strict(language_mode()) | 3634 Runtime::FunctionId function_id = is_strict(language_mode()) |
| 3641 ? Runtime::kStoreKeyedToSuper_Strict | 3635 ? Runtime::kStoreKeyedToSuper_Strict |
| 3642 : Runtime::kStoreKeyedToSuper_Sloppy; | 3636 : Runtime::kStoreKeyedToSuper_Sloppy; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3751 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 3745 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
| 3752 VectorSlotPair feedback = | 3746 VectorSlotPair feedback = |
| 3753 CreateVectorSlotPair(property->GetSlot(slot_number)); | 3747 CreateVectorSlotPair(property->GetSlot(slot_number)); |
| 3754 Node* store = BuildNamedStore(value, name, home_object, feedback); | 3748 Node* store = BuildNamedStore(value, name, home_object, feedback); |
| 3755 states.AddToNode(store, BailoutId::None(), OutputFrameStateCombine::Ignore()); | 3749 states.AddToNode(store, BailoutId::None(), OutputFrameStateCombine::Ignore()); |
| 3756 return store; | 3750 return store; |
| 3757 } | 3751 } |
| 3758 | 3752 |
| 3759 | 3753 |
| 3760 Node* AstGraphBuilder::BuildThrowError(Node* exception, BailoutId bailout_id) { | 3754 Node* AstGraphBuilder::BuildThrowError(Node* exception, BailoutId bailout_id) { |
| 3761 const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1); | 3755 const Operator* op = javascript()->CallRuntime(Runtime::kThrow); |
| 3762 Node* call = NewNode(op, exception); | 3756 Node* call = NewNode(op, exception); |
| 3763 PrepareFrameState(call, bailout_id); | 3757 PrepareFrameState(call, bailout_id); |
| 3764 Node* control = NewNode(common()->Throw(), call); | 3758 Node* control = NewNode(common()->Throw(), call); |
| 3765 UpdateControlDependencyToLeaveFunction(control); | 3759 UpdateControlDependencyToLeaveFunction(control); |
| 3766 return call; | 3760 return call; |
| 3767 } | 3761 } |
| 3768 | 3762 |
| 3769 | 3763 |
| 3770 Node* AstGraphBuilder::BuildThrowReferenceError(Variable* variable, | 3764 Node* AstGraphBuilder::BuildThrowReferenceError(Variable* variable, |
| 3771 BailoutId bailout_id) { | 3765 BailoutId bailout_id) { |
| 3772 Node* variable_name = jsgraph()->Constant(variable->name()); | 3766 Node* variable_name = jsgraph()->Constant(variable->name()); |
| 3773 const Operator* op = | 3767 const Operator* op = javascript()->CallRuntime(Runtime::kThrowReferenceError); |
| 3774 javascript()->CallRuntime(Runtime::kThrowReferenceError, 1); | |
| 3775 Node* call = NewNode(op, variable_name); | 3768 Node* call = NewNode(op, variable_name); |
| 3776 PrepareFrameState(call, bailout_id); | 3769 PrepareFrameState(call, bailout_id); |
| 3777 Node* control = NewNode(common()->Throw(), call); | 3770 Node* control = NewNode(common()->Throw(), call); |
| 3778 UpdateControlDependencyToLeaveFunction(control); | 3771 UpdateControlDependencyToLeaveFunction(control); |
| 3779 return call; | 3772 return call; |
| 3780 } | 3773 } |
| 3781 | 3774 |
| 3782 | 3775 |
| 3783 Node* AstGraphBuilder::BuildThrowConstAssignError(BailoutId bailout_id) { | 3776 Node* AstGraphBuilder::BuildThrowConstAssignError(BailoutId bailout_id) { |
| 3784 const Operator* op = | 3777 const Operator* op = |
| 3785 javascript()->CallRuntime(Runtime::kThrowConstAssignError, 0); | 3778 javascript()->CallRuntime(Runtime::kThrowConstAssignError); |
| 3786 Node* call = NewNode(op); | 3779 Node* call = NewNode(op); |
| 3787 PrepareFrameState(call, bailout_id); | 3780 PrepareFrameState(call, bailout_id); |
| 3788 Node* control = NewNode(common()->Throw(), call); | 3781 Node* control = NewNode(common()->Throw(), call); |
| 3789 UpdateControlDependencyToLeaveFunction(control); | 3782 UpdateControlDependencyToLeaveFunction(control); |
| 3790 return call; | 3783 return call; |
| 3791 } | 3784 } |
| 3792 | 3785 |
| 3793 | 3786 |
| 3794 Node* AstGraphBuilder::BuildThrowStaticPrototypeError(BailoutId bailout_id) { | 3787 Node* AstGraphBuilder::BuildThrowStaticPrototypeError(BailoutId bailout_id) { |
| 3795 const Operator* op = | 3788 const Operator* op = |
| 3796 javascript()->CallRuntime(Runtime::kThrowStaticPrototypeError, 0); | 3789 javascript()->CallRuntime(Runtime::kThrowStaticPrototypeError); |
| 3797 Node* call = NewNode(op); | 3790 Node* call = NewNode(op); |
| 3798 PrepareFrameState(call, bailout_id); | 3791 PrepareFrameState(call, bailout_id); |
| 3799 Node* control = NewNode(common()->Throw(), call); | 3792 Node* control = NewNode(common()->Throw(), call); |
| 3800 UpdateControlDependencyToLeaveFunction(control); | 3793 UpdateControlDependencyToLeaveFunction(control); |
| 3801 return call; | 3794 return call; |
| 3802 } | 3795 } |
| 3803 | 3796 |
| 3804 | 3797 |
| 3805 Node* AstGraphBuilder::BuildThrowUnsupportedSuperError(BailoutId bailout_id) { | 3798 Node* AstGraphBuilder::BuildThrowUnsupportedSuperError(BailoutId bailout_id) { |
| 3806 const Operator* op = | 3799 const Operator* op = |
| 3807 javascript()->CallRuntime(Runtime::kThrowUnsupportedSuperError, 0); | 3800 javascript()->CallRuntime(Runtime::kThrowUnsupportedSuperError); |
| 3808 Node* call = NewNode(op); | 3801 Node* call = NewNode(op); |
| 3809 PrepareFrameState(call, bailout_id); | 3802 PrepareFrameState(call, bailout_id); |
| 3810 Node* control = NewNode(common()->Throw(), call); | 3803 Node* control = NewNode(common()->Throw(), call); |
| 3811 UpdateControlDependencyToLeaveFunction(control); | 3804 UpdateControlDependencyToLeaveFunction(control); |
| 3812 return call; | 3805 return call; |
| 3813 } | 3806 } |
| 3814 | 3807 |
| 3815 | 3808 |
| 3816 Node* AstGraphBuilder::BuildReturn(Node* return_value) { | 3809 Node* AstGraphBuilder::BuildReturn(Node* return_value) { |
| 3817 Node* control = NewNode(common()->Return(), return_value); | 3810 Node* control = NewNode(common()->Return(), return_value); |
| 3818 UpdateControlDependencyToLeaveFunction(control); | 3811 UpdateControlDependencyToLeaveFunction(control); |
| 3819 return control; | 3812 return control; |
| 3820 } | 3813 } |
| 3821 | 3814 |
| 3822 | 3815 |
| 3823 Node* AstGraphBuilder::BuildThrow(Node* exception_value) { | 3816 Node* AstGraphBuilder::BuildThrow(Node* exception_value) { |
| 3824 NewNode(javascript()->CallRuntime(Runtime::kReThrow, 1), exception_value); | 3817 NewNode(javascript()->CallRuntime(Runtime::kReThrow), exception_value); |
| 3825 Node* control = NewNode(common()->Throw(), exception_value); | 3818 Node* control = NewNode(common()->Throw(), exception_value); |
| 3826 UpdateControlDependencyToLeaveFunction(control); | 3819 UpdateControlDependencyToLeaveFunction(control); |
| 3827 return control; | 3820 return control; |
| 3828 } | 3821 } |
| 3829 | 3822 |
| 3830 | 3823 |
| 3831 Node* AstGraphBuilder::BuildBinaryOp(Node* left, Node* right, Token::Value op, | 3824 Node* AstGraphBuilder::BuildBinaryOp(Node* left, Node* right, Token::Value op, |
| 3832 TypeFeedbackId feedback_id) { | 3825 TypeFeedbackId feedback_id) { |
| 3833 const Operator* js_op; | 3826 const Operator* js_op; |
| 3834 BinaryOperationHints hints; | 3827 BinaryOperationHints hints; |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4357 // Phi does not exist yet, introduce one. | 4350 // Phi does not exist yet, introduce one. |
| 4358 value = NewPhi(inputs, value, control); | 4351 value = NewPhi(inputs, value, control); |
| 4359 value->ReplaceInput(inputs - 1, other); | 4352 value->ReplaceInput(inputs - 1, other); |
| 4360 } | 4353 } |
| 4361 return value; | 4354 return value; |
| 4362 } | 4355 } |
| 4363 | 4356 |
| 4364 } // namespace compiler | 4357 } // namespace compiler |
| 4365 } // namespace internal | 4358 } // namespace internal |
| 4366 } // namespace v8 | 4359 } // namespace v8 |
| OLD | NEW |