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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
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 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 // -- a0 : the number of arguments (not including the receiver) | 1677 // -- a0 : the number of arguments (not including the receiver) |
1678 // -- a1 : the target to call (can be any Object). | 1678 // -- a1 : the target to call (can be any Object). |
1679 // ----------------------------------- | 1679 // ----------------------------------- |
1680 | 1680 |
1681 Label non_callable, non_function, non_smi; | 1681 Label non_callable, non_function, non_smi; |
1682 __ JumpIfSmi(a1, &non_callable); | 1682 __ JumpIfSmi(a1, &non_callable); |
1683 __ bind(&non_smi); | 1683 __ bind(&non_smi); |
1684 __ GetObjectType(a1, t1, t2); | 1684 __ GetObjectType(a1, t1, t2); |
1685 __ Jump(masm->isolate()->builtins()->CallFunction(mode), | 1685 __ Jump(masm->isolate()->builtins()->CallFunction(mode), |
1686 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); | 1686 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); |
1687 __ Branch(&non_function, ne, t2, Operand(JS_FUNCTION_PROXY_TYPE)); | 1687 __ Branch(&non_function, ne, t2, Operand(JS_PROXY_TYPE)); |
1688 | 1688 |
1689 // 1. Call to function proxy. | 1689 // 1. Call to function proxy. |
1690 // TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies. | 1690 // TODO(neis): Implement [[Call]] on proxies. |
1691 __ ld(a1, FieldMemOperand(a1, JSFunctionProxy::kCallTrapOffset)); | |
1692 __ AssertNotSmi(a1); | |
1693 __ Branch(&non_smi); | |
1694 | 1691 |
1695 // 2. Call to something else, which might have a [[Call]] internal method (if | 1692 // 2. Call to something else, which might have a [[Call]] internal method (if |
1696 // not we raise an exception). | 1693 // not we raise an exception). |
1697 __ bind(&non_function); | 1694 __ bind(&non_function); |
1698 // Check if target has a [[Call]] internal method. | 1695 // Check if target has a [[Call]] internal method. |
1699 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset)); | 1696 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset)); |
1700 __ And(t1, t1, Operand(1 << Map::kIsCallable)); | 1697 __ And(t1, t1, Operand(1 << Map::kIsCallable)); |
1701 __ Branch(&non_callable, eq, t1, Operand(zero_reg)); | 1698 __ Branch(&non_callable, eq, t1, Operand(zero_reg)); |
1702 // Overwrite the original receiver with the (original) target. | 1699 // Overwrite the original receiver with the (original) target. |
1703 __ dsll(at, a0, kPointerSizeLog2); | 1700 __ dsll(at, a0, kPointerSizeLog2); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 __ ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kConstructStubOffset)); | 1734 __ ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kConstructStubOffset)); |
1738 __ Daddu(at, a4, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1735 __ Daddu(at, a4, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1739 __ Jump(at); | 1736 __ Jump(at); |
1740 } | 1737 } |
1741 | 1738 |
1742 | 1739 |
1743 // static | 1740 // static |
1744 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { | 1741 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { |
1745 // ----------- S t a t e ------------- | 1742 // ----------- S t a t e ------------- |
1746 // -- a0 : the number of arguments (not including the receiver) | 1743 // -- a0 : the number of arguments (not including the receiver) |
1747 // -- a1 : the constructor to call (checked to be a JSFunctionProxy) | 1744 // -- a1 : the constructor to call (checked to be a JSProxy) |
1748 // -- a3 : the new target (either the same as the constructor or | 1745 // -- a3 : the new target (either the same as the constructor or |
1749 // the JSFunction on which new was invoked initially) | 1746 // the JSFunction on which new was invoked initially) |
1750 // ----------------------------------- | 1747 // ----------------------------------- |
1751 | 1748 |
1752 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. | 1749 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. |
1753 __ ld(a1, FieldMemOperand(a1, JSFunctionProxy::kConstructTrapOffset)); | |
1754 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1750 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
1755 } | 1751 } |
1756 | 1752 |
1757 | 1753 |
1758 // static | 1754 // static |
1759 void Builtins::Generate_Construct(MacroAssembler* masm) { | 1755 void Builtins::Generate_Construct(MacroAssembler* masm) { |
1760 // ----------- S t a t e ------------- | 1756 // ----------- S t a t e ------------- |
1761 // -- a0 : the number of arguments (not including the receiver) | 1757 // -- a0 : the number of arguments (not including the receiver) |
1762 // -- a1 : the constructor to call (can be any Object) | 1758 // -- a1 : the constructor to call (can be any Object) |
1763 // -- a3 : the new target (either the same as the constructor or | 1759 // -- a3 : the new target (either the same as the constructor or |
1764 // the JSFunction on which new was invoked initially) | 1760 // the JSFunction on which new was invoked initially) |
1765 // ----------------------------------- | 1761 // ----------------------------------- |
1766 | 1762 |
1767 // Check if target is a Smi. | 1763 // Check if target is a Smi. |
1768 Label non_constructor; | 1764 Label non_constructor; |
1769 __ JumpIfSmi(a1, &non_constructor); | 1765 __ JumpIfSmi(a1, &non_constructor); |
1770 | 1766 |
1771 // Dispatch based on instance type. | 1767 // Dispatch based on instance type. |
1772 __ ld(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); | 1768 __ ld(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); |
1773 __ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset)); | 1769 __ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset)); |
1774 __ Jump(masm->isolate()->builtins()->ConstructFunction(), | 1770 __ Jump(masm->isolate()->builtins()->ConstructFunction(), |
1775 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); | 1771 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); |
1776 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, | 1772 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, |
1777 eq, t2, Operand(JS_FUNCTION_PROXY_TYPE)); | 1773 eq, t2, Operand(JS_PROXY_TYPE)); |
1778 | 1774 |
1779 // Check if target has a [[Construct]] internal method. | 1775 // Check if target has a [[Construct]] internal method. |
1780 __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset)); | 1776 __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset)); |
1781 __ And(t2, t2, Operand(1 << Map::kIsCallable)); | 1777 __ And(t2, t2, Operand(1 << Map::kIsCallable)); |
1782 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); | 1778 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); |
1783 | 1779 |
1784 // Called Construct on an exotic Object with a [[Construct]] internal method. | 1780 // Called Construct on an exotic Object with a [[Construct]] internal method. |
1785 { | 1781 { |
1786 // Overwrite the original receiver with the (original) target. | 1782 // Overwrite the original receiver with the (original) target. |
1787 __ dsll(at, a0, kPointerSizeLog2); | 1783 __ dsll(at, a0, kPointerSizeLog2); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1955 } | 1951 } |
1956 } | 1952 } |
1957 | 1953 |
1958 | 1954 |
1959 #undef __ | 1955 #undef __ |
1960 | 1956 |
1961 } // namespace internal | 1957 } // namespace internal |
1962 } // namespace v8 | 1958 } // namespace v8 |
1963 | 1959 |
1964 #endif // V8_TARGET_ARCH_MIPS64 | 1960 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |