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 #if V8_TARGET_ARCH_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 break; | 1380 break; |
1381 case NAMED_PROPERTY: | 1381 case NAMED_PROPERTY: |
1382 if (expr->is_compound()) { | 1382 if (expr->is_compound()) { |
1383 // We need the receiver both on the stack and in the register. | 1383 // We need the receiver both on the stack and in the register. |
1384 VisitForStackValue(property->obj()); | 1384 VisitForStackValue(property->obj()); |
1385 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 1385 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
1386 } else { | 1386 } else { |
1387 VisitForStackValue(property->obj()); | 1387 VisitForStackValue(property->obj()); |
1388 } | 1388 } |
1389 break; | 1389 break; |
1390 case NAMED_SUPER_PROPERTY: | |
1391 VisitForStackValue( | |
1392 property->obj()->AsSuperPropertyReference()->this_var()); | |
1393 VisitForAccumulatorValue( | |
1394 property->obj()->AsSuperPropertyReference()->home_object()); | |
1395 PushOperand(result_register()); | |
1396 if (expr->is_compound()) { | |
1397 const Register scratch = r4; | |
1398 __ LoadP(scratch, MemOperand(sp, kPointerSize)); | |
1399 PushOperands(scratch, result_register()); | |
1400 } | |
1401 break; | |
1402 case KEYED_SUPER_PROPERTY: { | |
1403 VisitForStackValue( | |
1404 property->obj()->AsSuperPropertyReference()->this_var()); | |
1405 VisitForStackValue( | |
1406 property->obj()->AsSuperPropertyReference()->home_object()); | |
1407 VisitForAccumulatorValue(property->key()); | |
1408 PushOperand(result_register()); | |
1409 if (expr->is_compound()) { | |
1410 const Register scratch1 = r5; | |
1411 const Register scratch2 = r4; | |
1412 __ LoadP(scratch1, MemOperand(sp, 2 * kPointerSize)); | |
1413 __ LoadP(scratch2, MemOperand(sp, 1 * kPointerSize)); | |
1414 PushOperands(scratch1, scratch2, result_register()); | |
1415 } | |
1416 break; | |
1417 } | |
1418 case KEYED_PROPERTY: | 1390 case KEYED_PROPERTY: |
1419 if (expr->is_compound()) { | 1391 if (expr->is_compound()) { |
1420 VisitForStackValue(property->obj()); | 1392 VisitForStackValue(property->obj()); |
1421 VisitForStackValue(property->key()); | 1393 VisitForStackValue(property->key()); |
1422 __ LoadP(LoadDescriptor::ReceiverRegister(), | 1394 __ LoadP(LoadDescriptor::ReceiverRegister(), |
1423 MemOperand(sp, 1 * kPointerSize)); | 1395 MemOperand(sp, 1 * kPointerSize)); |
1424 __ LoadP(LoadDescriptor::NameRegister(), MemOperand(sp, 0)); | 1396 __ LoadP(LoadDescriptor::NameRegister(), MemOperand(sp, 0)); |
1425 } else { | 1397 } else { |
1426 VisitForStackValue(property->obj()); | 1398 VisitForStackValue(property->obj()); |
1427 VisitForStackValue(property->key()); | 1399 VisitForStackValue(property->key()); |
1428 } | 1400 } |
1429 break; | 1401 break; |
| 1402 case NAMED_SUPER_PROPERTY: |
| 1403 case KEYED_SUPER_PROPERTY: |
| 1404 UNREACHABLE(); |
| 1405 break; |
1430 } | 1406 } |
1431 | 1407 |
1432 // For compound assignments we need another deoptimization point after the | 1408 // For compound assignments we need another deoptimization point after the |
1433 // variable/property load. | 1409 // variable/property load. |
1434 if (expr->is_compound()) { | 1410 if (expr->is_compound()) { |
1435 { | 1411 { |
1436 AccumulatorValueContext context(this); | 1412 AccumulatorValueContext context(this); |
1437 switch (assign_type) { | 1413 switch (assign_type) { |
1438 case VARIABLE: | 1414 case VARIABLE: |
1439 EmitVariableLoad(expr->target()->AsVariableProxy()); | 1415 EmitVariableLoad(expr->target()->AsVariableProxy()); |
1440 PrepareForBailout(expr->target(), BailoutState::TOS_REGISTER); | 1416 PrepareForBailout(expr->target(), BailoutState::TOS_REGISTER); |
1441 break; | 1417 break; |
1442 case NAMED_PROPERTY: | 1418 case NAMED_PROPERTY: |
1443 EmitNamedPropertyLoad(property); | 1419 EmitNamedPropertyLoad(property); |
1444 PrepareForBailoutForId(property->LoadId(), | 1420 PrepareForBailoutForId(property->LoadId(), |
1445 BailoutState::TOS_REGISTER); | 1421 BailoutState::TOS_REGISTER); |
1446 break; | 1422 break; |
1447 case NAMED_SUPER_PROPERTY: | |
1448 EmitNamedSuperPropertyLoad(property); | |
1449 PrepareForBailoutForId(property->LoadId(), | |
1450 BailoutState::TOS_REGISTER); | |
1451 break; | |
1452 case KEYED_SUPER_PROPERTY: | |
1453 EmitKeyedSuperPropertyLoad(property); | |
1454 PrepareForBailoutForId(property->LoadId(), | |
1455 BailoutState::TOS_REGISTER); | |
1456 break; | |
1457 case KEYED_PROPERTY: | 1423 case KEYED_PROPERTY: |
1458 EmitKeyedPropertyLoad(property); | 1424 EmitKeyedPropertyLoad(property); |
1459 PrepareForBailoutForId(property->LoadId(), | 1425 PrepareForBailoutForId(property->LoadId(), |
1460 BailoutState::TOS_REGISTER); | 1426 BailoutState::TOS_REGISTER); |
1461 break; | 1427 break; |
| 1428 case NAMED_SUPER_PROPERTY: |
| 1429 case KEYED_SUPER_PROPERTY: |
| 1430 UNREACHABLE(); |
| 1431 break; |
1462 } | 1432 } |
1463 } | 1433 } |
1464 | 1434 |
1465 Token::Value op = expr->binary_op(); | 1435 Token::Value op = expr->binary_op(); |
1466 PushOperand(r3); // Left operand goes on the stack. | 1436 PushOperand(r3); // Left operand goes on the stack. |
1467 VisitForAccumulatorValue(expr->value()); | 1437 VisitForAccumulatorValue(expr->value()); |
1468 | 1438 |
1469 AccumulatorValueContext context(this); | 1439 AccumulatorValueContext context(this); |
1470 if (ShouldInlineSmiCase(op)) { | 1440 if (ShouldInlineSmiCase(op)) { |
1471 EmitInlineSmiBinaryOp(expr->binary_operation(), op, expr->target(), | 1441 EmitInlineSmiBinaryOp(expr->binary_operation(), op, expr->target(), |
(...skipping 16 matching lines...) Expand all Loading... |
1488 VariableProxy* proxy = expr->target()->AsVariableProxy(); | 1458 VariableProxy* proxy = expr->target()->AsVariableProxy(); |
1489 EmitVariableAssignment(proxy->var(), expr->op(), expr->AssignmentSlot(), | 1459 EmitVariableAssignment(proxy->var(), expr->op(), expr->AssignmentSlot(), |
1490 proxy->hole_check_mode()); | 1460 proxy->hole_check_mode()); |
1491 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 1461 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
1492 context()->Plug(r3); | 1462 context()->Plug(r3); |
1493 break; | 1463 break; |
1494 } | 1464 } |
1495 case NAMED_PROPERTY: | 1465 case NAMED_PROPERTY: |
1496 EmitNamedPropertyAssignment(expr); | 1466 EmitNamedPropertyAssignment(expr); |
1497 break; | 1467 break; |
1498 case NAMED_SUPER_PROPERTY: | |
1499 EmitNamedSuperPropertyStore(property); | |
1500 context()->Plug(r3); | |
1501 break; | |
1502 case KEYED_SUPER_PROPERTY: | |
1503 EmitKeyedSuperPropertyStore(property); | |
1504 context()->Plug(r3); | |
1505 break; | |
1506 case KEYED_PROPERTY: | 1468 case KEYED_PROPERTY: |
1507 EmitKeyedPropertyAssignment(expr); | 1469 EmitKeyedPropertyAssignment(expr); |
1508 break; | 1470 break; |
| 1471 case NAMED_SUPER_PROPERTY: |
| 1472 case KEYED_SUPER_PROPERTY: |
| 1473 UNREACHABLE(); |
| 1474 break; |
1509 } | 1475 } |
1510 } | 1476 } |
1511 | 1477 |
1512 | 1478 |
1513 void FullCodeGenerator::VisitYield(Yield* expr) { | 1479 void FullCodeGenerator::VisitYield(Yield* expr) { |
1514 // Resumable functions are not supported. | 1480 // Resumable functions are not supported. |
1515 UNREACHABLE(); | 1481 UNREACHABLE(); |
1516 } | 1482 } |
1517 | 1483 |
1518 void FullCodeGenerator::PushOperands(Register reg1, Register reg2) { | 1484 void FullCodeGenerator::PushOperands(Register reg1, Register reg2) { |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1723 break; | 1689 break; |
1724 } | 1690 } |
1725 case NAMED_PROPERTY: { | 1691 case NAMED_PROPERTY: { |
1726 PushOperand(r3); // Preserve value. | 1692 PushOperand(r3); // Preserve value. |
1727 VisitForAccumulatorValue(prop->obj()); | 1693 VisitForAccumulatorValue(prop->obj()); |
1728 __ Move(StoreDescriptor::ReceiverRegister(), r3); | 1694 __ Move(StoreDescriptor::ReceiverRegister(), r3); |
1729 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. | 1695 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. |
1730 CallStoreIC(slot, prop->key()->AsLiteral()->value()); | 1696 CallStoreIC(slot, prop->key()->AsLiteral()->value()); |
1731 break; | 1697 break; |
1732 } | 1698 } |
1733 case NAMED_SUPER_PROPERTY: { | |
1734 PushOperand(r3); | |
1735 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | |
1736 VisitForAccumulatorValue( | |
1737 prop->obj()->AsSuperPropertyReference()->home_object()); | |
1738 // stack: value, this; r3: home_object | |
1739 Register scratch = r5; | |
1740 Register scratch2 = r6; | |
1741 __ mr(scratch, result_register()); // home_object | |
1742 __ LoadP(r3, MemOperand(sp, kPointerSize)); // value | |
1743 __ LoadP(scratch2, MemOperand(sp, 0)); // this | |
1744 __ StoreP(scratch2, MemOperand(sp, kPointerSize)); // this | |
1745 __ StoreP(scratch, MemOperand(sp, 0)); // home_object | |
1746 // stack: this, home_object; r3: value | |
1747 EmitNamedSuperPropertyStore(prop); | |
1748 break; | |
1749 } | |
1750 case KEYED_SUPER_PROPERTY: { | |
1751 PushOperand(r3); | |
1752 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | |
1753 VisitForStackValue( | |
1754 prop->obj()->AsSuperPropertyReference()->home_object()); | |
1755 VisitForAccumulatorValue(prop->key()); | |
1756 Register scratch = r5; | |
1757 Register scratch2 = r6; | |
1758 __ LoadP(scratch2, MemOperand(sp, 2 * kPointerSize)); // value | |
1759 // stack: value, this, home_object; r3: key, r6: value | |
1760 __ LoadP(scratch, MemOperand(sp, kPointerSize)); // this | |
1761 __ StoreP(scratch, MemOperand(sp, 2 * kPointerSize)); | |
1762 __ LoadP(scratch, MemOperand(sp, 0)); // home_object | |
1763 __ StoreP(scratch, MemOperand(sp, kPointerSize)); | |
1764 __ StoreP(r3, MemOperand(sp, 0)); | |
1765 __ Move(r3, scratch2); | |
1766 // stack: this, home_object, key; r3: value. | |
1767 EmitKeyedSuperPropertyStore(prop); | |
1768 break; | |
1769 } | |
1770 case KEYED_PROPERTY: { | 1699 case KEYED_PROPERTY: { |
1771 PushOperand(r3); // Preserve value. | 1700 PushOperand(r3); // Preserve value. |
1772 VisitForStackValue(prop->obj()); | 1701 VisitForStackValue(prop->obj()); |
1773 VisitForAccumulatorValue(prop->key()); | 1702 VisitForAccumulatorValue(prop->key()); |
1774 __ Move(StoreDescriptor::NameRegister(), r3); | 1703 __ Move(StoreDescriptor::NameRegister(), r3); |
1775 PopOperands(StoreDescriptor::ValueRegister(), | 1704 PopOperands(StoreDescriptor::ValueRegister(), |
1776 StoreDescriptor::ReceiverRegister()); | 1705 StoreDescriptor::ReceiverRegister()); |
1777 CallKeyedStoreIC(slot); | 1706 CallKeyedStoreIC(slot); |
1778 break; | 1707 break; |
1779 } | 1708 } |
| 1709 case NAMED_SUPER_PROPERTY: |
| 1710 case KEYED_SUPER_PROPERTY: |
| 1711 UNREACHABLE(); |
| 1712 break; |
1780 } | 1713 } |
1781 context()->Plug(r3); | 1714 context()->Plug(r3); |
1782 } | 1715 } |
1783 | 1716 |
1784 | 1717 |
1785 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( | 1718 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( |
1786 Variable* var, MemOperand location) { | 1719 Variable* var, MemOperand location) { |
1787 __ StoreP(result_register(), location, r0); | 1720 __ StoreP(result_register(), location, r0); |
1788 if (var->IsContextSlot()) { | 1721 if (var->IsContextSlot()) { |
1789 // RecordWrite may destroy all its register arguments. | 1722 // RecordWrite may destroy all its register arguments. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1861 DCHECK(prop->key()->IsLiteral()); | 1794 DCHECK(prop->key()->IsLiteral()); |
1862 | 1795 |
1863 PopOperand(StoreDescriptor::ReceiverRegister()); | 1796 PopOperand(StoreDescriptor::ReceiverRegister()); |
1864 CallStoreIC(expr->AssignmentSlot(), prop->key()->AsLiteral()->value()); | 1797 CallStoreIC(expr->AssignmentSlot(), prop->key()->AsLiteral()->value()); |
1865 | 1798 |
1866 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 1799 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
1867 context()->Plug(r3); | 1800 context()->Plug(r3); |
1868 } | 1801 } |
1869 | 1802 |
1870 | 1803 |
1871 void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) { | |
1872 // Assignment to named property of super. | |
1873 // r3 : value | |
1874 // stack : receiver ('this'), home_object | |
1875 DCHECK(prop != NULL); | |
1876 Literal* key = prop->key()->AsLiteral(); | |
1877 DCHECK(key != NULL); | |
1878 | |
1879 PushOperand(key->value()); | |
1880 PushOperand(r3); | |
1881 CallRuntimeWithOperands((is_strict(language_mode()) | |
1882 ? Runtime::kStoreToSuper_Strict | |
1883 : Runtime::kStoreToSuper_Sloppy)); | |
1884 } | |
1885 | |
1886 | |
1887 void FullCodeGenerator::EmitKeyedSuperPropertyStore(Property* prop) { | |
1888 // Assignment to named property of super. | |
1889 // r3 : value | |
1890 // stack : receiver ('this'), home_object, key | |
1891 DCHECK(prop != NULL); | |
1892 | |
1893 PushOperand(r3); | |
1894 CallRuntimeWithOperands((is_strict(language_mode()) | |
1895 ? Runtime::kStoreKeyedToSuper_Strict | |
1896 : Runtime::kStoreKeyedToSuper_Sloppy)); | |
1897 } | |
1898 | |
1899 | |
1900 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { | 1804 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
1901 // Assignment to a property, using a keyed store IC. | 1805 // Assignment to a property, using a keyed store IC. |
1902 PopOperands(StoreDescriptor::ReceiverRegister(), | 1806 PopOperands(StoreDescriptor::ReceiverRegister(), |
1903 StoreDescriptor::NameRegister()); | 1807 StoreDescriptor::NameRegister()); |
1904 DCHECK(StoreDescriptor::ValueRegister().is(r3)); | 1808 DCHECK(StoreDescriptor::ValueRegister().is(r3)); |
1905 | 1809 |
1906 CallKeyedStoreIC(expr->AssignmentSlot()); | 1810 CallKeyedStoreIC(expr->AssignmentSlot()); |
1907 | 1811 |
1908 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 1812 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
1909 context()->Plug(r3); | 1813 context()->Plug(r3); |
(...skipping 28 matching lines...) Expand all Loading... |
1938 __ LoadP(r0, MemOperand(sp, 0)); | 1842 __ LoadP(r0, MemOperand(sp, 0)); |
1939 PushOperand(r0); | 1843 PushOperand(r0); |
1940 __ StoreP(r3, MemOperand(sp, kPointerSize)); | 1844 __ StoreP(r3, MemOperand(sp, kPointerSize)); |
1941 convert_mode = ConvertReceiverMode::kNotNullOrUndefined; | 1845 convert_mode = ConvertReceiverMode::kNotNullOrUndefined; |
1942 } | 1846 } |
1943 | 1847 |
1944 EmitCall(expr, convert_mode); | 1848 EmitCall(expr, convert_mode); |
1945 } | 1849 } |
1946 | 1850 |
1947 | 1851 |
1948 void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { | |
1949 Expression* callee = expr->expression(); | |
1950 DCHECK(callee->IsProperty()); | |
1951 Property* prop = callee->AsProperty(); | |
1952 DCHECK(prop->IsSuperAccess()); | |
1953 SetExpressionPosition(prop); | |
1954 | |
1955 Literal* key = prop->key()->AsLiteral(); | |
1956 DCHECK(!key->value()->IsSmi()); | |
1957 // Load the function from the receiver. | |
1958 const Register scratch = r4; | |
1959 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | |
1960 VisitForAccumulatorValue(super_ref->home_object()); | |
1961 __ mr(scratch, r3); | |
1962 VisitForAccumulatorValue(super_ref->this_var()); | |
1963 PushOperands(scratch, r3, r3, scratch); | |
1964 PushOperand(key->value()); | |
1965 | |
1966 // Stack here: | |
1967 // - home_object | |
1968 // - this (receiver) | |
1969 // - this (receiver) <-- LoadFromSuper will pop here and below. | |
1970 // - home_object | |
1971 // - key | |
1972 CallRuntimeWithOperands(Runtime::kLoadFromSuper); | |
1973 PrepareForBailoutForId(prop->LoadId(), BailoutState::TOS_REGISTER); | |
1974 | |
1975 // Replace home_object with target function. | |
1976 __ StoreP(r3, MemOperand(sp, kPointerSize)); | |
1977 | |
1978 // Stack here: | |
1979 // - target function | |
1980 // - this (receiver) | |
1981 EmitCall(expr); | |
1982 } | |
1983 | |
1984 | |
1985 // Code common for calls using the IC. | 1852 // Code common for calls using the IC. |
1986 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, Expression* key) { | 1853 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, Expression* key) { |
1987 // Load the key. | 1854 // Load the key. |
1988 VisitForAccumulatorValue(key); | 1855 VisitForAccumulatorValue(key); |
1989 | 1856 |
1990 Expression* callee = expr->expression(); | 1857 Expression* callee = expr->expression(); |
1991 | 1858 |
1992 // Load the function from the receiver. | 1859 // Load the function from the receiver. |
1993 DCHECK(callee->IsProperty()); | 1860 DCHECK(callee->IsProperty()); |
1994 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 1861 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
1995 __ Move(LoadDescriptor::NameRegister(), r3); | 1862 __ Move(LoadDescriptor::NameRegister(), r3); |
1996 EmitKeyedPropertyLoad(callee->AsProperty()); | 1863 EmitKeyedPropertyLoad(callee->AsProperty()); |
1997 PrepareForBailoutForId(callee->AsProperty()->LoadId(), | 1864 PrepareForBailoutForId(callee->AsProperty()->LoadId(), |
1998 BailoutState::TOS_REGISTER); | 1865 BailoutState::TOS_REGISTER); |
1999 | 1866 |
2000 // Push the target function under the receiver. | 1867 // Push the target function under the receiver. |
2001 __ LoadP(ip, MemOperand(sp, 0)); | 1868 __ LoadP(ip, MemOperand(sp, 0)); |
2002 PushOperand(ip); | 1869 PushOperand(ip); |
2003 __ StoreP(r3, MemOperand(sp, kPointerSize)); | 1870 __ StoreP(r3, MemOperand(sp, kPointerSize)); |
2004 | 1871 |
2005 EmitCall(expr, ConvertReceiverMode::kNotNullOrUndefined); | 1872 EmitCall(expr, ConvertReceiverMode::kNotNullOrUndefined); |
2006 } | 1873 } |
2007 | 1874 |
2008 | 1875 |
2009 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { | |
2010 Expression* callee = expr->expression(); | |
2011 DCHECK(callee->IsProperty()); | |
2012 Property* prop = callee->AsProperty(); | |
2013 DCHECK(prop->IsSuperAccess()); | |
2014 | |
2015 SetExpressionPosition(prop); | |
2016 // Load the function from the receiver. | |
2017 const Register scratch = r4; | |
2018 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | |
2019 VisitForAccumulatorValue(super_ref->home_object()); | |
2020 __ mr(scratch, r3); | |
2021 VisitForAccumulatorValue(super_ref->this_var()); | |
2022 PushOperands(scratch, r3, r3, scratch); | |
2023 VisitForStackValue(prop->key()); | |
2024 | |
2025 // Stack here: | |
2026 // - home_object | |
2027 // - this (receiver) | |
2028 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. | |
2029 // - home_object | |
2030 // - key | |
2031 CallRuntimeWithOperands(Runtime::kLoadKeyedFromSuper); | |
2032 PrepareForBailoutForId(prop->LoadId(), BailoutState::TOS_REGISTER); | |
2033 | |
2034 // Replace home_object with target function. | |
2035 __ StoreP(r3, MemOperand(sp, kPointerSize)); | |
2036 | |
2037 // Stack here: | |
2038 // - target function | |
2039 // - this (receiver) | |
2040 EmitCall(expr); | |
2041 } | |
2042 | |
2043 | |
2044 void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { | 1876 void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { |
2045 // Load the arguments. | 1877 // Load the arguments. |
2046 ZoneList<Expression*>* args = expr->arguments(); | 1878 ZoneList<Expression*>* args = expr->arguments(); |
2047 int arg_count = args->length(); | 1879 int arg_count = args->length(); |
2048 for (int i = 0; i < arg_count; i++) { | 1880 for (int i = 0; i < arg_count; i++) { |
2049 VisitForStackValue(args->at(i)); | 1881 VisitForStackValue(args->at(i)); |
2050 } | 1882 } |
2051 | 1883 |
2052 PrepareForBailoutForId(expr->CallId(), BailoutState::NO_REGISTERS); | 1884 PrepareForBailoutForId(expr->CallId(), BailoutState::NO_REGISTERS); |
2053 SetCallPosition(expr, expr->tail_call_mode()); | 1885 SetCallPosition(expr, expr->tail_call_mode()); |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2557 } | 2389 } |
2558 switch (assign_type) { | 2390 switch (assign_type) { |
2559 case NAMED_PROPERTY: { | 2391 case NAMED_PROPERTY: { |
2560 // Put the object both on the stack and in the register. | 2392 // Put the object both on the stack and in the register. |
2561 VisitForStackValue(prop->obj()); | 2393 VisitForStackValue(prop->obj()); |
2562 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 2394 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
2563 EmitNamedPropertyLoad(prop); | 2395 EmitNamedPropertyLoad(prop); |
2564 break; | 2396 break; |
2565 } | 2397 } |
2566 | 2398 |
2567 case NAMED_SUPER_PROPERTY: { | |
2568 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | |
2569 VisitForAccumulatorValue( | |
2570 prop->obj()->AsSuperPropertyReference()->home_object()); | |
2571 const Register scratch = r4; | |
2572 __ LoadP(scratch, MemOperand(sp, 0)); // this | |
2573 PushOperands(result_register(), scratch, result_register()); | |
2574 EmitNamedSuperPropertyLoad(prop); | |
2575 break; | |
2576 } | |
2577 | |
2578 case KEYED_SUPER_PROPERTY: { | |
2579 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | |
2580 VisitForStackValue( | |
2581 prop->obj()->AsSuperPropertyReference()->home_object()); | |
2582 VisitForAccumulatorValue(prop->key()); | |
2583 const Register scratch1 = r4; | |
2584 const Register scratch2 = r5; | |
2585 __ LoadP(scratch1, MemOperand(sp, 1 * kPointerSize)); // this | |
2586 __ LoadP(scratch2, MemOperand(sp, 0 * kPointerSize)); // home object | |
2587 PushOperands(result_register(), scratch1, scratch2, result_register()); | |
2588 EmitKeyedSuperPropertyLoad(prop); | |
2589 break; | |
2590 } | |
2591 | |
2592 case KEYED_PROPERTY: { | 2399 case KEYED_PROPERTY: { |
2593 VisitForStackValue(prop->obj()); | 2400 VisitForStackValue(prop->obj()); |
2594 VisitForStackValue(prop->key()); | 2401 VisitForStackValue(prop->key()); |
2595 __ LoadP(LoadDescriptor::ReceiverRegister(), | 2402 __ LoadP(LoadDescriptor::ReceiverRegister(), |
2596 MemOperand(sp, 1 * kPointerSize)); | 2403 MemOperand(sp, 1 * kPointerSize)); |
2597 __ LoadP(LoadDescriptor::NameRegister(), MemOperand(sp, 0)); | 2404 __ LoadP(LoadDescriptor::NameRegister(), MemOperand(sp, 0)); |
2598 EmitKeyedPropertyLoad(prop); | 2405 EmitKeyedPropertyLoad(prop); |
2599 break; | 2406 break; |
2600 } | 2407 } |
2601 | 2408 |
| 2409 case NAMED_SUPER_PROPERTY: |
| 2410 case KEYED_SUPER_PROPERTY: |
2602 case VARIABLE: | 2411 case VARIABLE: |
2603 UNREACHABLE(); | 2412 UNREACHABLE(); |
2604 } | 2413 } |
2605 } | 2414 } |
2606 | 2415 |
2607 // We need a second deoptimization point after loading the value | 2416 // We need a second deoptimization point after loading the value |
2608 // in case evaluating the property load my have a side effect. | 2417 // in case evaluating the property load my have a side effect. |
2609 if (assign_type == VARIABLE) { | 2418 if (assign_type == VARIABLE) { |
2610 PrepareForBailout(expr->expression(), BailoutState::TOS_REGISTER); | 2419 PrepareForBailout(expr->expression(), BailoutState::TOS_REGISTER); |
2611 } else { | 2420 } else { |
(...skipping 15 matching lines...) Expand all Loading... |
2627 // Save the result on the stack. If we have a named or keyed property | 2436 // Save the result on the stack. If we have a named or keyed property |
2628 // we store the result under the receiver that is currently on top | 2437 // we store the result under the receiver that is currently on top |
2629 // of the stack. | 2438 // of the stack. |
2630 switch (assign_type) { | 2439 switch (assign_type) { |
2631 case VARIABLE: | 2440 case VARIABLE: |
2632 __ push(r3); | 2441 __ push(r3); |
2633 break; | 2442 break; |
2634 case NAMED_PROPERTY: | 2443 case NAMED_PROPERTY: |
2635 __ StoreP(r3, MemOperand(sp, kPointerSize)); | 2444 __ StoreP(r3, MemOperand(sp, kPointerSize)); |
2636 break; | 2445 break; |
2637 case NAMED_SUPER_PROPERTY: | |
2638 __ StoreP(r3, MemOperand(sp, 2 * kPointerSize)); | |
2639 break; | |
2640 case KEYED_PROPERTY: | 2446 case KEYED_PROPERTY: |
2641 __ StoreP(r3, MemOperand(sp, 2 * kPointerSize)); | 2447 __ StoreP(r3, MemOperand(sp, 2 * kPointerSize)); |
2642 break; | 2448 break; |
| 2449 case NAMED_SUPER_PROPERTY: |
2643 case KEYED_SUPER_PROPERTY: | 2450 case KEYED_SUPER_PROPERTY: |
2644 __ StoreP(r3, MemOperand(sp, 3 * kPointerSize)); | 2451 UNREACHABLE(); |
2645 break; | 2452 break; |
2646 } | 2453 } |
2647 } | 2454 } |
2648 } | 2455 } |
2649 | 2456 |
2650 Register scratch1 = r4; | 2457 Register scratch1 = r4; |
2651 Register scratch2 = r5; | 2458 Register scratch2 = r5; |
2652 __ LoadSmiLiteral(scratch1, Smi::FromInt(count_value)); | 2459 __ LoadSmiLiteral(scratch1, Smi::FromInt(count_value)); |
2653 __ AddAndCheckForOverflow(r3, r3, scratch1, scratch2, r0); | 2460 __ AddAndCheckForOverflow(r3, r3, scratch1, scratch2, r0); |
2654 __ BranchOnNoOverflow(&done); | 2461 __ BranchOnNoOverflow(&done); |
(...skipping 14 matching lines...) Expand all Loading... |
2669 // Save the result on the stack. If we have a named or keyed property | 2476 // Save the result on the stack. If we have a named or keyed property |
2670 // we store the result under the receiver that is currently on top | 2477 // we store the result under the receiver that is currently on top |
2671 // of the stack. | 2478 // of the stack. |
2672 switch (assign_type) { | 2479 switch (assign_type) { |
2673 case VARIABLE: | 2480 case VARIABLE: |
2674 PushOperand(r3); | 2481 PushOperand(r3); |
2675 break; | 2482 break; |
2676 case NAMED_PROPERTY: | 2483 case NAMED_PROPERTY: |
2677 __ StoreP(r3, MemOperand(sp, kPointerSize)); | 2484 __ StoreP(r3, MemOperand(sp, kPointerSize)); |
2678 break; | 2485 break; |
2679 case NAMED_SUPER_PROPERTY: | |
2680 __ StoreP(r3, MemOperand(sp, 2 * kPointerSize)); | |
2681 break; | |
2682 case KEYED_PROPERTY: | 2486 case KEYED_PROPERTY: |
2683 __ StoreP(r3, MemOperand(sp, 2 * kPointerSize)); | 2487 __ StoreP(r3, MemOperand(sp, 2 * kPointerSize)); |
2684 break; | 2488 break; |
| 2489 case NAMED_SUPER_PROPERTY: |
2685 case KEYED_SUPER_PROPERTY: | 2490 case KEYED_SUPER_PROPERTY: |
2686 __ StoreP(r3, MemOperand(sp, 3 * kPointerSize)); | 2491 UNREACHABLE(); |
2687 break; | 2492 break; |
2688 } | 2493 } |
2689 } | 2494 } |
2690 } | 2495 } |
2691 | 2496 |
2692 __ bind(&stub_call); | 2497 __ bind(&stub_call); |
2693 __ mr(r4, r3); | 2498 __ mr(r4, r3); |
2694 __ LoadSmiLiteral(r3, Smi::FromInt(count_value)); | 2499 __ LoadSmiLiteral(r3, Smi::FromInt(count_value)); |
2695 | 2500 |
2696 SetExpressionPosition(expr); | 2501 SetExpressionPosition(expr); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2733 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 2538 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
2734 if (expr->is_postfix()) { | 2539 if (expr->is_postfix()) { |
2735 if (!context()->IsEffect()) { | 2540 if (!context()->IsEffect()) { |
2736 context()->PlugTOS(); | 2541 context()->PlugTOS(); |
2737 } | 2542 } |
2738 } else { | 2543 } else { |
2739 context()->Plug(r3); | 2544 context()->Plug(r3); |
2740 } | 2545 } |
2741 break; | 2546 break; |
2742 } | 2547 } |
2743 case NAMED_SUPER_PROPERTY: { | |
2744 EmitNamedSuperPropertyStore(prop); | |
2745 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | |
2746 if (expr->is_postfix()) { | |
2747 if (!context()->IsEffect()) { | |
2748 context()->PlugTOS(); | |
2749 } | |
2750 } else { | |
2751 context()->Plug(r3); | |
2752 } | |
2753 break; | |
2754 } | |
2755 case KEYED_SUPER_PROPERTY: { | |
2756 EmitKeyedSuperPropertyStore(prop); | |
2757 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | |
2758 if (expr->is_postfix()) { | |
2759 if (!context()->IsEffect()) { | |
2760 context()->PlugTOS(); | |
2761 } | |
2762 } else { | |
2763 context()->Plug(r3); | |
2764 } | |
2765 break; | |
2766 } | |
2767 case KEYED_PROPERTY: { | 2548 case KEYED_PROPERTY: { |
2768 PopOperands(StoreDescriptor::ReceiverRegister(), | 2549 PopOperands(StoreDescriptor::ReceiverRegister(), |
2769 StoreDescriptor::NameRegister()); | 2550 StoreDescriptor::NameRegister()); |
2770 CallKeyedStoreIC(expr->CountSlot()); | 2551 CallKeyedStoreIC(expr->CountSlot()); |
2771 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 2552 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
2772 if (expr->is_postfix()) { | 2553 if (expr->is_postfix()) { |
2773 if (!context()->IsEffect()) { | 2554 if (!context()->IsEffect()) { |
2774 context()->PlugTOS(); | 2555 context()->PlugTOS(); |
2775 } | 2556 } |
2776 } else { | 2557 } else { |
2777 context()->Plug(r3); | 2558 context()->Plug(r3); |
2778 } | 2559 } |
2779 break; | 2560 break; |
2780 } | 2561 } |
| 2562 case NAMED_SUPER_PROPERTY: |
| 2563 case KEYED_SUPER_PROPERTY: |
| 2564 UNREACHABLE(); |
| 2565 break; |
2781 } | 2566 } |
2782 } | 2567 } |
2783 | 2568 |
2784 | 2569 |
2785 void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr, | 2570 void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr, |
2786 Expression* sub_expr, | 2571 Expression* sub_expr, |
2787 Handle<String> check) { | 2572 Handle<String> check) { |
2788 Label materialize_true, materialize_false; | 2573 Label materialize_true, materialize_false; |
2789 Label* if_true = NULL; | 2574 Label* if_true = NULL; |
2790 Label* if_false = NULL; | 2575 Label* if_false = NULL; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3073 | 2858 |
3074 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); | 2859 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); |
3075 | 2860 |
3076 DCHECK(interrupt_address == | 2861 DCHECK(interrupt_address == |
3077 isolate->builtins()->OnStackReplacement()->entry()); | 2862 isolate->builtins()->OnStackReplacement()->entry()); |
3078 return ON_STACK_REPLACEMENT; | 2863 return ON_STACK_REPLACEMENT; |
3079 } | 2864 } |
3080 } // namespace internal | 2865 } // namespace internal |
3081 } // namespace v8 | 2866 } // namespace v8 |
3082 #endif // V8_TARGET_ARCH_PPC | 2867 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |