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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
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 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1847 __ Sd(this_arg, MemOperand(sp)); | 1847 __ Sd(this_arg, MemOperand(sp)); |
1848 } | 1848 } |
1849 | 1849 |
1850 // ----------- S t a t e ------------- | 1850 // ----------- S t a t e ------------- |
1851 // -- a2 : argArray | 1851 // -- a2 : argArray |
1852 // -- a1 : receiver | 1852 // -- a1 : receiver |
1853 // -- a3 : undefined root value | 1853 // -- a3 : undefined root value |
1854 // -- sp[0] : thisArg | 1854 // -- sp[0] : thisArg |
1855 // ----------------------------------- | 1855 // ----------------------------------- |
1856 | 1856 |
1857 // 2. Make sure the receiver is actually callable. | 1857 // 2. We don't need to check explicitly for callable receiver here, |
1858 Label receiver_not_callable; | 1858 // since that's the first thing the Call/CallWithArrayLike builtins |
1859 __ JumpIfSmi(receiver, &receiver_not_callable); | 1859 // will do. |
1860 __ Ld(a4, FieldMemOperand(receiver, HeapObject::kMapOffset)); | |
1861 __ Lbu(a4, FieldMemOperand(a4, Map::kBitFieldOffset)); | |
1862 __ And(a4, a4, Operand(1 << Map::kIsCallable)); | |
1863 __ Branch(&receiver_not_callable, eq, a4, Operand(zero_reg)); | |
1864 | 1860 |
1865 // 3. Tail call with no arguments if argArray is null or undefined. | 1861 // 3. Tail call with no arguments if argArray is null or undefined. |
1866 Label no_arguments; | 1862 Label no_arguments; |
1867 __ JumpIfRoot(arg_array, Heap::kNullValueRootIndex, &no_arguments); | 1863 __ JumpIfRoot(arg_array, Heap::kNullValueRootIndex, &no_arguments); |
1868 __ Branch(&no_arguments, eq, arg_array, Operand(undefined_value)); | 1864 __ Branch(&no_arguments, eq, arg_array, Operand(undefined_value)); |
1869 | 1865 |
1870 // 4a. Apply the receiver to the given argArray. | 1866 // 4a. Apply the receiver to the given argArray. |
1871 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), | 1867 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), |
1872 RelocInfo::CODE_TARGET); | 1868 RelocInfo::CODE_TARGET); |
1873 | 1869 |
1874 // 4b. The argArray is either null or undefined, so we tail call without any | 1870 // 4b. The argArray is either null or undefined, so we tail call without any |
1875 // arguments to the receiver. | 1871 // arguments to the receiver. |
1876 __ bind(&no_arguments); | 1872 __ bind(&no_arguments); |
1877 { | 1873 { |
1878 __ mov(a0, zero_reg); | 1874 __ mov(a0, zero_reg); |
1879 DCHECK(receiver.is(a1)); | 1875 DCHECK(receiver.is(a1)); |
1880 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1876 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
1881 } | 1877 } |
1882 | |
1883 // 4c. The receiver is not callable, throw an appropriate TypeError. | |
1884 __ bind(&receiver_not_callable); | |
1885 { | |
1886 __ Sd(receiver, MemOperand(sp)); | |
1887 __ TailCallRuntime(Runtime::kThrowApplyNonFunction); | |
1888 } | |
1889 } | 1878 } |
1890 | 1879 |
1891 // static | 1880 // static |
1892 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { | 1881 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { |
1893 // 1. Make sure we have at least one argument. | 1882 // 1. Make sure we have at least one argument. |
1894 // a0: actual number of arguments | 1883 // a0: actual number of arguments |
1895 { | 1884 { |
1896 Label done; | 1885 Label done; |
1897 __ Branch(&done, ne, a0, Operand(zero_reg)); | 1886 __ Branch(&done, ne, a0, Operand(zero_reg)); |
1898 __ PushRoot(Heap::kUndefinedValueRootIndex); | 1887 __ PushRoot(Heap::kUndefinedValueRootIndex); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1970 __ Sd(this_argument, MemOperand(sp, 0)); // Overwrite receiver | 1959 __ Sd(this_argument, MemOperand(sp, 0)); // Overwrite receiver |
1971 } | 1960 } |
1972 | 1961 |
1973 // ----------- S t a t e ------------- | 1962 // ----------- S t a t e ------------- |
1974 // -- a2 : argumentsList | 1963 // -- a2 : argumentsList |
1975 // -- a1 : target | 1964 // -- a1 : target |
1976 // -- a3 : undefined root value | 1965 // -- a3 : undefined root value |
1977 // -- sp[0] : thisArgument | 1966 // -- sp[0] : thisArgument |
1978 // ----------------------------------- | 1967 // ----------------------------------- |
1979 | 1968 |
1980 // 2. Make sure the target is actually callable. | 1969 // 2. We don't need to check explicitly for callable target here, |
1981 Label target_not_callable; | 1970 // since that's the first thing the Call/CallWithArrayLike builtins |
1982 __ JumpIfSmi(target, &target_not_callable); | 1971 // will do. |
1983 __ Ld(a4, FieldMemOperand(target, HeapObject::kMapOffset)); | |
1984 __ Lbu(a4, FieldMemOperand(a4, Map::kBitFieldOffset)); | |
1985 __ And(a4, a4, Operand(1 << Map::kIsCallable)); | |
1986 __ Branch(&target_not_callable, eq, a4, Operand(zero_reg)); | |
1987 | 1972 |
1988 // 3a. Apply the target to the given argumentsList. | 1973 // 3. Apply the target to the given argumentsList. |
1989 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), | 1974 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), |
1990 RelocInfo::CODE_TARGET); | 1975 RelocInfo::CODE_TARGET); |
1991 | |
1992 // 3b. The target is not callable, throw an appropriate TypeError. | |
1993 __ bind(&target_not_callable); | |
1994 { | |
1995 __ Sd(target, MemOperand(sp)); | |
1996 __ TailCallRuntime(Runtime::kThrowApplyNonFunction); | |
1997 } | |
1998 } | 1976 } |
1999 | 1977 |
2000 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { | 1978 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { |
2001 // ----------- S t a t e ------------- | 1979 // ----------- S t a t e ------------- |
2002 // -- a0 : argc | 1980 // -- a0 : argc |
2003 // -- sp[0] : new.target (optional) (dummy value if argc <= 2) | 1981 // -- sp[0] : new.target (optional) (dummy value if argc <= 2) |
2004 // -- sp[4] : argumentsList (dummy value if argc <= 1) | 1982 // -- sp[4] : argumentsList (dummy value if argc <= 1) |
2005 // -- sp[8] : target (dummy value if argc == 0) | 1983 // -- sp[8] : target (dummy value if argc == 0) |
2006 // -- sp[12] : receiver | 1984 // -- sp[12] : receiver |
2007 // ----------------------------------- | 1985 // ----------------------------------- |
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3103 __ Daddu(at, v0, Operand(Code::kHeaderSize - kHeapObjectTag)); | 3081 __ Daddu(at, v0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
3104 __ Jump(at); | 3082 __ Jump(at); |
3105 } | 3083 } |
3106 | 3084 |
3107 #undef __ | 3085 #undef __ |
3108 | 3086 |
3109 } // namespace internal | 3087 } // namespace internal |
3110 } // namespace v8 | 3088 } // namespace v8 |
3111 | 3089 |
3112 #endif // V8_TARGET_ARCH_MIPS64 | 3090 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |