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 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1920 __ sw(a2, MemOperand(sp)); | 1920 __ sw(a2, MemOperand(sp)); |
1921 __ mov(a2, a3); | 1921 __ mov(a2, a3); |
1922 } | 1922 } |
1923 | 1923 |
1924 // ----------- S t a t e ------------- | 1924 // ----------- S t a t e ------------- |
1925 // -- a2 : argArray | 1925 // -- a2 : argArray |
1926 // -- a1 : receiver | 1926 // -- a1 : receiver |
1927 // -- sp[0] : thisArg | 1927 // -- sp[0] : thisArg |
1928 // ----------------------------------- | 1928 // ----------------------------------- |
1929 | 1929 |
1930 // 2. Make sure the receiver is actually callable. | 1930 // 2. We don't need to check explicitly for callable receiver here, |
1931 Label receiver_not_callable; | 1931 // since that's the first thing the Call/CallWithArrayLike builtins |
1932 __ JumpIfSmi(a1, &receiver_not_callable); | 1932 // will do. |
1933 __ lw(t0, FieldMemOperand(a1, HeapObject::kMapOffset)); | |
1934 __ lbu(t0, FieldMemOperand(t0, Map::kBitFieldOffset)); | |
1935 __ And(t0, t0, Operand(1 << Map::kIsCallable)); | |
1936 __ Branch(&receiver_not_callable, eq, t0, Operand(zero_reg)); | |
1937 | 1933 |
1938 // 3. Tail call with no arguments if argArray is null or undefined. | 1934 // 3. Tail call with no arguments if argArray is null or undefined. |
1939 Label no_arguments; | 1935 Label no_arguments; |
1940 __ JumpIfRoot(a2, Heap::kNullValueRootIndex, &no_arguments); | 1936 __ JumpIfRoot(a2, Heap::kNullValueRootIndex, &no_arguments); |
1941 __ JumpIfRoot(a2, Heap::kUndefinedValueRootIndex, &no_arguments); | 1937 __ JumpIfRoot(a2, Heap::kUndefinedValueRootIndex, &no_arguments); |
1942 | 1938 |
1943 // 4a. Apply the receiver to the given argArray. | 1939 // 4a. Apply the receiver to the given argArray. |
1944 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), | 1940 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), |
1945 RelocInfo::CODE_TARGET); | 1941 RelocInfo::CODE_TARGET); |
1946 | 1942 |
1947 // 4b. The argArray is either null or undefined, so we tail call without any | 1943 // 4b. The argArray is either null or undefined, so we tail call without any |
1948 // arguments to the receiver. | 1944 // arguments to the receiver. |
1949 __ bind(&no_arguments); | 1945 __ bind(&no_arguments); |
1950 { | 1946 { |
1951 __ mov(a0, zero_reg); | 1947 __ mov(a0, zero_reg); |
1952 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1948 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
1953 } | 1949 } |
1954 | |
1955 // 4c. The receiver is not callable, throw an appropriate TypeError. | |
1956 __ bind(&receiver_not_callable); | |
1957 { | |
1958 __ sw(a1, MemOperand(sp)); | |
1959 __ TailCallRuntime(Runtime::kThrowApplyNonFunction); | |
1960 } | |
1961 } | 1950 } |
1962 | 1951 |
1963 // static | 1952 // static |
1964 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { | 1953 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { |
1965 // 1. Make sure we have at least one argument. | 1954 // 1. Make sure we have at least one argument. |
1966 // a0: actual number of arguments | 1955 // a0: actual number of arguments |
1967 { | 1956 { |
1968 Label done; | 1957 Label done; |
1969 __ Branch(&done, ne, a0, Operand(zero_reg)); | 1958 __ Branch(&done, ne, a0, Operand(zero_reg)); |
1970 __ PushRoot(Heap::kUndefinedValueRootIndex); | 1959 __ PushRoot(Heap::kUndefinedValueRootIndex); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2037 __ sw(a2, MemOperand(sp)); | 2026 __ sw(a2, MemOperand(sp)); |
2038 __ mov(a2, a3); | 2027 __ mov(a2, a3); |
2039 } | 2028 } |
2040 | 2029 |
2041 // ----------- S t a t e ------------- | 2030 // ----------- S t a t e ------------- |
2042 // -- a2 : argumentsList | 2031 // -- a2 : argumentsList |
2043 // -- a1 : target | 2032 // -- a1 : target |
2044 // -- sp[0] : thisArgument | 2033 // -- sp[0] : thisArgument |
2045 // ----------------------------------- | 2034 // ----------------------------------- |
2046 | 2035 |
2047 // 2. Make sure the target is actually callable. | 2036 // 2. We don't need to check explicitly for callable target here, |
2048 Label target_not_callable; | 2037 // since that's the first thing the Call/CallWithArrayLike builtins |
2049 __ JumpIfSmi(a1, &target_not_callable); | 2038 // will do. |
2050 __ lw(t0, FieldMemOperand(a1, HeapObject::kMapOffset)); | |
2051 __ lbu(t0, FieldMemOperand(t0, Map::kBitFieldOffset)); | |
2052 __ And(t0, t0, Operand(1 << Map::kIsCallable)); | |
2053 __ Branch(&target_not_callable, eq, t0, Operand(zero_reg)); | |
2054 | 2039 |
2055 // 3a. Apply the target to the given argumentsList. | 2040 // 3. Apply the target to the given argumentsList. |
2056 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), | 2041 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), |
2057 RelocInfo::CODE_TARGET); | 2042 RelocInfo::CODE_TARGET); |
2058 | |
2059 // 3b. The target is not callable, throw an appropriate TypeError. | |
2060 __ bind(&target_not_callable); | |
2061 { | |
2062 __ sw(a1, MemOperand(sp)); | |
2063 __ TailCallRuntime(Runtime::kThrowApplyNonFunction); | |
2064 } | |
2065 } | 2043 } |
2066 | 2044 |
2067 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { | 2045 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { |
2068 // ----------- S t a t e ------------- | 2046 // ----------- S t a t e ------------- |
2069 // -- a0 : argc | 2047 // -- a0 : argc |
2070 // -- sp[0] : new.target (optional) | 2048 // -- sp[0] : new.target (optional) |
2071 // -- sp[4] : argumentsList | 2049 // -- sp[4] : argumentsList |
2072 // -- sp[8] : target | 2050 // -- sp[8] : target |
2073 // -- sp[12] : receiver | 2051 // -- sp[12] : receiver |
2074 // ----------------------------------- | 2052 // ----------------------------------- |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3000 // Now jump to the instructions of the returned code object. | 2978 // Now jump to the instructions of the returned code object. |
3001 __ Jump(at, v0, Code::kHeaderSize - kHeapObjectTag); | 2979 __ Jump(at, v0, Code::kHeaderSize - kHeapObjectTag); |
3002 } | 2980 } |
3003 | 2981 |
3004 #undef __ | 2982 #undef __ |
3005 | 2983 |
3006 } // namespace internal | 2984 } // namespace internal |
3007 } // namespace v8 | 2985 } // namespace v8 |
3008 | 2986 |
3009 #endif // V8_TARGET_ARCH_MIPS | 2987 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |