| 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/codegen.h" | 7 #include "src/codegen.h" |
| 8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
| (...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1688 // -- r3 : the number of arguments (not including the receiver) | 1688 // -- r3 : the number of arguments (not including the receiver) |
| 1689 // -- r4 : the target to call (can be any Object). | 1689 // -- r4 : the target to call (can be any Object). |
| 1690 // ----------------------------------- | 1690 // ----------------------------------- |
| 1691 | 1691 |
| 1692 Label non_callable, non_function, non_smi; | 1692 Label non_callable, non_function, non_smi; |
| 1693 __ JumpIfSmi(r4, &non_callable); | 1693 __ JumpIfSmi(r4, &non_callable); |
| 1694 __ bind(&non_smi); | 1694 __ bind(&non_smi); |
| 1695 __ CompareObjectType(r4, r7, r8, JS_FUNCTION_TYPE); | 1695 __ CompareObjectType(r4, r7, r8, JS_FUNCTION_TYPE); |
| 1696 __ Jump(masm->isolate()->builtins()->CallFunction(mode), | 1696 __ Jump(masm->isolate()->builtins()->CallFunction(mode), |
| 1697 RelocInfo::CODE_TARGET, eq); | 1697 RelocInfo::CODE_TARGET, eq); |
| 1698 __ cmpi(r8, Operand(JS_FUNCTION_PROXY_TYPE)); | 1698 __ cmpi(r8, Operand(JS_PROXY_TYPE)); |
| 1699 __ bne(&non_function); | 1699 __ bne(&non_function); |
| 1700 | 1700 |
| 1701 // 1. Call to function proxy. | 1701 // 1. Call to function proxy. |
| 1702 // TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies. | 1702 // TODO(neis): Implement [[Call]] on proxies. |
| 1703 __ LoadP(r4, FieldMemOperand(r4, JSFunctionProxy::kCallTrapOffset)); | |
| 1704 __ AssertNotSmi(r4); | |
| 1705 __ b(&non_smi); | |
| 1706 | 1703 |
| 1707 // 2. Call to something else, which might have a [[Call]] internal method (if | 1704 // 2. Call to something else, which might have a [[Call]] internal method (if |
| 1708 // not we raise an exception). | 1705 // not we raise an exception). |
| 1709 __ bind(&non_function); | 1706 __ bind(&non_function); |
| 1710 // Check if target has a [[Call]] internal method. | 1707 // Check if target has a [[Call]] internal method. |
| 1711 __ lbz(r7, FieldMemOperand(r7, Map::kBitFieldOffset)); | 1708 __ lbz(r7, FieldMemOperand(r7, Map::kBitFieldOffset)); |
| 1712 __ TestBit(r7, Map::kIsCallable, r0); | 1709 __ TestBit(r7, Map::kIsCallable, r0); |
| 1713 __ beq(&non_callable, cr0); | 1710 __ beq(&non_callable, cr0); |
| 1714 // Overwrite the original receiver the (original) target. | 1711 // Overwrite the original receiver the (original) target. |
| 1715 __ ShiftLeftImm(r8, r3, Operand(kPointerSizeLog2)); | 1712 __ ShiftLeftImm(r8, r3, Operand(kPointerSizeLog2)); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1749 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kConstructStubOffset)); | 1746 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kConstructStubOffset)); |
| 1750 __ addi(ip, r7, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1747 __ addi(ip, r7, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1751 __ JumpToJSEntry(ip); | 1748 __ JumpToJSEntry(ip); |
| 1752 } | 1749 } |
| 1753 | 1750 |
| 1754 | 1751 |
| 1755 // static | 1752 // static |
| 1756 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { | 1753 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { |
| 1757 // ----------- S t a t e ------------- | 1754 // ----------- S t a t e ------------- |
| 1758 // -- r3 : the number of arguments (not including the receiver) | 1755 // -- r3 : the number of arguments (not including the receiver) |
| 1759 // -- r4 : the constructor to call (checked to be a JSFunctionProxy) | 1756 // -- r4 : the constructor to call (checked to be a JSProxy) |
| 1760 // -- r6 : the new target (either the same as the constructor or | 1757 // -- r6 : the new target (either the same as the constructor or |
| 1761 // the JSFunction on which new was invoked initially) | 1758 // the JSFunction on which new was invoked initially) |
| 1762 // ----------------------------------- | 1759 // ----------------------------------- |
| 1763 | 1760 |
| 1764 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. | 1761 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. |
| 1765 __ LoadP(r4, FieldMemOperand(r4, JSFunctionProxy::kConstructTrapOffset)); | |
| 1766 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1762 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 1767 } | 1763 } |
| 1768 | 1764 |
| 1769 | 1765 |
| 1770 // static | 1766 // static |
| 1771 void Builtins::Generate_Construct(MacroAssembler* masm) { | 1767 void Builtins::Generate_Construct(MacroAssembler* masm) { |
| 1772 // ----------- S t a t e ------------- | 1768 // ----------- S t a t e ------------- |
| 1773 // -- r3 : the number of arguments (not including the receiver) | 1769 // -- r3 : the number of arguments (not including the receiver) |
| 1774 // -- r4 : the constructor to call (can be any Object) | 1770 // -- r4 : the constructor to call (can be any Object) |
| 1775 // -- r6 : the new target (either the same as the constructor or | 1771 // -- r6 : the new target (either the same as the constructor or |
| 1776 // the JSFunction on which new was invoked initially) | 1772 // the JSFunction on which new was invoked initially) |
| 1777 // ----------------------------------- | 1773 // ----------------------------------- |
| 1778 | 1774 |
| 1779 // Check if target is a Smi. | 1775 // Check if target is a Smi. |
| 1780 Label non_constructor; | 1776 Label non_constructor; |
| 1781 __ JumpIfSmi(r4, &non_constructor); | 1777 __ JumpIfSmi(r4, &non_constructor); |
| 1782 | 1778 |
| 1783 // Dispatch based on instance type. | 1779 // Dispatch based on instance type. |
| 1784 __ CompareObjectType(r4, r7, r8, JS_FUNCTION_TYPE); | 1780 __ CompareObjectType(r4, r7, r8, JS_FUNCTION_TYPE); |
| 1785 __ Jump(masm->isolate()->builtins()->ConstructFunction(), | 1781 __ Jump(masm->isolate()->builtins()->ConstructFunction(), |
| 1786 RelocInfo::CODE_TARGET, eq); | 1782 RelocInfo::CODE_TARGET, eq); |
| 1787 __ cmpi(r8, Operand(JS_FUNCTION_PROXY_TYPE)); | 1783 __ cmpi(r8, Operand(JS_PROXY_TYPE)); |
| 1788 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, | 1784 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, |
| 1789 eq); | 1785 eq); |
| 1790 | 1786 |
| 1791 // Check if target has a [[Construct]] internal method. | 1787 // Check if target has a [[Construct]] internal method. |
| 1792 __ lbz(r5, FieldMemOperand(r7, Map::kBitFieldOffset)); | 1788 __ lbz(r5, FieldMemOperand(r7, Map::kBitFieldOffset)); |
| 1793 __ TestBit(r5, Map::kIsConstructor, r0); | 1789 __ TestBit(r5, Map::kIsConstructor, r0); |
| 1794 __ beq(&non_constructor, cr0); | 1790 __ beq(&non_constructor, cr0); |
| 1795 | 1791 |
| 1796 // Called Construct on an exotic Object with a [[Construct]] internal method. | 1792 // Called Construct on an exotic Object with a [[Construct]] internal method. |
| 1797 { | 1793 { |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1969 __ bkpt(0); | 1965 __ bkpt(0); |
| 1970 } | 1966 } |
| 1971 } | 1967 } |
| 1972 | 1968 |
| 1973 | 1969 |
| 1974 #undef __ | 1970 #undef __ |
| 1975 } // namespace internal | 1971 } // namespace internal |
| 1976 } // namespace v8 | 1972 } // namespace v8 |
| 1977 | 1973 |
| 1978 #endif // V8_TARGET_ARCH_PPC | 1974 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |