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 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1667 // -- x0 : the number of arguments (not including the receiver) | 1667 // -- x0 : the number of arguments (not including the receiver) |
1668 // -- x1 : the target to call (can be any Object). | 1668 // -- x1 : the target to call (can be any Object). |
1669 // ----------------------------------- | 1669 // ----------------------------------- |
1670 | 1670 |
1671 Label non_callable, non_function, non_smi; | 1671 Label non_callable, non_function, non_smi; |
1672 __ JumpIfSmi(x1, &non_callable); | 1672 __ JumpIfSmi(x1, &non_callable); |
1673 __ Bind(&non_smi); | 1673 __ Bind(&non_smi); |
1674 __ CompareObjectType(x1, x4, x5, JS_FUNCTION_TYPE); | 1674 __ CompareObjectType(x1, x4, x5, JS_FUNCTION_TYPE); |
1675 __ Jump(masm->isolate()->builtins()->CallFunction(mode), | 1675 __ Jump(masm->isolate()->builtins()->CallFunction(mode), |
1676 RelocInfo::CODE_TARGET, eq); | 1676 RelocInfo::CODE_TARGET, eq); |
1677 __ Cmp(x5, JS_FUNCTION_PROXY_TYPE); | 1677 __ Cmp(x5, JS_PROXY_TYPE); |
1678 __ B(ne, &non_function); | 1678 __ B(ne, &non_function); |
1679 | 1679 |
1680 // 1. Call to function proxy. | 1680 // 1. Call to proxy. |
1681 // TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies. | 1681 // TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies. |
1682 __ Ldr(x1, FieldMemOperand(x1, JSFunctionProxy::kCallTrapOffset)); | |
1683 __ AssertNotSmi(x1); | |
1684 __ B(&non_smi); | |
1685 | 1682 |
1686 // 2. Call to something else, which might have a [[Call]] internal method (if | 1683 // 2. Call to something else, which might have a [[Call]] internal method (if |
1687 // not we raise an exception). | 1684 // not we raise an exception). |
1688 __ Bind(&non_function); | 1685 __ Bind(&non_function); |
1689 // Check if target has a [[Call]] internal method. | 1686 // Check if target has a [[Call]] internal method. |
1690 __ Ldrb(x4, FieldMemOperand(x4, Map::kBitFieldOffset)); | 1687 __ Ldrb(x4, FieldMemOperand(x4, Map::kBitFieldOffset)); |
1691 __ TestAndBranchIfAllClear(x4, 1 << Map::kIsCallable, &non_callable); | 1688 __ TestAndBranchIfAllClear(x4, 1 << Map::kIsCallable, &non_callable); |
1692 // Overwrite the original receiver with the (original) target. | 1689 // Overwrite the original receiver with the (original) target. |
1693 __ Poke(x1, Operand(x0, LSL, kXRegSizeLog2)); | 1690 __ Poke(x1, Operand(x0, LSL, kXRegSizeLog2)); |
1694 // Let the "call_as_function_delegate" take care of the rest. | 1691 // Let the "call_as_function_delegate" take care of the rest. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1726 __ Ldr(x4, FieldMemOperand(x4, SharedFunctionInfo::kConstructStubOffset)); | 1723 __ Ldr(x4, FieldMemOperand(x4, SharedFunctionInfo::kConstructStubOffset)); |
1727 __ Add(x4, x4, Code::kHeaderSize - kHeapObjectTag); | 1724 __ Add(x4, x4, Code::kHeaderSize - kHeapObjectTag); |
1728 __ Br(x4); | 1725 __ Br(x4); |
1729 } | 1726 } |
1730 | 1727 |
1731 | 1728 |
1732 // static | 1729 // static |
1733 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { | 1730 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { |
1734 // ----------- S t a t e ------------- | 1731 // ----------- S t a t e ------------- |
1735 // -- x0 : the number of arguments (not including the receiver) | 1732 // -- x0 : the number of arguments (not including the receiver) |
1736 // -- x1 : the constructor to call (checked to be a JSFunctionProxy) | 1733 // -- x1 : the constructor to call (checked to be a JSProxy) |
1737 // -- x3 : the new target (either the same as the constructor or | 1734 // -- x3 : the new target (either the same as the constructor or |
1738 // the JSFunction on which new was invoked initially) | 1735 // the JSFunction on which new was invoked initially) |
1739 // ----------------------------------- | 1736 // ----------------------------------- |
1740 | 1737 |
1741 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. | 1738 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. |
1742 __ Ldr(x1, FieldMemOperand(x1, JSFunctionProxy::kConstructTrapOffset)); | |
1743 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1739 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
1744 } | 1740 } |
1745 | 1741 |
1746 | 1742 |
1747 // static | 1743 // static |
1748 void Builtins::Generate_Construct(MacroAssembler* masm) { | 1744 void Builtins::Generate_Construct(MacroAssembler* masm) { |
1749 // ----------- S t a t e ------------- | 1745 // ----------- S t a t e ------------- |
1750 // -- x0 : the number of arguments (not including the receiver) | 1746 // -- x0 : the number of arguments (not including the receiver) |
1751 // -- x1 : the constructor to call (can be any Object) | 1747 // -- x1 : the constructor to call (can be any Object) |
1752 // -- x3 : the new target (either the same as the constructor or | 1748 // -- x3 : the new target (either the same as the constructor or |
1753 // the JSFunction on which new was invoked initially) | 1749 // the JSFunction on which new was invoked initially) |
1754 // ----------------------------------- | 1750 // ----------------------------------- |
1755 | 1751 |
1756 // Check if target is a Smi. | 1752 // Check if target is a Smi. |
1757 Label non_constructor; | 1753 Label non_constructor; |
1758 __ JumpIfSmi(x1, &non_constructor); | 1754 __ JumpIfSmi(x1, &non_constructor); |
1759 | 1755 |
1760 // Dispatch based on instance type. | 1756 // Dispatch based on instance type. |
1761 __ CompareObjectType(x1, x4, x5, JS_FUNCTION_TYPE); | 1757 __ CompareObjectType(x1, x4, x5, JS_FUNCTION_TYPE); |
1762 __ Jump(masm->isolate()->builtins()->ConstructFunction(), | 1758 __ Jump(masm->isolate()->builtins()->ConstructFunction(), |
1763 RelocInfo::CODE_TARGET, eq); | 1759 RelocInfo::CODE_TARGET, eq); |
1764 __ Cmp(x5, JS_FUNCTION_PROXY_TYPE); | 1760 __ Cmp(x5, JS_PROXY_TYPE); |
1765 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, | 1761 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, |
1766 eq); | 1762 eq); |
1767 | 1763 |
1768 // Check if target has a [[Construct]] internal method. | 1764 // Check if target has a [[Construct]] internal method. |
1769 __ Ldrb(x2, FieldMemOperand(x4, Map::kBitFieldOffset)); | 1765 __ Ldrb(x2, FieldMemOperand(x4, Map::kBitFieldOffset)); |
1770 __ TestAndBranchIfAllClear(x2, 1 << Map::kIsConstructor, &non_constructor); | 1766 __ TestAndBranchIfAllClear(x2, 1 << Map::kIsConstructor, &non_constructor); |
1771 | 1767 |
1772 // Called Construct on an exotic Object with a [[Construct]] internal method. | 1768 // Called Construct on an exotic Object with a [[Construct]] internal method. |
1773 { | 1769 { |
1774 // Overwrite the original receiver with the (original) target. | 1770 // Overwrite the original receiver with the (original) target. |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2026 } | 2022 } |
2027 } | 2023 } |
2028 | 2024 |
2029 | 2025 |
2030 #undef __ | 2026 #undef __ |
2031 | 2027 |
2032 } // namespace internal | 2028 } // namespace internal |
2033 } // namespace v8 | 2029 } // namespace v8 |
2034 | 2030 |
2035 #endif // V8_TARGET_ARCH_ARM | 2031 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |