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/assembler-inl.h" | 7 #include "src/assembler-inl.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/counters.h" | 9 #include "src/counters.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1843 __ add(sp, sp, Operand(r0, LSL, kPointerSizeLog2)); | 1843 __ add(sp, sp, Operand(r0, LSL, kPointerSizeLog2)); |
1844 __ str(r5, MemOperand(sp, 0)); | 1844 __ str(r5, MemOperand(sp, 0)); |
1845 } | 1845 } |
1846 | 1846 |
1847 // ----------- S t a t e ------------- | 1847 // ----------- S t a t e ------------- |
1848 // -- r2 : argArray | 1848 // -- r2 : argArray |
1849 // -- r1 : receiver | 1849 // -- r1 : receiver |
1850 // -- sp[0] : thisArg | 1850 // -- sp[0] : thisArg |
1851 // ----------------------------------- | 1851 // ----------------------------------- |
1852 | 1852 |
1853 // 2. Make sure the receiver is actually callable. | 1853 // 2. We don't need to check explicitly for callable receiver here, |
1854 Label receiver_not_callable; | 1854 // since that's the first thing the Call/CallWithArrayLike builtins |
1855 __ JumpIfSmi(r1, &receiver_not_callable); | 1855 // will do. |
1856 __ ldr(r4, FieldMemOperand(r1, HeapObject::kMapOffset)); | |
1857 __ ldrb(r4, FieldMemOperand(r4, Map::kBitFieldOffset)); | |
1858 __ tst(r4, Operand(1 << Map::kIsCallable)); | |
1859 __ b(eq, &receiver_not_callable); | |
1860 | 1856 |
1861 // 3. Tail call with no arguments if argArray is null or undefined. | 1857 // 3. Tail call with no arguments if argArray is null or undefined. |
1862 Label no_arguments; | 1858 Label no_arguments; |
1863 __ JumpIfRoot(r2, Heap::kNullValueRootIndex, &no_arguments); | 1859 __ JumpIfRoot(r2, Heap::kNullValueRootIndex, &no_arguments); |
1864 __ JumpIfRoot(r2, Heap::kUndefinedValueRootIndex, &no_arguments); | 1860 __ JumpIfRoot(r2, Heap::kUndefinedValueRootIndex, &no_arguments); |
1865 | 1861 |
1866 // 4a. Apply the receiver to the given argArray. | 1862 // 4a. Apply the receiver to the given argArray. |
1867 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), | 1863 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), |
1868 RelocInfo::CODE_TARGET); | 1864 RelocInfo::CODE_TARGET); |
1869 | 1865 |
1870 // 4b. The argArray is either null or undefined, so we tail call without any | 1866 // 4b. The argArray is either null or undefined, so we tail call without any |
1871 // arguments to the receiver. | 1867 // arguments to the receiver. |
1872 __ bind(&no_arguments); | 1868 __ bind(&no_arguments); |
1873 { | 1869 { |
1874 __ mov(r0, Operand(0)); | 1870 __ mov(r0, Operand(0)); |
1875 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1871 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
1876 } | 1872 } |
1877 | |
1878 // 4c. The receiver is not callable, throw an appropriate TypeError. | |
1879 __ bind(&receiver_not_callable); | |
1880 { | |
1881 __ str(r1, MemOperand(sp, 0)); | |
1882 __ TailCallRuntime(Runtime::kThrowApplyNonFunction); | |
1883 } | |
1884 } | 1873 } |
1885 | 1874 |
1886 // static | 1875 // static |
1887 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { | 1876 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { |
1888 // 1. Make sure we have at least one argument. | 1877 // 1. Make sure we have at least one argument. |
1889 // r0: actual number of arguments | 1878 // r0: actual number of arguments |
1890 { | 1879 { |
1891 Label done; | 1880 Label done; |
1892 __ cmp(r0, Operand::Zero()); | 1881 __ cmp(r0, Operand::Zero()); |
1893 __ b(ne, &done); | 1882 __ b(ne, &done); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1951 __ add(sp, sp, Operand(r0, LSL, kPointerSizeLog2)); | 1940 __ add(sp, sp, Operand(r0, LSL, kPointerSizeLog2)); |
1952 __ str(r5, MemOperand(sp, 0)); | 1941 __ str(r5, MemOperand(sp, 0)); |
1953 } | 1942 } |
1954 | 1943 |
1955 // ----------- S t a t e ------------- | 1944 // ----------- S t a t e ------------- |
1956 // -- r2 : argumentsList | 1945 // -- r2 : argumentsList |
1957 // -- r1 : target | 1946 // -- r1 : target |
1958 // -- sp[0] : thisArgument | 1947 // -- sp[0] : thisArgument |
1959 // ----------------------------------- | 1948 // ----------------------------------- |
1960 | 1949 |
1961 // 2. Make sure the target is actually callable. | 1950 // 2. We don't need to check explicitly for callable target here, |
1962 Label target_not_callable; | 1951 // since that's the first thing the Call/CallWithArrayLike builtins |
1963 __ JumpIfSmi(r1, &target_not_callable); | 1952 // will do. |
1964 __ ldr(r4, FieldMemOperand(r1, HeapObject::kMapOffset)); | |
1965 __ ldrb(r4, FieldMemOperand(r4, Map::kBitFieldOffset)); | |
1966 __ tst(r4, Operand(1 << Map::kIsCallable)); | |
1967 __ b(eq, &target_not_callable); | |
1968 | 1953 |
1969 // 3a. Apply the target to the given argumentsList. | 1954 // 3. Apply the target to the given argumentsList. |
1970 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), | 1955 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), |
1971 RelocInfo::CODE_TARGET); | 1956 RelocInfo::CODE_TARGET); |
1972 | |
1973 // 3b. The target is not callable, throw an appropriate TypeError. | |
1974 __ bind(&target_not_callable); | |
1975 { | |
1976 __ str(r1, MemOperand(sp, 0)); | |
1977 __ TailCallRuntime(Runtime::kThrowApplyNonFunction); | |
1978 } | |
1979 } | 1957 } |
1980 | 1958 |
1981 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { | 1959 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { |
1982 // ----------- S t a t e ------------- | 1960 // ----------- S t a t e ------------- |
1983 // -- r0 : argc | 1961 // -- r0 : argc |
1984 // -- sp[0] : new.target (optional) | 1962 // -- sp[0] : new.target (optional) |
1985 // -- sp[4] : argumentsList | 1963 // -- sp[4] : argumentsList |
1986 // -- sp[8] : target | 1964 // -- sp[8] : target |
1987 // -- sp[12] : receiver | 1965 // -- sp[12] : receiver |
1988 // ----------------------------------- | 1966 // ----------------------------------- |
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3018 } | 2996 } |
3019 // Now jump to the instructions of the returned code object. | 2997 // Now jump to the instructions of the returned code object. |
3020 __ Jump(r8); | 2998 __ Jump(r8); |
3021 } | 2999 } |
3022 #undef __ | 3000 #undef __ |
3023 | 3001 |
3024 } // namespace internal | 3002 } // namespace internal |
3025 } // namespace v8 | 3003 } // namespace v8 |
3026 | 3004 |
3027 #endif // V8_TARGET_ARCH_ARM | 3005 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |