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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1840 __ sw(a2, MemOperand(sp)); | 1840 __ sw(a2, MemOperand(sp)); |
1841 __ mov(a2, a3); | 1841 __ mov(a2, a3); |
1842 } | 1842 } |
1843 | 1843 |
1844 // ----------- S t a t e ------------- | 1844 // ----------- S t a t e ------------- |
1845 // -- a2 : argArray | 1845 // -- a2 : argArray |
1846 // -- a1 : receiver | 1846 // -- a1 : receiver |
1847 // -- sp[0] : thisArg | 1847 // -- sp[0] : thisArg |
1848 // ----------------------------------- | 1848 // ----------------------------------- |
1849 | 1849 |
1850 // 2. Make sure the receiver is actually callable. | 1850 // 2. We don't need to check explicitly for callable receiver here, |
1851 Label receiver_not_callable; | 1851 // since that's the first thing the Call/CallWithArrayLike builtins |
1852 __ JumpIfSmi(a1, &receiver_not_callable); | 1852 // will do. |
1853 __ lw(t0, FieldMemOperand(a1, HeapObject::kMapOffset)); | |
1854 __ lbu(t0, FieldMemOperand(t0, Map::kBitFieldOffset)); | |
1855 __ And(t0, t0, Operand(1 << Map::kIsCallable)); | |
1856 __ Branch(&receiver_not_callable, eq, t0, Operand(zero_reg)); | |
1857 | 1853 |
1858 // 3. Tail call with no arguments if argArray is null or undefined. | 1854 // 3. Tail call with no arguments if argArray is null or undefined. |
1859 Label no_arguments; | 1855 Label no_arguments; |
1860 __ JumpIfRoot(a2, Heap::kNullValueRootIndex, &no_arguments); | 1856 __ JumpIfRoot(a2, Heap::kNullValueRootIndex, &no_arguments); |
1861 __ JumpIfRoot(a2, Heap::kUndefinedValueRootIndex, &no_arguments); | 1857 __ JumpIfRoot(a2, Heap::kUndefinedValueRootIndex, &no_arguments); |
1862 | 1858 |
1863 // 4a. Apply the receiver to the given argArray. | 1859 // 4a. Apply the receiver to the given argArray. |
1864 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), | 1860 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), |
1865 RelocInfo::CODE_TARGET); | 1861 RelocInfo::CODE_TARGET); |
1866 | 1862 |
1867 // 4b. The argArray is either null or undefined, so we tail call without any | 1863 // 4b. The argArray is either null or undefined, so we tail call without any |
1868 // arguments to the receiver. | 1864 // arguments to the receiver. |
1869 __ bind(&no_arguments); | 1865 __ bind(&no_arguments); |
1870 { | 1866 { |
1871 __ mov(a0, zero_reg); | 1867 __ mov(a0, zero_reg); |
1872 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1868 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
1873 } | 1869 } |
1874 | |
1875 // 4c. The receiver is not callable, throw an appropriate TypeError. | |
1876 __ bind(&receiver_not_callable); | |
1877 { | |
1878 __ sw(a1, MemOperand(sp)); | |
1879 __ TailCallRuntime(Runtime::kThrowApplyNonFunction); | |
1880 } | |
1881 } | 1870 } |
1882 | 1871 |
1883 // static | 1872 // static |
1884 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { | 1873 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { |
1885 // 1. Make sure we have at least one argument. | 1874 // 1. Make sure we have at least one argument. |
1886 // a0: actual number of arguments | 1875 // a0: actual number of arguments |
1887 { | 1876 { |
1888 Label done; | 1877 Label done; |
1889 __ Branch(&done, ne, a0, Operand(zero_reg)); | 1878 __ Branch(&done, ne, a0, Operand(zero_reg)); |
1890 __ PushRoot(Heap::kUndefinedValueRootIndex); | 1879 __ PushRoot(Heap::kUndefinedValueRootIndex); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1957 __ sw(a2, MemOperand(sp)); | 1946 __ sw(a2, MemOperand(sp)); |
1958 __ mov(a2, a3); | 1947 __ mov(a2, a3); |
1959 } | 1948 } |
1960 | 1949 |
1961 // ----------- S t a t e ------------- | 1950 // ----------- S t a t e ------------- |
1962 // -- a2 : argumentsList | 1951 // -- a2 : argumentsList |
1963 // -- a1 : target | 1952 // -- a1 : target |
1964 // -- sp[0] : thisArgument | 1953 // -- sp[0] : thisArgument |
1965 // ----------------------------------- | 1954 // ----------------------------------- |
1966 | 1955 |
1967 // 2. Make sure the target is actually callable. | 1956 // 2. We don't need to check explicitly for callable target here, |
1968 Label target_not_callable; | 1957 // since that's the first thing the Call/CallWithArrayLike builtins |
1969 __ JumpIfSmi(a1, &target_not_callable); | 1958 // will do. |
1970 __ lw(t0, FieldMemOperand(a1, HeapObject::kMapOffset)); | |
1971 __ lbu(t0, FieldMemOperand(t0, Map::kBitFieldOffset)); | |
1972 __ And(t0, t0, Operand(1 << Map::kIsCallable)); | |
1973 __ Branch(&target_not_callable, eq, t0, Operand(zero_reg)); | |
1974 | 1959 |
1975 // 3a. Apply the target to the given argumentsList. | 1960 // 3. Apply the target to the given argumentsList. |
1976 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), | 1961 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), |
1977 RelocInfo::CODE_TARGET); | 1962 RelocInfo::CODE_TARGET); |
1978 | |
1979 // 3b. The target is not callable, throw an appropriate TypeError. | |
1980 __ bind(&target_not_callable); | |
1981 { | |
1982 __ sw(a1, MemOperand(sp)); | |
1983 __ TailCallRuntime(Runtime::kThrowApplyNonFunction); | |
1984 } | |
1985 } | 1963 } |
1986 | 1964 |
1987 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { | 1965 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { |
1988 // ----------- S t a t e ------------- | 1966 // ----------- S t a t e ------------- |
1989 // -- a0 : argc | 1967 // -- a0 : argc |
1990 // -- sp[0] : new.target (optional) | 1968 // -- sp[0] : new.target (optional) |
1991 // -- sp[4] : argumentsList | 1969 // -- sp[4] : argumentsList |
1992 // -- sp[8] : target | 1970 // -- sp[8] : target |
1993 // -- sp[12] : receiver | 1971 // -- sp[12] : receiver |
1994 // ----------------------------------- | 1972 // ----------------------------------- |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3078 // Now jump to the instructions of the returned code object. | 3056 // Now jump to the instructions of the returned code object. |
3079 __ Jump(at, v0, Code::kHeaderSize - kHeapObjectTag); | 3057 __ Jump(at, v0, Code::kHeaderSize - kHeapObjectTag); |
3080 } | 3058 } |
3081 | 3059 |
3082 #undef __ | 3060 #undef __ |
3083 | 3061 |
3084 } // namespace internal | 3062 } // namespace internal |
3085 } // namespace v8 | 3063 } // namespace v8 |
3086 | 3064 |
3087 #endif // V8_TARGET_ARCH_MIPS | 3065 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |