OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1679 // -- x0 : the number of arguments (not including the receiver) | 1679 // -- x0 : the number of arguments (not including the receiver) |
1680 // -- x1 : the target to call (can be any Object). | 1680 // -- x1 : the target to call (can be any Object). |
1681 // ----------------------------------- | 1681 // ----------------------------------- |
1682 | 1682 |
1683 Label non_callable, non_function, non_smi; | 1683 Label non_callable, non_function, non_smi; |
1684 __ JumpIfSmi(x1, &non_callable); | 1684 __ JumpIfSmi(x1, &non_callable); |
1685 __ Bind(&non_smi); | 1685 __ Bind(&non_smi); |
1686 __ CompareObjectType(x1, x4, x5, JS_FUNCTION_TYPE); | 1686 __ CompareObjectType(x1, x4, x5, JS_FUNCTION_TYPE); |
1687 __ Jump(masm->isolate()->builtins()->CallFunction(mode), | 1687 __ Jump(masm->isolate()->builtins()->CallFunction(mode), |
1688 RelocInfo::CODE_TARGET, eq); | 1688 RelocInfo::CODE_TARGET, eq); |
1689 __ Cmp(x5, JS_FUNCTION_PROXY_TYPE); | 1689 __ Cmp(x5, JS_PROXY_TYPE); |
1690 __ B(ne, &non_function); | 1690 __ B(ne, &non_function); |
1691 | 1691 |
1692 // 1. Call to function proxy. | 1692 // 1. Call to proxy. |
1693 // TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies. | 1693 // TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies. |
1694 __ Ldr(x1, FieldMemOperand(x1, JSFunctionProxy::kCallTrapOffset)); | |
1695 __ AssertNotSmi(x1); | |
1696 __ B(&non_smi); | |
1697 | 1694 |
1698 // 2. Call to something else, which might have a [[Call]] internal method (if | 1695 // 2. Call to something else, which might have a [[Call]] internal method (if |
1699 // not we raise an exception). | 1696 // not we raise an exception). |
1700 __ Bind(&non_function); | 1697 __ Bind(&non_function); |
1701 // Check if target has a [[Call]] internal method. | 1698 // Check if target has a [[Call]] internal method. |
1702 __ Ldrb(x4, FieldMemOperand(x4, Map::kBitFieldOffset)); | 1699 __ Ldrb(x4, FieldMemOperand(x4, Map::kBitFieldOffset)); |
1703 __ TestAndBranchIfAllClear(x4, 1 << Map::kIsCallable, &non_callable); | 1700 __ TestAndBranchIfAllClear(x4, 1 << Map::kIsCallable, &non_callable); |
1704 // Overwrite the original receiver with the (original) target. | 1701 // Overwrite the original receiver with the (original) target. |
1705 __ Poke(x1, Operand(x0, LSL, kXRegSizeLog2)); | 1702 __ Poke(x1, Operand(x0, LSL, kXRegSizeLog2)); |
1706 // Let the "call_as_function_delegate" take care of the rest. | 1703 // Let the "call_as_function_delegate" take care of the rest. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1738 __ Ldr(x4, FieldMemOperand(x4, SharedFunctionInfo::kConstructStubOffset)); | 1735 __ Ldr(x4, FieldMemOperand(x4, SharedFunctionInfo::kConstructStubOffset)); |
1739 __ Add(x4, x4, Code::kHeaderSize - kHeapObjectTag); | 1736 __ Add(x4, x4, Code::kHeaderSize - kHeapObjectTag); |
1740 __ Br(x4); | 1737 __ Br(x4); |
1741 } | 1738 } |
1742 | 1739 |
1743 | 1740 |
1744 // static | 1741 // static |
1745 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { | 1742 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { |
1746 // ----------- S t a t e ------------- | 1743 // ----------- S t a t e ------------- |
1747 // -- x0 : the number of arguments (not including the receiver) | 1744 // -- x0 : the number of arguments (not including the receiver) |
1748 // -- x1 : the constructor to call (checked to be a JSFunctionProxy) | 1745 // -- x1 : the constructor to call (checked to be a JSProxy) |
1749 // -- x3 : the new target (either the same as the constructor or | 1746 // -- x3 : the new target (either the same as the constructor or |
1750 // the JSFunction on which new was invoked initially) | 1747 // the JSFunction on which new was invoked initially) |
1751 // ----------------------------------- | 1748 // ----------------------------------- |
1752 | 1749 |
1753 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. | 1750 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. |
1754 __ Ldr(x1, FieldMemOperand(x1, JSFunctionProxy::kConstructTrapOffset)); | |
1755 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1751 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
1756 } | 1752 } |
1757 | 1753 |
1758 | 1754 |
1759 // static | 1755 // static |
1760 void Builtins::Generate_Construct(MacroAssembler* masm) { | 1756 void Builtins::Generate_Construct(MacroAssembler* masm) { |
1761 // ----------- S t a t e ------------- | 1757 // ----------- S t a t e ------------- |
1762 // -- x0 : the number of arguments (not including the receiver) | 1758 // -- x0 : the number of arguments (not including the receiver) |
1763 // -- x1 : the constructor to call (can be any Object) | 1759 // -- x1 : the constructor to call (can be any Object) |
1764 // -- x3 : the new target (either the same as the constructor or | 1760 // -- x3 : the new target (either the same as the constructor or |
1765 // the JSFunction on which new was invoked initially) | 1761 // the JSFunction on which new was invoked initially) |
1766 // ----------------------------------- | 1762 // ----------------------------------- |
1767 | 1763 |
1768 // Check if target is a Smi. | 1764 // Check if target is a Smi. |
1769 Label non_constructor; | 1765 Label non_constructor; |
1770 __ JumpIfSmi(x1, &non_constructor); | 1766 __ JumpIfSmi(x1, &non_constructor); |
1771 | 1767 |
1772 // Dispatch based on instance type. | 1768 // Dispatch based on instance type. |
1773 __ CompareObjectType(x1, x4, x5, JS_FUNCTION_TYPE); | 1769 __ CompareObjectType(x1, x4, x5, JS_FUNCTION_TYPE); |
1774 __ Jump(masm->isolate()->builtins()->ConstructFunction(), | 1770 __ Jump(masm->isolate()->builtins()->ConstructFunction(), |
1775 RelocInfo::CODE_TARGET, eq); | 1771 RelocInfo::CODE_TARGET, eq); |
1776 __ Cmp(x5, JS_FUNCTION_PROXY_TYPE); | 1772 __ Cmp(x5, JS_PROXY_TYPE); |
1777 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, | 1773 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, |
1778 eq); | 1774 eq); |
1779 | 1775 |
1780 // Check if target has a [[Construct]] internal method. | 1776 // Check if target has a [[Construct]] internal method. |
1781 __ Ldrb(x2, FieldMemOperand(x4, Map::kBitFieldOffset)); | 1777 __ Ldrb(x2, FieldMemOperand(x4, Map::kBitFieldOffset)); |
1782 __ TestAndBranchIfAllClear(x2, 1 << Map::kIsConstructor, &non_constructor); | 1778 __ TestAndBranchIfAllClear(x2, 1 << Map::kIsConstructor, &non_constructor); |
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. |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2038 } | 2034 } |
2039 } | 2035 } |
2040 | 2036 |
2041 | 2037 |
2042 #undef __ | 2038 #undef __ |
2043 | 2039 |
2044 } // namespace internal | 2040 } // namespace internal |
2045 } // namespace v8 | 2041 } // namespace v8 |
2046 | 2042 |
2047 #endif // V8_TARGET_ARCH_ARM | 2043 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |