OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1755 // static | 1755 // static |
1756 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { | 1756 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { |
1757 // ----------- S t a t e ------------- | 1757 // ----------- S t a t e ------------- |
1758 // -- a0 : the number of arguments (not including the receiver) | 1758 // -- a0 : the number of arguments (not including the receiver) |
1759 // -- a1 : the constructor to call (checked to be a JSProxy) | 1759 // -- a1 : the constructor to call (checked to be a JSProxy) |
1760 // -- a3 : the new target (either the same as the constructor or | 1760 // -- a3 : the new target (either the same as the constructor or |
1761 // the JSFunction on which new was invoked initially) | 1761 // the JSFunction on which new was invoked initially) |
1762 // ----------------------------------- | 1762 // ----------------------------------- |
1763 | 1763 |
1764 // Call into the Runtime for Proxy [[Construct]]. | 1764 // Call into the Runtime for Proxy [[Construct]]. |
1765 __ Push(a1); | 1765 __ Push(a1, a3); |
1766 __ Push(a3); | |
1767 // Include the pushed new_target, constructor and the receiver. | 1766 // Include the pushed new_target, constructor and the receiver. |
1768 __ Addu(a0, a0, Operand(3)); | 1767 __ Addu(a0, a0, Operand(3)); |
1769 // Tail-call to the runtime. | 1768 // Tail-call to the runtime. |
1770 __ JumpToExternalReference( | 1769 __ JumpToExternalReference( |
1771 ExternalReference(Runtime::kJSProxyConstruct, masm->isolate())); | 1770 ExternalReference(Runtime::kJSProxyConstruct, masm->isolate())); |
1772 } | 1771 } |
1773 | 1772 |
1774 | 1773 |
1775 // static | 1774 // static |
1776 void Builtins::Generate_Construct(MacroAssembler* masm) { | 1775 void Builtins::Generate_Construct(MacroAssembler* masm) { |
1777 // ----------- S t a t e ------------- | 1776 // ----------- S t a t e ------------- |
1778 // -- a0 : the number of arguments (not including the receiver) | 1777 // -- a0 : the number of arguments (not including the receiver) |
1779 // -- a1 : the constructor to call (can be any Object) | 1778 // -- a1 : the constructor to call (can be any Object) |
1780 // -- a3 : the new target (either the same as the constructor or | 1779 // -- a3 : the new target (either the same as the constructor or |
1781 // the JSFunction on which new was invoked initially) | 1780 // the JSFunction on which new was invoked initially) |
1782 // ----------------------------------- | 1781 // ----------------------------------- |
1783 | 1782 |
1784 // Check if target is a Smi. | 1783 // Check if target is a Smi. |
1785 Label non_constructor; | 1784 Label non_constructor; |
1786 __ JumpIfSmi(a1, &non_constructor); | 1785 __ JumpIfSmi(a1, &non_constructor); |
1787 | 1786 |
1788 // Dispatch based on instance type. | 1787 // Dispatch based on instance type. |
1789 __ lw(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); | 1788 __ lw(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); |
1790 __ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset)); | 1789 __ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset)); |
1791 __ Jump(masm->isolate()->builtins()->ConstructFunction(), | 1790 __ Jump(masm->isolate()->builtins()->ConstructFunction(), |
1792 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); | 1791 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); |
1793 | 1792 |
1794 // Check if target has a [[Construct]] internal method. | 1793 // Check if target has a [[Construct]] internal method. |
1795 __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset)); | 1794 __ lbu(t3, FieldMemOperand(t1, Map::kBitFieldOffset)); |
1796 __ And(t2, t2, Operand(1 << Map::kIsCallable)); | 1795 __ And(t3, t3, Operand(1 << Map::kIsCallable)); |
1797 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); | 1796 __ Branch(&non_constructor, eq, t3, Operand(zero_reg)); |
1798 | 1797 |
1799 // Only dispatch to proxies after checking whether they are constructors. | 1798 // Only dispatch to proxies after checking whether they are constructors. |
1800 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, | 1799 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, |
1801 eq, t2, Operand(JS_PROXY_TYPE)); | 1800 eq, t2, Operand(JS_PROXY_TYPE)); |
1802 | 1801 |
1803 // Called Construct on an exotic Object with a [[Construct]] internal method. | 1802 // Called Construct on an exotic Object with a [[Construct]] internal method. |
1804 { | 1803 { |
1805 // Overwrite the original receiver with the (original) target. | 1804 // Overwrite the original receiver with the (original) target. |
1806 __ sll(at, a0, kPointerSizeLog2); | 1805 __ sll(at, a0, kPointerSizeLog2); |
1807 __ addu(at, sp, at); | 1806 __ addu(at, sp, at); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1974 } | 1973 } |
1975 } | 1974 } |
1976 | 1975 |
1977 | 1976 |
1978 #undef __ | 1977 #undef __ |
1979 | 1978 |
1980 } // namespace internal | 1979 } // namespace internal |
1981 } // namespace v8 | 1980 } // namespace v8 |
1982 | 1981 |
1983 #endif // V8_TARGET_ARCH_MIPS | 1982 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |