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 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1685 // -- r0 : the number of arguments (not including the receiver) | 1685 // -- r0 : the number of arguments (not including the receiver) |
1686 // -- r1 : the target to call (can be any Object). | 1686 // -- r1 : 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(r1, &non_callable); | 1690 __ JumpIfSmi(r1, &non_callable); |
1691 __ bind(&non_smi); | 1691 __ bind(&non_smi); |
1692 __ CompareObjectType(r1, r4, r5, JS_FUNCTION_TYPE); | 1692 __ CompareObjectType(r1, r4, r5, JS_FUNCTION_TYPE); |
1693 __ Jump(masm->isolate()->builtins()->CallFunction(mode), | 1693 __ Jump(masm->isolate()->builtins()->CallFunction(mode), |
1694 RelocInfo::CODE_TARGET, eq); | 1694 RelocInfo::CODE_TARGET, eq); |
1695 __ cmp(r5, Operand(JS_FUNCTION_PROXY_TYPE)); | 1695 __ cmp(r5, Operand(JS_PROXY_TYPE)); |
1696 __ b(ne, &non_function); | 1696 __ b(ne, &non_function); |
1697 | 1697 |
1698 // 1. Call to function proxy. | 1698 // 1. Call to Proxy. |
1699 // TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies. | 1699 // TODO(neis): Implement [[Call]] on proxies. |
1700 __ ldr(r1, FieldMemOperand(r1, JSFunctionProxy::kCallTrapOffset)); | |
1701 __ AssertNotSmi(r1); | |
1702 __ b(&non_smi); | 1700 __ b(&non_smi); |
Toon Verwaest
2015/12/03 11:48:41
you probably wanted to remove this b(&non_smi), lo
Camillo Bruni
2015/12/03 12:18:26
done
| |
1703 | 1701 |
1704 // 2. Call to something else, which might have a [[Call]] internal method (if | 1702 // 2. Call to something else, which might have a [[Call]] internal method (if |
1705 // not we raise an exception). | 1703 // not we raise an exception). |
1706 __ bind(&non_function); | 1704 __ bind(&non_function); |
1707 // Check if target has a [[Call]] internal method. | 1705 // Check if target has a [[Call]] internal method. |
1708 __ ldrb(r4, FieldMemOperand(r4, Map::kBitFieldOffset)); | 1706 __ ldrb(r4, FieldMemOperand(r4, Map::kBitFieldOffset)); |
1709 __ tst(r4, Operand(1 << Map::kIsCallable)); | 1707 __ tst(r4, Operand(1 << Map::kIsCallable)); |
1710 __ b(eq, &non_callable); | 1708 __ b(eq, &non_callable); |
1711 // Overwrite the original receiver the (original) target. | 1709 // Overwrite the original receiver the (original) target. |
1712 __ str(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | 1710 __ str(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1744 __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 1742 __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
1745 __ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kConstructStubOffset)); | 1743 __ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kConstructStubOffset)); |
1746 __ add(pc, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1744 __ add(pc, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1747 } | 1745 } |
1748 | 1746 |
1749 | 1747 |
1750 // static | 1748 // static |
1751 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { | 1749 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { |
1752 // ----------- S t a t e ------------- | 1750 // ----------- S t a t e ------------- |
1753 // -- r0 : the number of arguments (not including the receiver) | 1751 // -- r0 : the number of arguments (not including the receiver) |
1754 // -- r1 : the constructor to call (checked to be a JSFunctionProxy) | 1752 // -- r1 : the constructor to call (checked to be a JSProxy) |
1755 // -- r3 : the new target (either the same as the constructor or | 1753 // -- r3 : the new target (either the same as the constructor or |
1756 // the JSFunction on which new was invoked initially) | 1754 // the JSFunction on which new was invoked initially) |
1757 // ----------------------------------- | 1755 // ----------------------------------- |
1758 | 1756 |
1759 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. | 1757 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. |
1760 __ ldr(r1, FieldMemOperand(r1, JSFunctionProxy::kConstructTrapOffset)); | |
1761 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1758 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
1762 } | 1759 } |
1763 | 1760 |
1764 | 1761 |
1765 // static | 1762 // static |
1766 void Builtins::Generate_Construct(MacroAssembler* masm) { | 1763 void Builtins::Generate_Construct(MacroAssembler* masm) { |
1767 // ----------- S t a t e ------------- | 1764 // ----------- S t a t e ------------- |
1768 // -- r0 : the number of arguments (not including the receiver) | 1765 // -- r0 : the number of arguments (not including the receiver) |
1769 // -- r1 : the constructor to call (can be any Object) | 1766 // -- r1 : the constructor to call (can be any Object) |
1770 // -- r3 : the new target (either the same as the constructor or | 1767 // -- r3 : the new target (either the same as the constructor or |
1771 // the JSFunction on which new was invoked initially) | 1768 // the JSFunction on which new was invoked initially) |
1772 // ----------------------------------- | 1769 // ----------------------------------- |
1773 | 1770 |
1774 // Check if target is a Smi. | 1771 // Check if target is a Smi. |
1775 Label non_constructor; | 1772 Label non_constructor; |
1776 __ JumpIfSmi(r1, &non_constructor); | 1773 __ JumpIfSmi(r1, &non_constructor); |
1777 | 1774 |
1778 // Dispatch based on instance type. | 1775 // Dispatch based on instance type. |
1779 __ CompareObjectType(r1, r4, r5, JS_FUNCTION_TYPE); | 1776 __ CompareObjectType(r1, r4, r5, JS_FUNCTION_TYPE); |
1780 __ Jump(masm->isolate()->builtins()->ConstructFunction(), | 1777 __ Jump(masm->isolate()->builtins()->ConstructFunction(), |
1781 RelocInfo::CODE_TARGET, eq); | 1778 RelocInfo::CODE_TARGET, eq); |
1782 __ cmp(r5, Operand(JS_FUNCTION_PROXY_TYPE)); | 1779 __ cmp(r5, Operand(JS_PROXY_TYPE)); |
1783 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, | 1780 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, |
1784 eq); | 1781 eq); |
1785 | 1782 |
1786 // Check if target has a [[Construct]] internal method. | 1783 // Check if target has a [[Construct]] internal method. |
1787 __ ldrb(r2, FieldMemOperand(r4, Map::kBitFieldOffset)); | 1784 __ ldrb(r2, FieldMemOperand(r4, Map::kBitFieldOffset)); |
1788 __ tst(r2, Operand(1 << Map::kIsConstructor)); | 1785 __ tst(r2, Operand(1 << Map::kIsConstructor)); |
1789 __ b(eq, &non_constructor); | 1786 __ b(eq, &non_constructor); |
1790 | 1787 |
1791 // Called Construct on an exotic Object with a [[Construct]] internal method. | 1788 // Called Construct on an exotic Object with a [[Construct]] internal method. |
1792 { | 1789 { |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1951 } | 1948 } |
1952 } | 1949 } |
1953 | 1950 |
1954 | 1951 |
1955 #undef __ | 1952 #undef __ |
1956 | 1953 |
1957 } // namespace internal | 1954 } // namespace internal |
1958 } // namespace v8 | 1955 } // namespace v8 |
1959 | 1956 |
1960 #endif // V8_TARGET_ARCH_ARM | 1957 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |