Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: src/builtins/arm64/builtins-arm64.cc

Issue 2950773002: [turbofan] Introduce new JSCallWithArrayLike operator. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 5 #if V8_TARGET_ARCH_ARM64
6 6
7 #include "src/arm64/frames-arm64.h" 7 #include "src/arm64/frames-arm64.h"
8 #include "src/arm64/macro-assembler-arm64-inl.h" 8 #include "src/arm64/macro-assembler-arm64-inl.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/counters.h" 10 #include "src/counters.h"
(...skipping 1899 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 __ Peek(receiver, 0); 1910 __ Peek(receiver, 0);
1911 __ Poke(this_arg, 0); 1911 __ Poke(this_arg, 0);
1912 } 1912 }
1913 1913
1914 // ----------- S t a t e ------------- 1914 // ----------- S t a t e -------------
1915 // -- x2 : argArray 1915 // -- x2 : argArray
1916 // -- x1 : receiver 1916 // -- x1 : receiver
1917 // -- jssp[0] : thisArg 1917 // -- jssp[0] : thisArg
1918 // ----------------------------------- 1918 // -----------------------------------
1919 1919
1920 // 2. Make sure the receiver is actually callable. 1920 // 2. We don't need to check explicitly for callable receiver here,
1921 Label receiver_not_callable; 1921 // since that's the first thing the Call/CallWithArrayLike builtins
1922 __ JumpIfSmi(receiver, &receiver_not_callable); 1922 // will do.
1923 __ Ldr(x10, FieldMemOperand(receiver, HeapObject::kMapOffset));
1924 __ Ldrb(w10, FieldMemOperand(x10, Map::kBitFieldOffset));
1925 __ TestAndBranchIfAllClear(x10, 1 << Map::kIsCallable,
1926 &receiver_not_callable);
1927 1923
1928 // 3. Tail call with no arguments if argArray is null or undefined. 1924 // 3. Tail call with no arguments if argArray is null or undefined.
1929 Label no_arguments; 1925 Label no_arguments;
1930 __ Cmp(arg_array, null_value); 1926 __ Cmp(arg_array, null_value);
1931 __ Ccmp(arg_array, undefined_value, ZFlag, ne); 1927 __ Ccmp(arg_array, undefined_value, ZFlag, ne);
1932 __ B(eq, &no_arguments); 1928 __ B(eq, &no_arguments);
1933 1929
1934 // 4a. Apply the receiver to the given argArray. 1930 // 4a. Apply the receiver to the given argArray.
1935 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), 1931 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(),
1936 RelocInfo::CODE_TARGET); 1932 RelocInfo::CODE_TARGET);
1937 1933
1938 // 4b. The argArray is either null or undefined, so we tail call without any 1934 // 4b. The argArray is either null or undefined, so we tail call without any
1939 // arguments to the receiver. 1935 // arguments to the receiver.
1940 __ Bind(&no_arguments); 1936 __ Bind(&no_arguments);
1941 { 1937 {
1942 __ Mov(x0, 0); 1938 __ Mov(x0, 0);
1943 DCHECK(receiver.Is(x1)); 1939 DCHECK(receiver.Is(x1));
1944 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 1940 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
1945 } 1941 }
1946
1947 // 4c. The receiver is not callable, throw an appropriate TypeError.
1948 __ Bind(&receiver_not_callable);
1949 {
1950 __ Poke(receiver, 0);
1951 __ TailCallRuntime(Runtime::kThrowApplyNonFunction);
1952 }
1953 } 1942 }
1954 1943
1955 // static 1944 // static
1956 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { 1945 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) {
1957 Register argc = x0; 1946 Register argc = x0;
1958 Register function = x1; 1947 Register function = x1;
1959 Register scratch1 = x10; 1948 Register scratch1 = x10;
1960 Register scratch2 = x11; 1949 Register scratch2 = x11;
1961 1950
1962 ASM_LOCATION("Builtins::Generate_FunctionPrototypeCall"); 1951 ASM_LOCATION("Builtins::Generate_FunctionPrototypeCall");
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 2030
2042 __ Poke(this_argument, 0); // Overwrite receiver. 2031 __ Poke(this_argument, 0); // Overwrite receiver.
2043 } 2032 }
2044 2033
2045 // ----------- S t a t e ------------- 2034 // ----------- S t a t e -------------
2046 // -- x2 : argumentsList 2035 // -- x2 : argumentsList
2047 // -- x1 : target 2036 // -- x1 : target
2048 // -- jssp[0] : thisArgument 2037 // -- jssp[0] : thisArgument
2049 // ----------------------------------- 2038 // -----------------------------------
2050 2039
2051 // 2. Make sure the target is actually callable. 2040 // 2. We don't need to check explicitly for callable target here,
2052 Label target_not_callable; 2041 // since that's the first thing the Call/CallWithArrayLike builtins
2053 __ JumpIfSmi(target, &target_not_callable); 2042 // will do.
2054 __ Ldr(x10, FieldMemOperand(target, HeapObject::kMapOffset));
2055 __ Ldr(x10, FieldMemOperand(x10, Map::kBitFieldOffset));
2056 __ TestAndBranchIfAllClear(x10, 1 << Map::kIsCallable, &target_not_callable);
2057 2043
2058 // 3a. Apply the target to the given argumentsList. 2044 // 3. Apply the target to the given argumentsList.
2059 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), 2045 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(),
2060 RelocInfo::CODE_TARGET); 2046 RelocInfo::CODE_TARGET);
2061
2062 // 3b. The target is not callable, throw an appropriate TypeError.
2063 __ Bind(&target_not_callable);
2064 {
2065 __ Poke(target, 0);
2066 __ TailCallRuntime(Runtime::kThrowApplyNonFunction);
2067 }
2068 } 2047 }
2069 2048
2070 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { 2049 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) {
2071 // ----------- S t a t e ------------- 2050 // ----------- S t a t e -------------
2072 // -- x0 : argc 2051 // -- x0 : argc
2073 // -- jssp[0] : new.target (optional) 2052 // -- jssp[0] : new.target (optional)
2074 // -- jssp[8] : argumentsList 2053 // -- jssp[8] : argumentsList
2075 // -- jssp[16] : target 2054 // -- jssp[16] : target
2076 // -- jssp[24] : receiver 2055 // -- jssp[24] : receiver
2077 // ----------------------------------- 2056 // -----------------------------------
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
3166 // Now jump to the instructions of the returned code object. 3145 // Now jump to the instructions of the returned code object.
3167 __ Jump(x8); 3146 __ Jump(x8);
3168 } 3147 }
3169 3148
3170 #undef __ 3149 #undef __
3171 3150
3172 } // namespace internal 3151 } // namespace internal
3173 } // namespace v8 3152 } // namespace v8
3174 3153
3175 #endif // V8_TARGET_ARCH_ARM 3154 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698