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 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1927 __ Sd(this_arg, MemOperand(sp)); | 1927 __ Sd(this_arg, MemOperand(sp)); |
1928 } | 1928 } |
1929 | 1929 |
1930 // ----------- S t a t e ------------- | 1930 // ----------- S t a t e ------------- |
1931 // -- a2 : argArray | 1931 // -- a2 : argArray |
1932 // -- a1 : receiver | 1932 // -- a1 : receiver |
1933 // -- a3 : undefined root value | 1933 // -- a3 : undefined root value |
1934 // -- sp[0] : thisArg | 1934 // -- sp[0] : thisArg |
1935 // ----------------------------------- | 1935 // ----------------------------------- |
1936 | 1936 |
1937 // 2. Make sure the receiver is actually callable. | 1937 // 2. We don't need to check explicitly for callable receiver here, |
1938 Label receiver_not_callable; | 1938 // since that's the first thing the Call/CallWithArrayLike builtins |
1939 __ JumpIfSmi(receiver, &receiver_not_callable); | 1939 // will do. |
1940 __ Ld(a4, FieldMemOperand(receiver, HeapObject::kMapOffset)); | |
1941 __ Lbu(a4, FieldMemOperand(a4, Map::kBitFieldOffset)); | |
1942 __ And(a4, a4, Operand(1 << Map::kIsCallable)); | |
1943 __ Branch(&receiver_not_callable, eq, a4, Operand(zero_reg)); | |
1944 | 1940 |
1945 // 3. Tail call with no arguments if argArray is null or undefined. | 1941 // 3. Tail call with no arguments if argArray is null or undefined. |
1946 Label no_arguments; | 1942 Label no_arguments; |
1947 __ JumpIfRoot(arg_array, Heap::kNullValueRootIndex, &no_arguments); | 1943 __ JumpIfRoot(arg_array, Heap::kNullValueRootIndex, &no_arguments); |
1948 __ Branch(&no_arguments, eq, arg_array, Operand(undefined_value)); | 1944 __ Branch(&no_arguments, eq, arg_array, Operand(undefined_value)); |
1949 | 1945 |
1950 // 4a. Apply the receiver to the given argArray. | 1946 // 4a. Apply the receiver to the given argArray. |
1951 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), | 1947 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), |
1952 RelocInfo::CODE_TARGET); | 1948 RelocInfo::CODE_TARGET); |
1953 | 1949 |
1954 // 4b. The argArray is either null or undefined, so we tail call without any | 1950 // 4b. The argArray is either null or undefined, so we tail call without any |
1955 // arguments to the receiver. | 1951 // arguments to the receiver. |
1956 __ bind(&no_arguments); | 1952 __ bind(&no_arguments); |
1957 { | 1953 { |
1958 __ mov(a0, zero_reg); | 1954 __ mov(a0, zero_reg); |
1959 DCHECK(receiver.is(a1)); | 1955 DCHECK(receiver.is(a1)); |
1960 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1956 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
1961 } | 1957 } |
1962 | |
1963 // 4c. The receiver is not callable, throw an appropriate TypeError. | |
1964 __ bind(&receiver_not_callable); | |
1965 { | |
1966 __ Sd(receiver, MemOperand(sp)); | |
1967 __ TailCallRuntime(Runtime::kThrowApplyNonFunction); | |
1968 } | |
1969 } | 1958 } |
1970 | 1959 |
1971 // static | 1960 // static |
1972 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { | 1961 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { |
1973 // 1. Make sure we have at least one argument. | 1962 // 1. Make sure we have at least one argument. |
1974 // a0: actual number of arguments | 1963 // a0: actual number of arguments |
1975 { | 1964 { |
1976 Label done; | 1965 Label done; |
1977 __ Branch(&done, ne, a0, Operand(zero_reg)); | 1966 __ Branch(&done, ne, a0, Operand(zero_reg)); |
1978 __ PushRoot(Heap::kUndefinedValueRootIndex); | 1967 __ PushRoot(Heap::kUndefinedValueRootIndex); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2050 __ Sd(this_argument, MemOperand(sp, 0)); // Overwrite receiver | 2039 __ Sd(this_argument, MemOperand(sp, 0)); // Overwrite receiver |
2051 } | 2040 } |
2052 | 2041 |
2053 // ----------- S t a t e ------------- | 2042 // ----------- S t a t e ------------- |
2054 // -- a2 : argumentsList | 2043 // -- a2 : argumentsList |
2055 // -- a1 : target | 2044 // -- a1 : target |
2056 // -- a3 : undefined root value | 2045 // -- a3 : undefined root value |
2057 // -- sp[0] : thisArgument | 2046 // -- sp[0] : thisArgument |
2058 // ----------------------------------- | 2047 // ----------------------------------- |
2059 | 2048 |
2060 // 2. Make sure the target is actually callable. | 2049 // 2. We don't need to check explicitly for callable target here, |
2061 Label target_not_callable; | 2050 // since that's the first thing the Call/CallWithArrayLike builtins |
2062 __ JumpIfSmi(target, &target_not_callable); | 2051 // will do. |
2063 __ Ld(a4, FieldMemOperand(target, HeapObject::kMapOffset)); | |
2064 __ Lbu(a4, FieldMemOperand(a4, Map::kBitFieldOffset)); | |
2065 __ And(a4, a4, Operand(1 << Map::kIsCallable)); | |
2066 __ Branch(&target_not_callable, eq, a4, Operand(zero_reg)); | |
2067 | 2052 |
2068 // 3a. Apply the target to the given argumentsList. | 2053 // 3. Apply the target to the given argumentsList. |
2069 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), | 2054 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), |
2070 RelocInfo::CODE_TARGET); | 2055 RelocInfo::CODE_TARGET); |
2071 | |
2072 // 3b. The target is not callable, throw an appropriate TypeError. | |
2073 __ bind(&target_not_callable); | |
2074 { | |
2075 __ Sd(target, MemOperand(sp)); | |
2076 __ TailCallRuntime(Runtime::kThrowApplyNonFunction); | |
2077 } | |
2078 } | 2056 } |
2079 | 2057 |
2080 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { | 2058 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { |
2081 // ----------- S t a t e ------------- | 2059 // ----------- S t a t e ------------- |
2082 // -- a0 : argc | 2060 // -- a0 : argc |
2083 // -- sp[0] : new.target (optional) (dummy value if argc <= 2) | 2061 // -- sp[0] : new.target (optional) (dummy value if argc <= 2) |
2084 // -- sp[4] : argumentsList (dummy value if argc <= 1) | 2062 // -- sp[4] : argumentsList (dummy value if argc <= 1) |
2085 // -- sp[8] : target (dummy value if argc == 0) | 2063 // -- sp[8] : target (dummy value if argc == 0) |
2086 // -- sp[12] : receiver | 2064 // -- sp[12] : receiver |
2087 // ----------------------------------- | 2065 // ----------------------------------- |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3026 __ Daddu(at, v0, Operand(Code::kHeaderSize - kHeapObjectTag)); | 3004 __ Daddu(at, v0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
3027 __ Jump(at); | 3005 __ Jump(at); |
3028 } | 3006 } |
3029 | 3007 |
3030 #undef __ | 3008 #undef __ |
3031 | 3009 |
3032 } // namespace internal | 3010 } // namespace internal |
3033 } // namespace v8 | 3011 } // namespace v8 |
3034 | 3012 |
3035 #endif // V8_TARGET_ARCH_MIPS64 | 3013 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |