| 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
| 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 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1675 // -- r0 : the number of arguments (not including the receiver) | 1675 // -- r0 : the number of arguments (not including the receiver) |
| 1676 // -- r1 : the target to call (can be any Object). | 1676 // -- r1 : the target to call (can be any Object). |
| 1677 // ----------------------------------- | 1677 // ----------------------------------- |
| 1678 | 1678 |
| 1679 Label non_callable, non_function, non_smi; | 1679 Label non_callable, non_function, non_smi; |
| 1680 __ JumpIfSmi(r1, &non_callable); | 1680 __ JumpIfSmi(r1, &non_callable); |
| 1681 __ bind(&non_smi); | 1681 __ bind(&non_smi); |
| 1682 __ CompareObjectType(r1, r4, r5, JS_FUNCTION_TYPE); | 1682 __ CompareObjectType(r1, r4, r5, JS_FUNCTION_TYPE); |
| 1683 __ Jump(masm->isolate()->builtins()->CallFunction(mode), | 1683 __ Jump(masm->isolate()->builtins()->CallFunction(mode), |
| 1684 RelocInfo::CODE_TARGET, eq); | 1684 RelocInfo::CODE_TARGET, eq); |
| 1685 __ cmp(r5, Operand(JS_FUNCTION_PROXY_TYPE)); | 1685 __ cmp(r5, Operand(JS_PROXY_TYPE)); |
| 1686 __ b(ne, &non_function); | 1686 __ b(ne, &non_function); |
| 1687 | 1687 |
| 1688 // 1. Call to function proxy. | 1688 // 1. Call to Proxy. |
| 1689 // TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies. | 1689 // TODO(neis): Implement [[Call]] on proxies. |
| 1690 __ ldr(r1, FieldMemOperand(r1, JSFunctionProxy::kCallTrapOffset)); | |
| 1691 __ AssertNotSmi(r1); | |
| 1692 __ b(&non_smi); | |
| 1693 | 1690 |
| 1694 // 2. Call to something else, which might have a [[Call]] internal method (if | 1691 // 2. Call to something else, which might have a [[Call]] internal method (if |
| 1695 // not we raise an exception). | 1692 // not we raise an exception). |
| 1696 __ bind(&non_function); | 1693 __ bind(&non_function); |
| 1697 // Check if target has a [[Call]] internal method. | 1694 // Check if target has a [[Call]] internal method. |
| 1698 __ ldrb(r4, FieldMemOperand(r4, Map::kBitFieldOffset)); | 1695 __ ldrb(r4, FieldMemOperand(r4, Map::kBitFieldOffset)); |
| 1699 __ tst(r4, Operand(1 << Map::kIsCallable)); | 1696 __ tst(r4, Operand(1 << Map::kIsCallable)); |
| 1700 __ b(eq, &non_callable); | 1697 __ b(eq, &non_callable); |
| 1701 // Overwrite the original receiver the (original) target. | 1698 // Overwrite the original receiver the (original) target. |
| 1702 __ str(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | 1699 __ str(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1734 __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 1731 __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 1735 __ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kConstructStubOffset)); | 1732 __ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kConstructStubOffset)); |
| 1736 __ add(pc, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1733 __ add(pc, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1737 } | 1734 } |
| 1738 | 1735 |
| 1739 | 1736 |
| 1740 // static | 1737 // static |
| 1741 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { | 1738 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { |
| 1742 // ----------- S t a t e ------------- | 1739 // ----------- S t a t e ------------- |
| 1743 // -- r0 : the number of arguments (not including the receiver) | 1740 // -- r0 : the number of arguments (not including the receiver) |
| 1744 // -- r1 : the constructor to call (checked to be a JSFunctionProxy) | 1741 // -- r1 : the constructor to call (checked to be a JSProxy) |
| 1745 // -- r3 : the new target (either the same as the constructor or | 1742 // -- r3 : the new target (either the same as the constructor or |
| 1746 // the JSFunction on which new was invoked initially) | 1743 // the JSFunction on which new was invoked initially) |
| 1747 // ----------------------------------- | 1744 // ----------------------------------- |
| 1748 | 1745 |
| 1749 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. | 1746 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. |
| 1750 __ ldr(r1, FieldMemOperand(r1, JSFunctionProxy::kConstructTrapOffset)); | |
| 1751 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1747 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 1752 } | 1748 } |
| 1753 | 1749 |
| 1754 | 1750 |
| 1755 // static | 1751 // static |
| 1756 void Builtins::Generate_Construct(MacroAssembler* masm) { | 1752 void Builtins::Generate_Construct(MacroAssembler* masm) { |
| 1757 // ----------- S t a t e ------------- | 1753 // ----------- S t a t e ------------- |
| 1758 // -- r0 : the number of arguments (not including the receiver) | 1754 // -- r0 : the number of arguments (not including the receiver) |
| 1759 // -- r1 : the constructor to call (can be any Object) | 1755 // -- r1 : the constructor to call (can be any Object) |
| 1760 // -- r3 : the new target (either the same as the constructor or | 1756 // -- r3 : the new target (either the same as the constructor or |
| 1761 // the JSFunction on which new was invoked initially) | 1757 // the JSFunction on which new was invoked initially) |
| 1762 // ----------------------------------- | 1758 // ----------------------------------- |
| 1763 | 1759 |
| 1764 // Check if target is a Smi. | 1760 // Check if target is a Smi. |
| 1765 Label non_constructor; | 1761 Label non_constructor; |
| 1766 __ JumpIfSmi(r1, &non_constructor); | 1762 __ JumpIfSmi(r1, &non_constructor); |
| 1767 | 1763 |
| 1768 // Dispatch based on instance type. | 1764 // Dispatch based on instance type. |
| 1769 __ CompareObjectType(r1, r4, r5, JS_FUNCTION_TYPE); | 1765 __ CompareObjectType(r1, r4, r5, JS_FUNCTION_TYPE); |
| 1770 __ Jump(masm->isolate()->builtins()->ConstructFunction(), | 1766 __ Jump(masm->isolate()->builtins()->ConstructFunction(), |
| 1771 RelocInfo::CODE_TARGET, eq); | 1767 RelocInfo::CODE_TARGET, eq); |
| 1772 __ cmp(r5, Operand(JS_FUNCTION_PROXY_TYPE)); | 1768 __ cmp(r5, Operand(JS_PROXY_TYPE)); |
| 1773 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, | 1769 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, |
| 1774 eq); | 1770 eq); |
| 1775 | 1771 |
| 1776 // Check if target has a [[Construct]] internal method. | 1772 // Check if target has a [[Construct]] internal method. |
| 1777 __ ldrb(r2, FieldMemOperand(r4, Map::kBitFieldOffset)); | 1773 __ ldrb(r2, FieldMemOperand(r4, Map::kBitFieldOffset)); |
| 1778 __ tst(r2, Operand(1 << Map::kIsConstructor)); | 1774 __ tst(r2, Operand(1 << Map::kIsConstructor)); |
| 1779 __ b(eq, &non_constructor); | 1775 __ b(eq, &non_constructor); |
| 1780 | 1776 |
| 1781 // Called Construct on an exotic Object with a [[Construct]] internal method. | 1777 // Called Construct on an exotic Object with a [[Construct]] internal method. |
| 1782 { | 1778 { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1941 } | 1937 } |
| 1942 } | 1938 } |
| 1943 | 1939 |
| 1944 | 1940 |
| 1945 #undef __ | 1941 #undef __ |
| 1946 | 1942 |
| 1947 } // namespace internal | 1943 } // namespace internal |
| 1948 } // namespace v8 | 1944 } // namespace v8 |
| 1949 | 1945 |
| 1950 #endif // V8_TARGET_ARCH_ARM | 1946 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |