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 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1685 // -- a0 : the number of arguments (not including the receiver) | 1685 // -- a0 : the number of arguments (not including the receiver) |
1686 // -- a1 : the target to call (can be any Object). | 1686 // -- a1 : the target to call (can be any Object). |
1687 // ----------------------------------- | 1687 // ----------------------------------- |
1688 | 1688 |
1689 Label non_callable, non_function, non_smi; | 1689 Label non_callable, non_function, non_smi; |
1690 __ JumpIfSmi(a1, &non_callable); | 1690 __ JumpIfSmi(a1, &non_callable); |
1691 __ bind(&non_smi); | 1691 __ bind(&non_smi); |
1692 __ GetObjectType(a1, t1, t2); | 1692 __ GetObjectType(a1, t1, t2); |
1693 __ Jump(masm->isolate()->builtins()->CallFunction(mode), | 1693 __ Jump(masm->isolate()->builtins()->CallFunction(mode), |
1694 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); | 1694 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); |
1695 __ Branch(&non_function, ne, t2, Operand(JS_FUNCTION_PROXY_TYPE)); | 1695 __ Branch(&non_function, ne, t2, Operand(JS_PROXY_TYPE)); |
1696 | 1696 |
1697 // 1. Call to function proxy. | 1697 // 1. Call Proxy. |
1698 // TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies. | 1698 // TODO(neis): implement call on Proxy |
1699 __ lw(a1, FieldMemOperand(a1, JSFunctionProxy::kCallTrapOffset)); | |
1700 __ AssertNotSmi(a1); | |
1701 __ Branch(&non_smi); | |
1702 | 1699 |
1703 // 2. Call to something else, which might have a [[Call]] internal method (if | 1700 // 2. Call to something else, which might have a [[Call]] internal method (if |
1704 // not we raise an exception). | 1701 // not we raise an exception). |
1705 __ bind(&non_function); | 1702 __ bind(&non_function); |
1706 // Check if target has a [[Call]] internal method. | 1703 // Check if target has a [[Call]] internal method. |
1707 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset)); | 1704 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset)); |
1708 __ And(t1, t1, Operand(1 << Map::kIsCallable)); | 1705 __ And(t1, t1, Operand(1 << Map::kIsCallable)); |
1709 __ Branch(&non_callable, eq, t1, Operand(zero_reg)); | 1706 __ Branch(&non_callable, eq, t1, Operand(zero_reg)); |
1710 // Overwrite the original receiver with the (original) target. | 1707 // Overwrite the original receiver with the (original) target. |
1711 __ sll(at, a0, kPointerSizeLog2); | 1708 __ sll(at, a0, kPointerSizeLog2); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 __ lw(t0, FieldMemOperand(t0, SharedFunctionInfo::kConstructStubOffset)); | 1743 __ lw(t0, FieldMemOperand(t0, SharedFunctionInfo::kConstructStubOffset)); |
1747 __ Addu(at, t0, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1744 __ Addu(at, t0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1748 __ Jump(at); | 1745 __ Jump(at); |
1749 } | 1746 } |
1750 | 1747 |
1751 | 1748 |
1752 // static | 1749 // static |
1753 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { | 1750 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { |
1754 // ----------- S t a t e ------------- | 1751 // ----------- S t a t e ------------- |
1755 // -- a0 : the number of arguments (not including the receiver) | 1752 // -- a0 : the number of arguments (not including the receiver) |
1756 // -- a1 : the constructor to call (checked to be a JSFunctionProxy) | 1753 // -- a1 : the constructor to call (checked to be a JSProxy) |
1757 // -- a3 : the new target (either the same as the constructor or | 1754 // -- a3 : the new target (either the same as the constructor or |
1758 // the JSFunction on which new was invoked initially) | 1755 // the JSFunction on which new was invoked initially) |
1759 // ----------------------------------- | 1756 // ----------------------------------- |
1760 | 1757 |
1761 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. | 1758 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. |
1762 __ lw(a1, FieldMemOperand(a1, JSFunctionProxy::kConstructTrapOffset)); | |
1763 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1759 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
1764 } | 1760 } |
1765 | 1761 |
1766 | 1762 |
1767 // static | 1763 // static |
1768 void Builtins::Generate_Construct(MacroAssembler* masm) { | 1764 void Builtins::Generate_Construct(MacroAssembler* masm) { |
1769 // ----------- S t a t e ------------- | 1765 // ----------- S t a t e ------------- |
1770 // -- a0 : the number of arguments (not including the receiver) | 1766 // -- a0 : the number of arguments (not including the receiver) |
1771 // -- a1 : the constructor to call (can be any Object) | 1767 // -- a1 : the constructor to call (can be any Object) |
1772 // -- a3 : the new target (either the same as the constructor or | 1768 // -- a3 : the new target (either the same as the constructor or |
1773 // the JSFunction on which new was invoked initially) | 1769 // the JSFunction on which new was invoked initially) |
1774 // ----------------------------------- | 1770 // ----------------------------------- |
1775 | 1771 |
1776 // Check if target is a Smi. | 1772 // Check if target is a Smi. |
1777 Label non_constructor; | 1773 Label non_constructor; |
1778 __ JumpIfSmi(a1, &non_constructor); | 1774 __ JumpIfSmi(a1, &non_constructor); |
1779 | 1775 |
1780 // Dispatch based on instance type. | 1776 // Dispatch based on instance type. |
1781 __ lw(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); | 1777 __ lw(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); |
1782 __ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset)); | 1778 __ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset)); |
1783 __ Jump(masm->isolate()->builtins()->ConstructFunction(), | 1779 __ Jump(masm->isolate()->builtins()->ConstructFunction(), |
1784 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); | 1780 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); |
1785 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, | 1781 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, |
1786 eq, t2, Operand(JS_FUNCTION_PROXY_TYPE)); | 1782 eq, t2, Operand(JS_PROXY_TYPE)); |
1787 | 1783 |
1788 // Check if target has a [[Construct]] internal method. | 1784 // Check if target has a [[Construct]] internal method. |
1789 __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset)); | 1785 __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset)); |
1790 __ And(t2, t2, Operand(1 << Map::kIsCallable)); | 1786 __ And(t2, t2, Operand(1 << Map::kIsCallable)); |
1791 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); | 1787 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); |
1792 | 1788 |
1793 // Called Construct on an exotic Object with a [[Construct]] internal method. | 1789 // Called Construct on an exotic Object with a [[Construct]] internal method. |
1794 { | 1790 { |
1795 // Overwrite the original receiver with the (original) target. | 1791 // Overwrite the original receiver with the (original) target. |
1796 __ sll(at, a0, kPointerSizeLog2); | 1792 __ sll(at, a0, kPointerSizeLog2); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1964 } | 1960 } |
1965 } | 1961 } |
1966 | 1962 |
1967 | 1963 |
1968 #undef __ | 1964 #undef __ |
1969 | 1965 |
1970 } // namespace internal | 1966 } // namespace internal |
1971 } // namespace v8 | 1967 } // namespace v8 |
1972 | 1968 |
1973 #endif // V8_TARGET_ARCH_MIPS | 1969 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |