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 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1698 // -- r3 : the number of arguments (not including the receiver) | 1698 // -- r3 : the number of arguments (not including the receiver) |
1699 // -- r4 : the target to call (can be any Object). | 1699 // -- r4 : the target to call (can be any Object). |
1700 // ----------------------------------- | 1700 // ----------------------------------- |
1701 | 1701 |
1702 Label non_callable, non_function, non_smi; | 1702 Label non_callable, non_function, non_smi; |
1703 __ JumpIfSmi(r4, &non_callable); | 1703 __ JumpIfSmi(r4, &non_callable); |
1704 __ bind(&non_smi); | 1704 __ bind(&non_smi); |
1705 __ CompareObjectType(r4, r7, r8, JS_FUNCTION_TYPE); | 1705 __ CompareObjectType(r4, r7, r8, JS_FUNCTION_TYPE); |
1706 __ Jump(masm->isolate()->builtins()->CallFunction(mode), | 1706 __ Jump(masm->isolate()->builtins()->CallFunction(mode), |
1707 RelocInfo::CODE_TARGET, eq); | 1707 RelocInfo::CODE_TARGET, eq); |
1708 __ cmpi(r8, Operand(JS_FUNCTION_PROXY_TYPE)); | 1708 __ cmpi(r8, Operand(JS_PROXY_TYPE)); |
1709 __ bne(&non_function); | 1709 __ bne(&non_function); |
1710 | 1710 |
1711 // 1. Call to function proxy. | 1711 // 1. Call to function proxy. |
1712 // TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies. | 1712 // TODO(neis): Implementy [[Call]] on proxies. |
1713 __ LoadP(r4, FieldMemOperand(r4, JSFunctionProxy::kCallTrapOffset)); | |
1714 __ AssertNotSmi(r4); | |
1715 __ b(&non_smi); | 1713 __ b(&non_smi); |
Toon Verwaest
2015/12/03 11:48:42
drop branch (Implementy?)
Camillo Bruni
2015/12/03 12:18:26
done
| |
1716 | 1714 |
1717 // 2. Call to something else, which might have a [[Call]] internal method (if | 1715 // 2. Call to something else, which might have a [[Call]] internal method (if |
1718 // not we raise an exception). | 1716 // not we raise an exception). |
1719 __ bind(&non_function); | 1717 __ bind(&non_function); |
1720 // Check if target has a [[Call]] internal method. | 1718 // Check if target has a [[Call]] internal method. |
1721 __ lbz(r7, FieldMemOperand(r7, Map::kBitFieldOffset)); | 1719 __ lbz(r7, FieldMemOperand(r7, Map::kBitFieldOffset)); |
1722 __ TestBit(r7, Map::kIsCallable, r0); | 1720 __ TestBit(r7, Map::kIsCallable, r0); |
1723 __ beq(&non_callable, cr0); | 1721 __ beq(&non_callable, cr0); |
1724 // Overwrite the original receiver the (original) target. | 1722 // Overwrite the original receiver the (original) target. |
1725 __ ShiftLeftImm(r8, r3, Operand(kPointerSizeLog2)); | 1723 __ ShiftLeftImm(r8, r3, Operand(kPointerSizeLog2)); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1759 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kConstructStubOffset)); | 1757 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kConstructStubOffset)); |
1760 __ addi(ip, r7, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1758 __ addi(ip, r7, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1761 __ JumpToJSEntry(ip); | 1759 __ JumpToJSEntry(ip); |
1762 } | 1760 } |
1763 | 1761 |
1764 | 1762 |
1765 // static | 1763 // static |
1766 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { | 1764 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { |
1767 // ----------- S t a t e ------------- | 1765 // ----------- S t a t e ------------- |
1768 // -- r3 : the number of arguments (not including the receiver) | 1766 // -- r3 : the number of arguments (not including the receiver) |
1769 // -- r4 : the constructor to call (checked to be a JSFunctionProxy) | 1767 // -- r4 : the constructor to call (checked to be a JSProxy) |
1770 // -- r6 : the new target (either the same as the constructor or | 1768 // -- r6 : the new target (either the same as the constructor or |
1771 // the JSFunction on which new was invoked initially) | 1769 // the JSFunction on which new was invoked initially) |
1772 // ----------------------------------- | 1770 // ----------------------------------- |
1773 | 1771 |
1774 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. | 1772 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. |
1775 __ LoadP(r4, FieldMemOperand(r4, JSFunctionProxy::kConstructTrapOffset)); | |
1776 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1773 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
1777 } | 1774 } |
1778 | 1775 |
1779 | 1776 |
1780 // static | 1777 // static |
1781 void Builtins::Generate_Construct(MacroAssembler* masm) { | 1778 void Builtins::Generate_Construct(MacroAssembler* masm) { |
1782 // ----------- S t a t e ------------- | 1779 // ----------- S t a t e ------------- |
1783 // -- r3 : the number of arguments (not including the receiver) | 1780 // -- r3 : the number of arguments (not including the receiver) |
1784 // -- r4 : the constructor to call (can be any Object) | 1781 // -- r4 : the constructor to call (can be any Object) |
1785 // -- r6 : the new target (either the same as the constructor or | 1782 // -- r6 : the new target (either the same as the constructor or |
1786 // the JSFunction on which new was invoked initially) | 1783 // the JSFunction on which new was invoked initially) |
1787 // ----------------------------------- | 1784 // ----------------------------------- |
1788 | 1785 |
1789 // Check if target is a Smi. | 1786 // Check if target is a Smi. |
1790 Label non_constructor; | 1787 Label non_constructor; |
1791 __ JumpIfSmi(r4, &non_constructor); | 1788 __ JumpIfSmi(r4, &non_constructor); |
1792 | 1789 |
1793 // Dispatch based on instance type. | 1790 // Dispatch based on instance type. |
1794 __ CompareObjectType(r4, r7, r8, JS_FUNCTION_TYPE); | 1791 __ CompareObjectType(r4, r7, r8, JS_FUNCTION_TYPE); |
1795 __ Jump(masm->isolate()->builtins()->ConstructFunction(), | 1792 __ Jump(masm->isolate()->builtins()->ConstructFunction(), |
1796 RelocInfo::CODE_TARGET, eq); | 1793 RelocInfo::CODE_TARGET, eq); |
1797 __ cmpi(r8, Operand(JS_FUNCTION_PROXY_TYPE)); | 1794 __ cmpi(r8, Operand(JS_PROXY_TYPE)); |
1798 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, | 1795 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, |
1799 eq); | 1796 eq); |
1800 | 1797 |
1801 // Check if target has a [[Construct]] internal method. | 1798 // Check if target has a [[Construct]] internal method. |
1802 __ lbz(r5, FieldMemOperand(r7, Map::kBitFieldOffset)); | 1799 __ lbz(r5, FieldMemOperand(r7, Map::kBitFieldOffset)); |
1803 __ TestBit(r5, Map::kIsConstructor, r0); | 1800 __ TestBit(r5, Map::kIsConstructor, r0); |
1804 __ beq(&non_constructor, cr0); | 1801 __ beq(&non_constructor, cr0); |
1805 | 1802 |
1806 // Called Construct on an exotic Object with a [[Construct]] internal method. | 1803 // Called Construct on an exotic Object with a [[Construct]] internal method. |
1807 { | 1804 { |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1979 __ bkpt(0); | 1976 __ bkpt(0); |
1980 } | 1977 } |
1981 } | 1978 } |
1982 | 1979 |
1983 | 1980 |
1984 #undef __ | 1981 #undef __ |
1985 } // namespace internal | 1982 } // namespace internal |
1986 } // namespace v8 | 1983 } // namespace v8 |
1987 | 1984 |
1988 #endif // V8_TARGET_ARCH_PPC | 1985 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |