| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #if V8_TARGET_ARCH_S390 | 5 #if V8_TARGET_ARCH_S390 |
| 6 | 6 |
| 7 #include "src/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
| 8 #include "src/ast/compile-time-value.h" | 8 #include "src/ast/compile-time-value.h" |
| 9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1341 break; | 1341 break; |
| 1342 case NAMED_PROPERTY: | 1342 case NAMED_PROPERTY: |
| 1343 if (expr->is_compound()) { | 1343 if (expr->is_compound()) { |
| 1344 // We need the receiver both on the stack and in the register. | 1344 // We need the receiver both on the stack and in the register. |
| 1345 VisitForStackValue(property->obj()); | 1345 VisitForStackValue(property->obj()); |
| 1346 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 1346 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
| 1347 } else { | 1347 } else { |
| 1348 VisitForStackValue(property->obj()); | 1348 VisitForStackValue(property->obj()); |
| 1349 } | 1349 } |
| 1350 break; | 1350 break; |
| 1351 case NAMED_SUPER_PROPERTY: | |
| 1352 VisitForStackValue( | |
| 1353 property->obj()->AsSuperPropertyReference()->this_var()); | |
| 1354 VisitForAccumulatorValue( | |
| 1355 property->obj()->AsSuperPropertyReference()->home_object()); | |
| 1356 PushOperand(result_register()); | |
| 1357 if (expr->is_compound()) { | |
| 1358 const Register scratch = r3; | |
| 1359 __ LoadP(scratch, MemOperand(sp, kPointerSize)); | |
| 1360 PushOperands(scratch, result_register()); | |
| 1361 } | |
| 1362 break; | |
| 1363 case KEYED_SUPER_PROPERTY: { | |
| 1364 VisitForStackValue( | |
| 1365 property->obj()->AsSuperPropertyReference()->this_var()); | |
| 1366 VisitForStackValue( | |
| 1367 property->obj()->AsSuperPropertyReference()->home_object()); | |
| 1368 VisitForAccumulatorValue(property->key()); | |
| 1369 PushOperand(result_register()); | |
| 1370 if (expr->is_compound()) { | |
| 1371 const Register scratch1 = r4; | |
| 1372 const Register scratch2 = r3; | |
| 1373 __ LoadP(scratch1, MemOperand(sp, 2 * kPointerSize)); | |
| 1374 __ LoadP(scratch2, MemOperand(sp, 1 * kPointerSize)); | |
| 1375 PushOperands(scratch1, scratch2, result_register()); | |
| 1376 } | |
| 1377 break; | |
| 1378 } | |
| 1379 case KEYED_PROPERTY: | 1351 case KEYED_PROPERTY: |
| 1380 if (expr->is_compound()) { | 1352 if (expr->is_compound()) { |
| 1381 VisitForStackValue(property->obj()); | 1353 VisitForStackValue(property->obj()); |
| 1382 VisitForStackValue(property->key()); | 1354 VisitForStackValue(property->key()); |
| 1383 __ LoadP(LoadDescriptor::ReceiverRegister(), | 1355 __ LoadP(LoadDescriptor::ReceiverRegister(), |
| 1384 MemOperand(sp, 1 * kPointerSize)); | 1356 MemOperand(sp, 1 * kPointerSize)); |
| 1385 __ LoadP(LoadDescriptor::NameRegister(), MemOperand(sp, 0)); | 1357 __ LoadP(LoadDescriptor::NameRegister(), MemOperand(sp, 0)); |
| 1386 } else { | 1358 } else { |
| 1387 VisitForStackValue(property->obj()); | 1359 VisitForStackValue(property->obj()); |
| 1388 VisitForStackValue(property->key()); | 1360 VisitForStackValue(property->key()); |
| 1389 } | 1361 } |
| 1390 break; | 1362 break; |
| 1363 case NAMED_SUPER_PROPERTY: |
| 1364 case KEYED_SUPER_PROPERTY: |
| 1365 UNREACHABLE(); |
| 1366 break; |
| 1391 } | 1367 } |
| 1392 | 1368 |
| 1393 // For compound assignments we need another deoptimization point after the | 1369 // For compound assignments we need another deoptimization point after the |
| 1394 // variable/property load. | 1370 // variable/property load. |
| 1395 if (expr->is_compound()) { | 1371 if (expr->is_compound()) { |
| 1396 { | 1372 { |
| 1397 AccumulatorValueContext context(this); | 1373 AccumulatorValueContext context(this); |
| 1398 switch (assign_type) { | 1374 switch (assign_type) { |
| 1399 case VARIABLE: | 1375 case VARIABLE: |
| 1400 EmitVariableLoad(expr->target()->AsVariableProxy()); | 1376 EmitVariableLoad(expr->target()->AsVariableProxy()); |
| 1401 PrepareForBailout(expr->target(), BailoutState::TOS_REGISTER); | 1377 PrepareForBailout(expr->target(), BailoutState::TOS_REGISTER); |
| 1402 break; | 1378 break; |
| 1403 case NAMED_PROPERTY: | 1379 case NAMED_PROPERTY: |
| 1404 EmitNamedPropertyLoad(property); | 1380 EmitNamedPropertyLoad(property); |
| 1405 PrepareForBailoutForId(property->LoadId(), | 1381 PrepareForBailoutForId(property->LoadId(), |
| 1406 BailoutState::TOS_REGISTER); | 1382 BailoutState::TOS_REGISTER); |
| 1407 break; | 1383 break; |
| 1408 case NAMED_SUPER_PROPERTY: | |
| 1409 EmitNamedSuperPropertyLoad(property); | |
| 1410 PrepareForBailoutForId(property->LoadId(), | |
| 1411 BailoutState::TOS_REGISTER); | |
| 1412 break; | |
| 1413 case KEYED_SUPER_PROPERTY: | |
| 1414 EmitKeyedSuperPropertyLoad(property); | |
| 1415 PrepareForBailoutForId(property->LoadId(), | |
| 1416 BailoutState::TOS_REGISTER); | |
| 1417 break; | |
| 1418 case KEYED_PROPERTY: | 1384 case KEYED_PROPERTY: |
| 1419 EmitKeyedPropertyLoad(property); | 1385 EmitKeyedPropertyLoad(property); |
| 1420 PrepareForBailoutForId(property->LoadId(), | 1386 PrepareForBailoutForId(property->LoadId(), |
| 1421 BailoutState::TOS_REGISTER); | 1387 BailoutState::TOS_REGISTER); |
| 1422 break; | 1388 break; |
| 1389 case NAMED_SUPER_PROPERTY: |
| 1390 case KEYED_SUPER_PROPERTY: |
| 1391 UNREACHABLE(); |
| 1392 break; |
| 1423 } | 1393 } |
| 1424 } | 1394 } |
| 1425 | 1395 |
| 1426 Token::Value op = expr->binary_op(); | 1396 Token::Value op = expr->binary_op(); |
| 1427 PushOperand(r2); // Left operand goes on the stack. | 1397 PushOperand(r2); // Left operand goes on the stack. |
| 1428 VisitForAccumulatorValue(expr->value()); | 1398 VisitForAccumulatorValue(expr->value()); |
| 1429 | 1399 |
| 1430 AccumulatorValueContext context(this); | 1400 AccumulatorValueContext context(this); |
| 1431 if (ShouldInlineSmiCase(op)) { | 1401 if (ShouldInlineSmiCase(op)) { |
| 1432 EmitInlineSmiBinaryOp(expr->binary_operation(), op, expr->target(), | 1402 EmitInlineSmiBinaryOp(expr->binary_operation(), op, expr->target(), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1449 VariableProxy* proxy = expr->target()->AsVariableProxy(); | 1419 VariableProxy* proxy = expr->target()->AsVariableProxy(); |
| 1450 EmitVariableAssignment(proxy->var(), expr->op(), expr->AssignmentSlot(), | 1420 EmitVariableAssignment(proxy->var(), expr->op(), expr->AssignmentSlot(), |
| 1451 proxy->hole_check_mode()); | 1421 proxy->hole_check_mode()); |
| 1452 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 1422 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
| 1453 context()->Plug(r2); | 1423 context()->Plug(r2); |
| 1454 break; | 1424 break; |
| 1455 } | 1425 } |
| 1456 case NAMED_PROPERTY: | 1426 case NAMED_PROPERTY: |
| 1457 EmitNamedPropertyAssignment(expr); | 1427 EmitNamedPropertyAssignment(expr); |
| 1458 break; | 1428 break; |
| 1459 case NAMED_SUPER_PROPERTY: | |
| 1460 EmitNamedSuperPropertyStore(property); | |
| 1461 context()->Plug(r2); | |
| 1462 break; | |
| 1463 case KEYED_SUPER_PROPERTY: | |
| 1464 EmitKeyedSuperPropertyStore(property); | |
| 1465 context()->Plug(r2); | |
| 1466 break; | |
| 1467 case KEYED_PROPERTY: | 1429 case KEYED_PROPERTY: |
| 1468 EmitKeyedPropertyAssignment(expr); | 1430 EmitKeyedPropertyAssignment(expr); |
| 1469 break; | 1431 break; |
| 1432 case NAMED_SUPER_PROPERTY: |
| 1433 case KEYED_SUPER_PROPERTY: |
| 1434 UNREACHABLE(); |
| 1435 break; |
| 1470 } | 1436 } |
| 1471 } | 1437 } |
| 1472 | 1438 |
| 1473 void FullCodeGenerator::VisitYield(Yield* expr) { | 1439 void FullCodeGenerator::VisitYield(Yield* expr) { |
| 1474 // Resumable functions are not supported. | 1440 // Resumable functions are not supported. |
| 1475 UNREACHABLE(); | 1441 UNREACHABLE(); |
| 1476 } | 1442 } |
| 1477 | 1443 |
| 1478 void FullCodeGenerator::PushOperands(Register reg1, Register reg2) { | 1444 void FullCodeGenerator::PushOperands(Register reg1, Register reg2) { |
| 1479 OperandStackDepthIncrement(2); | 1445 OperandStackDepthIncrement(2); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1683 break; | 1649 break; |
| 1684 } | 1650 } |
| 1685 case NAMED_PROPERTY: { | 1651 case NAMED_PROPERTY: { |
| 1686 PushOperand(r2); // Preserve value. | 1652 PushOperand(r2); // Preserve value. |
| 1687 VisitForAccumulatorValue(prop->obj()); | 1653 VisitForAccumulatorValue(prop->obj()); |
| 1688 __ Move(StoreDescriptor::ReceiverRegister(), r2); | 1654 __ Move(StoreDescriptor::ReceiverRegister(), r2); |
| 1689 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. | 1655 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. |
| 1690 CallStoreIC(slot, prop->key()->AsLiteral()->value()); | 1656 CallStoreIC(slot, prop->key()->AsLiteral()->value()); |
| 1691 break; | 1657 break; |
| 1692 } | 1658 } |
| 1693 case NAMED_SUPER_PROPERTY: { | |
| 1694 PushOperand(r2); | |
| 1695 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | |
| 1696 VisitForAccumulatorValue( | |
| 1697 prop->obj()->AsSuperPropertyReference()->home_object()); | |
| 1698 // stack: value, this; r2: home_object | |
| 1699 Register scratch = r4; | |
| 1700 Register scratch2 = r5; | |
| 1701 __ LoadRR(scratch, result_register()); // home_object | |
| 1702 __ LoadP(r2, MemOperand(sp, kPointerSize)); // value | |
| 1703 __ LoadP(scratch2, MemOperand(sp, 0)); // this | |
| 1704 __ StoreP(scratch2, MemOperand(sp, kPointerSize)); // this | |
| 1705 __ StoreP(scratch, MemOperand(sp, 0)); // home_object | |
| 1706 // stack: this, home_object; r2: value | |
| 1707 EmitNamedSuperPropertyStore(prop); | |
| 1708 break; | |
| 1709 } | |
| 1710 case KEYED_SUPER_PROPERTY: { | |
| 1711 PushOperand(r2); | |
| 1712 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | |
| 1713 VisitForStackValue( | |
| 1714 prop->obj()->AsSuperPropertyReference()->home_object()); | |
| 1715 VisitForAccumulatorValue(prop->key()); | |
| 1716 Register scratch = r4; | |
| 1717 Register scratch2 = r5; | |
| 1718 __ LoadP(scratch2, MemOperand(sp, 2 * kPointerSize)); // value | |
| 1719 // stack: value, this, home_object; r3: key, r6: value | |
| 1720 __ LoadP(scratch, MemOperand(sp, kPointerSize)); // this | |
| 1721 __ StoreP(scratch, MemOperand(sp, 2 * kPointerSize)); | |
| 1722 __ LoadP(scratch, MemOperand(sp, 0)); // home_object | |
| 1723 __ StoreP(scratch, MemOperand(sp, kPointerSize)); | |
| 1724 __ StoreP(r2, MemOperand(sp, 0)); | |
| 1725 __ Move(r2, scratch2); | |
| 1726 // stack: this, home_object, key; r2: value. | |
| 1727 EmitKeyedSuperPropertyStore(prop); | |
| 1728 break; | |
| 1729 } | |
| 1730 case KEYED_PROPERTY: { | 1659 case KEYED_PROPERTY: { |
| 1731 PushOperand(r2); // Preserve value. | 1660 PushOperand(r2); // Preserve value. |
| 1732 VisitForStackValue(prop->obj()); | 1661 VisitForStackValue(prop->obj()); |
| 1733 VisitForAccumulatorValue(prop->key()); | 1662 VisitForAccumulatorValue(prop->key()); |
| 1734 __ Move(StoreDescriptor::NameRegister(), r2); | 1663 __ Move(StoreDescriptor::NameRegister(), r2); |
| 1735 PopOperands(StoreDescriptor::ValueRegister(), | 1664 PopOperands(StoreDescriptor::ValueRegister(), |
| 1736 StoreDescriptor::ReceiverRegister()); | 1665 StoreDescriptor::ReceiverRegister()); |
| 1737 CallKeyedStoreIC(slot); | 1666 CallKeyedStoreIC(slot); |
| 1738 break; | 1667 break; |
| 1739 } | 1668 } |
| 1669 case NAMED_SUPER_PROPERTY: |
| 1670 case KEYED_SUPER_PROPERTY: |
| 1671 UNREACHABLE(); |
| 1672 break; |
| 1740 } | 1673 } |
| 1741 context()->Plug(r2); | 1674 context()->Plug(r2); |
| 1742 } | 1675 } |
| 1743 | 1676 |
| 1744 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( | 1677 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( |
| 1745 Variable* var, MemOperand location) { | 1678 Variable* var, MemOperand location) { |
| 1746 __ StoreP(result_register(), location); | 1679 __ StoreP(result_register(), location); |
| 1747 if (var->IsContextSlot()) { | 1680 if (var->IsContextSlot()) { |
| 1748 // RecordWrite may destroy all its register arguments. | 1681 // RecordWrite may destroy all its register arguments. |
| 1749 __ LoadRR(r5, result_register()); | 1682 __ LoadRR(r5, result_register()); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1818 DCHECK(prop != NULL); | 1751 DCHECK(prop != NULL); |
| 1819 DCHECK(prop->key()->IsLiteral()); | 1752 DCHECK(prop->key()->IsLiteral()); |
| 1820 | 1753 |
| 1821 PopOperand(StoreDescriptor::ReceiverRegister()); | 1754 PopOperand(StoreDescriptor::ReceiverRegister()); |
| 1822 CallStoreIC(expr->AssignmentSlot(), prop->key()->AsLiteral()->value()); | 1755 CallStoreIC(expr->AssignmentSlot(), prop->key()->AsLiteral()->value()); |
| 1823 | 1756 |
| 1824 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 1757 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
| 1825 context()->Plug(r2); | 1758 context()->Plug(r2); |
| 1826 } | 1759 } |
| 1827 | 1760 |
| 1828 void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) { | |
| 1829 // Assignment to named property of super. | |
| 1830 // r2 : value | |
| 1831 // stack : receiver ('this'), home_object | |
| 1832 DCHECK(prop != NULL); | |
| 1833 Literal* key = prop->key()->AsLiteral(); | |
| 1834 DCHECK(key != NULL); | |
| 1835 | |
| 1836 PushOperand(key->value()); | |
| 1837 PushOperand(r2); | |
| 1838 CallRuntimeWithOperands((is_strict(language_mode()) | |
| 1839 ? Runtime::kStoreToSuper_Strict | |
| 1840 : Runtime::kStoreToSuper_Sloppy)); | |
| 1841 } | |
| 1842 | |
| 1843 void FullCodeGenerator::EmitKeyedSuperPropertyStore(Property* prop) { | |
| 1844 // Assignment to named property of super. | |
| 1845 // r2 : value | |
| 1846 // stack : receiver ('this'), home_object, key | |
| 1847 DCHECK(prop != NULL); | |
| 1848 | |
| 1849 PushOperand(r2); | |
| 1850 CallRuntimeWithOperands((is_strict(language_mode()) | |
| 1851 ? Runtime::kStoreKeyedToSuper_Strict | |
| 1852 : Runtime::kStoreKeyedToSuper_Sloppy)); | |
| 1853 } | |
| 1854 | |
| 1855 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { | 1761 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
| 1856 // Assignment to a property, using a keyed store IC. | 1762 // Assignment to a property, using a keyed store IC. |
| 1857 PopOperands(StoreDescriptor::ReceiverRegister(), | 1763 PopOperands(StoreDescriptor::ReceiverRegister(), |
| 1858 StoreDescriptor::NameRegister()); | 1764 StoreDescriptor::NameRegister()); |
| 1859 DCHECK(StoreDescriptor::ValueRegister().is(r2)); | 1765 DCHECK(StoreDescriptor::ValueRegister().is(r2)); |
| 1860 | 1766 |
| 1861 CallKeyedStoreIC(expr->AssignmentSlot()); | 1767 CallKeyedStoreIC(expr->AssignmentSlot()); |
| 1862 | 1768 |
| 1863 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 1769 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
| 1864 context()->Plug(r2); | 1770 context()->Plug(r2); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1892 // Push the target function under the receiver. | 1798 // Push the target function under the receiver. |
| 1893 __ LoadP(r1, MemOperand(sp, 0)); | 1799 __ LoadP(r1, MemOperand(sp, 0)); |
| 1894 PushOperand(r1); | 1800 PushOperand(r1); |
| 1895 __ StoreP(r2, MemOperand(sp, kPointerSize)); | 1801 __ StoreP(r2, MemOperand(sp, kPointerSize)); |
| 1896 convert_mode = ConvertReceiverMode::kNotNullOrUndefined; | 1802 convert_mode = ConvertReceiverMode::kNotNullOrUndefined; |
| 1897 } | 1803 } |
| 1898 | 1804 |
| 1899 EmitCall(expr, convert_mode); | 1805 EmitCall(expr, convert_mode); |
| 1900 } | 1806 } |
| 1901 | 1807 |
| 1902 void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { | |
| 1903 Expression* callee = expr->expression(); | |
| 1904 DCHECK(callee->IsProperty()); | |
| 1905 Property* prop = callee->AsProperty(); | |
| 1906 DCHECK(prop->IsSuperAccess()); | |
| 1907 SetExpressionPosition(prop); | |
| 1908 | |
| 1909 Literal* key = prop->key()->AsLiteral(); | |
| 1910 DCHECK(!key->value()->IsSmi()); | |
| 1911 // Load the function from the receiver. | |
| 1912 const Register scratch = r3; | |
| 1913 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | |
| 1914 VisitForAccumulatorValue(super_ref->home_object()); | |
| 1915 __ LoadRR(scratch, r2); | |
| 1916 VisitForAccumulatorValue(super_ref->this_var()); | |
| 1917 PushOperands(scratch, r2, r2, scratch); | |
| 1918 PushOperand(key->value()); | |
| 1919 | |
| 1920 // Stack here: | |
| 1921 // - home_object | |
| 1922 // - this (receiver) | |
| 1923 // - this (receiver) <-- LoadFromSuper will pop here and below. | |
| 1924 // - home_object | |
| 1925 // - key | |
| 1926 CallRuntimeWithOperands(Runtime::kLoadFromSuper); | |
| 1927 PrepareForBailoutForId(prop->LoadId(), BailoutState::TOS_REGISTER); | |
| 1928 | |
| 1929 // Replace home_object with target function. | |
| 1930 __ StoreP(r2, MemOperand(sp, kPointerSize)); | |
| 1931 | |
| 1932 // Stack here: | |
| 1933 // - target function | |
| 1934 // - this (receiver) | |
| 1935 EmitCall(expr); | |
| 1936 } | |
| 1937 | |
| 1938 // Code common for calls using the IC. | 1808 // Code common for calls using the IC. |
| 1939 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, Expression* key) { | 1809 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, Expression* key) { |
| 1940 // Load the key. | 1810 // Load the key. |
| 1941 VisitForAccumulatorValue(key); | 1811 VisitForAccumulatorValue(key); |
| 1942 | 1812 |
| 1943 Expression* callee = expr->expression(); | 1813 Expression* callee = expr->expression(); |
| 1944 | 1814 |
| 1945 // Load the function from the receiver. | 1815 // Load the function from the receiver. |
| 1946 DCHECK(callee->IsProperty()); | 1816 DCHECK(callee->IsProperty()); |
| 1947 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 1817 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
| 1948 __ Move(LoadDescriptor::NameRegister(), r2); | 1818 __ Move(LoadDescriptor::NameRegister(), r2); |
| 1949 EmitKeyedPropertyLoad(callee->AsProperty()); | 1819 EmitKeyedPropertyLoad(callee->AsProperty()); |
| 1950 PrepareForBailoutForId(callee->AsProperty()->LoadId(), | 1820 PrepareForBailoutForId(callee->AsProperty()->LoadId(), |
| 1951 BailoutState::TOS_REGISTER); | 1821 BailoutState::TOS_REGISTER); |
| 1952 | 1822 |
| 1953 // Push the target function under the receiver. | 1823 // Push the target function under the receiver. |
| 1954 __ LoadP(ip, MemOperand(sp, 0)); | 1824 __ LoadP(ip, MemOperand(sp, 0)); |
| 1955 PushOperand(ip); | 1825 PushOperand(ip); |
| 1956 __ StoreP(r2, MemOperand(sp, kPointerSize)); | 1826 __ StoreP(r2, MemOperand(sp, kPointerSize)); |
| 1957 | 1827 |
| 1958 EmitCall(expr, ConvertReceiverMode::kNotNullOrUndefined); | 1828 EmitCall(expr, ConvertReceiverMode::kNotNullOrUndefined); |
| 1959 } | 1829 } |
| 1960 | 1830 |
| 1961 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { | |
| 1962 Expression* callee = expr->expression(); | |
| 1963 DCHECK(callee->IsProperty()); | |
| 1964 Property* prop = callee->AsProperty(); | |
| 1965 DCHECK(prop->IsSuperAccess()); | |
| 1966 | |
| 1967 SetExpressionPosition(prop); | |
| 1968 // Load the function from the receiver. | |
| 1969 const Register scratch = r3; | |
| 1970 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | |
| 1971 VisitForAccumulatorValue(super_ref->home_object()); | |
| 1972 __ LoadRR(scratch, r2); | |
| 1973 VisitForAccumulatorValue(super_ref->this_var()); | |
| 1974 PushOperands(scratch, r2, r2, scratch); | |
| 1975 VisitForStackValue(prop->key()); | |
| 1976 | |
| 1977 // Stack here: | |
| 1978 // - home_object | |
| 1979 // - this (receiver) | |
| 1980 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. | |
| 1981 // - home_object | |
| 1982 // - key | |
| 1983 CallRuntimeWithOperands(Runtime::kLoadKeyedFromSuper); | |
| 1984 PrepareForBailoutForId(prop->LoadId(), BailoutState::TOS_REGISTER); | |
| 1985 | |
| 1986 // Replace home_object with target function. | |
| 1987 __ StoreP(r2, MemOperand(sp, kPointerSize)); | |
| 1988 | |
| 1989 // Stack here: | |
| 1990 // - target function | |
| 1991 // - this (receiver) | |
| 1992 EmitCall(expr); | |
| 1993 } | |
| 1994 | |
| 1995 void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { | 1831 void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { |
| 1996 // Load the arguments. | 1832 // Load the arguments. |
| 1997 ZoneList<Expression*>* args = expr->arguments(); | 1833 ZoneList<Expression*>* args = expr->arguments(); |
| 1998 int arg_count = args->length(); | 1834 int arg_count = args->length(); |
| 1999 for (int i = 0; i < arg_count; i++) { | 1835 for (int i = 0; i < arg_count; i++) { |
| 2000 VisitForStackValue(args->at(i)); | 1836 VisitForStackValue(args->at(i)); |
| 2001 } | 1837 } |
| 2002 | 1838 |
| 2003 PrepareForBailoutForId(expr->CallId(), BailoutState::NO_REGISTERS); | 1839 PrepareForBailoutForId(expr->CallId(), BailoutState::NO_REGISTERS); |
| 2004 SetCallPosition(expr, expr->tail_call_mode()); | 1840 SetCallPosition(expr, expr->tail_call_mode()); |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2494 } | 2330 } |
| 2495 switch (assign_type) { | 2331 switch (assign_type) { |
| 2496 case NAMED_PROPERTY: { | 2332 case NAMED_PROPERTY: { |
| 2497 // Put the object both on the stack and in the register. | 2333 // Put the object both on the stack and in the register. |
| 2498 VisitForStackValue(prop->obj()); | 2334 VisitForStackValue(prop->obj()); |
| 2499 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 2335 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
| 2500 EmitNamedPropertyLoad(prop); | 2336 EmitNamedPropertyLoad(prop); |
| 2501 break; | 2337 break; |
| 2502 } | 2338 } |
| 2503 | 2339 |
| 2504 case NAMED_SUPER_PROPERTY: { | |
| 2505 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | |
| 2506 VisitForAccumulatorValue( | |
| 2507 prop->obj()->AsSuperPropertyReference()->home_object()); | |
| 2508 const Register scratch = r3; | |
| 2509 __ LoadP(scratch, MemOperand(sp, 0)); // this | |
| 2510 PushOperands(result_register(), scratch, result_register()); | |
| 2511 EmitNamedSuperPropertyLoad(prop); | |
| 2512 break; | |
| 2513 } | |
| 2514 | |
| 2515 case KEYED_SUPER_PROPERTY: { | |
| 2516 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | |
| 2517 VisitForStackValue( | |
| 2518 prop->obj()->AsSuperPropertyReference()->home_object()); | |
| 2519 VisitForAccumulatorValue(prop->key()); | |
| 2520 const Register scratch1 = r3; | |
| 2521 const Register scratch2 = r4; | |
| 2522 __ LoadP(scratch1, MemOperand(sp, 1 * kPointerSize)); // this | |
| 2523 __ LoadP(scratch2, MemOperand(sp, 0 * kPointerSize)); // home object | |
| 2524 PushOperands(result_register(), scratch1, scratch2, result_register()); | |
| 2525 EmitKeyedSuperPropertyLoad(prop); | |
| 2526 break; | |
| 2527 } | |
| 2528 | |
| 2529 case KEYED_PROPERTY: { | 2340 case KEYED_PROPERTY: { |
| 2530 VisitForStackValue(prop->obj()); | 2341 VisitForStackValue(prop->obj()); |
| 2531 VisitForStackValue(prop->key()); | 2342 VisitForStackValue(prop->key()); |
| 2532 __ LoadP(LoadDescriptor::ReceiverRegister(), | 2343 __ LoadP(LoadDescriptor::ReceiverRegister(), |
| 2533 MemOperand(sp, 1 * kPointerSize)); | 2344 MemOperand(sp, 1 * kPointerSize)); |
| 2534 __ LoadP(LoadDescriptor::NameRegister(), MemOperand(sp, 0)); | 2345 __ LoadP(LoadDescriptor::NameRegister(), MemOperand(sp, 0)); |
| 2535 EmitKeyedPropertyLoad(prop); | 2346 EmitKeyedPropertyLoad(prop); |
| 2536 break; | 2347 break; |
| 2537 } | 2348 } |
| 2538 | 2349 |
| 2350 case NAMED_SUPER_PROPERTY: |
| 2351 case KEYED_SUPER_PROPERTY: |
| 2539 case VARIABLE: | 2352 case VARIABLE: |
| 2540 UNREACHABLE(); | 2353 UNREACHABLE(); |
| 2541 } | 2354 } |
| 2542 } | 2355 } |
| 2543 | 2356 |
| 2544 // We need a second deoptimization point after loading the value | 2357 // We need a second deoptimization point after loading the value |
| 2545 // in case evaluating the property load my have a side effect. | 2358 // in case evaluating the property load my have a side effect. |
| 2546 if (assign_type == VARIABLE) { | 2359 if (assign_type == VARIABLE) { |
| 2547 PrepareForBailout(expr->expression(), BailoutState::TOS_REGISTER); | 2360 PrepareForBailout(expr->expression(), BailoutState::TOS_REGISTER); |
| 2548 } else { | 2361 } else { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2564 // Save the result on the stack. If we have a named or keyed property | 2377 // Save the result on the stack. If we have a named or keyed property |
| 2565 // we store the result under the receiver that is currently on top | 2378 // we store the result under the receiver that is currently on top |
| 2566 // of the stack. | 2379 // of the stack. |
| 2567 switch (assign_type) { | 2380 switch (assign_type) { |
| 2568 case VARIABLE: | 2381 case VARIABLE: |
| 2569 __ push(r2); | 2382 __ push(r2); |
| 2570 break; | 2383 break; |
| 2571 case NAMED_PROPERTY: | 2384 case NAMED_PROPERTY: |
| 2572 __ StoreP(r2, MemOperand(sp, kPointerSize)); | 2385 __ StoreP(r2, MemOperand(sp, kPointerSize)); |
| 2573 break; | 2386 break; |
| 2574 case NAMED_SUPER_PROPERTY: | |
| 2575 __ StoreP(r2, MemOperand(sp, 2 * kPointerSize)); | |
| 2576 break; | |
| 2577 case KEYED_PROPERTY: | 2387 case KEYED_PROPERTY: |
| 2578 __ StoreP(r2, MemOperand(sp, 2 * kPointerSize)); | 2388 __ StoreP(r2, MemOperand(sp, 2 * kPointerSize)); |
| 2579 break; | 2389 break; |
| 2390 case NAMED_SUPER_PROPERTY: |
| 2580 case KEYED_SUPER_PROPERTY: | 2391 case KEYED_SUPER_PROPERTY: |
| 2581 __ StoreP(r2, MemOperand(sp, 3 * kPointerSize)); | 2392 UNREACHABLE(); |
| 2582 break; | 2393 break; |
| 2583 } | 2394 } |
| 2584 } | 2395 } |
| 2585 } | 2396 } |
| 2586 | 2397 |
| 2587 Register scratch1 = r3; | 2398 Register scratch1 = r3; |
| 2588 Register scratch2 = r4; | 2399 Register scratch2 = r4; |
| 2589 __ LoadSmiLiteral(scratch1, Smi::FromInt(count_value)); | 2400 __ LoadSmiLiteral(scratch1, Smi::FromInt(count_value)); |
| 2590 __ AddP(scratch2, r2, scratch1); | 2401 __ AddP(scratch2, r2, scratch1); |
| 2591 __ LoadOnConditionP(nooverflow, r2, scratch2); | 2402 __ LoadOnConditionP(nooverflow, r2, scratch2); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2606 // Save the result on the stack. If we have a named or keyed property | 2417 // Save the result on the stack. If we have a named or keyed property |
| 2607 // we store the result under the receiver that is currently on top | 2418 // we store the result under the receiver that is currently on top |
| 2608 // of the stack. | 2419 // of the stack. |
| 2609 switch (assign_type) { | 2420 switch (assign_type) { |
| 2610 case VARIABLE: | 2421 case VARIABLE: |
| 2611 PushOperand(r2); | 2422 PushOperand(r2); |
| 2612 break; | 2423 break; |
| 2613 case NAMED_PROPERTY: | 2424 case NAMED_PROPERTY: |
| 2614 __ StoreP(r2, MemOperand(sp, kPointerSize)); | 2425 __ StoreP(r2, MemOperand(sp, kPointerSize)); |
| 2615 break; | 2426 break; |
| 2616 case NAMED_SUPER_PROPERTY: | |
| 2617 __ StoreP(r2, MemOperand(sp, 2 * kPointerSize)); | |
| 2618 break; | |
| 2619 case KEYED_PROPERTY: | 2427 case KEYED_PROPERTY: |
| 2620 __ StoreP(r2, MemOperand(sp, 2 * kPointerSize)); | 2428 __ StoreP(r2, MemOperand(sp, 2 * kPointerSize)); |
| 2621 break; | 2429 break; |
| 2430 case NAMED_SUPER_PROPERTY: |
| 2622 case KEYED_SUPER_PROPERTY: | 2431 case KEYED_SUPER_PROPERTY: |
| 2623 __ StoreP(r2, MemOperand(sp, 3 * kPointerSize)); | 2432 UNREACHABLE(); |
| 2624 break; | 2433 break; |
| 2625 } | 2434 } |
| 2626 } | 2435 } |
| 2627 } | 2436 } |
| 2628 | 2437 |
| 2629 __ bind(&stub_call); | 2438 __ bind(&stub_call); |
| 2630 __ LoadRR(r3, r2); | 2439 __ LoadRR(r3, r2); |
| 2631 __ LoadSmiLiteral(r2, Smi::FromInt(count_value)); | 2440 __ LoadSmiLiteral(r2, Smi::FromInt(count_value)); |
| 2632 | 2441 |
| 2633 SetExpressionPosition(expr); | 2442 SetExpressionPosition(expr); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2670 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 2479 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
| 2671 if (expr->is_postfix()) { | 2480 if (expr->is_postfix()) { |
| 2672 if (!context()->IsEffect()) { | 2481 if (!context()->IsEffect()) { |
| 2673 context()->PlugTOS(); | 2482 context()->PlugTOS(); |
| 2674 } | 2483 } |
| 2675 } else { | 2484 } else { |
| 2676 context()->Plug(r2); | 2485 context()->Plug(r2); |
| 2677 } | 2486 } |
| 2678 break; | 2487 break; |
| 2679 } | 2488 } |
| 2680 case NAMED_SUPER_PROPERTY: { | |
| 2681 EmitNamedSuperPropertyStore(prop); | |
| 2682 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | |
| 2683 if (expr->is_postfix()) { | |
| 2684 if (!context()->IsEffect()) { | |
| 2685 context()->PlugTOS(); | |
| 2686 } | |
| 2687 } else { | |
| 2688 context()->Plug(r2); | |
| 2689 } | |
| 2690 break; | |
| 2691 } | |
| 2692 case KEYED_SUPER_PROPERTY: { | |
| 2693 EmitKeyedSuperPropertyStore(prop); | |
| 2694 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | |
| 2695 if (expr->is_postfix()) { | |
| 2696 if (!context()->IsEffect()) { | |
| 2697 context()->PlugTOS(); | |
| 2698 } | |
| 2699 } else { | |
| 2700 context()->Plug(r2); | |
| 2701 } | |
| 2702 break; | |
| 2703 } | |
| 2704 case KEYED_PROPERTY: { | 2489 case KEYED_PROPERTY: { |
| 2705 PopOperands(StoreDescriptor::ReceiverRegister(), | 2490 PopOperands(StoreDescriptor::ReceiverRegister(), |
| 2706 StoreDescriptor::NameRegister()); | 2491 StoreDescriptor::NameRegister()); |
| 2707 CallKeyedStoreIC(expr->CountSlot()); | 2492 CallKeyedStoreIC(expr->CountSlot()); |
| 2708 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 2493 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
| 2709 if (expr->is_postfix()) { | 2494 if (expr->is_postfix()) { |
| 2710 if (!context()->IsEffect()) { | 2495 if (!context()->IsEffect()) { |
| 2711 context()->PlugTOS(); | 2496 context()->PlugTOS(); |
| 2712 } | 2497 } |
| 2713 } else { | 2498 } else { |
| 2714 context()->Plug(r2); | 2499 context()->Plug(r2); |
| 2715 } | 2500 } |
| 2716 break; | 2501 break; |
| 2717 } | 2502 } |
| 2503 case NAMED_SUPER_PROPERTY: |
| 2504 case KEYED_SUPER_PROPERTY: |
| 2505 UNREACHABLE(); |
| 2506 break; |
| 2718 } | 2507 } |
| 2719 } | 2508 } |
| 2720 | 2509 |
| 2721 void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr, | 2510 void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr, |
| 2722 Expression* sub_expr, | 2511 Expression* sub_expr, |
| 2723 Handle<String> check) { | 2512 Handle<String> check) { |
| 2724 Label materialize_true, materialize_false; | 2513 Label materialize_true, materialize_false; |
| 2725 Label* if_true = NULL; | 2514 Label* if_true = NULL; |
| 2726 Label* if_false = NULL; | 2515 Label* if_false = NULL; |
| 2727 Label* fall_through = NULL; | 2516 Label* fall_through = NULL; |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3006 DCHECK(kOSRBranchInstruction == br_instr); | 2795 DCHECK(kOSRBranchInstruction == br_instr); |
| 3007 | 2796 |
| 3008 DCHECK(interrupt_address == | 2797 DCHECK(interrupt_address == |
| 3009 isolate->builtins()->OnStackReplacement()->entry()); | 2798 isolate->builtins()->OnStackReplacement()->entry()); |
| 3010 return ON_STACK_REPLACEMENT; | 2799 return ON_STACK_REPLACEMENT; |
| 3011 } | 2800 } |
| 3012 | 2801 |
| 3013 } // namespace internal | 2802 } // namespace internal |
| 3014 } // namespace v8 | 2803 } // namespace v8 |
| 3015 #endif // V8_TARGET_ARCH_S390 | 2804 #endif // V8_TARGET_ARCH_S390 |
| OLD | NEW |