| 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 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1758 // static | 1758 // static |
| 1759 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { | 1759 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { |
| 1760 // ----------- S t a t e ------------- | 1760 // ----------- S t a t e ------------- |
| 1761 // -- r3 : the number of arguments (not including the receiver) | 1761 // -- r3 : the number of arguments (not including the receiver) |
| 1762 // -- r4 : the constructor to call (checked to be a JSProxy) | 1762 // -- r4 : the constructor to call (checked to be a JSProxy) |
| 1763 // -- r6 : the new target (either the same as the constructor or | 1763 // -- r6 : the new target (either the same as the constructor or |
| 1764 // the JSFunction on which new was invoked initially) | 1764 // the JSFunction on which new was invoked initially) |
| 1765 // ----------------------------------- | 1765 // ----------------------------------- |
| 1766 | 1766 |
| 1767 // Call into the Runtime for Proxy [[Construct]]. | 1767 // Call into the Runtime for Proxy [[Construct]]. |
| 1768 __ Push(r4); | 1768 __ Push(r4, r6); |
| 1769 __ Push(r6); | |
| 1770 // Include the pushed new_target, constructor and the receiver. | 1769 // Include the pushed new_target, constructor and the receiver. |
| 1771 __ addi(r3, r3, Operand(3)); | 1770 __ addi(r3, r3, Operand(3)); |
| 1772 // Tail-call to the runtime. | 1771 // Tail-call to the runtime. |
| 1773 __ JumpToExternalReference( | 1772 __ JumpToExternalReference( |
| 1774 ExternalReference(Runtime::kJSProxyConstruct, masm->isolate())); | 1773 ExternalReference(Runtime::kJSProxyConstruct, masm->isolate())); |
| 1775 } | 1774 } |
| 1776 | 1775 |
| 1777 | 1776 |
| 1778 // static | 1777 // static |
| 1779 void Builtins::Generate_Construct(MacroAssembler* masm) { | 1778 void Builtins::Generate_Construct(MacroAssembler* masm) { |
| 1780 // ----------- S t a t e ------------- | 1779 // ----------- S t a t e ------------- |
| 1781 // -- r3 : the number of arguments (not including the receiver) | 1780 // -- r3 : the number of arguments (not including the receiver) |
| 1782 // -- r4 : the constructor to call (can be any Object) | 1781 // -- r4 : the constructor to call (can be any Object) |
| 1783 // -- r6 : the new target (either the same as the constructor or | 1782 // -- r6 : the new target (either the same as the constructor or |
| 1784 // the JSFunction on which new was invoked initially) | 1783 // the JSFunction on which new was invoked initially) |
| 1785 // ----------------------------------- | 1784 // ----------------------------------- |
| 1786 | 1785 |
| 1787 // Check if target is a Smi. | 1786 // Check if target is a Smi. |
| 1788 Label non_constructor; | 1787 Label non_constructor; |
| 1789 __ JumpIfSmi(r4, &non_constructor); | 1788 __ JumpIfSmi(r4, &non_constructor); |
| 1790 | 1789 |
| 1791 // Dispatch based on instance type. | 1790 // Dispatch based on instance type. |
| 1792 __ CompareObjectType(r4, r7, r8, JS_FUNCTION_TYPE); | 1791 __ CompareObjectType(r4, r7, r8, JS_FUNCTION_TYPE); |
| 1793 __ Jump(masm->isolate()->builtins()->ConstructFunction(), | 1792 __ Jump(masm->isolate()->builtins()->ConstructFunction(), |
| 1794 RelocInfo::CODE_TARGET, eq); | 1793 RelocInfo::CODE_TARGET, eq); |
| 1795 __ cmpi(r8, Operand(JS_PROXY_TYPE)); | |
| 1796 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, | |
| 1797 eq); | |
| 1798 | 1794 |
| 1799 // Check if target has a [[Construct]] internal method. | 1795 // Check if target has a [[Construct]] internal method. |
| 1800 __ lbz(r5, FieldMemOperand(r7, Map::kBitFieldOffset)); | 1796 __ lbz(r5, FieldMemOperand(r7, Map::kBitFieldOffset)); |
| 1801 __ TestBit(r5, Map::kIsConstructor, r0); | 1797 __ TestBit(r5, Map::kIsConstructor, r0); |
| 1802 __ beq(&non_constructor, cr0); | 1798 __ beq(&non_constructor, cr0); |
| 1803 | 1799 |
| 1800 // Only dispatch to proxies after checking whether they are constructors. |
| 1801 __ cmpi(r8, Operand(JS_PROXY_TYPE)); |
| 1802 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, |
| 1803 eq); |
| 1804 |
| 1804 // Called Construct on an exotic Object with a [[Construct]] internal method. | 1805 // Called Construct on an exotic Object with a [[Construct]] internal method. |
| 1805 { | 1806 { |
| 1806 // Overwrite the original receiver with the (original) target. | 1807 // Overwrite the original receiver with the (original) target. |
| 1807 __ ShiftLeftImm(r8, r3, Operand(kPointerSizeLog2)); | 1808 __ ShiftLeftImm(r8, r3, Operand(kPointerSizeLog2)); |
| 1808 __ StorePX(r4, MemOperand(sp, r8)); | 1809 __ StorePX(r4, MemOperand(sp, r8)); |
| 1809 // Let the "call_as_constructor_delegate" take care of the rest. | 1810 // Let the "call_as_constructor_delegate" take care of the rest. |
| 1810 __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, r4); | 1811 __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, r4); |
| 1811 __ Jump(masm->isolate()->builtins()->CallFunction(), | 1812 __ Jump(masm->isolate()->builtins()->CallFunction(), |
| 1812 RelocInfo::CODE_TARGET); | 1813 RelocInfo::CODE_TARGET); |
| 1813 } | 1814 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1977 __ bkpt(0); | 1978 __ bkpt(0); |
| 1978 } | 1979 } |
| 1979 } | 1980 } |
| 1980 | 1981 |
| 1981 | 1982 |
| 1982 #undef __ | 1983 #undef __ |
| 1983 } // namespace internal | 1984 } // namespace internal |
| 1984 } // namespace v8 | 1985 } // namespace v8 |
| 1985 | 1986 |
| 1986 #endif // V8_TARGET_ARCH_PPC | 1987 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |